From 64274570d66f18fd277e807890ae05c0ac2601ab Mon Sep 17 00:00:00 2001 From: berkay Date: Mon, 9 Dec 2024 21:30:15 +0300 Subject: [PATCH] event 2 page updated --- src/(apicalls)/basics.ts | 4 +- src/app/dashboard/page.tsx | 1 - src/appEvents/categories.ts | 135 ++++++------ .../Accounts/accountRecords.tsx | 2 +- .../Building/Build/Build.tsx | 194 +++++++----------- .../Building/Build/BuildUpdate.tsx | 38 ++++ .../Commons/ButtonCreate.tsx | 78 +++++++ .../Commons/ButtonDelete.tsx | 46 +++++ .../{EventButton.tsx => ButtonEvent.tsx} | 10 +- .../Commons/ButtonUpdate.tsx | 66 ++++++ .../ContextComponents/Commons/PageCreate.tsx | 78 +++++++ .../Commons/{Landing.tsx => PageLanding.tsx} | 0 .../ContextComponents/Commons/PageUpdate.tsx | 94 +++++++++ .../Commons/PageisNotAllowed.tsx | 21 ++ .../ContextComponents/Commons/Table.tsx | 8 +- .../Commons/isNotAllowedButton.tsx | 38 ++++ .../LivingSpace/LivingSpace.tsx | 2 +- src/components/Dashboards/DashboardPage.tsx | 2 +- src/components/Sidebar/SidebarItem.tsx | 23 +-- src/components/Sidebar/index.tsx | 4 +- src/components/Tables/TableThree.tsx | 2 +- 21 files changed, 642 insertions(+), 204 deletions(-) create mode 100644 src/components/ContextComponents/Building/Build/BuildUpdate.tsx create mode 100644 src/components/ContextComponents/Commons/ButtonCreate.tsx create mode 100644 src/components/ContextComponents/Commons/ButtonDelete.tsx rename src/components/ContextComponents/Commons/{EventButton.tsx => ButtonEvent.tsx} (72%) create mode 100644 src/components/ContextComponents/Commons/ButtonUpdate.tsx create mode 100644 src/components/ContextComponents/Commons/PageCreate.tsx rename src/components/ContextComponents/Commons/{Landing.tsx => PageLanding.tsx} (100%) create mode 100644 src/components/ContextComponents/Commons/PageUpdate.tsx create mode 100644 src/components/ContextComponents/Commons/PageisNotAllowed.tsx create mode 100644 src/components/ContextComponents/Commons/isNotAllowedButton.tsx diff --git a/src/(apicalls)/basics.ts b/src/(apicalls)/basics.ts index 43f881b..719dcd7 100644 --- a/src/(apicalls)/basics.ts +++ b/src/(apicalls)/basics.ts @@ -4,9 +4,9 @@ export const tokenSecret = export const cookieObject: any = { httpOnly: true, path: "/", - secure: true, + // secure: true, sameSite: "strict", - // maxAge: 3600, + maxAge: 3600, }; interface FilterListInterface { diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index dd34e90..a1a14b2 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -15,7 +15,6 @@ const Dashboard: React.FC = async () => { redirect("/login/email"); } const eventsList = await retrieveAvailableEvents(); - console.log("eventsList", eventsList); const availableMenu = retrieveAvailableCategories(eventsList || []); return ( <> diff --git a/src/appEvents/categories.ts b/src/appEvents/categories.ts index 38a367c..31de705 100644 --- a/src/appEvents/categories.ts +++ b/src/appEvents/categories.ts @@ -50,25 +50,73 @@ const BuildSubCategories = [ }, ]; +const AccountSubCategories = [ + { + title: "Bakiye Sorgulama", + icon: AccountIcon, + component: AccountPage, + selfEndpoints: ["/account/records/list"], + allEndpoints: [], + subCategories: [], + }, +]; + +const DecisionBookSubCategories: any = []; + +const MeetingSubCategories = [ + { + title: "Davetiyeler", + icon: InviteIcon, + component: BuildPage, + selfEndpoints: [ + "/build/decision_book/invite/list", + "/build/decision_book/invite/create", + "/build/decision_book/invite/update", + "/build/decision_book/invitations/assign", + ], + allEndpoints: [], + subCategories: [], + }, + { + title: "Görev Ata", + icon: TaskIcon, + component: BuildPage, + selfEndpoints: [], + allEndpoints: [], + subCategories: [], + }, +]; + +const buildAllEndpoints = [ + "/building/build/list", + "/building/build/create", + "/building/build/update/{build_uu_id}", + "/building/parts/list", + "/building/parts/create", + "/building/parts/update/{build_uu_id}", + "/building/area/list", + "/building/area/create", + "/building/area/update/{build_uu_id}", + "/building/living_space/list", + "/building/living_space/create", + "/building/living_space/update/{build_uu_id}", +]; + +const meetingAllEndpoints = [ + "/build/decision_book/invite/list", + "/build/decision_book/invite/create", + "/build/decision_book/invite/update", + "/build/decision_book/invitations/assign", +]; + +const accountAllEndpoints = ["/account/records/list"]; + const LeftMenuCategories = [ { title: "Bina Tanımları", icon: BuildIcon, component: BuildPage, - allEndpoints: [ - "/building/build/list", - "/building/build/create", - "/building/build/update/{build_uu_id}", - "/building/parts/list", - "/building/parts/create", - "/building/parts/update/{build_uu_id}", - "/building/area/list", - "/building/area/create", - "/building/area/update/{build_uu_id}", - "/building/living_space/list", - "/building/living_space/create", - "/building/living_space/update/{build_uu_id}", - ], + allEndpoints: buildAllEndpoints, selfEndpoints: [ "/building/build/list", "/building/build/create", @@ -79,36 +127,18 @@ const LeftMenuCategories = [ { title: "Toplantılar", icon: meetingIcon, - allEndpoints: [ - "/build/decision_book/invite/list", - "/build/decision_book/invite/create", - "/build/decision_book/invite/update", - "/build/decision_book/invitations/assign", - ], + allEndpoints: meetingAllEndpoints, component: BuildPage, - subCategories: [ - { - title: "Davetiyeler", - icon: InviteIcon, - component: BuildPage, - selfEndpoints: [ - "/build/decision_book/invite/list", - "/build/decision_book/invite/create", - "/build/decision_book/invite/update", - "/build/decision_book/invitations/assign", - ], - allEndpoints: [], - subCategories: [], - }, - { - title: "Görev Ata", - icon: TaskIcon, - component: BuildPage, - selfEndpoints: [], - subCategories: [], - allEndpoints: [], - }, - ], + selfEndpoints: [], + subCategories: MeetingSubCategories, + }, + { + title: "Cari Hesaplar", + icon: AccountIcon, + component: BuildPage, + selfEndpoints: [], + allEndpoints: accountAllEndpoints, + subCategories: AccountSubCategories, }, { title: "Karar Defteri", @@ -116,24 +146,7 @@ const LeftMenuCategories = [ component: BuildPage, selfEndpoints: [], allEndpoints: [], - subCategories: [], - }, - { - title: "Cari Hesaplar", - icon: AccountIcon, - component: BuildPage, - selfEndpoints: [], - allEndpoints: ["/account/records/list"], - subCategories: [ - { - title: "Bakiye Sorgulama", - icon: AccountIcon, - component: AccountPage, - subCategories: [], - selfEndpoints: ["/account/records/list"], - allEndpoints: [], - }, - ], + subCategories: DecisionBookSubCategories, }, ]; diff --git a/src/components/ContextComponents/Accounts/accountRecords.tsx b/src/components/ContextComponents/Accounts/accountRecords.tsx index 58bba5e..e13b666 100644 --- a/src/components/ContextComponents/Accounts/accountRecords.tsx +++ b/src/components/ContextComponents/Accounts/accountRecords.tsx @@ -1,6 +1,6 @@ "use client"; import React from "react"; -import EventButton from "@/components/ContextComponents/Commons/EventButton"; +import EventButton from "@/components/ContextComponents/Commons/ButtonEvent"; import Table from "@/components/ContextComponents/Commons/Table"; import { retrieveAvailableEvents } from "@/(apicalls)/cookies/token"; diff --git a/src/components/ContextComponents/Building/Build/Build.tsx b/src/components/ContextComponents/Building/Build/Build.tsx index 6ea885d..e976151 100644 --- a/src/components/ContextComponents/Building/Build/Build.tsx +++ b/src/components/ContextComponents/Building/Build/Build.tsx @@ -1,7 +1,12 @@ "use client"; import React from "react"; -import EventButton from "@/components/ContextComponents/Commons/EventButton"; import Table from "@/components/ContextComponents/Commons/Table"; +import IsNotAllowedButton from "@/components/ContextComponents/Commons/isNotAllowedButton"; +import IsNotAllowed from "@/components/ContextComponents/Commons/PageisNotAllowed"; +import DeleteButton from "@/components/ContextComponents/Commons/ButtonDelete"; +import UpdateButton from "@/components/ContextComponents/Commons/ButtonUpdate"; +import CreateButton from "@/components/ContextComponents/Commons/ButtonCreate"; +import BuildUpdatePage from "@/components/ContextComponents/Building/Build/BuildUpdate"; import { retrieveAvailableEvents } from "@/(apicalls)/cookies/token"; import { retrieveBuildList } from "@/(apicalls)/building/build"; @@ -10,28 +15,78 @@ const Build: React.FC = () => { const [renderTable, setRenderTable] = React.useState(false); const [renderCreate, setRenderCreate] = React.useState(false); const [renderUpdate, setRenderUpdate] = React.useState(false); + const [renderDelete, setRenderDelete] = React.useState(false); + const [isFormEnabled, setIsFormEnabled] = React.useState(false); + const [rowData, setRowData] = React.useState({}); + const [formPage, setFormPage] = React.useState(); - const endpointNeeds = [ - { + const endpointNeeds = { + table: { endpoint: "/building/build/list", - component: setRenderTable, + component: renderTable ? ( + + ) : ( + + ), + isRender: setRenderTable, }, - { + update: { endpoint: "/building/build/create", - component: setRenderCreate, + component: renderUpdate ? ( + + } + formPageFunction={setFormPage} + isFormEnabledFunction={setIsFormEnabled} + /> + ) : ( + + ), + isRender: setRenderCreate, }, - { + create: { endpoint: "/building/build/update/{build_uu_id}", - component: setRenderUpdate, + component: renderCreate ? ( + + ) : ( + + ), + isRender: setRenderUpdate, }, - ]; + delete: { + endpoint: "/building/build/delete", + component: renderDelete ? ( + () => setIsFormEnabled(true)} /> + ) : ( + + ), + isRender: setRenderDelete, + }, + }; React.useEffect(() => { retrieveAvailableEvents() .then((data) => { - for (const endpointNeed of endpointNeeds) { + for (const endpointNeed of Object.values(endpointNeeds)) { if (data?.availableEvents.includes(endpointNeed.endpoint)) { - endpointNeed.component(true); + endpointNeed.isRender(true); } } }) @@ -42,111 +97,18 @@ const Build: React.FC = () => { return ( <> -
- {renderUpdate && ( - console.log("Delete clicked")} - label="Seçili Olanları Sil" - bgColor="bg-emerald-700" - icon={ - - - - - - - } - /> - )} - {renderUpdate && ( - console.log("Create clicked")} - label="Kayıdı Güncelle" - bgColor="bg-blue-500" - icon={ - - - - - - - } - /> - )} - {renderCreate && ( - console.log("Create clicked")} - label="Kayıt ekle" - bgColor="bg-indigo-700" - icon={ - - - - - - - } - /> - )} -
- {renderTable ?
: <>} + {isFormEnabled ? ( + formPage + ) : ( +
+
+ {endpointNeeds.update.component} + {endpointNeeds.create.component} + {endpointNeeds.delete.component} +
+ {endpointNeeds.table.component} +
+ )} ); }; diff --git a/src/components/ContextComponents/Building/Build/BuildUpdate.tsx b/src/components/ContextComponents/Building/Build/BuildUpdate.tsx new file mode 100644 index 0000000..9cf196e --- /dev/null +++ b/src/components/ContextComponents/Building/Build/BuildUpdate.tsx @@ -0,0 +1,38 @@ +import React from "react"; +import PageUpdate from "@/components/ContextComponents/Commons/PageUpdate"; +import IsNotAllowed from "@/components/ContextComponents/Commons/PageisNotAllowed"; + +interface BuildUpdatePageButtonProps { + rowData: any; + setRowData: React.Dispatch>; + formPageFunction: React.Dispatch>; + isFormEnabledFunction: React.Dispatch>; +} + +const BuildUpdatePage: React.FC = ({ + rowData, + setRowData, + formPageFunction, + isFormEnabledFunction, +}) => { + if (JSON.stringify(rowData) === "{}") { + formPageFunction(); + setRowData({}); + isFormEnabledFunction(false); + } + + return ( +
+ console.log("Create button clicked")} + /> +
+ ); +}; + +export default BuildUpdatePage; diff --git a/src/components/ContextComponents/Commons/ButtonCreate.tsx b/src/components/ContextComponents/Commons/ButtonCreate.tsx new file mode 100644 index 0000000..6e3290f --- /dev/null +++ b/src/components/ContextComponents/Commons/ButtonCreate.tsx @@ -0,0 +1,78 @@ +"use client"; +import React from "react"; +import EventButton from "@/components/ContextComponents/Commons/ButtonEvent"; +import PageCreate from "@/components/ContextComponents/Commons/PageCreate"; + +interface CreateButtonProps { + title: string; + buttonLabel: string; + isFormEnabled: boolean; + formPageFunction: React.Dispatch>; + isFormEnabledFunction: React.Dispatch>; +} + +const CreateButton: React.FC = ({ + title, + buttonLabel, + isFormEnabled, + formPageFunction, + isFormEnabledFunction, +}) => { + const pageCreate = ( + console.log("Create button clicked")} + /> + ); + + function openFormPage({ + isFormEnabled, + setFormPage, + setIsFormEnabled, + }: { + isFormEnabled: boolean; + setFormPage: React.Dispatch>; + setIsFormEnabled: React.Dispatch>; + }) { + if (!isFormEnabled) { + setFormPage(pageCreate); + setIsFormEnabled(true); + } + } + + return ( + + openFormPage({ + isFormEnabled: isFormEnabled, + setFormPage: formPageFunction, + setIsFormEnabled: isFormEnabledFunction, + }) + } + label={buttonLabel} + bgColor="bg-indigo-700" + icon={ + + + + + + } + /> + ); +}; + +export default CreateButton; diff --git a/src/components/ContextComponents/Commons/ButtonDelete.tsx b/src/components/ContextComponents/Commons/ButtonDelete.tsx new file mode 100644 index 0000000..8a020e1 --- /dev/null +++ b/src/components/ContextComponents/Commons/ButtonDelete.tsx @@ -0,0 +1,46 @@ +"use client"; +import React from "react"; +import EventButton from "@/components/ContextComponents/Commons/ButtonEvent"; + +interface DeleteButtonProps { + onClick: () => void; +} + +const DeleteButton: React.FC = ({ onClick }) => { + return ( + onClick()} + label="Seçili Olanları Sil" + bgColor="bg-emerald-700" + icon={ + + + + + + + } + /> + ); +}; + +export default DeleteButton; diff --git a/src/components/ContextComponents/Commons/EventButton.tsx b/src/components/ContextComponents/Commons/ButtonEvent.tsx similarity index 72% rename from src/components/ContextComponents/Commons/EventButton.tsx rename to src/components/ContextComponents/Commons/ButtonEvent.tsx index 7afea85..edaab07 100644 --- a/src/components/ContextComponents/Commons/EventButton.tsx +++ b/src/components/ContextComponents/Commons/ButtonEvent.tsx @@ -1,10 +1,11 @@ import React from "react"; interface EventButtonProps { - onClick: () => void; + onClick?: () => void; label: string; icon: React.ReactNode; bgColor?: string; + ishover?: boolean; } const EventButton: React.FC = ({ @@ -12,14 +13,17 @@ const EventButton: React.FC = ({ label, icon, bgColor, + ishover = true, }) => { return (
onClick()} + onClick={onClick ? () => onClick() : () => {}} >
{icon} {label} diff --git a/src/components/ContextComponents/Commons/ButtonUpdate.tsx b/src/components/ContextComponents/Commons/ButtonUpdate.tsx new file mode 100644 index 0000000..66e222b --- /dev/null +++ b/src/components/ContextComponents/Commons/ButtonUpdate.tsx @@ -0,0 +1,66 @@ +"use client"; +import React from "react"; +import EventButton from "@/components/ContextComponents/Commons/ButtonEvent"; + +interface UpdateButtonProps { + buttonLabel: string; + isFormEnabled: boolean; + pageToSet: React.JSX.Element; + formPageFunction: React.Dispatch>; + isFormEnabledFunction: React.Dispatch>; +} + +const UpdateButton: React.FC = ({ + buttonLabel, + isFormEnabled, + pageToSet, + formPageFunction, + isFormEnabledFunction, +}) => { + function openFormPage({ + isFormEnabled, + setFormPage, + setIsFormEnabled, + }: { + isFormEnabled: boolean; + setFormPage: React.Dispatch>; + setIsFormEnabled: React.Dispatch>; + }) { + if (!isFormEnabled) { + setFormPage(pageToSet); + setIsFormEnabled(true); + } + } + + return ( + + openFormPage({ + isFormEnabled: isFormEnabled, + setFormPage: formPageFunction, + setIsFormEnabled: isFormEnabledFunction, + }) + } + label={buttonLabel} + bgColor="bg-blue-900" + icon={ + + + + } + /> + ); +}; + +export default UpdateButton; diff --git a/src/components/ContextComponents/Commons/PageCreate.tsx b/src/components/ContextComponents/Commons/PageCreate.tsx new file mode 100644 index 0000000..b742cff --- /dev/null +++ b/src/components/ContextComponents/Commons/PageCreate.tsx @@ -0,0 +1,78 @@ +import React from "react"; +import IsNotAllowed from "./PageisNotAllowed"; +import EventButton from "./ButtonEvent"; + +interface CreatePageButtonProps { + title: string; + formPageFunction: React.Dispatch>; + isFormEnabledFunction: React.Dispatch>; + onClickAction: () => void; +} + +const PageCreate: React.FC = ({ + title, + formPageFunction, + isFormEnabledFunction, + onClickAction, +}) => { + function closeFormPage() { + formPageFunction(); + isFormEnabledFunction(false); + } + + return ( + <> +

{title}

+
+ closeFormPage()} + label="Dashboarda Dön" + bgColor="bg-red-700" + icon={ + + + + + + } + /> +
+ onClickAction()} + label="Kaydet" + bgColor="bg-emerald-700" + icon={ + + + + } + /> +
+
+ + ); +}; + +export default PageCreate; diff --git a/src/components/ContextComponents/Commons/Landing.tsx b/src/components/ContextComponents/Commons/PageLanding.tsx similarity index 100% rename from src/components/ContextComponents/Commons/Landing.tsx rename to src/components/ContextComponents/Commons/PageLanding.tsx diff --git a/src/components/ContextComponents/Commons/PageUpdate.tsx b/src/components/ContextComponents/Commons/PageUpdate.tsx new file mode 100644 index 0000000..0721b06 --- /dev/null +++ b/src/components/ContextComponents/Commons/PageUpdate.tsx @@ -0,0 +1,94 @@ +import React from "react"; +import IsNotAllowed from "./PageisNotAllowed"; +import EventButton from "./ButtonEvent"; + +interface UpdatePageButtonProps { + title: string; + rowData: any; + setRowData: React.Dispatch>; + formPageFunction: React.Dispatch>; + isFormEnabledFunction: React.Dispatch>; + onClickAction: () => void; +} + +const PageUpdate: React.FC = ({ + title, + rowData, + setRowData, + formPageFunction, + isFormEnabledFunction, + onClickAction, +}) => { + function closeFormPage() { + formPageFunction(); + setRowData({}); + isFormEnabledFunction(false); + } + + return ( + <> +

{title}

+
+ closeFormPage()} + label="Dashboarda Dön" + bgColor="bg-red-700" + icon={ + + + + + + } + /> +
+ onClickAction()} + label="Kaydet" + bgColor="bg-emerald-700" + icon={ + + + + } + /> +
+
+
+ {Object.entries(rowData).map(([key, value]: [string, any]) => { + return ( + <> +

+ {key}: {value} +

+ + ); + })} +
+ + ); +}; + +export default PageUpdate; diff --git a/src/components/ContextComponents/Commons/PageisNotAllowed.tsx b/src/components/ContextComponents/Commons/PageisNotAllowed.tsx new file mode 100644 index 0000000..2aa2cbb --- /dev/null +++ b/src/components/ContextComponents/Commons/PageisNotAllowed.tsx @@ -0,0 +1,21 @@ +import React from "react"; + +const IsNotAllowed: React.FC = () => { + return ( + <> +
+
+
+
+ + Kullanıcı bu etkinliğe erişim iznine sahip değil. + +
+
+
+
+ + ); +}; + +export default IsNotAllowed; diff --git a/src/components/ContextComponents/Commons/Table.tsx b/src/components/ContextComponents/Commons/Table.tsx index ccd3898..66e2036 100644 --- a/src/components/ContextComponents/Commons/Table.tsx +++ b/src/components/ContextComponents/Commons/Table.tsx @@ -15,13 +15,14 @@ import { interface TableProps { createTable: any; + rowClickedFunction: React.Dispatch>; } const formSchema = z.object({ searchText: z.string().default(""), }); -const Table: React.FC = ({ createTable }) => { +const Table: React.FC = ({ createTable, rowClickedFunction }) => { const [initalData, setInitalData] = React.useState([]); const [tabledata, settabledata] = React.useState([]); const [headersList, setHeadersList] = React.useState([]); @@ -51,10 +52,13 @@ const Table: React.FC = ({ createTable }) => { function selectItem({ key }: { key: number }) { tabledata.map((item, index) => { if (index === key) { - item.selected = !item.selected; + item.selected = true; + } else { + item.selected = false; } }); settabledata([...tabledata] as any); + rowClickedFunction(tabledata[key]); } function cleanSelection() { diff --git a/src/components/ContextComponents/Commons/isNotAllowedButton.tsx b/src/components/ContextComponents/Commons/isNotAllowedButton.tsx new file mode 100644 index 0000000..e7af1bf --- /dev/null +++ b/src/components/ContextComponents/Commons/isNotAllowedButton.tsx @@ -0,0 +1,38 @@ +"use client"; +import React from "react"; +import EventButton from "@/components/ContextComponents/Commons/ButtonEvent"; + +interface IsNotAllowedButtonProps { + label: string; +} + +const IsNotAllowedButton: React.FC = ({ label }) => { + return ( + <> + + + + + } + /> + + ); +}; + +export default IsNotAllowedButton; diff --git a/src/components/ContextComponents/LivingSpace/LivingSpace.tsx b/src/components/ContextComponents/LivingSpace/LivingSpace.tsx index f509cdc..0303f7d 100644 --- a/src/components/ContextComponents/LivingSpace/LivingSpace.tsx +++ b/src/components/ContextComponents/LivingSpace/LivingSpace.tsx @@ -1,6 +1,6 @@ "use client"; import React from "react"; -import EventButton from "@/components/ContextComponents/Commons/EventButton"; +import EventButton from "@/components/ContextComponents/Commons/ButtonEvent"; import Table from "@/components/ContextComponents/Commons/Table"; import { retrieveAvailableEvents } from "@/(apicalls)/cookies/token"; diff --git a/src/components/Dashboards/DashboardPage.tsx b/src/components/Dashboards/DashboardPage.tsx index 0f9a78a..dde1914 100644 --- a/src/components/Dashboards/DashboardPage.tsx +++ b/src/components/Dashboards/DashboardPage.tsx @@ -1,7 +1,7 @@ "use client"; import React from "react"; -import Landing from "../ContextComponents/Commons/Landing"; +import Landing from "../ContextComponents/Commons/PageLanding"; import DefaultLayout from "@/components/Layouts/DefaultLayout"; interface DashboardPageProps { diff --git a/src/components/Sidebar/SidebarItem.tsx b/src/components/Sidebar/SidebarItem.tsx index e57c1d1..e97661d 100644 --- a/src/components/Sidebar/SidebarItem.tsx +++ b/src/components/Sidebar/SidebarItem.tsx @@ -1,6 +1,7 @@ "use client"; import React from "react"; -import { retrieveAvailableCategories } from "@/appEvents/categories"; +// import { retrieveAvailableCategories } from "@/appEvents/categories"; + interface SidebarItemProps { item: any; pageName: any; @@ -27,23 +28,19 @@ const SidebarItem = ({ } }; - const isActive = (item: any) => { - if (item.title === pageName?.title) { - return item.children.some((child: any) => isActive(child)); - } - return false; - }; - - const isItemActive = isActive(item); + // const isActive = (item: any) => { + // if (item.title === pageName?.title) { + // console.log("item.title", item.title); + // return item.children.some((child: any) => isActive(child)); + // } + // return false; + // }; return ( <> -

{item.title}

{item.icon} {item.title} diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx index 1cfd4c2..598d487 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -111,11 +111,11 @@ const Sidebar = ({
-