refactor: centralize documents route configuration into new useDocumentsShell hook and export related types.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { ComponentProps, ReactNode } from 'react';
|
||||
import { SidebarExpandIcon } from '../ui/icons';
|
||||
import DocumentsPanel from '../documents/panel/DocumentsPanel';
|
||||
import DocumentViewerPanel from '../preview/DocumentViewerPanel';
|
||||
@@ -7,18 +7,33 @@ import { usePanelManager } from './PanelManagerContext';
|
||||
import { FolderManagerProvider } from '../folders/FolderManagerContext';
|
||||
import type { Identifier } from '../types/identifiers';
|
||||
|
||||
type EnsureAssetUrl = (docId: Identifier, asset: unknown, options?: Record<string, unknown>) => Promise<unknown> | void;
|
||||
type EnsurePreviewData = (docId: Identifier, options?: Record<string, unknown>) => Promise<unknown>;
|
||||
type GetDocumentAsset = (document: unknown, assetType: string) => unknown;
|
||||
type NotifyApiError = (error: unknown, fallbackMessage?: string) => void;
|
||||
export type EnsureAssetUrl = (
|
||||
docId: Identifier,
|
||||
asset: unknown,
|
||||
options?: Record<string, unknown>,
|
||||
) => Promise<unknown> | void;
|
||||
export type EnsurePreviewData = (docId: Identifier, options?: Record<string, unknown>) => Promise<unknown>;
|
||||
export type GetDocumentAsset = (document: unknown, assetType: string) => unknown;
|
||||
export type NotifyApiError = (error: unknown, fallbackMessage?: string) => void;
|
||||
|
||||
type WorkspaceSurface = { content: ReactNode; detail?: ReactNode | null } | null;
|
||||
export type DocumentsTableProps = ComponentProps<typeof DocumentsPanel> | null;
|
||||
export type DetailPanelProps = (ComponentProps<typeof DocumentViewerPanel> & {
|
||||
onClose?: () => void;
|
||||
onOpenPreview?: (args: { documentIds: Array<string> }) => void;
|
||||
folderNodes?: Map<Identifier | 'root', unknown>;
|
||||
ensureFolderData?: (
|
||||
folderId: Identifier | 'root',
|
||||
options?: { force?: boolean; includeDocuments?: boolean },
|
||||
) => Promise<void>;
|
||||
}) | null;
|
||||
|
||||
interface UseWorkspaceSurfaceArgs {
|
||||
export type WorkspaceSurface = { content: ReactNode; detail?: ReactNode | null } | null;
|
||||
|
||||
export interface UseWorkspaceSurfaceArgs {
|
||||
sidebarHidden?: boolean;
|
||||
onExpandSidebar?: () => void;
|
||||
documentsTableProps?: Record<string, any> | null;
|
||||
detailPanelProps?: (Record<string, any> & { onClose?: () => void }) | null;
|
||||
documentsTableProps?: DocumentsTableProps;
|
||||
detailPanelProps?: DetailPanelProps;
|
||||
detailPanelOpen?: boolean;
|
||||
previewWorkspaceDocument?: unknown;
|
||||
documentLink?: unknown;
|
||||
@@ -30,7 +45,7 @@ interface UseWorkspaceSurfaceArgs {
|
||||
closeDocumentPreview?: () => void;
|
||||
}
|
||||
|
||||
interface UseWorkspaceSurfaceResult {
|
||||
export interface UseWorkspaceSurfaceResult {
|
||||
surface: WorkspaceSurface;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user