refactor: move lib-root files to lib/shared/ and finalize domain structure
- Move api.server.ts, errors.ts, types.ts, utils.ts, relativeTime.ts to lib/shared/ - Move person relationship components to lib/person/relationship/ - Move Stammbaum components to lib/person/genealogy/ - Move HelpPopover to lib/shared/primitives/ - Update all import paths across routes, specs, and lib files - Update vi.mock() paths in server-project test files - Remove now-empty legacy directories (components/, hooks/, server/, etc.) - Update vite.config.ts coverage include paths for new structure - Update frontend/CLAUDE.md to reflect domain-based lib/ layout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,24 +35,40 @@ src/
|
|||||||
│ ├── api/ # Internal API proxies (server-side only)
|
│ ├── api/ # Internal API proxies (server-side only)
|
||||||
│ ├── login/ logout/ # Auth pages
|
│ ├── login/ logout/ # Auth pages
|
||||||
│ └── ...
|
│ └── ...
|
||||||
├── lib/
|
├── lib/ # Domain-based package structure (mirrors backend)
|
||||||
│ ├── components/ # Reusable Svelte components
|
│ ├── document/ # Document domain: components, stores, services, utils
|
||||||
│ │ ├── document/ # Document-specific components
|
│ │ ├── annotation/ # Annotation overlay components
|
||||||
│ │ ├── chronik/ # Activity feed components
|
│ │ ├── comment/ # Comment thread components
|
||||||
│ │ └── user/ # User-related components
|
│ │ └── transcription/ # Transcription editor + block logic
|
||||||
|
│ ├── person/ # Person domain: chips, typeahead, avatar, format
|
||||||
|
│ │ ├── relationship/ # Relationship form + chip components
|
||||||
|
│ │ └── genealogy/ # Stammbaum (family tree) components
|
||||||
|
│ ├── tag/ # Tag domain: TagInput, TagChipList, TagParentPicker
|
||||||
|
│ ├── geschichte/ # Geschichte (story) domain: editor + card
|
||||||
|
│ ├── notification/ # Notification bell + dropdown + store
|
||||||
|
│ ├── activity/ # Activity feed (Chronik) components
|
||||||
|
│ ├── conversation/ # Bilateral conversation (Briefwechsel) components
|
||||||
|
│ ├── ocr/ # OCR progress, training cards, trigger
|
||||||
|
│ ├── user/ # User profile/password/groups section components
|
||||||
|
│ ├── shared/ # Cross-domain utilities and primitives
|
||||||
|
│ │ ├── actions/ # Svelte actions (clickOutside, etc.)
|
||||||
|
│ │ ├── hooks/ # Reusable Svelte state hooks (useTypeahead, etc.)
|
||||||
|
│ │ ├── server/ # Server-only utilities (locale, session)
|
||||||
|
│ │ ├── services/ # Client-side service helpers
|
||||||
|
│ │ ├── utils/ # Pure utility functions (date, search, etc.)
|
||||||
|
│ │ ├── primitives/ # Generic UI primitives (BackButton, ProgressRing, etc.)
|
||||||
|
│ │ ├── dashboard/ # Dashboard stat components
|
||||||
|
│ │ ├── discussion/ # CommentThread + shared discussion UI
|
||||||
|
│ │ ├── help/ # Help/FAQ page components
|
||||||
|
│ │ ├── api.server.ts # Typed API client factory
|
||||||
|
│ │ ├── errors.ts # Error code mapping (mirrors backend ErrorCode)
|
||||||
|
│ │ ├── types.ts # Shared TypeScript types
|
||||||
|
│ │ ├── relativeTime.ts # Relative time formatting
|
||||||
|
│ │ └── utils.ts # Top-level shared utilities
|
||||||
│ ├── generated/ # Auto-generated API types (openapi-typescript)
|
│ ├── generated/ # Auto-generated API types (openapi-typescript)
|
||||||
│ ├── server/ # Server-only utilities (db, auth helpers)
|
|
||||||
│ ├── services/ # Client-side service logic
|
|
||||||
│ ├── stores/ # Svelte stores (global state)
|
|
||||||
│ ├── types.ts # Shared TypeScript types
|
|
||||||
│ ├── errors.ts # Error code mapping (mirrors backend ErrorCode)
|
|
||||||
│ ├── api.server.ts # Typed API client factory
|
|
||||||
│ ├── utils.ts # Shared utilities
|
|
||||||
│ ├── relativeTime.ts # Time formatting
|
|
||||||
│ ├── search.ts # Search utilities
|
|
||||||
│ └── paraglide/ # Generated i18n code
|
│ └── paraglide/ # Generated i18n code
|
||||||
├── hooks/ # SvelteKit hooks (handle, handleFetch)
|
├── hooks/ # SvelteKit hooks (handle, handleFetch)
|
||||||
└── actions/ # Custom Svelte actions (click outside, etc.)
|
└── ... # Other SvelteKit config files
|
||||||
```
|
```
|
||||||
|
|
||||||
## API Client Pattern
|
## API Client Pattern
|
||||||
@@ -130,14 +146,15 @@ Card pattern for content sections:
|
|||||||
|
|
||||||
## Key UI Components
|
## Key UI Components
|
||||||
|
|
||||||
| Component | Props | Description |
|
| Component | Location | Props | Description |
|
||||||
| -------------------- | ---------------------------------------------------- | ------------------------------------- |
|
| -------------------- | ------------------------------ | --------------------------------------- | ------------------------------------------ |
|
||||||
| `PersonTypeahead` | `name`, `label`, `value`, `initialName`, `on:change` | Single-person selector with typeahead |
|
| `PersonTypeahead` | `$lib/person/` | `name`, `label`, `value`, `initialName` | Single-person selector with typeahead |
|
||||||
| `PersonMultiSelect` | `selectedPersons` (bind) | Chip-based multi-person selector |
|
| `PersonMultiSelect` | `$lib/person/` | `selectedPersons` (bind) | Chip-based multi-person selector |
|
||||||
| `TagInput` | `tags` (bind), `allowCreation?`, `on:change` | Tag chip input with typeahead |
|
| `TagInput` | `$lib/tag/` | `tags` (bind), `allowCreation?` | Tag chip input with typeahead |
|
||||||
| `PdfViewer` | `url`, `annotations`, `on:annotation` | PDF rendering with annotation overlay |
|
| `PdfViewer` | `$lib/document/` | `url`, `annotations` | PDF rendering with annotation overlay |
|
||||||
| `TranscriptionBlock` | `block`, `mode` | Read/edit transcription block |
|
| `TranscriptionBlock` | `$lib/document/transcription/` | `block`, `mode` | Read/edit transcription block |
|
||||||
| `DocumentTopBar` | `document` | Responsive document metadata header |
|
| `DocumentTopBar` | `$lib/document/` | `document` | Responsive document metadata header |
|
||||||
|
| `BackButton` | `$lib/shared/primitives/` | — | Calls `history.back()`; 44 px touch target |
|
||||||
|
|
||||||
## How to Run
|
## How to Run
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as m from '$lib/paraglide/messages.js';
|
import * as m from '$lib/paraglide/messages.js';
|
||||||
import { relativeTimeDe } from '$lib/relativeTime';
|
import { relativeTimeDe } from '$lib/shared/relativeTime';
|
||||||
|
|
||||||
type IncompleteDoc = {
|
type IncompleteDoc = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { m } from '$lib/paraglide/messages.js';
|
|||||||
import { formatDate } from '$lib/shared/utils/date';
|
import { formatDate } from '$lib/shared/utils/date';
|
||||||
import { formatDocumentStatus } from '$lib/document/documentStatusLabel';
|
import { formatDocumentStatus } from '$lib/document/documentStatusLabel';
|
||||||
import { getInitials, personAvatarColor } from '$lib/person/personFormat';
|
import { getInitials, personAvatarColor } from '$lib/person/personFormat';
|
||||||
import RelationshipPill from '$lib/person/RelationshipPill.svelte';
|
import RelationshipPill from '$lib/person/relationship/RelationshipPill.svelte';
|
||||||
|
|
||||||
type Person = { id: string; firstName?: string | null; lastName: string; displayName: string };
|
type Person = { id: string; firstName?: string | null; lastName: string; displayName: string };
|
||||||
type Tag = { id: string; name: string };
|
type Tag = { id: string; name: string };
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from 'svelte';
|
import { getContext } from 'svelte';
|
||||||
import type { Annotation } from '$lib/types';
|
import type { Annotation } from '$lib/shared/types';
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
|
|
||||||
type UpdateAnnotationFn = (
|
type UpdateAnnotationFn = (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { render } from 'vitest-browser-svelte';
|
import { render } from 'vitest-browser-svelte';
|
||||||
import AnnotationEditOverlay from './AnnotationEditOverlay.svelte';
|
import AnnotationEditOverlay from './AnnotationEditOverlay.svelte';
|
||||||
import type { Annotation } from '$lib/types';
|
import type { Annotation } from '$lib/shared/types';
|
||||||
|
|
||||||
const annotation: Annotation = {
|
const annotation: Annotation = {
|
||||||
id: 'ann-1',
|
id: 'ann-1',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Annotation } from '$lib/types';
|
import type { Annotation } from '$lib/shared/types';
|
||||||
import AnnotationShape from './AnnotationShape.svelte';
|
import AnnotationShape from './AnnotationShape.svelte';
|
||||||
|
|
||||||
type DrawRect = {
|
type DrawRect = {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest';
|
|||||||
import { render } from 'vitest-browser-svelte';
|
import { render } from 'vitest-browser-svelte';
|
||||||
import { page } from 'vitest/browser';
|
import { page } from 'vitest/browser';
|
||||||
import AnnotationLayer from './AnnotationLayer.svelte';
|
import AnnotationLayer from './AnnotationLayer.svelte';
|
||||||
import type { Annotation } from '$lib/types';
|
import type { Annotation } from '$lib/shared/types';
|
||||||
|
|
||||||
const annotation: Annotation = {
|
const annotation: Annotation = {
|
||||||
id: 'ann-1',
|
id: 'ann-1',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Annotation } from '$lib/types';
|
import type { Annotation } from '$lib/shared/types';
|
||||||
import AnnotationEditOverlay from './AnnotationEditOverlay.svelte';
|
import AnnotationEditOverlay from './AnnotationEditOverlay.svelte';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { render } from 'vitest-browser-svelte';
|
import { render } from 'vitest-browser-svelte';
|
||||||
import AnnotationShape from './AnnotationShape.svelte';
|
import AnnotationShape from './AnnotationShape.svelte';
|
||||||
import type { Annotation } from '$lib/types';
|
import type { Annotation } from '$lib/shared/types';
|
||||||
|
|
||||||
const annotation: Annotation = {
|
const annotation: Annotation = {
|
||||||
id: 'ann-1',
|
id: 'ann-1',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { m } from '$lib/paraglide/messages.js';
|
|||||||
import { getConfirmService } from '$lib/shared/services/confirm.svelte.js';
|
import { getConfirmService } from '$lib/shared/services/confirm.svelte.js';
|
||||||
import CommentThread from '$lib/shared/discussion/CommentThread.svelte';
|
import CommentThread from '$lib/shared/discussion/CommentThread.svelte';
|
||||||
import PersonMentionEditor from '$lib/shared/discussion/PersonMentionEditor.svelte';
|
import PersonMentionEditor from '$lib/shared/discussion/PersonMentionEditor.svelte';
|
||||||
import type { PersonMention } from '$lib/types';
|
import type { PersonMention } from '$lib/shared/types';
|
||||||
|
|
||||||
const { confirm } = getConfirmService();
|
const { confirm } = getConfirmService();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { provideConfirmService, type ConfirmService } from '$lib/shared/services/confirm.svelte.js';
|
import { provideConfirmService, type ConfirmService } from '$lib/shared/services/confirm.svelte.js';
|
||||||
import TranscriptionBlock from './TranscriptionBlock.svelte';
|
import TranscriptionBlock from './TranscriptionBlock.svelte';
|
||||||
import type { PersonMention } from '$lib/types';
|
import type { PersonMention } from '$lib/shared/types';
|
||||||
|
|
||||||
type BlockProps = {
|
type BlockProps = {
|
||||||
blockId: string;
|
blockId: string;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { m } from '$lib/paraglide/messages.js';
|
|||||||
import TranscriptionBlock from './TranscriptionBlock.svelte';
|
import TranscriptionBlock from './TranscriptionBlock.svelte';
|
||||||
import OcrTrigger from '$lib/ocr/OcrTrigger.svelte';
|
import OcrTrigger from '$lib/ocr/OcrTrigger.svelte';
|
||||||
import TranscribeCoachEmptyState from '$lib/shared/help/TranscribeCoachEmptyState.svelte';
|
import TranscribeCoachEmptyState from '$lib/shared/help/TranscribeCoachEmptyState.svelte';
|
||||||
import type { PersonMention, TranscriptionBlockData } from '$lib/types';
|
import type { PersonMention, TranscriptionBlockData } from '$lib/shared/types';
|
||||||
import { createBlockAutoSave } from '$lib/document/transcription/useBlockAutoSave.svelte';
|
import { createBlockAutoSave } from '$lib/document/transcription/useBlockAutoSave.svelte';
|
||||||
import { createBlockDragDrop } from '$lib/document/transcription/useBlockDragDrop.svelte';
|
import { createBlockDragDrop } from '$lib/document/transcription/useBlockDragDrop.svelte';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import { getLocale } from '$lib/paraglide/runtime.js';
|
import { getLocale } from '$lib/paraglide/runtime.js';
|
||||||
import HelpPopover from '$lib/shared/help/HelpPopover.svelte';
|
import HelpPopover from '$lib/shared/primitives/HelpPopover.svelte';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
mode: 'read' | 'edit';
|
mode: 'read' | 'edit';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { TranscriptionBlockData } from '$lib/types';
|
import type { TranscriptionBlockData } from '$lib/shared/types';
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
import { splitByMarkers } from '$lib/document/transcription/transcriptionMarkers';
|
import { splitByMarkers } from '$lib/document/transcription/transcriptionMarkers';
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, it, expect, vi, afterEach } from 'vitest';
|
import { describe, it, expect, vi, afterEach } from 'vitest';
|
||||||
import { cleanup, render } from 'vitest-browser-svelte';
|
import { cleanup, render } from 'vitest-browser-svelte';
|
||||||
import TranscriptionReadView from './TranscriptionReadView.svelte';
|
import TranscriptionReadView from './TranscriptionReadView.svelte';
|
||||||
import type { TranscriptionBlockData } from '$lib/types';
|
import type { TranscriptionBlockData } from '$lib/shared/types';
|
||||||
|
|
||||||
const PERSON_ID = '11111111-0000-0000-0000-000000000001';
|
const PERSON_ID = '11111111-0000-0000-0000-000000000001';
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|||||||
import { cleanup, render } from 'vitest-browser-svelte';
|
import { cleanup, render } from 'vitest-browser-svelte';
|
||||||
import { page } from 'vitest/browser';
|
import { page } from 'vitest/browser';
|
||||||
import TranscriptionReadView from './TranscriptionReadView.svelte';
|
import TranscriptionReadView from './TranscriptionReadView.svelte';
|
||||||
import type { TranscriptionBlockData } from '$lib/types';
|
import type { TranscriptionBlockData } from '$lib/shared/types';
|
||||||
|
|
||||||
const blocks: TranscriptionBlockData[] = [
|
const blocks: TranscriptionBlockData[] = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { BlockConflictResolvedError, mergeBlockOnConflict } from './blockConflictMerge';
|
import { BlockConflictResolvedError, mergeBlockOnConflict } from './blockConflictMerge';
|
||||||
import type { PersonMention, TranscriptionBlockData } from '$lib/types';
|
import type { PersonMention, TranscriptionBlockData } from '$lib/shared/types';
|
||||||
|
|
||||||
const baseBlock: TranscriptionBlockData = {
|
const baseBlock: TranscriptionBlockData = {
|
||||||
id: 'b1',
|
id: 'b1',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PersonMention, TranscriptionBlockData } from '$lib/types';
|
import type { PersonMention, TranscriptionBlockData } from '$lib/shared/types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sentinel thrown by saveBlockWithConflictRetry after a 409 rename-mid-edit
|
* Sentinel thrown by saveBlockWithConflictRetry after a 409 rename-mid-edit
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, it, expect, vi } from 'vitest';
|
import { describe, it, expect, vi } from 'vitest';
|
||||||
import { saveBlockWithConflictRetry } from './saveBlockWithConflictRetry';
|
import { saveBlockWithConflictRetry } from './saveBlockWithConflictRetry';
|
||||||
import { BlockConflictResolvedError } from './blockConflictMerge';
|
import { BlockConflictResolvedError } from './blockConflictMerge';
|
||||||
import type { PersonMention } from '$lib/types';
|
import type { PersonMention } from '$lib/shared/types';
|
||||||
|
|
||||||
const DOC = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
|
const DOC = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
|
||||||
const BLK = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb';
|
const BLK = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PersonMention, TranscriptionBlockData } from '$lib/types';
|
import type { PersonMention, TranscriptionBlockData } from '$lib/shared/types';
|
||||||
import {
|
import {
|
||||||
BlockConflictResolvedError,
|
BlockConflictResolvedError,
|
||||||
mergeBlockOnConflict
|
mergeBlockOnConflict
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, it, expect, vi, beforeEach, afterEach, type Mock } from 'vitest';
|
import { describe, it, expect, vi, beforeEach, afterEach, type Mock } from 'vitest';
|
||||||
import type { PersonMention } from '$lib/types';
|
import type { PersonMention } from '$lib/shared/types';
|
||||||
|
|
||||||
const mockSaveFn =
|
const mockSaveFn =
|
||||||
vi.fn<(blockId: string, text: string, mentionedPersons: PersonMention[]) => Promise<void>>();
|
vi.fn<(blockId: string, text: string, mentionedPersons: PersonMention[]) => Promise<void>>();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { SvelteMap } from 'svelte/reactivity';
|
import { SvelteMap } from 'svelte/reactivity';
|
||||||
import type { PersonMention } from '$lib/types';
|
import type { PersonMention } from '$lib/shared/types';
|
||||||
|
|
||||||
export type SaveState = 'idle' | 'saving' | 'saved' | 'fading' | 'error';
|
export type SaveState = 'idle' | 'saving' | 'saved' | 'fading' | 'error';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { describe, it, expect, vi } from 'vitest';
|
import { describe, it, expect, vi } from 'vitest';
|
||||||
import { createBlockDragDrop } from './useBlockDragDrop.svelte';
|
import { createBlockDragDrop } from './useBlockDragDrop.svelte';
|
||||||
import type { TranscriptionBlockData } from '$lib/types';
|
import type { TranscriptionBlockData } from '$lib/shared/types';
|
||||||
|
|
||||||
function makeBlock(id: string, sortOrder: number): TranscriptionBlockData {
|
function makeBlock(id: string, sortOrder: number): TranscriptionBlockData {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { TranscriptionBlockData } from '$lib/types';
|
import type { TranscriptionBlockData } from '$lib/shared/types';
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
getSortedBlocks: () => TranscriptionBlockData[];
|
getSortedBlocks: () => TranscriptionBlockData[];
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import { onMount, setContext } from 'svelte';
|
|||||||
import { createPdfRenderer } from '$lib/document/viewer/usePdfRenderer.svelte';
|
import { createPdfRenderer } from '$lib/document/viewer/usePdfRenderer.svelte';
|
||||||
import PdfControls from './PdfControls.svelte';
|
import PdfControls from './PdfControls.svelte';
|
||||||
import AnnotationLayer from '$lib/document/annotation/AnnotationLayer.svelte';
|
import AnnotationLayer from '$lib/document/annotation/AnnotationLayer.svelte';
|
||||||
import type { Annotation } from '$lib/types';
|
import type { Annotation } from '$lib/shared/types';
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import { parseBackendError, getErrorMessage } from '$lib/errors';
|
import { parseBackendError, getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
type DrawRect = { x: number; y: number; width: number; height: number; pageNumber: number };
|
type DrawRect = { x: number; y: number; width: number; height: number; pageNumber: number };
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { enhance } from '$app/forms';
|
import { enhance } from '$app/forms';
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import RelationshipChip from '$lib/person/RelationshipChip.svelte';
|
import RelationshipChip from '$lib/person/relationship/RelationshipChip.svelte';
|
||||||
import AddRelationshipForm from '$lib/person/AddRelationshipForm.svelte';
|
import AddRelationshipForm from '$lib/person/relationship/AddRelationshipForm.svelte';
|
||||||
import { chipLabel, otherName, inferredRelationshipLabel } from '$lib/person/relationshipLabels';
|
import { chipLabel, otherName, inferredRelationshipLabel } from '$lib/person/relationshipLabels';
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
|
|
||||||
@@ -4,8 +4,8 @@ import { page } from 'vitest/browser';
|
|||||||
import StammbaumCard from './StammbaumCard.svelte';
|
import StammbaumCard from './StammbaumCard.svelte';
|
||||||
|
|
||||||
vi.mock('$app/forms', () => ({ enhance: () => () => {} }));
|
vi.mock('$app/forms', () => ({ enhance: () => () => {} }));
|
||||||
vi.mock('$lib/person/RelationshipChip.svelte', () => ({ default: () => null }));
|
vi.mock('$lib/person/relationship/RelationshipChip.svelte', () => ({ default: () => null }));
|
||||||
vi.mock('$lib/person/AddRelationshipForm.svelte', () => ({ default: () => null }));
|
vi.mock('$lib/person/relationship/AddRelationshipForm.svelte', () => ({ default: () => null }));
|
||||||
|
|
||||||
afterEach(cleanup);
|
afterEach(cleanup);
|
||||||
|
|
||||||
@@ -3,8 +3,8 @@ import { onMount } from 'svelte';
|
|||||||
import { invalidateAll } from '$app/navigation';
|
import { invalidateAll } from '$app/navigation';
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import { chipLabel, otherName, inferredRelationshipLabel } from '$lib/person/relationshipLabels';
|
import { chipLabel, otherName, inferredRelationshipLabel } from '$lib/person/relationshipLabels';
|
||||||
import AddRelationshipForm from '$lib/person/AddRelationshipForm.svelte';
|
import AddRelationshipForm from '$lib/person/relationship/AddRelationshipForm.svelte';
|
||||||
import type { RelFormData } from '$lib/person/AddRelationshipForm.svelte';
|
import type { RelFormData } from '$lib/person/relationship/AddRelationshipForm.svelte';
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
|
|
||||||
type PersonNodeDTO = components['schemas']['PersonNodeDTO'];
|
type PersonNodeDTO = components['schemas']['PersonNodeDTO'];
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import type { FlatMessage } from '$lib/types';
|
import type { FlatMessage } from '$lib/shared/types';
|
||||||
import { extractQuote } from '$lib/shared/discussion/comment';
|
import { extractQuote } from '$lib/shared/discussion/comment';
|
||||||
import { getInitials } from '$lib/person/personFormat';
|
import { getInitials } from '$lib/person/personFormat';
|
||||||
import { relativeTime } from '$lib/shared/utils/time';
|
import { relativeTime } from '$lib/shared/utils/time';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, afterEach } from 'vitest';
|
|||||||
import { cleanup, render } from 'vitest-browser-svelte';
|
import { cleanup, render } from 'vitest-browser-svelte';
|
||||||
import { page, userEvent } from 'vitest/browser';
|
import { page, userEvent } from 'vitest/browser';
|
||||||
import CommentMessage from './CommentMessage.svelte';
|
import CommentMessage from './CommentMessage.svelte';
|
||||||
import type { FlatMessage } from '$lib/types';
|
import type { FlatMessage } from '$lib/shared/types';
|
||||||
|
|
||||||
afterEach(cleanup);
|
afterEach(cleanup);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, untrack } from 'svelte';
|
import { onMount, untrack } from 'svelte';
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import type { Comment, FlatMessage, MentionDTO } from '$lib/types';
|
import type { Comment, FlatMessage, MentionDTO } from '$lib/shared/types';
|
||||||
import MentionEditor from '$lib/shared/discussion/MentionEditor.svelte';
|
import MentionEditor from '$lib/shared/discussion/MentionEditor.svelte';
|
||||||
import CommentMessage from '$lib/shared/discussion/CommentMessage.svelte';
|
import CommentMessage from '$lib/shared/discussion/CommentMessage.svelte';
|
||||||
import { extractContent } from '$lib/shared/discussion/mention';
|
import { extractContent } from '$lib/shared/discussion/mention';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, afterEach } from 'vitest';
|
|||||||
import { cleanup, render } from 'vitest-browser-svelte';
|
import { cleanup, render } from 'vitest-browser-svelte';
|
||||||
import { page } from 'vitest/browser';
|
import { page } from 'vitest/browser';
|
||||||
import CommentThread from './CommentThread.svelte';
|
import CommentThread from './CommentThread.svelte';
|
||||||
import type { Comment } from '$lib/types';
|
import type { Comment } from '$lib/shared/types';
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onDestroy, tick } from 'svelte';
|
import { onDestroy, tick } from 'svelte';
|
||||||
import { detectMention } from '$lib/shared/discussion/mention';
|
import { detectMention } from '$lib/shared/discussion/mention';
|
||||||
import type { MentionDTO } from '$lib/types';
|
import type { MentionDTO } from '$lib/shared/types';
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import StarterKit from '@tiptap/starter-kit';
|
|||||||
import { Mention } from '@tiptap/extension-mention';
|
import { Mention } from '@tiptap/extension-mention';
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
import type { PersonMention } from '$lib/types';
|
import type { PersonMention } from '$lib/shared/types';
|
||||||
import { deserialize, serialize } from '$lib/shared/discussion/mentionSerializer';
|
import { deserialize, serialize } from '$lib/shared/discussion/mentionSerializer';
|
||||||
import MentionDropdown from './MentionDropdown.svelte';
|
import MentionDropdown from './MentionDropdown.svelte';
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
renderBody,
|
renderBody,
|
||||||
renderTranscriptionBody
|
renderTranscriptionBody
|
||||||
} from './mention';
|
} from './mention';
|
||||||
import type { MentionDTO, PersonMention } from '$lib/types';
|
import type { MentionDTO, PersonMention } from '$lib/shared/types';
|
||||||
|
|
||||||
// ─── escapeHtml ───────────────────────────────────────────────────────────────
|
// ─── escapeHtml ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { MentionDTO, PersonMention } from '$lib/types';
|
import type { MentionDTO, PersonMention } from '$lib/shared/types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single-source CSS selector for rendered person-mention anchors. Used by:
|
* Single-source CSS selector for rendered person-mention anchors. Used by:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { deserialize, serialize } from './mentionSerializer';
|
import { deserialize, serialize } from './mentionSerializer';
|
||||||
import type { PersonMention } from '$lib/types';
|
import type { PersonMention } from '$lib/shared/types';
|
||||||
|
|
||||||
// ─── deserialize ─────────────────────────────────────────────────────────────
|
// ─── deserialize ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { JSONContent } from '@tiptap/core';
|
import type { JSONContent } from '@tiptap/core';
|
||||||
import type { PersonMention } from '$lib/types';
|
import type { PersonMention } from '$lib/shared/types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts stored block text + sidecar into a Tiptap ProseMirror document.
|
* Converts stored block text + sidecar into a Tiptap ProseMirror document.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { redirect } from '@sveltejs/kit';
|
import { redirect } from '@sveltejs/kit';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
|
|
||||||
type StatsDTO = components['schemas']['StatsDTO'];
|
type StatsDTO = components['schemas']['StatsDTO'];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { invalidateAll } from '$app/navigation';
|
import { invalidateAll } from '$app/navigation';
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
const ACCEPTED_TYPES = ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff'];
|
const ACCEPTED_TYPES = ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff'];
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import { env } from '$env/dynamic/private';
|
import { env } from '$env/dynamic/private';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
|
|
||||||
type UserGroup = components['schemas']['UserGroup'];
|
type UserGroup = components['schemas']['UserGroup'];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import type { LayoutServerLoad } from './$types';
|
import type { LayoutServerLoad } from './$types';
|
||||||
|
|
||||||
export const load: LayoutServerLoad = async ({ fetch }) => {
|
export const load: LayoutServerLoad = async ({ fetch }) => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error, fail, redirect } from '@sveltejs/kit';
|
import { error, fail, redirect } from '@sveltejs/kit';
|
||||||
import type { PageServerLoad, Actions } from './$types';
|
import type { PageServerLoad, Actions } from './$types';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ params, parent }) => {
|
export const load: PageServerLoad = async ({ params, parent }) => {
|
||||||
const { groups } = await parent();
|
const { groups } = await parent();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const mockApi = {
|
|||||||
DELETE: vi.fn()
|
DELETE: vi.fn()
|
||||||
};
|
};
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({
|
vi.mock('$lib/shared/api.server', () => ({
|
||||||
createApiClient: () => mockApi
|
createApiClient: () => mockApi
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||||
import { load } from './+layout.server';
|
import { load } from './+layout.server';
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
|
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
|
||||||
|
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
|
|
||||||
function mockApi(groups: unknown[]) {
|
function mockApi(groups: unknown[]) {
|
||||||
vi.mocked(createApiClient).mockReturnValue({
|
vi.mocked(createApiClient).mockReturnValue({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { fail, redirect } from '@sveltejs/kit';
|
import { fail, redirect } from '@sveltejs/kit';
|
||||||
import type { Actions } from './$types';
|
import type { Actions } from './$types';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export const actions: Actions = {
|
export const actions: Actions = {
|
||||||
default: async ({ request, fetch }) => {
|
default: async ({ request, fetch }) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { fail } from '@sveltejs/kit';
|
import { fail } from '@sveltejs/kit';
|
||||||
import { env } from '$env/dynamic/private';
|
import { env } from '$env/dynamic/private';
|
||||||
import { parseBackendError } from '$lib/errors';
|
import { parseBackendError } from '$lib/shared/errors';
|
||||||
import type { Actions, PageServerLoad } from './$types';
|
import type { Actions, PageServerLoad } from './$types';
|
||||||
|
|
||||||
export interface InviteListItem {
|
export interface InviteListItem {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { enhance } from '$app/forms';
|
import { enhance } from '$app/forms';
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
import type { InviteListItem } from './+page.server.ts';
|
import type { InviteListItem } from './+page.server.ts';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||||
import { load } from './+layout.server';
|
import { load } from './+layout.server';
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
|
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
|
||||||
|
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
|
|
||||||
function mockApi(users: unknown[], groups: unknown[], tags: unknown[]) {
|
function mockApi(users: unknown[], groups: unknown[], tags: unknown[]) {
|
||||||
vi.mocked(createApiClient).mockReturnValue({
|
vi.mocked(createApiClient).mockReturnValue({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ fetch }) => {
|
export const load: PageServerLoad = async ({ fetch }) => {
|
||||||
const api = createApiClient(fetch);
|
const api = createApiClient(fetch);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ params, fetch }) => {
|
export const load: PageServerLoad = async ({ params, fetch }) => {
|
||||||
const api = createApiClient(fetch);
|
const api = createApiClient(fetch);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { load } from './+page.server';
|
|||||||
|
|
||||||
const mockApi = { GET: vi.fn() };
|
const mockApi = { GET: vi.fn() };
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({ createApiClient: () => mockApi }));
|
vi.mock('$lib/shared/api.server', () => ({ createApiClient: () => mockApi }));
|
||||||
|
|
||||||
beforeEach(() => vi.clearAllMocks());
|
beforeEach(() => vi.clearAllMocks());
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ fetch }) => {
|
export const load: PageServerLoad = async ({ fetch }) => {
|
||||||
const api = createApiClient(fetch);
|
const api = createApiClient(fetch);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { load } from './+page.server';
|
|||||||
|
|
||||||
const mockApi = { GET: vi.fn() };
|
const mockApi = { GET: vi.fn() };
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({ createApiClient: () => mockApi }));
|
vi.mock('$lib/shared/api.server', () => ({ createApiClient: () => mockApi }));
|
||||||
|
|
||||||
beforeEach(() => vi.clearAllMocks());
|
beforeEach(() => vi.clearAllMocks());
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { load } from './+page.server';
|
|||||||
|
|
||||||
const mockApi = { GET: vi.fn() };
|
const mockApi = { GET: vi.fn() };
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({ createApiClient: () => mockApi }));
|
vi.mock('$lib/shared/api.server', () => ({ createApiClient: () => mockApi }));
|
||||||
|
|
||||||
beforeEach(() => vi.clearAllMocks());
|
beforeEach(() => vi.clearAllMocks());
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
import type { LayoutServerLoad } from './$types';
|
import type { LayoutServerLoad } from './$types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error, fail, redirect } from '@sveltejs/kit';
|
import { error, fail, redirect } from '@sveltejs/kit';
|
||||||
import type { PageServerLoad, Actions } from './$types';
|
import type { PageServerLoad, Actions } from './$types';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ params, parent, url }) => {
|
export const load: PageServerLoad = async ({ params, parent, url }) => {
|
||||||
const { tags } = await parent();
|
const { tags } = await parent();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const mockApi = {
|
|||||||
DELETE: vi.fn()
|
DELETE: vi.fn()
|
||||||
};
|
};
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({
|
vi.mock('$lib/shared/api.server', () => ({
|
||||||
createApiClient: () => mockApi
|
createApiClient: () => mockApi
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||||
import { load } from './+layout.server';
|
import { load } from './+layout.server';
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
|
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
|
||||||
|
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
|
|
||||||
function mockTreeApi(tree: unknown[]) {
|
function mockTreeApi(tree: unknown[]) {
|
||||||
vi.mocked(createApiClient).mockReturnValue({
|
vi.mocked(createApiClient).mockReturnValue({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import type { LayoutServerLoad } from './$types';
|
import type { LayoutServerLoad } from './$types';
|
||||||
|
|
||||||
export const load: LayoutServerLoad = async ({ fetch }) => {
|
export const load: LayoutServerLoad = async ({ fetch }) => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error, fail, redirect } from '@sveltejs/kit';
|
import { error, fail, redirect } from '@sveltejs/kit';
|
||||||
import type { PageServerLoad, Actions } from './$types';
|
import type { PageServerLoad, Actions } from './$types';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ params, fetch, locals }) => {
|
export const load: PageServerLoad = async ({ params, fetch, locals }) => {
|
||||||
const user = locals.user;
|
const user = locals.user;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||||
import { load } from './+layout.server';
|
import { load } from './+layout.server';
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
|
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
|
||||||
|
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
|
|
||||||
function mockApi(users: unknown[]) {
|
function mockApi(users: unknown[]) {
|
||||||
vi.mocked(createApiClient).mockReturnValue({
|
vi.mocked(createApiClient).mockReturnValue({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error, fail, redirect } from '@sveltejs/kit';
|
import { error, fail, redirect } from '@sveltejs/kit';
|
||||||
import type { PageServerLoad, Actions } from './$types';
|
import type { PageServerLoad, Actions } from './$types';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ fetch, locals }) => {
|
export const load: PageServerLoad = async ({ fetch, locals }) => {
|
||||||
const user = locals.user;
|
const user = locals.user;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import type { components, operations } from '$lib/generated/api';
|
import type { components, operations } from '$lib/generated/api';
|
||||||
|
|
||||||
type ActivityFeedItemDTO = components['schemas']['ActivityFeedItemDTO'];
|
type ActivityFeedItemDTO = components['schemas']['ActivityFeedItemDTO'];
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const mockApi = {
|
|||||||
GET: vi.fn()
|
GET: vi.fn()
|
||||||
};
|
};
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({
|
vi.mock('$lib/shared/api.server', () => ({
|
||||||
createApiClient: () => mockApi
|
createApiClient: () => mockApi
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export async function load({ url, fetch, locals }) {
|
export async function load({ url, fetch, locals }) {
|
||||||
const senderId = url.searchParams.get('senderId') || '';
|
const senderId = url.searchParams.get('senderId') || '';
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||||
import { load } from './+page.server';
|
import { load } from './+page.server';
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
|
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
|
||||||
vi.mock('$lib/errors', () => ({ getErrorMessage: (code: string) => code ?? 'Unknown error' }));
|
vi.mock('$lib/shared/errors', () => ({
|
||||||
|
getErrorMessage: (code: string) => code ?? 'Unknown error'
|
||||||
|
}));
|
||||||
|
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
|
|
||||||
const writeUser = { groups: [{ permissions: ['WRITE_ALL'] }] };
|
const writeUser = { groups: [{ permissions: ['WRITE_ALL'] }] };
|
||||||
const readUser = { groups: [{ permissions: ['READ_ALL'] }] };
|
const readUser = { groups: [{ permissions: ['READ_ALL'] }] };
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { redirect } from '@sveltejs/kit';
|
import { redirect } from '@sveltejs/kit';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
|
|
||||||
type DocumentSearchItem = components['schemas']['DocumentSearchItem'];
|
type DocumentSearchItem = components['schemas']['DocumentSearchItem'];
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import DocumentList from '../DocumentList.svelte';
|
|||||||
import Pagination from '$lib/shared/primitives/Pagination.svelte';
|
import Pagination from '$lib/shared/primitives/Pagination.svelte';
|
||||||
import BulkSelectionBar from '$lib/document/BulkSelectionBar.svelte';
|
import BulkSelectionBar from '$lib/document/BulkSelectionBar.svelte';
|
||||||
import { bulkSelectionStore } from '$lib/document/bulkSelection.svelte';
|
import { bulkSelectionStore } from '$lib/document/bulkSelection.svelte';
|
||||||
import { getErrorMessage, parseBackendError } from '$lib/errors';
|
import { getErrorMessage, parseBackendError } from '$lib/shared/errors';
|
||||||
import * as m from '$lib/paraglide/messages.js';
|
import * as m from '$lib/paraglide/messages.js';
|
||||||
|
|
||||||
let { data } = $props();
|
let { data } = $props();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { error, redirect } from '@sveltejs/kit';
|
import { error, redirect } from '@sveltejs/kit';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
import { inferredRelationshipLabel } from '$lib/person/relationshipLabels';
|
import { inferredRelationshipLabel } from '$lib/person/relationshipLabels';
|
||||||
|
|
||||||
export async function load({ params, fetch }) {
|
export async function load({ params, fetch }) {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import DocumentViewer from '$lib/document/DocumentViewer.svelte';
|
|||||||
import TranscriptionEditView from '$lib/document/transcription/TranscriptionEditView.svelte';
|
import TranscriptionEditView from '$lib/document/transcription/TranscriptionEditView.svelte';
|
||||||
import TranscriptionReadView from '$lib/document/transcription/TranscriptionReadView.svelte';
|
import TranscriptionReadView from '$lib/document/transcription/TranscriptionReadView.svelte';
|
||||||
import TranscriptionPanelHeader from '$lib/document/transcription/TranscriptionPanelHeader.svelte';
|
import TranscriptionPanelHeader from '$lib/document/transcription/TranscriptionPanelHeader.svelte';
|
||||||
import type { TranscriptionBlockData } from '$lib/types';
|
import type { TranscriptionBlockData } from '$lib/shared/types';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
import { translateOcrProgress } from '$lib/ocr/translateOcrProgress';
|
import { translateOcrProgress } from '$lib/ocr/translateOcrProgress';
|
||||||
import { createFileLoader } from '$lib/document/viewer/useFileLoader.svelte';
|
import { createFileLoader } from '$lib/document/viewer/useFileLoader.svelte';
|
||||||
import { scrollToCommentFromQuery } from '$lib/shared/utils/deepLinkScroll';
|
import { scrollToCommentFromQuery } from '$lib/shared/utils/deepLinkScroll';
|
||||||
@@ -91,7 +91,7 @@ async function loadTranscriptionBlocks() {
|
|||||||
async function saveBlock(
|
async function saveBlock(
|
||||||
blockId: string,
|
blockId: string,
|
||||||
text: string,
|
text: string,
|
||||||
mentionedPersons: import('$lib/types').PersonMention[]
|
mentionedPersons: import('$lib/shared/types').PersonMention[]
|
||||||
) {
|
) {
|
||||||
const { saveBlockWithConflictRetry } =
|
const { saveBlockWithConflictRetry } =
|
||||||
await import('$lib/document/transcription/saveBlockWithConflictRetry');
|
await import('$lib/document/transcription/saveBlockWithConflictRetry');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error, fail, redirect } from '@sveltejs/kit';
|
import { error, fail, redirect } from '@sveltejs/kit';
|
||||||
import { env } from '$env/dynamic/private';
|
import { env } from '$env/dynamic/private';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { parseBackendError, getErrorMessage } from '$lib/errors';
|
import { parseBackendError, getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export async function load({
|
export async function load({
|
||||||
params,
|
params,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
|
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
|
||||||
vi.mock('$env/dynamic/private', () => ({ env: { API_INTERNAL_URL: 'http://test-backend:8080' } }));
|
vi.mock('$env/dynamic/private', () => ({ env: { API_INTERNAL_URL: 'http://test-backend:8080' } }));
|
||||||
|
|
||||||
import { load } from './+page.server';
|
import { load } from './+page.server';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
|
|
||||||
beforeEach(() => vi.clearAllMocks());
|
beforeEach(() => vi.clearAllMocks());
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { bulkSelectionStore } from '$lib/document/bulkSelection.svelte';
|
|||||||
import BulkDocumentEditLayout, {
|
import BulkDocumentEditLayout, {
|
||||||
type BulkEditEntry
|
type BulkEditEntry
|
||||||
} from '$lib/document/BulkDocumentEditLayout.svelte';
|
} from '$lib/document/BulkDocumentEditLayout.svelte';
|
||||||
import { getErrorMessage, parseBackendError } from '$lib/errors';
|
import { getErrorMessage, parseBackendError } from '$lib/shared/errors';
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
|
|
||||||
let entries = $state<BulkEditEntry[]>([]);
|
let entries = $state<BulkEditEntry[]>([]);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { fail, redirect } from '@sveltejs/kit';
|
import { fail, redirect } from '@sveltejs/kit';
|
||||||
import { env } from '$env/dynamic/private';
|
import { env } from '$env/dynamic/private';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { parseBackendError, getErrorMessage } from '$lib/errors';
|
import { parseBackendError, getErrorMessage } from '$lib/shared/errors';
|
||||||
|
|
||||||
export async function load({
|
export async function load({
|
||||||
fetch,
|
fetch,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||||
|
|
||||||
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
|
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
|
||||||
|
|
||||||
import { load } from './+page.server';
|
import { load } from './+page.server';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
|
|
||||||
beforeEach(() => vi.clearAllMocks());
|
beforeEach(() => vi.clearAllMocks());
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { redirect } from '@sveltejs/kit';
|
import { redirect } from '@sveltejs/kit';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
|
|
||||||
export async function load({
|
export async function load({
|
||||||
fetch,
|
fetch,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { error, redirect } from '@sveltejs/kit';
|
import { error, redirect } from '@sveltejs/kit';
|
||||||
import { env } from '$env/dynamic/private';
|
import { env } from '$env/dynamic/private';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage, parseBackendError } from '$lib/errors';
|
import { getErrorMessage, parseBackendError } from '$lib/shared/errors';
|
||||||
|
|
||||||
export async function load({
|
export async function load({
|
||||||
params,
|
params,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { fail } from '@sveltejs/kit';
|
import { fail } from '@sveltejs/kit';
|
||||||
import type { Actions } from './$types';
|
import type { Actions } from './$types';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
default: async ({ request, fetch }) => {
|
default: async ({ request, fetch }) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ params, fetch }) => {
|
export const load: PageServerLoad = async ({ params, fetch }) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { error, redirect } from '@sveltejs/kit';
|
import { error, redirect } from '@sveltejs/kit';
|
||||||
import { createApiClient } from '$lib/api.server';
|
import { createApiClient } from '$lib/shared/api.server';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ params, fetch, parent }) => {
|
export const load: PageServerLoad = async ({ params, fetch, parent }) => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { goto } from '$app/navigation';
|
|||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import GeschichteEditor from '$lib/geschichte/GeschichteEditor.svelte';
|
import GeschichteEditor from '$lib/geschichte/GeschichteEditor.svelte';
|
||||||
import BackButton from '$lib/shared/primitives/BackButton.svelte';
|
import BackButton from '$lib/shared/primitives/BackButton.svelte';
|
||||||
import { getErrorMessage } from '$lib/errors';
|
import { getErrorMessage } from '$lib/shared/errors';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
|
|
||||||
let { data }: { data: PageData } = $props();
|
let { data }: { data: PageData } = $props();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user