Skip to content

Commit 89f67bf

Browse files
feat: mover sidebarlist from server to local
1 parent e4f0e9c commit 89f67bf

File tree

5 files changed

+194
-16
lines changed

5 files changed

+194
-16
lines changed

apps/OpenSign/src/components/pdf/DropdownWidgetOption.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ function DropdownWidgetOption(props) {
205205
/>
206206

207207
<i
208-
className="fa-light fa-rectangle-xmark text-[25px] ml-[10px] text-error"
208+
className="fa-light fa-rectangle-xmark text-[25px] ml-[10px] text-accent cursor-pointer"
209209
onClick={() => handleDeleteInput(index)}
210210
></i>
211211
</div>
212212
))}
213213
<i
214214
onClick={handleAddInput}
215-
className="fa-light fa-square-plus text-[25px] ml-[10px] text-primary"
215+
className="fa-light fa-square-plus text-[25px] ml-[10px] op-text-primary cursor-pointer"
216216
></i>
217217
<div>
218218
{props.type === "checkbox" && !props.isSignYourself && (

apps/OpenSign/src/components/sidebar/Sidebar.js

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import React, { useState, useEffect } from "react";
2-
32
import Menu from "./Menu";
43
import Submenu from "./SubMenu";
54
import SocialMedia from "./SocialMedia";
6-
7-
import Parse from "parse";
85
import dp from "../../assets/images/dp.png";
6+
import sidebarList from "../../json/menuJson";
97

108
const Sidebar = ({ isOpen, closeSidebar }) => {
119
const [menuList, setmenuList] = useState([]);
@@ -24,13 +22,32 @@ const Sidebar = ({ isOpen, closeSidebar }) => {
2422

2523
const menuItem = async () => {
2624
try {
27-
var sideMenu = Parse.Object.extend("w_menu");
28-
var query = new Parse.Query(sideMenu);
29-
query.equalTo("objectId", localStorage.getItem("defaultmenuid"));
30-
const results = await query.first();
31-
const resultjson = results.toJSON();
32-
let result = resultjson;
33-
setmenuList(result.menuItems);
25+
if (localStorage.getItem("defaultmenuid")) {
26+
const menuId = localStorage.getItem("defaultmenuid") !== "VPh91h0ZHk";
27+
if (menuId) {
28+
setmenuList(sidebarList);
29+
} else {
30+
const addUserForm = {
31+
icon: "fa-light fa-user",
32+
title: "Add User",
33+
target: "_self",
34+
pageType: "form",
35+
description: "",
36+
objectId: "lM0xRnM3iE"
37+
};
38+
const newSidebarList = sidebarList.map((item) => {
39+
if (item.title === "Settings") {
40+
// Make a shallow copy of the item
41+
const newItem = { ...item };
42+
// Insert addUserForm at the second position
43+
newItem.children.splice(1, 0, addUserForm);
44+
return newItem;
45+
}
46+
return item;
47+
});
48+
setmenuList(newSidebarList);
49+
}
50+
}
3451
} catch (e) {
3552
console.error("Problem", e);
3653
}

apps/OpenSign/src/json/ReportJson.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export default function reportJson(id) {
296296
{
297297
btnId: "2204",
298298
hoverLabel: "Delete",
299-
btnColor: "op-btn-outline op-btn-error",
299+
btnColor: "op-btn-secondary",
300300
btnIcon: "fa-light fa-trash",
301301
action: "delete"
302302
}

apps/OpenSign/src/json/menuJson.js

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
const sidebarList = [
2+
{
3+
icon: "fa-light fa-tachometer-alt",
4+
title: "Dashboard",
5+
target: "",
6+
pageType: "dashboard",
7+
description: "",
8+
objectId: "35KBoSgoAK"
9+
},
10+
{
11+
icon: "fa-light fa-pen-nib",
12+
title: "Sign yourself",
13+
target: "_self",
14+
pageType: "form",
15+
description: "",
16+
objectId: "sHAnZphf69"
17+
},
18+
{
19+
icon: "fa-light fa-paper-plane",
20+
title: "Request signatures",
21+
target: "_self",
22+
pageType: "form",
23+
description: "",
24+
objectId: "8mZzFxbG1z"
25+
},
26+
{
27+
icon: "fa-light fa-newspaper",
28+
title: "Templates",
29+
target: "_self",
30+
pageType: null,
31+
description: null,
32+
objectId: null,
33+
children: [
34+
{
35+
icon: "fa-light fa-file-signature",
36+
title: "Create template",
37+
target: "_self",
38+
pageType: "form",
39+
description: "",
40+
objectId: "template"
41+
},
42+
{
43+
icon: "fa-light fa-file-contract",
44+
title: "Manage templates",
45+
target: "_self",
46+
pageType: "report",
47+
description: "",
48+
objectId: "6TeaPr321t"
49+
}
50+
]
51+
},
52+
{
53+
icon: "fa-light fa-folder",
54+
title: "OpenSign™ Drive",
55+
target: "_self",
56+
pageType: "",
57+
description: "",
58+
objectId: "opensigndrive"
59+
},
60+
{
61+
icon: "fa-light fa-address-card",
62+
title: "Reports",
63+
target: "_self",
64+
pageType: null,
65+
description: "",
66+
objectId: null,
67+
children: [
68+
{
69+
icon: "fa-light fa-signature",
70+
title: "Need your sign",
71+
target: "_self",
72+
pageType: "report",
73+
description: "",
74+
objectId: "4Hhwbp482K"
75+
},
76+
{
77+
icon: "fa-light fa-tasks",
78+
title: "In Progress",
79+
target: "_self",
80+
pageType: "report",
81+
description: "",
82+
objectId: "1MwEuxLEkF"
83+
},
84+
{
85+
icon: "fa-light fa-check-circle",
86+
title: "Completed",
87+
target: "_self",
88+
pageType: "report",
89+
description: "",
90+
objectId: "kQUoW4hUXz"
91+
},
92+
{
93+
icon: "fa-light fa-edit",
94+
title: "Drafts",
95+
target: "_self",
96+
pageType: "report",
97+
description: "",
98+
objectId: "ByHuevtCFY"
99+
},
100+
{
101+
icon: "fa-light fa-times-circle",
102+
title: "Declined",
103+
target: "_self",
104+
pageType: "report",
105+
description: "",
106+
objectId: "UPr2Fm5WY3"
107+
},
108+
{
109+
icon: "fa-light fa-hourglass-end",
110+
title: "Expired",
111+
target: "_self",
112+
pageType: "report",
113+
description: "",
114+
objectId: "zNqBHXHsYH"
115+
},
116+
{
117+
icon: "fa-light fa-address-book",
118+
title: "Contactbook",
119+
target: "_self",
120+
pageType: "report",
121+
description: "",
122+
objectId: "5KhaPr482K"
123+
}
124+
]
125+
},
126+
{
127+
icon: "fa-light fa-cog",
128+
title: "Settings",
129+
target: "_self",
130+
pageType: null,
131+
description: "",
132+
objectId: null,
133+
children: [
134+
{
135+
icon: "fa-light fa-pen-fancy",
136+
title: "My Signature",
137+
target: "_self",
138+
pageType: "",
139+
description: "",
140+
objectId: "managesign"
141+
},
142+
{
143+
icon: "fa-light fa-key",
144+
title: "API Token",
145+
target: "_self",
146+
pageType: "generatetoken",
147+
description: "",
148+
objectId: ""
149+
},
150+
{
151+
icon: "fa-light fa-globe",
152+
title: "Webhook",
153+
target: "_self",
154+
pageType: "webhook",
155+
description: "",
156+
objectId: ""
157+
}
158+
]
159+
}
160+
];
161+
export default sidebarList;

apps/OpenSign/src/pages/Form.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,9 +645,9 @@ const Forms = (props) => {
645645
</label>
646646
{fileupload.length > 0 ? (
647647
<div className="flex gap-2 justify-center items-center">
648-
<div className="flex justify-between items-center op-input op-input-bordered op-input-sm w-full text-x text-[13px]">
649-
<div className="break-all">
650-
file selected : {getFileName(fileupload)}
648+
<div className="flex justify-between items-center op-input op-input-bordered op-input-sm w-full h-full text-x text-[13px]">
649+
<div className="break-all ">
650+
file selected: {getFileName(fileupload)}
651651
</div>
652652
<div
653653
onClick={() => setFileUpload("")}

0 commit comments

Comments
 (0)