From 89f67bfeebddce20d6176fb0fefc1bc55377850c Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Fri, 21 Jun 2024 16:18:39 +0530 Subject: [PATCH] feat: mover sidebarlist from server to local --- .../components/pdf/DropdownWidgetOption.js | 4 +- .../src/components/sidebar/Sidebar.js | 37 ++-- apps/OpenSign/src/json/ReportJson.js | 2 +- apps/OpenSign/src/json/menuJson.js | 161 ++++++++++++++++++ apps/OpenSign/src/pages/Form.js | 6 +- 5 files changed, 194 insertions(+), 16 deletions(-) create mode 100644 apps/OpenSign/src/json/menuJson.js diff --git a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js index 9756a6df1..225baf1bb 100644 --- a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js +++ b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js @@ -205,14 +205,14 @@ function DropdownWidgetOption(props) { /> handleDeleteInput(index)} > ))}
{props.type === "checkbox" && !props.isSignYourself && ( diff --git a/apps/OpenSign/src/components/sidebar/Sidebar.js b/apps/OpenSign/src/components/sidebar/Sidebar.js index fddf6ac8a..4d7da0bff 100644 --- a/apps/OpenSign/src/components/sidebar/Sidebar.js +++ b/apps/OpenSign/src/components/sidebar/Sidebar.js @@ -1,11 +1,9 @@ import React, { useState, useEffect } from "react"; - import Menu from "./Menu"; import Submenu from "./SubMenu"; import SocialMedia from "./SocialMedia"; - -import Parse from "parse"; import dp from "../../assets/images/dp.png"; +import sidebarList from "../../json/menuJson"; const Sidebar = ({ isOpen, closeSidebar }) => { const [menuList, setmenuList] = useState([]); @@ -24,13 +22,32 @@ const Sidebar = ({ isOpen, closeSidebar }) => { const menuItem = async () => { try { - var sideMenu = Parse.Object.extend("w_menu"); - var query = new Parse.Query(sideMenu); - query.equalTo("objectId", localStorage.getItem("defaultmenuid")); - const results = await query.first(); - const resultjson = results.toJSON(); - let result = resultjson; - setmenuList(result.menuItems); + if (localStorage.getItem("defaultmenuid")) { + const menuId = localStorage.getItem("defaultmenuid") !== "VPh91h0ZHk"; + if (menuId) { + setmenuList(sidebarList); + } else { + 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") { + // Make a shallow copy of the item + const newItem = { ...item }; + // Insert addUserForm at the second position + newItem.children.splice(1, 0, addUserForm); + return newItem; + } + return item; + }); + setmenuList(newSidebarList); + } + } } catch (e) { console.error("Problem", e); } diff --git a/apps/OpenSign/src/json/ReportJson.js b/apps/OpenSign/src/json/ReportJson.js index 3ced20de5..bd35f9312 100644 --- a/apps/OpenSign/src/json/ReportJson.js +++ b/apps/OpenSign/src/json/ReportJson.js @@ -296,7 +296,7 @@ export default function reportJson(id) { { btnId: "2204", hoverLabel: "Delete", - btnColor: "op-btn-outline op-btn-error", + btnColor: "op-btn-secondary", btnIcon: "fa-light fa-trash", action: "delete" } diff --git a/apps/OpenSign/src/json/menuJson.js b/apps/OpenSign/src/json/menuJson.js new file mode 100644 index 000000000..c9b576221 --- /dev/null +++ b/apps/OpenSign/src/json/menuJson.js @@ -0,0 +1,161 @@ +const sidebarList = [ + { + icon: "fa-light fa-tachometer-alt", + title: "Dashboard", + target: "", + pageType: "dashboard", + description: "", + objectId: "35KBoSgoAK" + }, + { + icon: "fa-light fa-pen-nib", + title: "Sign yourself", + target: "_self", + pageType: "form", + description: "", + objectId: "sHAnZphf69" + }, + { + icon: "fa-light fa-paper-plane", + title: "Request signatures", + target: "_self", + pageType: "form", + description: "", + objectId: "8mZzFxbG1z" + }, + { + icon: "fa-light fa-newspaper", + title: "Templates", + target: "_self", + pageType: null, + description: null, + objectId: null, + children: [ + { + icon: "fa-light fa-file-signature", + title: "Create template", + target: "_self", + pageType: "form", + description: "", + objectId: "template" + }, + { + icon: "fa-light fa-file-contract", + title: "Manage templates", + target: "_self", + pageType: "report", + description: "", + objectId: "6TeaPr321t" + } + ] + }, + { + icon: "fa-light fa-folder", + title: "OpenSign™ Drive", + target: "_self", + pageType: "", + description: "", + objectId: "opensigndrive" + }, + { + icon: "fa-light fa-address-card", + title: "Reports", + target: "_self", + pageType: null, + description: "", + objectId: null, + children: [ + { + icon: "fa-light fa-signature", + title: "Need your sign", + target: "_self", + pageType: "report", + description: "", + objectId: "4Hhwbp482K" + }, + { + icon: "fa-light fa-tasks", + title: "In Progress", + target: "_self", + pageType: "report", + description: "", + objectId: "1MwEuxLEkF" + }, + { + icon: "fa-light fa-check-circle", + title: "Completed", + target: "_self", + pageType: "report", + description: "", + objectId: "kQUoW4hUXz" + }, + { + icon: "fa-light fa-edit", + title: "Drafts", + target: "_self", + pageType: "report", + description: "", + objectId: "ByHuevtCFY" + }, + { + icon: "fa-light fa-times-circle", + title: "Declined", + target: "_self", + pageType: "report", + description: "", + objectId: "UPr2Fm5WY3" + }, + { + icon: "fa-light fa-hourglass-end", + title: "Expired", + target: "_self", + pageType: "report", + description: "", + objectId: "zNqBHXHsYH" + }, + { + icon: "fa-light fa-address-book", + title: "Contactbook", + target: "_self", + pageType: "report", + description: "", + objectId: "5KhaPr482K" + } + ] + }, + { + icon: "fa-light fa-cog", + title: "Settings", + target: "_self", + pageType: null, + description: "", + objectId: null, + children: [ + { + icon: "fa-light fa-pen-fancy", + title: "My Signature", + target: "_self", + pageType: "", + description: "", + objectId: "managesign" + }, + { + icon: "fa-light fa-key", + title: "API Token", + target: "_self", + pageType: "generatetoken", + description: "", + objectId: "" + }, + { + icon: "fa-light fa-globe", + title: "Webhook", + target: "_self", + pageType: "webhook", + description: "", + objectId: "" + } + ] + } +]; +export default sidebarList; diff --git a/apps/OpenSign/src/pages/Form.js b/apps/OpenSign/src/pages/Form.js index 414535b16..12ad3f895 100644 --- a/apps/OpenSign/src/pages/Form.js +++ b/apps/OpenSign/src/pages/Form.js @@ -645,9 +645,9 @@ const Forms = (props) => { {fileupload.length > 0 ? (
-
-
- file selected : {getFileName(fileupload)} +
+
+ file selected: {getFileName(fileupload)}
setFileUpload("")}