diff --git a/apps/client/src/components/layouts/global/app-header.tsx b/apps/client/src/components/layouts/global/app-header.tsx index 03bbb872..97a464fd 100644 --- a/apps/client/src/components/layouts/global/app-header.tsx +++ b/apps/client/src/components/layouts/global/app-header.tsx @@ -52,10 +52,7 @@ export function AppHeader() { const [workspace] = useAtom(workspaceAtom); const aiChatEnabled = workspace?.settings?.ai?.chat === true; - const isHomeRoute = location.pathname.startsWith("/home"); - const isSpacesRoute = location.pathname === "/spaces"; const isPageRoute = location.pathname.includes("/p/"); - const hideSidebar = isHomeRoute || isSpacesRoute; const items = links.map((link) => ( diff --git a/apps/client/src/components/layouts/global/global-app-shell.tsx b/apps/client/src/components/layouts/global/global-app-shell.tsx index aeb9cb7e..64bd3dde 100644 --- a/apps/client/src/components/layouts/global/global-app-shell.tsx +++ b/apps/client/src/components/layouts/global/global-app-shell.tsx @@ -75,8 +75,6 @@ export default function GlobalAppShell({ const isSettingsRoute = location.pathname.startsWith("/settings"); const isSpaceRoute = location.pathname.startsWith("/s/"); const isAiRoute = location.pathname.startsWith("/ai"); - const isHomeRoute = location.pathname.startsWith("/home"); - const isSpacesRoute = location.pathname === "/spaces"; const isPageRoute = location.pathname.includes("/p/"); const showGlobalSidebar = !isSpaceRoute && !isSettingsRoute && !isAiRoute; @@ -118,7 +116,7 @@ export default function GlobalAppShell({ {isSettingsRoute ? ( - {children} + {children} ) : ( children )} diff --git a/apps/client/src/ee/ai-chat/components/ai-chat-sidebar.tsx b/apps/client/src/ee/ai-chat/components/ai-chat-sidebar.tsx index e3df3e52..5d790329 100644 --- a/apps/client/src/ee/ai-chat/components/ai-chat-sidebar.tsx +++ b/apps/client/src/ee/ai-chat/components/ai-chat-sidebar.tsx @@ -11,53 +11,9 @@ import { useSearchChatsQuery, } from "../queries/ai-chat-query"; import AiChatSidebarItem from "./ai-chat-sidebar-item"; -import type { AiChat } from "../types/ai-chat.types"; +import { groupChatsByAge } from "../utils/group-chats-by-age"; import classes from "../styles/chat-sidebar.module.css"; -type ChatGroup = { key: string; label: string; chats: AiChat[] }; - -function groupChatsByAge( - chats: AiChat[], - t: (key: string) => string, -): ChatGroup[] { - if (chats.length === 0) return []; - - const now = new Date(); - const startOfToday = new Date( - now.getFullYear(), - now.getMonth(), - now.getDate(), - ).getTime(); - const startOfYesterday = startOfToday - 24 * 60 * 60 * 1000; - const startOfLast7 = startOfToday - 7 * 24 * 60 * 60 * 1000; - const startOfLast30 = startOfToday - 30 * 24 * 60 * 60 * 1000; - - const buckets: Record = { - today: { key: "today", label: t("Today"), chats: [] }, - yesterday: { key: "yesterday", label: t("Yesterday"), chats: [] }, - last7: { key: "last7", label: t("Previous 7 days"), chats: [] }, - last30: { key: "last30", label: t("Previous 30 days"), chats: [] }, - older: { key: "older", label: t("Older"), chats: [] }, - }; - - for (const chat of chats) { - const ts = new Date(chat.updatedAt).getTime(); - if (ts >= startOfToday) buckets.today.chats.push(chat); - else if (ts >= startOfYesterday) buckets.yesterday.chats.push(chat); - else if (ts >= startOfLast7) buckets.last7.chats.push(chat); - else if (ts >= startOfLast30) buckets.last30.chats.push(chat); - else buckets.older.chats.push(chat); - } - - return [ - buckets.today, - buckets.yesterday, - buckets.last7, - buckets.last30, - buckets.older, - ].filter((b) => b.chats.length > 0); -} - export default function AiChatSidebar() { const { t } = useTranslation(); const navigate = useNavigate(); diff --git a/apps/client/src/ee/ai-chat/utils/group-chats-by-age.ts b/apps/client/src/ee/ai-chat/utils/group-chats-by-age.ts new file mode 100644 index 00000000..d2b1904f --- /dev/null +++ b/apps/client/src/ee/ai-chat/utils/group-chats-by-age.ts @@ -0,0 +1,45 @@ +import type { AiChat } from "../types/ai-chat.types"; + +export type ChatGroup = { key: string; label: string; chats: AiChat[] }; + +export function groupChatsByAge( + chats: AiChat[], + t: (key: string) => string, +): ChatGroup[] { + if (chats.length === 0) return []; + + const now = new Date(); + const startOfToday = new Date( + now.getFullYear(), + now.getMonth(), + now.getDate(), + ).getTime(); + const startOfYesterday = startOfToday - 24 * 60 * 60 * 1000; + const startOfLast7 = startOfToday - 7 * 24 * 60 * 60 * 1000; + const startOfLast30 = startOfToday - 30 * 24 * 60 * 60 * 1000; + + const buckets: Record = { + today: { key: "today", label: t("Today"), chats: [] }, + yesterday: { key: "yesterday", label: t("Yesterday"), chats: [] }, + last7: { key: "last7", label: t("Previous 7 days"), chats: [] }, + last30: { key: "last30", label: t("Previous 30 days"), chats: [] }, + older: { key: "older", label: t("Older"), chats: [] }, + }; + + for (const chat of chats) { + const ts = new Date(chat.updatedAt).getTime(); + if (ts >= startOfToday) buckets.today.chats.push(chat); + else if (ts >= startOfYesterday) buckets.yesterday.chats.push(chat); + else if (ts >= startOfLast7) buckets.last7.chats.push(chat); + else if (ts >= startOfLast30) buckets.last30.chats.push(chat); + else buckets.older.chats.push(chat); + } + + return [ + buckets.today, + buckets.yesterday, + buckets.last7, + buckets.last30, + buckets.older, + ].filter((b) => b.chats.length > 0); +} diff --git a/apps/client/src/pages/dashboard/home.tsx b/apps/client/src/pages/dashboard/home.tsx index cefff053..83d55303 100644 --- a/apps/client/src/pages/dashboard/home.tsx +++ b/apps/client/src/pages/dashboard/home.tsx @@ -16,7 +16,7 @@ export default function Home() { {t("Home")} - {getAppName()} - + diff --git a/apps/client/src/pages/space/space-home.tsx b/apps/client/src/pages/space/space-home.tsx index 0b5622fe..b8d72a2d 100644 --- a/apps/client/src/pages/space/space-home.tsx +++ b/apps/client/src/pages/space/space-home.tsx @@ -14,7 +14,7 @@ export default function SpaceHome() { {space?.name || 'Overview'} - {getAppName()} - + {space && } diff --git a/apps/server/src/ee b/apps/server/src/ee index 16cec9b3..d80f660b 160000 --- a/apps/server/src/ee +++ b/apps/server/src/ee @@ -1 +1 @@ -Subproject commit 16cec9b3b03f07b4fa6610ec5f70f8935c81f12e +Subproject commit d80f660b20e71f07b0dce1e8bae012597ebe1ec5