mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 02:26:21 +08:00
refactor: move non-affine hooks (#1857)
This commit is contained in:
@@ -23,21 +23,21 @@ import { beforeAll, beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { currentWorkspaceIdAtom, workspacesAtom } from '../../atoms';
|
||||
import { LocalPlugin } from '../../plugins/local';
|
||||
import { BlockSuiteWorkspace, WorkspaceSubPath } from '../../shared';
|
||||
import {
|
||||
currentWorkspaceAtom,
|
||||
useCurrentWorkspace,
|
||||
} from '../current/use-current-workspace';
|
||||
import {
|
||||
useGuideHidden,
|
||||
useGuideHiddenUntilNextUpdate,
|
||||
useLastVersion,
|
||||
useTipsDisplayStatus,
|
||||
} from '../affine/use-is-first-load';
|
||||
} from '../use-is-first-load';
|
||||
import { usePageMeta, usePageMetaHelper } from '../use-page-meta';
|
||||
import {
|
||||
useRecentlyViewed,
|
||||
useSyncRecentViewsWithRouter,
|
||||
} from '../affine/use-recent-views';
|
||||
import {
|
||||
currentWorkspaceAtom,
|
||||
useCurrentWorkspace,
|
||||
} from '../current/use-current-workspace';
|
||||
import { usePageMeta, usePageMetaHelper } from '../use-page-meta';
|
||||
} from '../use-recent-views';
|
||||
import {
|
||||
REDIRECT_TIMEOUT,
|
||||
useSyncRouterWithCurrentWorkspaceAndPage,
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# AFFiNE Hooks
|
||||
|
||||
> This directory will be moved to `@affine/worksapce/affine/hooks` in the future.
|
||||
|
||||
Only put hooks in this directory if they are specific to AFFiNE, for example
|
||||
if they are using the AFFiNE API, or if the `AffineWorkspace` is required.
|
||||
+1
-1
@@ -6,7 +6,7 @@ import {
|
||||
guideHiddenAtom,
|
||||
guideHiddenUntilNextUpdateAtom,
|
||||
lastVersionAtom,
|
||||
} from '../../atoms/first-load';
|
||||
} from '../atoms/first-load';
|
||||
|
||||
export function useLastVersion() {
|
||||
return useAtom(lastVersionAtom);
|
||||
+1
-1
@@ -3,7 +3,7 @@ import type { PageMeta } from '@blocksuite/store';
|
||||
import type { MouseEvent } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import type { BlockSuiteWorkspace } from '../../shared';
|
||||
import type { BlockSuiteWorkspace } from '../shared';
|
||||
|
||||
export type RenderProps = {
|
||||
blockSuiteWorkspace: BlockSuiteWorkspace;
|
||||
+3
-3
@@ -4,9 +4,9 @@ import type { PageMeta } from '@blocksuite/store';
|
||||
import { nanoid } from '@blocksuite/store';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import type { BlockSuiteWorkspace } from '../../shared';
|
||||
import { useBlockSuiteWorkspaceHelper } from '../use-blocksuite-workspace-helper';
|
||||
import { usePageMetaHelper } from '../use-page-meta';
|
||||
import type { BlockSuiteWorkspace } from '../shared';
|
||||
import { useBlockSuiteWorkspaceHelper } from './use-blocksuite-workspace-helper';
|
||||
import { usePageMetaHelper } from './use-page-meta';
|
||||
import type { NodeRenderProps, PinboardNode } from './use-pinboard-data';
|
||||
|
||||
const logger = new DebugLogger('pinboard');
|
||||
+3
-3
@@ -6,9 +6,9 @@ import {
|
||||
workspacePreferredModeAtom,
|
||||
workspaceRecentViewsAtom,
|
||||
workspaceRecentViresWriteAtom,
|
||||
} from '../../atoms';
|
||||
import { useCurrentWorkspace } from '../current/use-current-workspace';
|
||||
import { usePageMeta } from '../use-page-meta';
|
||||
} from '../atoms';
|
||||
import { useCurrentWorkspace } from './current/use-current-workspace';
|
||||
import { usePageMeta } from './use-page-meta';
|
||||
|
||||
export function useRecentlyViewed() {
|
||||
const [workspace] = useCurrentWorkspace();
|
||||
Reference in New Issue
Block a user