mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-19 15:26:59 +08:00
refactor(core): replace WorkspaceSubPath in env package with the one in core package (#5537)
This commit is contained in:
8
packages/common/env/src/workspace.ts
vendored
8
packages/common/env/src/workspace.ts
vendored
@@ -1,11 +1,3 @@
|
|||||||
export enum WorkspaceSubPath {
|
|
||||||
ALL = 'all',
|
|
||||||
Collection = 'collection',
|
|
||||||
SETTING = 'setting',
|
|
||||||
TRASH = 'trash',
|
|
||||||
SHARED = 'shared',
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum WorkspaceFlavour {
|
export enum WorkspaceFlavour {
|
||||||
/**
|
/**
|
||||||
* New AFFiNE Cloud Workspace using Nest.js Server.
|
* New AFFiNE Cloud Workspace using Nest.js Server.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import type { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import type { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { ArrowRightBigIcon } from '@blocksuite/icons';
|
import { ArrowRightBigIcon } from '@blocksuite/icons';
|
||||||
import type { Workspace } from '@blocksuite/store';
|
import type { Workspace } from '@blocksuite/store';
|
||||||
@@ -10,7 +11,6 @@ import {
|
|||||||
type PageModeOption,
|
type PageModeOption,
|
||||||
} from '../atoms';
|
} from '../atoms';
|
||||||
import type { useNavigateHelper } from '../hooks/use-navigate-helper';
|
import type { useNavigateHelper } from '../hooks/use-navigate-helper';
|
||||||
import { WorkspaceSubPath } from '../shared';
|
|
||||||
|
|
||||||
export function registerAffineNavigationCommands({
|
export function registerAffineNavigationCommands({
|
||||||
t,
|
t,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
workspaceListAtom,
|
workspaceListAtom,
|
||||||
workspaceManagerAtom,
|
workspaceManagerAtom,
|
||||||
} from '@affine/core/modules/workspace';
|
} from '@affine/core/modules/workspace';
|
||||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { ArrowRightSmallIcon } from '@blocksuite/icons';
|
import { ArrowRightSmallIcon } from '@blocksuite/icons';
|
||||||
import { useAtomValue, useSetAtom } from 'jotai';
|
import { useAtomValue, useSetAtom } from 'jotai';
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ import { Button } from '@affine/component/ui/button';
|
|||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { useWorkspaceInfo } from '@affine/core/hooks/use-workspace-info';
|
import { useWorkspaceInfo } from '@affine/core/hooks/use-workspace-info';
|
||||||
import { workspaceManagerAtom } from '@affine/core/modules/workspace';
|
import { workspaceManagerAtom } from '@affine/core/modules/workspace';
|
||||||
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
||||||
import { WorkspaceFlavour, WorkspaceSubPath } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import type { Workspace } from '@affine/workspace';
|
import type { Workspace } from '@affine/workspace';
|
||||||
import { useAtomValue, useSetAtom } from 'jotai';
|
import { useAtomValue, useSetAtom } from 'jotai';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { toast } from '@affine/component';
|
|||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { usePageMetaHelper } from '@affine/core/hooks/use-block-suite-page-meta';
|
import { usePageMetaHelper } from '@affine/core/hooks/use-block-suite-page-meta';
|
||||||
import { useBlockSuiteWorkspaceHelper } from '@affine/core/hooks/use-block-suite-workspace-helper';
|
import { useBlockSuiteWorkspaceHelper } from '@affine/core/hooks/use-block-suite-workspace-helper';
|
||||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import { initEmptyPage } from '@toeverything/infra/blocksuite';
|
import { initEmptyPage } from '@toeverything/infra/blocksuite';
|
||||||
import { useAtomValue, useSetAtom } from 'jotai';
|
import { useAtomValue, useSetAtom } from 'jotai';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
currentWorkspaceAtom,
|
currentWorkspaceAtom,
|
||||||
waitForCurrentWorkspaceAtom,
|
waitForCurrentWorkspaceAtom,
|
||||||
} from '@affine/core/modules/workspace';
|
} from '@affine/core/modules/workspace';
|
||||||
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import type { Collection } from '@affine/env/filter';
|
import type { Collection } from '@affine/env/filter';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { EdgelessIcon, PageIcon, ViewLayersIcon } from '@blocksuite/icons';
|
import { EdgelessIcon, PageIcon, ViewLayersIcon } from '@blocksuite/icons';
|
||||||
@@ -31,7 +32,6 @@ import {
|
|||||||
import { collectionsCRUDAtom } from '../../../atoms/collections';
|
import { collectionsCRUDAtom } from '../../../atoms/collections';
|
||||||
import { currentPageIdAtom } from '../../../atoms/mode';
|
import { currentPageIdAtom } from '../../../atoms/mode';
|
||||||
import { useNavigateHelper } from '../../../hooks/use-navigate-helper';
|
import { useNavigateHelper } from '../../../hooks/use-navigate-helper';
|
||||||
import { WorkspaceSubPath } from '../../../shared';
|
|
||||||
import { usePageHelper } from '../../blocksuite/block-suite-page-list/utils';
|
import { usePageHelper } from '../../blocksuite/block-suite-page-list/utils';
|
||||||
import type { CMDKCommand, CommandContext } from './types';
|
import type { CMDKCommand, CommandContext } from './types';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ConfirmModal } from '@affine/component/ui/modal';
|
|||||||
import { Tooltip } from '@affine/component/ui/tooltip';
|
import { Tooltip } from '@affine/component/ui/tooltip';
|
||||||
import { useBlockSuitePageMeta } from '@affine/core/hooks/use-block-suite-page-meta';
|
import { useBlockSuitePageMeta } from '@affine/core/hooks/use-block-suite-page-meta';
|
||||||
import { waitForCurrentWorkspaceAtom } from '@affine/core/modules/workspace';
|
import { waitForCurrentWorkspaceAtom } from '@affine/core/modules/workspace';
|
||||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import { DeleteIcon, ResetIcon } from '@blocksuite/icons';
|
import { DeleteIcon, ResetIcon } from '@blocksuite/icons';
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import {
|
|||||||
currentWorkspaceAtom,
|
currentWorkspaceAtom,
|
||||||
workspaceListAtom,
|
workspaceListAtom,
|
||||||
} from '@affine/core/modules/workspace';
|
} from '@affine/core/modules/workspace';
|
||||||
import { WorkspaceFlavour, WorkspaceSubPath } from '@affine/env/workspace';
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import type { WorkspaceMetadata } from '@affine/workspace';
|
import type { WorkspaceMetadata } from '@affine/workspace';
|
||||||
import type { DragEndEvent } from '@dnd-kit/core';
|
import type { DragEndEvent } from '@dnd-kit/core';
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import {
|
|||||||
import { Menu } from '@affine/component/ui/menu';
|
import { Menu } from '@affine/component/ui/menu';
|
||||||
import { collectionsCRUDAtom } from '@affine/core/atoms/collections';
|
import { collectionsCRUDAtom } from '@affine/core/atoms/collections';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import { apis, events } from '@affine/electron-api';
|
import { apis, events } from '@affine/electron-api';
|
||||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import type { Workspace } from '@affine/workspace';
|
import type { Workspace } from '@affine/workspace';
|
||||||
import { FolderIcon, SettingsIcon } from '@blocksuite/icons';
|
import { FolderIcon, SettingsIcon } from '@blocksuite/icons';
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { BrowserWarning } from '@affine/component/affine-banner';
|
|||||||
import { LocalDemoTips } from '@affine/component/affine-banner';
|
import { LocalDemoTips } from '@affine/component/affine-banner';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { workspaceManagerAtom } from '@affine/core/modules/workspace';
|
import { workspaceManagerAtom } from '@affine/core/modules/workspace';
|
||||||
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
@@ -12,7 +13,6 @@ import { useCallback, useState } from 'react';
|
|||||||
import { authAtom } from '../atoms';
|
import { authAtom } from '../atoms';
|
||||||
import { useCurrentLoginStatus } from '../hooks/affine/use-current-login-status';
|
import { useCurrentLoginStatus } from '../hooks/affine/use-current-login-status';
|
||||||
import { useNavigateHelper } from '../hooks/use-navigate-helper';
|
import { useNavigateHelper } from '../hooks/use-navigate-helper';
|
||||||
import { WorkspaceSubPath } from '../shared';
|
|
||||||
import { EnableAffineCloudModal } from './affine/enable-affine-cloud-modal';
|
import { EnableAffineCloudModal } from './affine/enable-affine-cloud-modal';
|
||||||
|
|
||||||
const minimumChromeVersion = 106;
|
const minimumChromeVersion = 106;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
waitForCurrentWorkspaceAtom,
|
waitForCurrentWorkspaceAtom,
|
||||||
workspaceManagerAtom,
|
workspaceManagerAtom,
|
||||||
} from '@affine/core/modules/workspace';
|
} from '@affine/core/modules/workspace';
|
||||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { WorkspaceSubPath } from '@affine/env/workspace';
|
import type { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import {
|
import {
|
||||||
type NavigateOptions,
|
type NavigateOptions,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Menu } from '@affine/component/ui/menu';
|
import { Menu } from '@affine/component/ui/menu';
|
||||||
import { WorkspaceFallback } from '@affine/component/workspace';
|
import { WorkspaceFallback } from '@affine/component/workspace';
|
||||||
import { workspaceListAtom } from '@affine/core/modules/workspace';
|
import { workspaceListAtom } from '@affine/core/modules/workspace';
|
||||||
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
import { lazy, useEffect, useLayoutEffect, useState } from 'react';
|
import { lazy, useEffect, useLayoutEffect, useState } from 'react';
|
||||||
import { type LoaderFunction, redirect } from 'react-router-dom';
|
import { type LoaderFunction, redirect } from 'react-router-dom';
|
||||||
@@ -9,7 +10,6 @@ import { createFirstAppData } from '../bootstrap/first-app-data';
|
|||||||
import { UserWithWorkspaceList } from '../components/pure/workspace-slider-bar/user-with-workspace-list';
|
import { UserWithWorkspaceList } from '../components/pure/workspace-slider-bar/user-with-workspace-list';
|
||||||
import { appConfigStorage } from '../hooks/use-app-config-storage';
|
import { appConfigStorage } from '../hooks/use-app-config-storage';
|
||||||
import { useNavigateHelper } from '../hooks/use-navigate-helper';
|
import { useNavigateHelper } from '../hooks/use-navigate-helper';
|
||||||
import { WorkspaceSubPath } from '../shared';
|
|
||||||
|
|
||||||
const AllWorkspaceModals = lazy(() =>
|
const AllWorkspaceModals = lazy(() =>
|
||||||
import('../providers/modal-provider').then(({ AllWorkspaceModals }) => ({
|
import('../providers/modal-provider').then(({ AllWorkspaceModals }) => ({
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { AcceptInvitePage } from '@affine/component/member-components';
|
import { AcceptInvitePage } from '@affine/component/member-components';
|
||||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import {
|
import {
|
||||||
acceptInviteByInviteIdMutation,
|
acceptInviteByInviteIdMutation,
|
||||||
type GetInviteInfoQuery,
|
type GetInviteInfoQuery,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ResizePanel } from '@affine/component/resize-panel';
|
|||||||
import { useBlockSuitePageMeta } from '@affine/core/hooks/use-block-suite-page-meta';
|
import { useBlockSuitePageMeta } from '@affine/core/hooks/use-block-suite-page-meta';
|
||||||
import { useWorkspaceStatus } from '@affine/core/hooks/use-workspace-status';
|
import { useWorkspaceStatus } from '@affine/core/hooks/use-workspace-status';
|
||||||
import { waitForCurrentWorkspaceAtom } from '@affine/core/modules/workspace';
|
import { waitForCurrentWorkspaceAtom } from '@affine/core/modules/workspace';
|
||||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import { globalBlockSuiteSchema, SyncEngineStep } from '@affine/workspace';
|
import { globalBlockSuiteSchema, SyncEngineStep } from '@affine/workspace';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { AffineEditorContainer } from '@blocksuite/presets';
|
||||||
import type { Page, Workspace } from '@blocksuite/store';
|
import type { Page, Workspace } from '@blocksuite/store';
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import {
|
|||||||
waitForCurrentWorkspaceAtom,
|
waitForCurrentWorkspaceAtom,
|
||||||
workspaceListAtom,
|
workspaceListAtom,
|
||||||
} from '@affine/core/modules/workspace';
|
} from '@affine/core/modules/workspace';
|
||||||
import { WorkspaceFlavour, WorkspaceSubPath } from '@affine/env/workspace';
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import { useAtom, useAtomValue } from 'jotai';
|
import { useAtom, useAtomValue } from 'jotai';
|
||||||
import type { ReactElement } from 'react';
|
import type { ReactElement } from 'react';
|
||||||
|
|||||||
Reference in New Issue
Block a user