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 { CloseIcon } from '../components/icons';
|
||||||
import { CORRESPONDENTS_MODAL, TAGS_MODAL } from '../constants/app';
|
import { CORRESPONDENTS_MODAL, TAGS_MODAL } from '../constants/app';
|
||||||
import type { Tag, Correspondent } from '../types/documents';
|
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';
|
import type { Identifier } from '../types/identifiers';
|
||||||
|
|
||||||
interface UseManagementModalsArgs {
|
interface UseManagementModalsArgs {
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ const useCorrespondents = ({
|
|||||||
handleCorrespondentCreate,
|
handleCorrespondentCreate,
|
||||||
handleCorrespondentUpdate,
|
handleCorrespondentUpdate,
|
||||||
handleCorrespondentDelete,
|
handleCorrespondentDelete,
|
||||||
|
correspondentManager,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -623,14 +623,8 @@ const useDocumentsWorkspace = ({
|
|||||||
documentsState,
|
documentsState,
|
||||||
folderState,
|
folderState,
|
||||||
selectionState,
|
selectionState,
|
||||||
tagsState: {
|
tagsState,
|
||||||
...tagsState,
|
correspondentsState,
|
||||||
tagManager,
|
|
||||||
},
|
|
||||||
correspondentsState: {
|
|
||||||
...correspondentsState,
|
|
||||||
correspondentManager,
|
|
||||||
},
|
|
||||||
closeDocumentViewer,
|
closeDocumentViewer,
|
||||||
viewerDocumentId,
|
viewerDocumentId,
|
||||||
resolveTargetDocumentIds,
|
resolveTargetDocumentIds,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ interface UseTagsResult {
|
|||||||
handleTagUpdate: (tagId: TagId, changes: { label?: string; color?: string | null }) => Promise<boolean>;
|
handleTagUpdate: (tagId: TagId, changes: { label?: string; color?: string | null }) => Promise<boolean>;
|
||||||
handleTagCreate: (payload?: { label?: string; color?: string | null }) => Promise<void>;
|
handleTagCreate: (payload?: { label?: string; color?: string | null }) => Promise<void>;
|
||||||
handleTagDelete: (tagId: TagId) => Promise<boolean>;
|
handleTagDelete: (tagId: TagId) => Promise<boolean>;
|
||||||
|
tagManager: TagManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
const useTags = ({
|
const useTags = ({
|
||||||
@@ -136,6 +137,7 @@ const useTags = ({
|
|||||||
handleTagUpdate,
|
handleTagUpdate,
|
||||||
handleTagCreate,
|
handleTagCreate,
|
||||||
handleTagDelete,
|
handleTagDelete,
|
||||||
|
tagManager,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,19 +2,8 @@ import type { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|||||||
import type { DocumentId, FolderId, Identifier } from '../../types/identifiers';
|
import type { DocumentId, FolderId, Identifier } from '../../types/identifiers';
|
||||||
import type { Document, FolderNode, Tag, Correspondent } from '../../types/documents';
|
import type { Document, FolderNode, Tag, Correspondent } from '../../types/documents';
|
||||||
|
|
||||||
interface TagManager {
|
import type TagManager from '../../lib/assets/TagManager';
|
||||||
normalizeLabel: (label: string) => string;
|
import type CorrespondentManager from '../../lib/assets/CorrespondentManager';
|
||||||
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>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DocumentsManagerInterface {
|
interface DocumentsManagerInterface {
|
||||||
map(mapper: (doc: Document) => Document | undefined): boolean;
|
map(mapper: (doc: Document) => Document | undefined): boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user