refactor: move non-affine hooks (#1857)

This commit is contained in:
Himself65
2023-04-09 17:15:07 -05:00
committed by GitHub
parent d9e42d6a0f
commit 401cad799e
18 changed files with 42 additions and 36 deletions
+7 -7
View File
@@ -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,
+6
View File
@@ -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.
@@ -6,7 +6,7 @@ import {
guideHiddenAtom,
guideHiddenUntilNextUpdateAtom,
lastVersionAtom,
} from '../../atoms/first-load';
} from '../atoms/first-load';
export function useLastVersion() {
return useAtom(lastVersionAtom);
@@ -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;
@@ -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');
@@ -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();