refactor: lazy load workspaces (#3091)

(cherry picked from commit 283f0cd263)
This commit is contained in:
Alex Yang
2023-07-07 22:15:27 +08:00
parent e6530f5017
commit 1908d1a213
45 changed files with 446 additions and 750 deletions
+3 -7
View File
@@ -26,14 +26,12 @@ export type NextPageWithLayout<P = Record<string, unknown>, IP = P> = NextPage<
export enum WorkspaceSubPath {
ALL = 'all',
SETTING = 'setting',
TRASH = 'trash',
SHARED = 'shared',
}
export const WorkspaceSubPathName = {
[WorkspaceSubPath.ALL]: 'All Pages',
[WorkspaceSubPath.SETTING]: 'Settings',
[WorkspaceSubPath.TRASH]: 'Trash',
[WorkspaceSubPath.SHARED]: 'Shared',
} satisfies {
@@ -43,17 +41,15 @@ export const WorkspaceSubPathName = {
export const pathGenerator = {
all: workspaceId => `/workspace/${workspaceId}/all`,
trash: workspaceId => `/workspace/${workspaceId}/trash`,
setting: workspaceId => `/workspace/${workspaceId}/setting`,
shared: workspaceId => `/workspace/${workspaceId}/shared`,
} satisfies {
[Path in WorkspaceSubPath]: (workspaceId: string) => string;
};
export const publicPathGenerator = {
all: workspaceId => `/public-workspace/${workspaceId}/all`,
trash: workspaceId => `/public-workspace/${workspaceId}/trash`,
setting: workspaceId => `/public-workspace/${workspaceId}/setting`,
shared: workspaceId => `/public-workspace/${workspaceId}/shared`,
all: workspaceId => `/share/${workspaceId}/all`,
trash: workspaceId => `/share/${workspaceId}/trash`,
shared: workspaceId => `/share/${workspaceId}/shared`,
} satisfies {
[Path in WorkspaceSubPath]: (workspaceId: string) => string;
};