Skip to content

Commit d991cc8

Browse files
authored
Calendar sync dashboard mock data (#3299)
2 parents bbe2dc5 + f1a15c2 commit d991cc8

File tree

15 files changed

+1358
-128
lines changed

15 files changed

+1358
-128
lines changed

apps/web/messages/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,9 @@
970970
"calendar-tabs": {
971971
"calendar": "Calendar",
972972
"overview": "Overview",
973-
"events": "Events"
973+
"events": "Events",
974+
"sync-dashboard": "Sync Dashboard",
975+
"sync-history": "Sync History"
974976
},
975977
"workspace-finance-tabs": {
976978
"overview": "Overview",

apps/web/messages/vi.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,9 @@
981981
"calendar-tabs": {
982982
"calendar": "Lịch",
983983
"overview": "Tổng quan",
984-
"events": "Sự kiện"
984+
"events": "Sự kiện",
985+
"sync-dashboard": "Bảng điều khiển đồng bộ",
986+
"sync-history": "Đồng bộ hóa lịch sử"
985987
},
986988
"workspace-finance-tabs": {
987989
"overview": "Tổng quan",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { CalendarSyncDashboard } from '@tuturuuu/ui/calendar-settings';
2+
3+
export default function CalendarSyncDashboardPage() {
4+
return <CalendarSyncDashboard />;
5+
}

apps/web/src/app/[locale]/(dashboard)/[wsId]/layout.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
import { SidebarProvider } from '@/context/sidebar-context';
1212
import { createClient } from '@tuturuuu/supabase/next/server';
1313
import {
14+
Activity,
1415
Archive,
1516
Banknote,
1617
Blocks,
@@ -90,7 +91,6 @@ export default async function Layout({ children, params }: LayoutProps) {
9091
icon: <ChartArea className="h-5 w-5" />,
9192
matchExact: true,
9293
},
93-
null,
9494
{
9595
title: t('sidebar_tabs.ai_tools'),
9696
icon: <Sparkles className="h-5 w-5" />,
@@ -217,10 +217,23 @@ export default async function Layout({ children, params }: LayoutProps) {
217217
children: [
218218
{
219219
title: t('sidebar_tabs.calendar'),
220-
href: `/${wsId}/calendar`,
221220
icon: <Calendar className="h-5 w-5" />,
222221
disabled: ENABLE_AI_ONLY || withoutPermission('manage_calendar'),
223222
experimental: 'alpha',
223+
children: [
224+
{
225+
title: t('calendar-tabs.calendar'),
226+
href: `/${wsId}/calendar`,
227+
icon: <Calendar className="h-4 w-4" />,
228+
matchExact: true,
229+
},
230+
{
231+
title: t('calendar-tabs.sync-history'),
232+
href: `/${wsId}/calendar/history/sync`,
233+
icon: <Activity className="h-4 w-4" />,
234+
requireRootWorkspace: true,
235+
},
236+
],
224237
},
225238
{
226239
title: t('sidebar_tabs.tumeet'),
@@ -421,7 +434,6 @@ export default async function Layout({ children, params }: LayoutProps) {
421434
},
422435
],
423436
},
424-
null,
425437
{
426438
title: t('common.settings'),
427439
icon: <Cog className="h-5 w-5" />,

apps/web/src/app/[locale]/(dashboard)/[wsId]/structure.tsx

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function Structure({
6262
direction: 'forward' | 'backward';
6363
}>(() => {
6464
for (const link of links) {
65-
if (link?.children) {
65+
if (link?.children && link.children.length > 1) {
6666
const isActive = link.children.some(
6767
(child) =>
6868
child?.href &&
@@ -79,8 +79,16 @@ export function Structure({
7979
}
8080
}
8181
}
82+
// Flatten links with a single child
83+
const flattenedLinks = links
84+
.flatMap((link) =>
85+
link?.children && link.children.length === 1
86+
? [link.children[0] as NavLink]
87+
: [link]
88+
)
89+
.filter(Boolean) as (NavLink | null)[];
8290
return {
83-
currentLinks: links,
91+
currentLinks: flattenedLinks,
8492
history: [],
8593
titleHistory: [],
8694
direction: 'forward' as const,
@@ -91,7 +99,7 @@ export function Structure({
9199
setNavState((prevState) => {
92100
// Find if any submenu should be active for the current path.
93101
for (const link of links) {
94-
if (link?.children) {
102+
if (link?.children && link.children.length > 1) {
95103
const isActive = link.children.some(
96104
(child) =>
97105
child?.href &&
@@ -121,8 +129,16 @@ export function Structure({
121129
// If we are in a submenu, but no submenu link is active for the current path,
122130
// it means we navigated to a top-level page. Go back to the main menu.
123131
if (prevState.history.length > 0) {
132+
// Flatten links with a single child
133+
const flattenedLinks = links
134+
.flatMap((link) =>
135+
link?.children && link.children.length === 1
136+
? [link.children[0] as NavLink]
137+
: [link]
138+
)
139+
.filter(Boolean) as (NavLink | null)[];
124140
return {
125-
currentLinks: links,
141+
currentLinks: flattenedLinks,
126142
history: [],
127143
titleHistory: [],
128144
direction: 'backward',
@@ -179,28 +195,30 @@ export function Structure({
179195
const getFilteredLinks = (
180196
linksToFilter: (NavLink | null)[] | undefined
181197
): NavLink[] =>
182-
(linksToFilter || [])
183-
.map((link) => {
184-
if (!link) return null;
198+
(linksToFilter || []).flatMap((link) => {
199+
if (!link) return [];
185200

186-
if (link.disabled) return null;
187-
if (link.disableOnProduction && PROD_MODE) return null;
188-
if (link.requireRootMember && !user?.email?.endsWith('@tuturuuu.com'))
189-
return null;
190-
if (link.requireRootWorkspace && !isRootWorkspace) return null;
191-
if (link.allowedRoles && link.allowedRoles.length > 0) return null;
201+
if (link.disabled) return [];
202+
if (link.disableOnProduction && PROD_MODE) return [];
203+
if (link.requireRootMember && !user?.email?.endsWith('@tuturuuu.com'))
204+
return [];
205+
if (link.requireRootWorkspace && !isRootWorkspace) return [];
206+
if (link.allowedRoles && link.allowedRoles.length > 0) return [];
192207

193-
if (link.children) {
194-
const filteredChildren = getFilteredLinks(link.children);
195-
if (filteredChildren.length === 0) {
196-
return null;
197-
}
198-
return { ...link, children: filteredChildren };
208+
if (link.children && link.children.length > 1) {
209+
const filteredChildren = getFilteredLinks(link.children);
210+
if (filteredChildren.length === 0) {
211+
return [];
199212
}
213+
return [{ ...link, children: filteredChildren }];
214+
}
215+
// Flatten links with a single child
216+
if (link.children && link.children.length === 1) {
217+
return getFilteredLinks([link.children[0] as NavLink]);
218+
}
200219

201-
return link;
202-
})
203-
.filter((link): link is NavLink => link !== null);
220+
return [link];
221+
});
204222

205223
const backButton: NavLink = {
206224
title: t('common.back'),
@@ -253,8 +271,7 @@ export function Structure({
253271
<WorkspaceSelect
254272
t={t as (key: string) => string}
255273
hideLeading={isCollapsed}
256-
// biome-ignore lint/suspicious/noExplicitAny: <useQuery can be any>
257-
localUseQuery={useQuery as any}
274+
localUseQuery={useQuery}
258275
disableCreateNewWorkspace={disableCreateNewWorkspace}
259276
/>
260277
</Suspense>

apps/web/src/app/global-error.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/trigger/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"@tuturuuu/trigger/*": ["./src/*"]
77
}
88
},
9-
"include": ["src"],
9+
"include": ["*.ts", "__tests__/**/*.ts"],
1010
"exclude": ["node_modules", "dist", ".turbo"]
1111
}

0 commit comments

Comments
 (0)