mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
refactor: init package @affine/workspace (#1661)
This commit is contained in:
@@ -12,7 +12,7 @@ let prefixUrl = '/';
|
||||
if (typeof window === 'undefined') {
|
||||
// SSR
|
||||
const serverAPI = config.serverAPI;
|
||||
if (isValidIPAddress(serverAPI)) {
|
||||
if (isValidIPAddress(serverAPI.split(':')[0])) {
|
||||
// This is for Server side rendering support
|
||||
prefixUrl = new URL('http://' + config.serverAPI + '/').origin;
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Workspace as RemoteWorkspace } from '@affine/datacenter';
|
||||
import type { WorkspaceFlavour } from '@affine/workspace/type';
|
||||
import { Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
|
||||
import type { NextPage } from 'next';
|
||||
import type { ReactElement, ReactNode } from 'react';
|
||||
@@ -11,25 +12,15 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
export const enum RemWorkspaceFlavour {
|
||||
AFFINE = 'affine',
|
||||
LOCAL = 'local',
|
||||
}
|
||||
|
||||
export interface FlavourToWorkspace {
|
||||
[RemWorkspaceFlavour.AFFINE]: AffineWorkspace;
|
||||
[RemWorkspaceFlavour.LOCAL]: LocalWorkspace;
|
||||
}
|
||||
|
||||
export interface AffineWorkspace extends RemoteWorkspace {
|
||||
flavour: RemWorkspaceFlavour.AFFINE;
|
||||
flavour: WorkspaceFlavour.AFFINE;
|
||||
// empty
|
||||
blockSuiteWorkspace: BlockSuiteWorkspace;
|
||||
providers: Provider[];
|
||||
}
|
||||
|
||||
export interface LocalWorkspace {
|
||||
flavour: RemWorkspaceFlavour.LOCAL;
|
||||
flavour: WorkspaceFlavour.LOCAL;
|
||||
id: string;
|
||||
blockSuiteWorkspace: BlockSuiteWorkspace;
|
||||
providers: Provider[];
|
||||
@@ -89,16 +80,6 @@ export const enum WorkspaceSubPath {
|
||||
TRASH = 'trash',
|
||||
}
|
||||
|
||||
export const settingPanel = {
|
||||
General: 'general',
|
||||
Collaboration: 'collaboration',
|
||||
Publish: 'publish',
|
||||
Export: 'export',
|
||||
Sync: 'sync',
|
||||
} as const;
|
||||
export const settingPanelValues = [...Object.values(settingPanel)] as const;
|
||||
export type SettingPanel = (typeof settingPanel)[keyof typeof settingPanel];
|
||||
|
||||
export const WorkspaceSubPathName = {
|
||||
[WorkspaceSubPath.ALL]: 'All Pages',
|
||||
[WorkspaceSubPath.FAVORITE]: 'Favorites',
|
||||
@@ -125,9 +106,3 @@ export const publicPathGenerator = {
|
||||
} satisfies {
|
||||
[Path in WorkspaceSubPath]: (workspaceId: string) => string;
|
||||
};
|
||||
|
||||
export const enum LoadPriority {
|
||||
HIGH = 1,
|
||||
MEDIUM = 2,
|
||||
LOW = 3,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user