@canmingir/link 1.2.63 → 1.2.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,113 +0,0 @@
1
- import { Box } from "@mui/material";
2
- import MiniTopBar from "../components/MiniTopBar";
3
- import Sidebar from "../components/Sidebar";
4
- import TopNavBar from "../components/TopNavBar";
5
- import config from "../config/config";
6
- import { useContext } from "../ContextProvider/ContextProvider";
7
- import user from "../http/user";
8
-
9
- import { Outlet, useLocation } from "react-router-dom";
10
- import React, { useEffect, useState } from "react";
11
-
12
- function AppLayout() {
13
- const [anchorElUser, setAnchorElUser] = useState(null);
14
- const [isCollapsed, setIsCollapsed] = useState(false);
15
- const [isSubmenuOpen, setSubmenuOpen] = useState(false);
16
- const [selectedItem, setSelectedItem] = useState();
17
- const [state, dispatch] = useContext();
18
- const [miniTopMenu, setMiniTopMenu] = useState(false);
19
- const [userData, setUserData] = useState(null);
20
- const location = useLocation();
21
- const globalConfig = useConfig();
22
-
23
- const toggleCollapse = () => {
24
- setIsCollapsed(!isCollapsed);
25
- if (isSubmenuOpen) {
26
- setSubmenuOpen(false);
27
- }
28
- };
29
-
30
- const handleOpenUserMenu = (event) => {
31
- setAnchorElUser(event.currentTarget);
32
- };
33
-
34
- const handleCloseUserMenu = () => {
35
- setAnchorElUser(null);
36
- };
37
-
38
- const handleItemSelect = (item) => {
39
- dispatch({ type: "ITEM_SELECT", payload: item.id });
40
- };
41
-
42
- useEffect(() => {
43
- const foundItem = globalConfig.itemsData.find(
44
- (item) => item.id === state.itemId
45
- );
46
-
47
- if (foundItem) {
48
- setSelectedItem(foundItem);
49
- }
50
- selectedItem && setSubmenuOpen(false);
51
-
52
- // eslint-disable-next-line react-hooks/exhaustive-deps
53
- }, []);
54
-
55
- useEffect(() => {
56
- user.get("https://api.github.com/user").then((response) => {
57
- setUserData(response.data);
58
- });
59
- // eslint-disable-next-line react-hooks/exhaustive-deps
60
- }, [state.login]);
61
-
62
- useEffect(() => {
63
- const targetPage = globalConfig.topMenu.find(
64
- (target) => target.url === location.pathname
65
- );
66
-
67
- targetPage?.hideTopBar
68
- ? (setMiniTopMenu(true), setIsCollapsed(true))
69
- : (setMiniTopMenu(false), setIsCollapsed(false));
70
- // eslint-disable-next-line react-hooks/exhaustive-deps
71
- }, [location]);
72
-
73
- return (
74
- <Box>
75
- {state.login &&
76
- (miniTopMenu ? (
77
- <MiniTopBar />
78
- ) : (
79
- <TopNavBar
80
- sx={{ flexShrink: 0 }}
81
- anchorElUser={anchorElUser}
82
- handleOpenUserMenu={handleOpenUserMenu}
83
- handleCloseUserMenu={handleCloseUserMenu}
84
- routes={globalConfig.topMenu}
85
- itemsData={globalConfig.itemsData}
86
- onItemSelect={handleItemSelect}
87
- sideBarToggle={toggleCollapse}
88
- selectedItem={selectedItem}
89
- setSelectedItem={setSelectedItem}
90
- itemUrl="/"
91
- itemName="ITEEEEEM"
92
- userData={userData}
93
- />
94
- ))}
95
-
96
- <Box sx={{ display: "flex", flexGrow: 1 }}>
97
- {state.itemId ? (
98
- <Sidebar
99
- sx={{ flexShrink: 0 }}
100
- routes={globalConfig.sideMenu}
101
- isCollapsed={isCollapsed}
102
- currentPage={location.pathname}
103
- />
104
- ) : null}
105
- <Box sx={{ flexGrow: 1, overflow: "auto" }}>
106
- <Outlet />
107
- </Box>
108
- </Box>
109
- </Box>
110
- );
111
- }
112
-
113
- export default AppLayout;
@@ -1 +0,0 @@
1
- export { default } from "./NucDialog";
@@ -1,24 +0,0 @@
1
- const ActionTemplate = {
2
- GET: `function action(req) {
3
- // Implement your GET logic here
4
- return {};
5
- }`,
6
- POST: `function action(req) {
7
- // Implement your POST logic here
8
- return {};
9
- }`,
10
- PUT: `function action(req) {
11
- // Implement your PUT logic here
12
- return {};
13
- }`,
14
- DELETE: `function action(req) {
15
- // Implement your DELETE logic here
16
- return {};
17
- }`,
18
- PATCH: `function action(req) {
19
- // Implement your PATCH logic here
20
- return {};
21
- }`,
22
- };
23
-
24
- export default ActionTemplate;