mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
feat: make profile portion from sidebar redirectable, restrict menu
This commit is contained in:
@@ -4,11 +4,14 @@ import Submenu from "./SubMenu";
|
||||
import SocialMedia from "./SocialMedia";
|
||||
import dp from "../../assets/images/dp.png";
|
||||
import sidebarList from "../../json/menuJson";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { isStaging } from "../../constant/const";
|
||||
|
||||
const Sidebar = ({ isOpen, closeSidebar }) => {
|
||||
const navigate = useNavigate();
|
||||
const [menuList, setmenuList] = useState([]);
|
||||
const [submenuOpen, setSubmenuOpen] = useState(false);
|
||||
let username = localStorage.getItem("username");
|
||||
const username = localStorage.getItem("username");
|
||||
const image = localStorage.getItem("profileImg") || dp;
|
||||
const tenantname = localStorage.getItem("Extand_Class")
|
||||
? JSON.parse(localStorage.getItem("Extand_Class"))?.[0]?.Company
|
||||
@@ -34,16 +37,8 @@ const Sidebar = ({ isOpen, closeSidebar }) => {
|
||||
userRole === "contracts_Admin" ||
|
||||
userRole === "contracts_OrgAdmin"
|
||||
) {
|
||||
// const addUserForm = {
|
||||
// icon: "fa-light fa-user",
|
||||
// title: "Add User",
|
||||
// target: "_self",
|
||||
// pageType: "form",
|
||||
// description: "",
|
||||
// objectId: "lM0xRnM3iE"
|
||||
// };
|
||||
const newSidebarList = sidebarList.map((item) => {
|
||||
if (item.title === "Settings") {
|
||||
if (item.title === "Settings" && isStaging) {
|
||||
// Make a shallow copy of the item
|
||||
const newItem = { ...item };
|
||||
newItem.children = [
|
||||
@@ -65,8 +60,6 @@ const Sidebar = ({ isOpen, closeSidebar }) => {
|
||||
objectId: "users"
|
||||
}
|
||||
];
|
||||
// Insert addUserForm at the second position
|
||||
// newItem.children.splice(1, 0, addUserForm);
|
||||
return newItem;
|
||||
}
|
||||
return item;
|
||||
@@ -89,13 +82,19 @@ const Sidebar = ({ isOpen, closeSidebar }) => {
|
||||
closeSidebar();
|
||||
setSubmenuOpen({});
|
||||
};
|
||||
const handleProfile = () => {
|
||||
navigate("/profile");
|
||||
};
|
||||
return (
|
||||
<aside
|
||||
className={`absolute lg:relative bg-base-100 h-screen overflow-y-auto transition-all z-[500] shadow-lg hide-scrollbar
|
||||
${isOpen ? "w-full md:w-[300px]" : "w-0"}`}
|
||||
>
|
||||
<div className="flex px-2 py-3 gap-2 items-center shadow-md">
|
||||
<div className="w-[75px] h-[75px] rounded-full ring-[2px] ring-offset-2 ring-gray-400 overflow-hidden">
|
||||
<div
|
||||
onClick={() => handleProfile()}
|
||||
className="w-[75px] h-[75px] rounded-full ring-[2px] ring-offset-2 ring-gray-400 overflow-hidden cursor-pointer"
|
||||
>
|
||||
<img
|
||||
className="w-full h-full object-contain"
|
||||
src={image}
|
||||
@@ -103,9 +102,15 @@ const Sidebar = ({ isOpen, closeSidebar }) => {
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-[14px] font-bold text-base-content">{username}</p>
|
||||
<p
|
||||
className={`text-[12px] text-base-content ${
|
||||
onClick={handleProfile}
|
||||
className="text-[14px] font-bold text-base-content cursor-pointer"
|
||||
>
|
||||
{username}
|
||||
</p>
|
||||
<p
|
||||
onClick={handleProfile}
|
||||
className={`cursor-pointer text-[12px] text-base-content ${
|
||||
tenantname ? "mt-2" : ""
|
||||
}`}
|
||||
>
|
||||
|
||||
@@ -4,3 +4,5 @@ export const documentCls = "contracts_Document";
|
||||
export const themeColor = "#47a3ad";
|
||||
export const iconColor = "#686968";
|
||||
export const isEnableSubscription = process.env.REACT_APP_ENABLE_SUBSCRIPTION;
|
||||
export const isStaging =
|
||||
window.location.origin === "https://staging-app.opensignlabs.com";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { isStaging } from "../constant/const";
|
||||
|
||||
const plans = [
|
||||
{
|
||||
planName: "OPENSIGN™ FREE",
|
||||
@@ -35,14 +37,12 @@ const plans = [
|
||||
yearlyPrice: `10 <sup style="font-size: 17px;">/month/user</sup>`,
|
||||
subtitle: "Exclusive Access to advanced features.",
|
||||
btn: { text: "Subscribe", color: "op-btn-primary" },
|
||||
url:
|
||||
window.location.origin === "https://staging-app.opensignlabs.com"
|
||||
? "https://billing.zoho.in/subscribe/9627f62a09df1c8ce500f2f4dc8328dd84ecda20eeae13878ce581d60240f206/pro-weekly"
|
||||
: "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901d1a09dfa8085585cdd4ec4d7f32137f3/professional-monthly",
|
||||
yearlyUrl:
|
||||
window.location.origin === "https://staging-app.opensignlabs.com"
|
||||
? "https://billing.zoho.in/subscribe/9627f62a09df1c8ce500f2f4dc8328ddc184411129224f1f29ed84f6cef3b862/pro-yearly"
|
||||
: "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901d8ad1135190dff951330360e47585a71/professional-yearly",
|
||||
url: isStaging
|
||||
? "https://billing.zoho.in/subscribe/9627f62a09df1c8ce500f2f4dc8328dd84ecda20eeae13878ce581d60240f206/pro-weekly"
|
||||
: "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901d1a09dfa8085585cdd4ec4d7f32137f3/professional-monthly",
|
||||
yearlyUrl: isStaging
|
||||
? "https://billing.zoho.in/subscribe/9627f62a09df1c8ce500f2f4dc8328ddc184411129224f1f29ed84f6cef3b862/pro-yearly"
|
||||
: "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901d8ad1135190dff951330360e47585a71/professional-yearly",
|
||||
target: "_self",
|
||||
benefits: [
|
||||
"Everything in OpenSign™ free",
|
||||
@@ -86,14 +86,12 @@ export const stagingPlan = {
|
||||
yearlyPrice: `20 <sup style="font-size: 17px;">/month/user</sup>`,
|
||||
subtitle: "Exclusive Access to advanced features.",
|
||||
btn: { text: "Subscribe", color: "op-btn-accent" },
|
||||
url:
|
||||
window.location.origin === "https://staging-app.opensignlabs.com"
|
||||
? "https://billing.zoho.in/subscribe/ed8097273a82b6bf39892c11a3bb3c381eb2705736014cfbdbde1ccf1c7a189d/team-weekly"
|
||||
: "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901d1a09dfa8085585cdd4ec4d7f32137f3/professional-monthly",
|
||||
yearlyUrl:
|
||||
window.location.origin === "https://staging-app.opensignlabs.com"
|
||||
? "https://billing.zoho.in/subscribe/ed8097273a82b6bf39892c11a3bb3c381eb2705736014cfbdbde1ccf1c7a189d/team-weekly"
|
||||
: "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901d8ad1135190dff951330360e47585a71/professional-yearly",
|
||||
url: isStaging
|
||||
? "https://billing.zoho.in/subscribe/ed8097273a82b6bf39892c11a3bb3c381eb2705736014cfbdbde1ccf1c7a189d/team-weekly"
|
||||
: "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901d1a09dfa8085585cdd4ec4d7f32137f3/professional-monthly",
|
||||
yearlyUrl: isStaging
|
||||
? "https://billing.zoho.in/subscribe/ed8097273a82b6bf39892c11a3bb3c381eb2705736014cfbdbde1ccf1c7a189d/team-weekly"
|
||||
: "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901d8ad1135190dff951330360e47585a71/professional-yearly",
|
||||
target: "_self",
|
||||
benefits: [
|
||||
"Everything in OpenSign™ free, professional",
|
||||
|
||||
@@ -6,6 +6,7 @@ import Title from "../components/Title";
|
||||
import Parse from "parse";
|
||||
import { openInNewTab } from "../constant/Utils";
|
||||
import Loader from "../primitives/Loader";
|
||||
import { isStaging } from "../constant/const";
|
||||
const listItemStyle = {
|
||||
paddingLeft: "20px", // Add padding to create space for the image
|
||||
backgroundImage: `url(${checkmark})`, // Set your image as the list style image
|
||||
@@ -16,7 +17,7 @@ const listItemStyle = {
|
||||
|
||||
const PlanSubscriptions = () => {
|
||||
const navigate = useNavigate();
|
||||
const isStagingPlan = plansArr.some((x) => x.planName === "OPENSIGN™ TEAMS");
|
||||
const isTeamPlan = plansArr.some((x) => x.planName === "OPENSIGN™ TEAMS");
|
||||
const [yearlyVisible, setYearlyVisible] = useState(true);
|
||||
const [isLoader, setIsLoader] = useState(true);
|
||||
const extUser =
|
||||
@@ -30,10 +31,15 @@ const PlanSubscriptions = () => {
|
||||
};
|
||||
const userDetails = JSON.parse(localStorage.getItem("userDetails")) || user;
|
||||
// console.log("userDetails ", userDetails);
|
||||
const name =
|
||||
userDetails && userDetails.name
|
||||
? "first_name=" + encodeURIComponent(userDetails.name)
|
||||
: "";
|
||||
const fullname =
|
||||
userDetails && userDetails.name ? userDetails.name.split(" ") : "";
|
||||
const firstname = fullname?.[0]
|
||||
? "first_name=" + encodeURIComponent(fullname?.[0])
|
||||
: "";
|
||||
const lastname = fullname?.[1]
|
||||
? "&last_name=" + encodeURIComponent(fullname?.[1])
|
||||
: "";
|
||||
const name = firstname ? firstname + lastname : "";
|
||||
const email =
|
||||
userDetails && userDetails.email
|
||||
? "&email=" + encodeURIComponent(userDetails.email)
|
||||
@@ -55,10 +61,7 @@ const PlanSubscriptions = () => {
|
||||
phone;
|
||||
useEffect(() => {
|
||||
setIsLoader(false);
|
||||
if (
|
||||
!isStagingPlan &&
|
||||
window.location.origin === "https://staging-app.opensignlabs.com"
|
||||
) {
|
||||
if (!isTeamPlan && isStaging) {
|
||||
plansArr.splice(2, 0, stagingPlan);
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
|
||||
Reference in New Issue
Block a user