@canmingir/link 1.2.55 → 1.2.57

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.
Files changed (220) hide show
  1. package/.eslintignore +0 -1
  2. package/.github/workflows/publish.yml +6 -1
  3. package/LICENSE +201 -0
  4. package/bun.lock +20 -30
  5. package/package.json +4 -1
  6. package/src/assets/illustrations/avatar-shape.jsx +10 -8
  7. package/src/assets/illustrations/background-shape.jsx +0 -2
  8. package/src/assets/illustrations/booking-illustration.jsx +8 -6
  9. package/src/assets/illustrations/check-in-illustration.jsx +8 -6
  10. package/src/assets/illustrations/check-out-illustration.jsx +8 -6
  11. package/src/assets/illustrations/coming-soon-illustration.jsx +8 -6
  12. package/src/assets/illustrations/forbidden-illustration.jsx +8 -6
  13. package/src/assets/illustrations/maintenance-illustration.jsx +8 -6
  14. package/src/assets/illustrations/motivation-illustration.jsx +8 -6
  15. package/src/assets/illustrations/order-complete-illustration.jsx +8 -6
  16. package/src/assets/illustrations/page-not-found-illustration.jsx +8 -6
  17. package/src/assets/illustrations/seo-illustration.jsx +8 -6
  18. package/src/assets/illustrations/sever-error-illustration.jsx +8 -6
  19. package/src/assets/illustrations/upgrade-storage-illustration.jsx +8 -6
  20. package/src/assets/illustrations/upload-illustration.jsx +8 -6
  21. package/src/components/Iconify/Iconify.jsx +0 -1
  22. package/src/components/chart/chart.js +0 -2
  23. package/src/components/chart/index.js +0 -2
  24. package/src/components/chart/use-chart.js +0 -2
  25. package/src/components/custom-popover/styles.js +0 -2
  26. package/src/components/custom-popover/use-popover.js +0 -2
  27. package/src/components/custom-popover/utils.js +0 -2
  28. package/src/components/file-thumbnail/utils.js +0 -12
  29. package/src/components/image/utils.js +0 -2
  30. package/src/components/label/styles.js +0 -2
  31. package/src/components/logo/logo.jsx +1 -1
  32. package/src/components/scrollbar/styles.js +0 -2
  33. package/src/components/settings/context/settings-context.js +0 -2
  34. package/src/hooks/use-boolean.js +0 -2
  35. package/src/hooks/use-event-listener.js +0 -2
  36. package/src/hooks/use-local-storage.js +0 -4
  37. package/src/hooks/use-off-set-top.js +0 -2
  38. package/src/hooks/use-responsive.js +0 -4
  39. package/src/hooks/use-scroll-to-top.js +0 -2
  40. package/src/layouts/CompactLayout/CompactLayout.jsx +0 -2
  41. package/src/layouts/DashboardLayout/DashboardLayout.jsx +0 -2
  42. package/src/layouts/DashboardLayout/main.jsx +0 -2
  43. package/src/layouts/DashboardLayout/nav-horizontal.jsx +0 -2
  44. package/src/layouts/DashboardLayout/nav-vertical.jsx +6 -5
  45. package/src/layouts/FullScreenLayout/FullScreenLayout.jsx +3 -4
  46. package/src/layouts/FullScreenLayout/nav-horizontal.jsx +0 -2
  47. package/src/layouts/FullScreenLayout/nav-vertical.jsx +4 -5
  48. package/src/layouts/MainLayout/header.jsx +1 -3
  49. package/src/layouts/MainLayout/nav/desktop/index.jsx +0 -2
  50. package/src/layouts/MainLayout/nav/desktop/nav-item.jsx +0 -6
  51. package/src/layouts/MainLayout/nav/desktop/nav-list.jsx +16 -16
  52. package/src/layouts/MainLayout/nav/mobile/index.jsx +1 -3
  53. package/src/layouts/MainLayout/nav/mobile/nav-item.jsx +0 -4
  54. package/src/layouts/MainLayout/nav/mobile/nav-list.jsx +0 -2
  55. package/src/layouts/TwoSideLayout/TwoSideLayout.jsx +0 -1
  56. package/src/layouts/auth/classic.jsx +3 -4
  57. package/src/layouts/auth/modern-compact.jsx +0 -2
  58. package/src/layouts/auth/modern.jsx +0 -2
  59. package/src/layouts/common/ProjectBar/utils.js +0 -10
  60. package/src/layouts/common/account-popover.jsx +0 -2
  61. package/src/layouts/common/header-shadow.jsx +0 -2
  62. package/src/layouts/common/header-sim.jsx +7 -4
  63. package/src/layouts/common/header-simple.jsx +14 -8
  64. package/src/layouts/common/nav-toggle-button.jsx +1 -3
  65. package/src/layouts/common/notifications-popover/index.jsx +9 -10
  66. package/src/layouts/common/notifications-popover/notification-item.jsx +20 -17
  67. package/src/layouts/common/settings-button.jsx +0 -2
  68. package/src/layouts/config-layout.js +0 -2
  69. package/src/lib/ChatMessage/AIMessage.tsx +163 -0
  70. package/src/lib/ChatMessage/ErrorMessage.tsx +63 -0
  71. package/src/lib/ChatMessage/HumanMessage.tsx +142 -0
  72. package/src/lib/ChatMessage/LoadingMessage.tsx +27 -0
  73. package/src/lib/ChatMessage/MessageList.tsx +81 -0
  74. package/src/lib/ChatMessage/ToolMessage.tsx +346 -0
  75. package/src/lib/ChatMessage/index.js +6 -0
  76. package/src/lib/Image/utils.js +0 -2
  77. package/src/lib/PresetSelector/PresetSelector.tsx +112 -0
  78. package/src/lib/PresetSelector/index.js +1 -0
  79. package/src/lib/Scrollbar/styles.js +0 -2
  80. package/src/lib/SidebarChat/ChatDrawer.tsx +407 -0
  81. package/src/lib/SidebarChat/SessionPopover.tsx +221 -0
  82. package/src/lib/SidebarChat/SidebarChat.tsx +222 -0
  83. package/src/lib/SidebarChat/SidebarSessionList.tsx +304 -0
  84. package/src/lib/SidebarChat/assets.d.ts +4 -0
  85. package/src/lib/SidebarChat/cleanIconName.ts +4 -0
  86. package/src/lib/SidebarChat/index.js +1 -0
  87. package/src/lib/SidebarChat/messageSFX.mp3 +0 -0
  88. package/src/lib/SidebarChat/types.ts +14 -0
  89. package/src/lib/index.js +11 -0
  90. package/src/pages/404.jsx +0 -2
  91. package/src/routes/components/router-link.jsx +0 -2
  92. package/src/routes/hooks/use-active-link.js +0 -2
  93. package/src/routes/hooks/use-pathname.js +0 -2
  94. package/src/routes/hooks/use-router.js +0 -2
  95. package/src/theme/css.js +0 -12
  96. package/src/theme/custom-shadows.js +0 -2
  97. package/src/theme/options/contrast.js +0 -2
  98. package/src/theme/options/presets.js +0 -4
  99. package/src/theme/options/right-to-left.jsx +0 -2
  100. package/src/theme/overrides/components/accordion.js +0 -2
  101. package/src/theme/overrides/components/alert.js +0 -4
  102. package/src/theme/overrides/components/appbar.js +0 -2
  103. package/src/theme/overrides/components/autocomplete.js +0 -2
  104. package/src/theme/overrides/components/avatar.js +0 -4
  105. package/src/theme/overrides/components/backdrop.js +0 -2
  106. package/src/theme/overrides/components/badge.js +0 -2
  107. package/src/theme/overrides/components/breadcrumbs.js +0 -2
  108. package/src/theme/overrides/components/button-group.js +0 -4
  109. package/src/theme/overrides/components/button.js +0 -4
  110. package/src/theme/overrides/components/card.js +0 -2
  111. package/src/theme/overrides/components/checkbox.js +0 -2
  112. package/src/theme/overrides/components/chip.js +0 -4
  113. package/src/theme/overrides/components/css-baseline.js +0 -2
  114. package/src/theme/overrides/components/data-grid.js +0 -2
  115. package/src/theme/overrides/components/date-picker.jsx +0 -2
  116. package/src/theme/overrides/components/dialog.js +0 -2
  117. package/src/theme/overrides/components/drawer.js +0 -2
  118. package/src/theme/overrides/components/fab.js +0 -4
  119. package/src/theme/overrides/components/form.js +0 -2
  120. package/src/theme/overrides/components/list.js +0 -2
  121. package/src/theme/overrides/components/loading-button.js +0 -2
  122. package/src/theme/overrides/components/menu.js +0 -2
  123. package/src/theme/overrides/components/pagination.js +0 -4
  124. package/src/theme/overrides/components/paper.js +0 -2
  125. package/src/theme/overrides/components/popover.js +0 -2
  126. package/src/theme/overrides/components/progress.js +0 -4
  127. package/src/theme/overrides/components/radio.js +0 -2
  128. package/src/theme/overrides/components/rating.js +0 -2
  129. package/src/theme/overrides/components/select.js +0 -2
  130. package/src/theme/overrides/components/skeleton.js +0 -2
  131. package/src/theme/overrides/components/slider.js +0 -2
  132. package/src/theme/overrides/components/stepper.js +0 -2
  133. package/src/theme/overrides/components/svg-icon.js +0 -2
  134. package/src/theme/overrides/components/switch.js +0 -2
  135. package/src/theme/overrides/components/table.js +0 -2
  136. package/src/theme/overrides/components/tabs.js +0 -2
  137. package/src/theme/overrides/components/textfield.js +0 -2
  138. package/src/theme/overrides/components/timeline.js +0 -2
  139. package/src/theme/overrides/components/toggle-button.js +0 -4
  140. package/src/theme/overrides/components/tooltip.js +0 -2
  141. package/src/theme/overrides/components/tree-view.js +0 -2
  142. package/src/theme/overrides/components/typography.js +0 -2
  143. package/src/theme/overrides/default-props.jsx +4 -7
  144. package/src/theme/palette.js +0 -4
  145. package/src/theme/shadows.js +0 -2
  146. package/src/theme/typography.js +0 -4
  147. package/src/utils/flatten-array.js +0 -2
  148. package/src/utils/format-number.js +0 -2
  149. package/src/utils/format-time.js +0 -2
  150. package/src/utils/storage-available.js +0 -2
  151. package/src/widgets/Login/Login.jsx +0 -2
  152. package/src/widgets/error/not-found-view.jsx +0 -2
  153. package/vite/vite.js +8 -1
  154. package/project/.eslintrc.cjs +0 -22
  155. package/project/config.js +0 -18
  156. package/project/config.menu.js +0 -39
  157. package/project/config.template.js +0 -31
  158. package/project/cypress/e2e/layouts.cy.js +0 -170
  159. package/project/cypress/e2e/login.cy.js +0 -35
  160. package/project/cypress/e2e/selectbar.cy.js +0 -80
  161. package/project/cypress/fixtures/CONFIG/MENU_CONFIG.js +0 -39
  162. package/project/cypress/fixtures/EMPEROR/EMPERORS_GET.json +0 -51
  163. package/project/cypress/fixtures/EMPEROR/EMPERORS_POST.json +0 -9
  164. package/project/cypress/fixtures/OAUTH/GITHUB/user.json +0 -46
  165. package/project/cypress/fixtures/example.json +0 -5
  166. package/project/cypress/support/commands.js +0 -104
  167. package/project/cypress/support/e2e.js +0 -1
  168. package/project/cypress.config.js +0 -10
  169. package/project/index.html +0 -12
  170. package/project/media/ProjectIcons/3d.png +0 -0
  171. package/project/media/ProjectIcons/box.png +0 -0
  172. package/project/media/ProjectIcons/cafe.png +0 -0
  173. package/project/media/ProjectIcons/cargo.png +0 -0
  174. package/project/media/ProjectIcons/cloud.png +0 -0
  175. package/project/media/ProjectIcons/code.png +0 -0
  176. package/project/media/ProjectIcons/company.png +0 -0
  177. package/project/media/ProjectIcons/conversation.png +0 -0
  178. package/project/media/ProjectIcons/distributed.png +0 -0
  179. package/project/media/ProjectIcons/fingerprint.png +0 -0
  180. package/project/media/ProjectIcons/forest.png +0 -0
  181. package/project/media/ProjectIcons/headphones.png +0 -0
  182. package/project/media/ProjectIcons/office.png +0 -0
  183. package/project/media/ProjectIcons/path.png +0 -0
  184. package/project/media/ProjectIcons/printer.png +0 -0
  185. package/project/media/ProjectIcons/project.png +0 -0
  186. package/project/media/ProjectIcons/resume.png +0 -0
  187. package/project/media/ProjectIcons/rocket.png +0 -0
  188. package/project/media/ProjectIcons/rtruck.png +0 -0
  189. package/project/media/ProjectIcons/sign.png +0 -0
  190. package/project/media/ProjectIcons/site.png +0 -0
  191. package/project/media/ProjectIcons/truck.png +0 -0
  192. package/project/media/logo.png +0 -0
  193. package/project/package-lock.json +0 -22434
  194. package/project/package.json +0 -42
  195. package/project/public/assets/background/overlay_2.jpg +0 -0
  196. package/project/public/assets/illustrations/illustration_dashboard.png +0 -0
  197. package/project/public/media/largeLogo.png +0 -0
  198. package/project/public/media/logo.png +0 -0
  199. package/project/public/vite.svg +0 -1
  200. package/project/routes.jsx +0 -47
  201. package/project/server/mock.json +0 -110
  202. package/project/server/oauthMock.js +0 -27
  203. package/project/server/package-lock.json +0 -1505
  204. package/project/server/package.json +0 -20
  205. package/project/server/server.js +0 -127
  206. package/project/src/Container.jsx +0 -7
  207. package/project/src/components/ActionButton.jsx +0 -18
  208. package/project/src/hooks/useEmperor.jsx +0 -21
  209. package/project/src/http/index.js +0 -39
  210. package/project/src/main.jsx +0 -10
  211. package/project/src/pages/Battles.jsx +0 -16
  212. package/project/src/pages/Emperor.jsx +0 -50
  213. package/project/src/pages/index.jsx +0 -33
  214. package/project/src/theme.js +0 -151
  215. package/project/src/widgets/ActionButton.jsx +0 -68
  216. package/project/src/widgets/AddNewEmperor.jsx +0 -120
  217. package/project/src/widgets/ProjectContainer.jsx +0 -27
  218. package/project/vite.config.js +0 -6
  219. package/project/vite.config.js.timestamp-1709564450418-45fdd27900806.mjs +0 -341
  220. package/src/layouts/MainLayout/footer.jsx +0 -153
@@ -13,8 +13,6 @@ import { useTheme } from "@mui/material/styles";
13
13
  import { NavItem, NavItemDashboard } from "./nav-item";
14
14
  import { useCallback, useEffect, useState } from "react";
15
15
 
16
- // ----------------------------------------------------------------------
17
-
18
16
  export default function NavList({ data }) {
19
17
  const theme = useTheme();
20
18
 
@@ -93,8 +91,6 @@ export default function NavList({ data }) {
93
91
  );
94
92
  }
95
93
 
96
- // ----------------------------------------------------------------------
97
-
98
94
  function NavSubList({ data, subheader, sx, ...other }) {
99
95
  const pathname = usePathname();
100
96
 
@@ -104,18 +100,22 @@ function NavSubList({ data, subheader, sx, ...other }) {
104
100
  <Stack
105
101
  spacing={2}
106
102
  {...other}
107
- sx={[{
108
- flexGrow: 1,
109
- alignItems: "flex-start",
110
- pb: 2,
111
-
112
- ...(dashboard && {
113
- pb: 0,
114
- maxWidth: { md: 1 / 3, lg: 540 },
115
- }),
116
-
117
- ...sx
118
- }, ...(Array.isArray(other.sx) ? other.sx : [other.sx])]}>
103
+ sx={[
104
+ {
105
+ flexGrow: 1,
106
+ alignItems: "flex-start",
107
+ pb: 2,
108
+
109
+ ...(dashboard && {
110
+ pb: 0,
111
+ maxWidth: { md: 1 / 3, lg: 540 },
112
+ }),
113
+
114
+ ...sx,
115
+ },
116
+ ...(Array.isArray(other.sx) ? other.sx : [other.sx]),
117
+ ]}
118
+ >
119
119
  <ListSubheader
120
120
  disableSticky
121
121
  sx={{
@@ -9,8 +9,6 @@ import { usePathname } from "../../../../routes/hooks";
9
9
 
10
10
  import { useCallback, useEffect, useState } from "react";
11
11
 
12
- // ----------------------------------------------------------------------
13
-
14
12
  export default function NavMobile({ data }) {
15
13
  const pathname = usePathname();
16
14
 
@@ -45,7 +43,7 @@ export default function NavMobile({ data }) {
45
43
  pb: 5,
46
44
  width: 260,
47
45
  },
48
- }
46
+ },
49
47
  }}
50
48
  >
51
49
  <Scrollbar>
@@ -8,8 +8,6 @@ import { forwardRef } from "react";
8
8
 
9
9
  import { alpha, styled } from "@mui/material/styles";
10
10
 
11
- // ----------------------------------------------------------------------
12
-
13
11
  export const NavItem = forwardRef(
14
12
  (
15
13
  { title, path, icon, open, active, hasChild, externalLink, ...other },
@@ -63,8 +61,6 @@ export const NavItem = forwardRef(
63
61
  }
64
62
  );
65
63
 
66
- // ----------------------------------------------------------------------
67
-
68
64
  const StyledNavItem = styled(ListItemButton, {
69
65
  shouldForwardProp: (prop) => prop !== "active",
70
66
  })(({ open, active, theme }) => {
@@ -8,8 +8,6 @@ import { useActiveLink } from "../../../../routes/hooks/use-active-link";
8
8
 
9
9
  import { useCallback, useState } from "react";
10
10
 
11
- // ----------------------------------------------------------------------
12
-
13
11
  export default function NavList({ data }) {
14
12
  const active = useActiveLink(data.path, !!data.children);
15
13
 
@@ -2,7 +2,6 @@ import Container from "@mui/material/Container";
2
2
  import Grid from "@mui/material/Grid";
3
3
  import React from "react";
4
4
  import Typography from "@mui/material/Typography";
5
- // ----------------------------------------------------------------------
6
5
 
7
6
  export default function TwoSideLayout({ rows, title }) {
8
7
  const rowData = rows;
@@ -9,8 +9,6 @@ import { useResponsive } from "../../hooks/use-responsive";
9
9
 
10
10
  import { alpha, useTheme } from "@mui/material/styles";
11
11
 
12
- // ----------------------------------------------------------------------
13
-
14
12
  export default function AuthClassicLayout({ image, title }) {
15
13
  const theme = useTheme();
16
14
 
@@ -56,8 +54,9 @@ export default function AuthClassicLayout({ image, title }) {
56
54
  theme.palette.mode === "light" ? 0.88 : 0.94
57
55
  ),
58
56
  imgUrl: "https://minimals.cc/assets/background/overlay_2.jpg",
59
- })
60
- }}>
57
+ }),
58
+ }}
59
+ >
61
60
  <Typography variant="h3" sx={{ maxWidth: 480, textAlign: "center" }}>
62
61
  {title || "Hi, Welcome back"}
63
62
  </Typography>
@@ -4,8 +4,6 @@ import Header from "../common/header-sim";
4
4
  import { Outlet } from "react-router";
5
5
  import React from "react";
6
6
 
7
- // ----------------------------------------------------------------------
8
-
9
7
  export default function AuthModernCompactLayout() {
10
8
  return (
11
9
  <>
@@ -6,8 +6,6 @@ import React from "react";
6
6
  import Stack from "@mui/material/Stack";
7
7
  import { alpha } from "@mui/material/styles";
8
8
 
9
- // ----------------------------------------------------------------------
10
-
11
9
  export default function AuthModernLayout() {
12
10
  return (
13
11
  <Stack
@@ -1,7 +1,5 @@
1
1
  import { flattenArray } from "../../../utils/flatten-array";
2
2
 
3
- // ----------------------------------------------------------------------
4
-
5
3
  export function getAllItems({ data }) {
6
4
  const reduceItems = data
7
5
  .map((list) => handleLoop(list.items, list.subheader))
@@ -20,8 +18,6 @@ export function getAllItems({ data }) {
20
18
  return items;
21
19
  }
22
20
 
23
- // ----------------------------------------------------------------------
24
-
25
21
  export function applyFilter({ inputData, query }) {
26
22
  if (query) {
27
23
  inputData = inputData.filter(
@@ -32,8 +28,6 @@ export function applyFilter({ inputData, query }) {
32
28
  return inputData;
33
29
  }
34
30
 
35
- // ----------------------------------------------------------------------
36
-
37
31
  export function splitPath(array, key) {
38
32
  let stack = array.map((item) => ({
39
33
  path: [item.title],
@@ -59,8 +53,6 @@ export function splitPath(array, key) {
59
53
  return null;
60
54
  }
61
55
 
62
- // ----------------------------------------------------------------------
63
-
64
56
  export function handleLoop(array, subheader) {
65
57
  return array?.map((list) => ({
66
58
  subheader,
@@ -71,8 +63,6 @@ export function handleLoop(array, subheader) {
71
63
  }));
72
64
  }
73
65
 
74
- // ----------------------------------------------------------------------
75
-
76
66
  export function groupedData(array) {
77
67
  const group = array.reduce((groups, item) => {
78
68
  groups[item.group] = groups[item.group] || [];
@@ -16,8 +16,6 @@ import { varHover } from "../../components/animate";
16
16
 
17
17
  import CustomPopover, { usePopover } from "../../components/custom-popover";
18
18
 
19
- // ----------------------------------------------------------------------
20
-
21
19
  export default function AccountPopover() {
22
20
  const { options } = config().menu;
23
21
  const router = useRouter();
@@ -1,8 +1,6 @@
1
1
  import Box from "@mui/material/Box";
2
2
  import React from "react";
3
3
 
4
- // ----------------------------------------------------------------------
5
-
6
4
  export default function HeaderShadow({ sx, ...other }) {
7
5
  return (
8
6
  <Box
@@ -9,7 +9,6 @@ import Toolbar from "@mui/material/Toolbar";
9
9
  import { bgBlur } from "../../theme/css";
10
10
  import { useOffSetTop } from "../../hooks/use-off-set-top";
11
11
  import { useTheme } from "@mui/material/styles";
12
- // ----------------------------------------------------------------------
13
12
 
14
13
  export default function HeaderSim() {
15
14
  const theme = useTheme();
@@ -41,9 +40,13 @@ export default function HeaderSim() {
41
40
  >
42
41
  <Logo />
43
42
 
44
- <Stack direction="row" spacing={1} sx={{
45
- alignItems: "center"
46
- }}>
43
+ <Stack
44
+ direction="row"
45
+ spacing={1}
46
+ sx={{
47
+ alignItems: "center",
48
+ }}
49
+ >
47
50
  <SettingsButton />
48
51
  </Stack>
49
52
  </Toolbar>
@@ -16,8 +16,6 @@ import { useOffSetTop } from "../../hooks/use-off-set-top";
16
16
  import { useResponsive } from "../../hooks/use-responsive";
17
17
  import { useTheme } from "@mui/material/styles";
18
18
 
19
- // ----------------------------------------------------------------------
20
-
21
19
  export default function HeaderSimple({
22
20
  handleItemSelect,
23
21
  selectedItem,
@@ -52,9 +50,13 @@ export default function HeaderSimple({
52
50
  }),
53
51
  }}
54
52
  >
55
- <Stack direction="row" spacing={5} sx={{
56
- alignItems: "center"
57
- }}>
53
+ <Stack
54
+ direction="row"
55
+ spacing={5}
56
+ sx={{
57
+ alignItems: "center",
58
+ }}
59
+ >
58
60
  <Logo />
59
61
  <ProjectBar
60
62
  handleItemSelect={handleItemSelect}
@@ -62,9 +64,13 @@ export default function HeaderSimple({
62
64
  setSelectedItem={setSelectedItem}
63
65
  />
64
66
  </Stack>
65
- <Stack direction="row" spacing={1} sx={{
66
- alignItems: "center"
67
- }}>
67
+ <Stack
68
+ direction="row"
69
+ spacing={1}
70
+ sx={{
71
+ alignItems: "center",
72
+ }}
73
+ >
68
74
  {mdUp && <NavDesktop data={topMenu} />}
69
75
  <NotificationsPopover />
70
76
 
@@ -7,8 +7,6 @@ import { useResponsive } from "../../hooks/use-responsive";
7
7
  import { useSettingsContext } from "../../components/settings";
8
8
  import { useTheme } from "@mui/material/styles";
9
9
 
10
- // ----------------------------------------------------------------------
11
-
12
10
  export default function NavToggleButton({ sx, ...other }) {
13
11
  const theme = useTheme();
14
12
 
@@ -26,7 +24,7 @@ export default function NavToggleButton({ sx, ...other }) {
26
24
  onClick={() =>
27
25
  settings.onUpdate(
28
26
  "themeLayout",
29
- settings.themeLayout === "vertical" ? "mini" : "vertical",
27
+ settings.themeLayout === "vertical" ? "mini" : "vertical"
30
28
  )
31
29
  }
32
30
  sx={{
@@ -18,8 +18,6 @@ import { varHover } from "../../../components/animate";
18
18
 
19
19
  import { useCallback, useState } from "react";
20
20
 
21
- // ----------------------------------------------------------------------
22
-
23
21
  const TABS = [
24
22
  {
25
23
  value: "all",
@@ -38,8 +36,6 @@ const TABS = [
38
36
  },
39
37
  ];
40
38
 
41
- // ----------------------------------------------------------------------
42
-
43
39
  export default function NotificationsPopover() {
44
40
  const drawer = useBoolean();
45
41
 
@@ -74,8 +70,9 @@ export default function NotificationsPopover() {
74
70
  py: 2,
75
71
  pl: 2.5,
76
72
  pr: 1,
77
- minHeight: 68
78
- }}>
73
+ minHeight: 68,
74
+ }}
75
+ >
79
76
  <Typography variant="h6" sx={{ flexGrow: 1 }}>
80
77
  Notifications
81
78
  </Typography>
@@ -153,8 +150,9 @@ export default function NotificationsPopover() {
153
150
 
154
151
  paper: {
155
152
  sx: { width: 1, maxWidth: 420 },
156
- }
157
- }}>
153
+ },
154
+ }}
155
+ >
158
156
  {renderHead}
159
157
 
160
158
  <Divider />
@@ -165,8 +163,9 @@ export default function NotificationsPopover() {
165
163
  alignItems: "center",
166
164
  justifyContent: "space-between",
167
165
  pl: 2.5,
168
- pr: 1
169
- }}>
166
+ pr: 1,
167
+ }}
168
+ >
170
169
  {renderTabs}
171
170
  <IconButton onClick={handleMarkAllAsRead}>
172
171
  <Iconify icon="solar:settings-bold-duotone" />
@@ -11,8 +11,6 @@ import Stack from "@mui/material/Stack";
11
11
  import Typography from "@mui/material/Typography";
12
12
  import { fToNow } from "../../../utils/format-time";
13
13
 
14
- // ----------------------------------------------------------------------
15
-
16
14
  export default function NotificationItem({ notification }) {
17
15
  const renderAvatar = (
18
16
  <ListItemAvatar>
@@ -29,8 +27,9 @@ export default function NotificationItem({ notification }) {
29
27
  width: 40,
30
28
  height: 40,
31
29
  borderRadius: "50%",
32
- bgcolor: "background.neutral"
33
- }}>
30
+ bgcolor: "background.neutral",
31
+ }}
32
+ >
34
33
  <Box
35
34
  component="img"
36
35
  src={`/assets/icons/notification/${
@@ -67,8 +66,9 @@ export default function NotificationItem({ notification }) {
67
66
  sx={{
68
67
  alignItems: "center",
69
68
  typography: "caption",
70
- color: "text.disabled"
71
- }}>
69
+ color: "text.disabled",
70
+ }}
71
+ >
72
72
  {fToNow(notification.createdAt)}
73
73
  {notification.category}
74
74
  </Stack>
@@ -102,9 +102,11 @@ export default function NotificationItem({ notification }) {
102
102
  );
103
103
 
104
104
  const projectAction = (
105
- <Stack sx={{
106
- alignItems: "flex-start"
107
- }}>
105
+ <Stack
106
+ sx={{
107
+ alignItems: "flex-start",
108
+ }}
109
+ >
108
110
  <Box
109
111
  sx={{
110
112
  p: 1.5,
@@ -147,8 +149,9 @@ export default function NotificationItem({ notification }) {
147
149
  direction={{ xs: "column", sm: "row" }}
148
150
  sx={{
149
151
  flexGrow: 1,
150
- minWidth: 0
151
- }}>
152
+ minWidth: 0,
153
+ }}
154
+ >
152
155
  <ListItemText
153
156
  disableTypography
154
157
  primary={
@@ -178,8 +181,9 @@ export default function NotificationItem({ notification }) {
178
181
  sx={{
179
182
  alignItems: "center",
180
183
  typography: "caption",
181
- color: "text.disabled"
182
- }}>
184
+ color: "text.disabled",
185
+ }}
186
+ >
183
187
  <span>2.3 GB</span>
184
188
  <span>30 min ago</span>
185
189
  </Stack>
@@ -199,8 +203,9 @@ export default function NotificationItem({ notification }) {
199
203
  spacing={0.75}
200
204
  sx={{
201
205
  flexWrap: "wrap",
202
- mt: 1.5
203
- }}>
206
+ mt: 1.5,
207
+ }}
208
+ >
204
209
  <Label variant="outlined" color="info">
205
210
  Design
206
211
  </Label>
@@ -247,8 +252,6 @@ export default function NotificationItem({ notification }) {
247
252
  );
248
253
  }
249
254
 
250
- // ----------------------------------------------------------------------
251
-
252
255
  function reader(data) {
253
256
  return (
254
257
  <Box
@@ -6,8 +6,6 @@ import SettingsDialog from "../../widgets/SettingsDialog";
6
6
  import { motion } from "framer-motion";
7
7
  import { varHover } from "../../components/animate";
8
8
 
9
- // ----------------------------------------------------------------------
10
-
11
9
  export default function SettingsButton({ sx }) {
12
10
  const [settingsOpen, setSettingsOpen] = React.useState(false);
13
11
 
@@ -1,5 +1,3 @@
1
- // ----------------------------------------------------------------------
2
-
3
1
  export const HEADER = {
4
2
  H_MOBILE: 64,
5
3
  H_DESKTOP: 80,
@@ -0,0 +1,163 @@
1
+ import Editor from "@monaco-editor/react";
2
+ import ReactMarkdown from "react-markdown";
3
+ import { alpha } from "@mui/material/styles";
4
+
5
+ import remarkGfm from "remark-gfm";
6
+
7
+ import { Box, Stack } from "@mui/material";
8
+
9
+ import React, { memo, useMemo } from "react";
10
+
11
+ function tryParseJson(content: string): object | null {
12
+ const trimmed = content.trim();
13
+ if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return null;
14
+ try {
15
+ return JSON.parse(trimmed);
16
+ } catch {
17
+ return null;
18
+ }
19
+ }
20
+
21
+ const JsonViewer: React.FC<{ content: string }> = memo(({ content }) => {
22
+ const formatted = useMemo(() => {
23
+ try {
24
+ return JSON.stringify(JSON.parse(content), null, 2);
25
+ } catch {
26
+ return content;
27
+ }
28
+ }, [content]);
29
+
30
+ const lineCount = formatted.split("\n").length;
31
+ const height = Math.min(Math.max(lineCount * 19 + 24, 60), 300);
32
+
33
+ return (
34
+ <Box
35
+ sx={{
36
+ border: (theme) =>
37
+ `1px solid ${alpha(theme.palette.primary.main, 0.25)}`,
38
+ borderRadius: 1,
39
+ overflow: "hidden",
40
+ bgcolor: "#1e1e1e",
41
+ }}
42
+ >
43
+ <Editor
44
+ height={`${height}px`}
45
+ defaultLanguage="json"
46
+ value={formatted}
47
+ theme="vs-dark"
48
+ options={{
49
+ readOnly: true,
50
+ minimap: { enabled: false },
51
+ fontSize: 12,
52
+ lineNumbers: "off",
53
+ scrollBeyondLastLine: false,
54
+ wordWrap: "on",
55
+ tabSize: 2,
56
+ folding: false,
57
+ glyphMargin: false,
58
+ lineDecorationsWidth: 0,
59
+ lineNumbersMinChars: 0,
60
+ padding: { top: 8, bottom: 8 },
61
+ scrollbar: { vertical: "hidden", horizontal: "hidden" },
62
+ renderLineHighlight: "none",
63
+ selectionHighlight: false,
64
+ occurrencesHighlight: "off",
65
+ cursorStyle: "line",
66
+ contextmenu: false,
67
+ domReadOnly: true,
68
+ }}
69
+ />
70
+ </Box>
71
+ );
72
+ });
73
+
74
+ const AIMessage: React.FC<{
75
+ content: string;
76
+ messageRef?: React.RefObject<HTMLDivElement>;
77
+ }> = memo(({ content, messageRef }) => {
78
+ const parsedJson = useMemo(() => tryParseJson(content), [content]);
79
+
80
+ return (
81
+ <Stack
82
+ ref={messageRef}
83
+ sx={{
84
+ p: 2,
85
+ alignContent: "flex-start",
86
+ justifyContent: "flex-start",
87
+ backgroundColor: (theme) => alpha(theme.palette.primary.dark, 0.4),
88
+ borderRadius: 2,
89
+ height: "auto",
90
+ mt: 1.5,
91
+ boxShadow: 1,
92
+ border: (theme) =>
93
+ `1px solid ${alpha(theme.palette.primary.light, 0.2)}`,
94
+ }}
95
+ >
96
+ {parsedJson ? (
97
+ <JsonViewer content={content} />
98
+ ) : (
99
+ <Box
100
+ sx={{
101
+ width: "100%",
102
+ "& p": {
103
+ margin: "0.5em 0",
104
+ fontSize: "0.95rem",
105
+ lineHeight: 1.6,
106
+ color: (theme) => theme.palette.text.primary,
107
+ },
108
+ "& p:first-of-type": { marginTop: 0 },
109
+ "& p:last-of-type": { marginBottom: 0 },
110
+ "& code": {
111
+ backgroundColor: (theme) => alpha(theme.palette.grey[900], 0.6),
112
+ padding: "2px 6px",
113
+ borderRadius: "4px",
114
+ fontSize: "0.9em",
115
+ fontFamily: "monospace",
116
+ },
117
+ "& pre": {
118
+ backgroundColor: (theme) => alpha(theme.palette.grey[900], 0.7),
119
+ padding: "12px",
120
+ borderRadius: "6px",
121
+ overflow: "auto",
122
+ margin: "0.75em 0",
123
+ },
124
+ "& pre code": { backgroundColor: "transparent", padding: 0 },
125
+ "& ul, & ol": {
126
+ marginLeft: "1.5em",
127
+ marginTop: "0.5em",
128
+ marginBottom: "0.5em",
129
+ },
130
+ "& li": { marginBottom: "0.25em", lineHeight: 1.6 },
131
+ "& blockquote": {
132
+ borderLeft: (theme) => `3px solid ${theme.palette.primary.main}`,
133
+ paddingLeft: "1em",
134
+ marginLeft: 0,
135
+ fontStyle: "italic",
136
+ opacity: 0.9,
137
+ },
138
+ "& strong": { fontWeight: 600 },
139
+ "& a": {
140
+ color: (theme) => theme.palette.primary.light,
141
+ textDecoration: "underline",
142
+ },
143
+ "& h1, & h2, & h3, & h4, & h5, & h6": {
144
+ marginTop: "0.75em",
145
+ marginBottom: "0.5em",
146
+ fontWeight: 600,
147
+ },
148
+ "& hr": {
149
+ border: "none",
150
+ borderTop: (theme) =>
151
+ `1px solid ${alpha(theme.palette.grey[500], 0.3)}`,
152
+ margin: "1em 0",
153
+ },
154
+ }}
155
+ >
156
+ <ReactMarkdown remarkPlugins={[remarkGfm]}>{content}</ReactMarkdown>
157
+ </Box>
158
+ )}
159
+ </Stack>
160
+ );
161
+ });
162
+
163
+ export { AIMessage };