feat: update frontend data management and types.
This commit is contained in:
@@ -7,7 +7,7 @@ import PanelHeader from '../components/PanelHeader';
|
||||
import { CloseIcon } from '../components/icons';
|
||||
import { CORRESPONDENTS_MODAL, TAGS_MODAL } from '../constants/app';
|
||||
import type { Tag, Correspondent } from '../types/documents';
|
||||
import type { CorrespondentManager } from '../documents/types/workspaceTypes';
|
||||
import type CorrespondentManager from '../lib/assets/CorrespondentManager';
|
||||
import type { Identifier } from '../types/identifiers';
|
||||
|
||||
interface UseManagementModalsArgs {
|
||||
|
||||
@@ -132,6 +132,7 @@ const useCorrespondents = ({
|
||||
handleCorrespondentCreate,
|
||||
handleCorrespondentUpdate,
|
||||
handleCorrespondentDelete,
|
||||
correspondentManager,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -623,14 +623,8 @@ const useDocumentsWorkspace = ({
|
||||
documentsState,
|
||||
folderState,
|
||||
selectionState,
|
||||
tagsState: {
|
||||
...tagsState,
|
||||
tagManager,
|
||||
},
|
||||
correspondentsState: {
|
||||
...correspondentsState,
|
||||
correspondentManager,
|
||||
},
|
||||
tagsState,
|
||||
correspondentsState,
|
||||
closeDocumentViewer,
|
||||
viewerDocumentId,
|
||||
resolveTargetDocumentIds,
|
||||
|
||||
@@ -19,6 +19,7 @@ interface UseTagsResult {
|
||||
handleTagUpdate: (tagId: TagId, changes: { label?: string; color?: string | null }) => Promise<boolean>;
|
||||
handleTagCreate: (payload?: { label?: string; color?: string | null }) => Promise<void>;
|
||||
handleTagDelete: (tagId: TagId) => Promise<boolean>;
|
||||
tagManager: TagManager;
|
||||
}
|
||||
|
||||
const useTags = ({
|
||||
@@ -136,6 +137,7 @@ const useTags = ({
|
||||
handleTagUpdate,
|
||||
handleTagCreate,
|
||||
handleTagDelete,
|
||||
tagManager,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -2,19 +2,8 @@ import type { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
||||
import type { DocumentId, FolderId, Identifier } from '../../types/identifiers';
|
||||
import type { Document, FolderNode, Tag, Correspondent } from '../../types/documents';
|
||||
|
||||
interface TagManager {
|
||||
normalizeLabel: (label: string) => string;
|
||||
buildPayload: (args: { label: string; color?: string | null }) => Record<string, unknown>;
|
||||
ingest: (tags: Tag[]) => void;
|
||||
create: (payload: Record<string, unknown>) => Promise<Tag>;
|
||||
}
|
||||
|
||||
export interface CorrespondentManager {
|
||||
normalizeName: (name: string) => string;
|
||||
buildPayload: (args: { name: string }) => Record<string, unknown>;
|
||||
ingest: (correspondents: Correspondent[]) => void;
|
||||
create: (payload: Record<string, unknown>) => Promise<Correspondent>;
|
||||
}
|
||||
import type TagManager from '../../lib/assets/TagManager';
|
||||
import type CorrespondentManager from '../../lib/assets/CorrespondentManager';
|
||||
|
||||
interface DocumentsManagerInterface {
|
||||
map(mapper: (doc: Document) => Document | undefined): boolean;
|
||||
|
||||
Reference in New Issue
Block a user