refactor(types): extract TranscriptionBlockData to shared types
Move duplicated type definition from TranscriptionEditView.svelte and +page.svelte into $lib/types.ts for single source of truth. Fixes @Felix: "Consider extracting the TranscriptionBlockData type" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,16 +2,7 @@
|
|||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import { SvelteMap } from 'svelte/reactivity';
|
import { SvelteMap } from 'svelte/reactivity';
|
||||||
import TranscriptionBlock from './TranscriptionBlock.svelte';
|
import TranscriptionBlock from './TranscriptionBlock.svelte';
|
||||||
|
import type { TranscriptionBlockData } from '$lib/types';
|
||||||
type TranscriptionBlockData = {
|
|
||||||
id: string;
|
|
||||||
annotationId: string;
|
|
||||||
documentId: string;
|
|
||||||
text: string;
|
|
||||||
label: string | null;
|
|
||||||
sortOrder: number;
|
|
||||||
version: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
type SaveState = 'idle' | 'saving' | 'saved' | 'error';
|
type SaveState = 'idle' | 'saving' | 'saved' | 'error';
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,16 @@ export type Comment = {
|
|||||||
|
|
||||||
export type DocumentPanelTab = 'metadata' | 'transcription' | 'discussion' | 'history';
|
export type DocumentPanelTab = 'metadata' | 'transcription' | 'discussion' | 'history';
|
||||||
|
|
||||||
|
export type TranscriptionBlockData = {
|
||||||
|
id: string;
|
||||||
|
annotationId: string;
|
||||||
|
documentId: string;
|
||||||
|
text: string;
|
||||||
|
label: string | null;
|
||||||
|
sortOrder: number;
|
||||||
|
version: number;
|
||||||
|
};
|
||||||
|
|
||||||
export type Annotation = {
|
export type Annotation = {
|
||||||
id: string;
|
id: string;
|
||||||
documentId: string;
|
documentId: string;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import DocumentTopBar from '$lib/components/DocumentTopBar.svelte';
|
|||||||
import DocumentViewer from '$lib/components/DocumentViewer.svelte';
|
import DocumentViewer from '$lib/components/DocumentViewer.svelte';
|
||||||
import AnnotationSidePanel from '$lib/components/AnnotationSidePanel.svelte';
|
import AnnotationSidePanel from '$lib/components/AnnotationSidePanel.svelte';
|
||||||
import TranscriptionEditView from '$lib/components/TranscriptionEditView.svelte';
|
import TranscriptionEditView from '$lib/components/TranscriptionEditView.svelte';
|
||||||
|
import type { TranscriptionBlockData } from '$lib/types';
|
||||||
|
|
||||||
let { data } = $props();
|
let { data } = $props();
|
||||||
|
|
||||||
@@ -65,16 +66,6 @@ let activeAnnotationPage = $state<number | null>(null);
|
|||||||
|
|
||||||
// ── Transcription blocks ─────────────────────────────────────────────────────
|
// ── Transcription blocks ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
type TranscriptionBlockData = {
|
|
||||||
id: string;
|
|
||||||
annotationId: string;
|
|
||||||
documentId: string;
|
|
||||||
text: string;
|
|
||||||
label: string | null;
|
|
||||||
sortOrder: number;
|
|
||||||
version: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
let transcriptionBlocks = $state<TranscriptionBlockData[]>([]);
|
let transcriptionBlocks = $state<TranscriptionBlockData[]>([]);
|
||||||
|
|
||||||
async function loadTranscriptionBlocks() {
|
async function loadTranscriptionBlocks() {
|
||||||
|
|||||||
Reference in New Issue
Block a user