refactor(ui): unify LanguageSelector, ConfirmDialog, and AppSlider across apps

- contacts, zitare: migrate LanguageSelector to shared PillDropdown pattern
- context, times: replace local ConfirmDialog with ConfirmationModal from @manacore/shared-ui
  - delete local ConfirmDialog.svelte in both apps
  - map open→visible, onCancel→onClose, remove destructive prop (default in shared-ui)
- calendar, chat, contacts, presi, todo: switch AppSlider from static MANA_APPS
  to getActiveManaApps() to filter inactive apps consistently

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-31 19:10:55 +02:00
parent 3ea2c03ab2
commit 5e4518b418
16 changed files with 62 additions and 228 deletions

View file

@ -1,48 +0,0 @@
<script lang="ts">
interface Props {
open: boolean;
title: string;
message: string;
confirmLabel?: string;
cancelLabel?: string;
destructive?: boolean;
onConfirm: () => void;
onCancel: () => void;
}
let {
open,
title,
message,
confirmLabel = 'Bestätigen',
cancelLabel = 'Abbrechen',
destructive = false,
onConfirm,
onCancel,
}: Props = $props();
</script>
{#if open}
<div class="fixed inset-0 z-50 flex items-center justify-center" role="dialog" aria-modal="true">
<button class="absolute inset-0 bg-black/50" onclick={onCancel} aria-label="Schließen"></button>
<div
class="relative bg-card border border-border rounded-xl p-6 max-w-sm w-full mx-4 shadow-xl"
>
<h3 class="text-lg font-semibold text-foreground">{title}</h3>
<p class="text-sm text-muted-foreground mt-2">{message}</p>
<div class="flex justify-end gap-2 mt-6">
<button class="btn btn-secondary text-sm" onclick={onCancel}>
{cancelLabel}
</button>
<button
class="btn text-sm text-white {destructive
? 'bg-destructive hover:bg-destructive/90'
: 'btn-primary'}"
onclick={onConfirm}
>
{confirmLabel}
</button>
</div>
</div>
</div>
{/if}

View file

@ -11,7 +11,7 @@
getAllDocumentTags,
} from '$lib/data/queries';
import DocumentCard from '$lib/components/DocumentCard.svelte';
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
import { ConfirmationModal } from '@manacore/shared-ui';
import type { DocumentType } from '$lib/types';
let deleteTarget = $state<string | null>(null);
@ -190,12 +190,11 @@
{/if}
</div>
<ConfirmDialog
open={deleteTarget !== null}
<ConfirmationModal
visible={deleteTarget !== null}
title="Dokument löschen?"
message="Das Dokument wird unwiderruflich gelöscht."
confirmLabel="Löschen"
destructive
onConfirm={handleDeleteConfirm}
onCancel={() => (deleteTarget = null)}
onClose={() => (deleteTarget = null)}
/>

View file

@ -9,7 +9,7 @@
import { tokensStore } from '$lib/stores/tokens.svelte';
import DocumentEditor from '$lib/components/DocumentEditor.svelte';
import AIToolbar from '$lib/components/AIToolbar.svelte';
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
import { ConfirmationModal } from '@manacore/shared-ui';
import type { Document, DocumentType } from '$lib/types';
import type { InsertionMode } from '$lib/services/ai';
@ -164,12 +164,11 @@
{/if}
</div>
<ConfirmDialog
open={showDeleteConfirm}
<ConfirmationModal
visible={showDeleteConfirm}
title="Dokument löschen?"
message="Das Dokument wird unwiderruflich gelöscht."
confirmLabel="Löschen"
destructive
onConfirm={handleDelete}
onCancel={() => (showDeleteConfirm = false)}
onClose={() => (showDeleteConfirm = false)}
/>

View file

@ -6,7 +6,7 @@
import { useAllSpaces } from '$lib/data/queries';
import SpaceCard from '$lib/components/SpaceCard.svelte';
import CreateSpaceModal from '$lib/components/CreateSpaceModal.svelte';
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
import { ConfirmationModal } from '@manacore/shared-ui';
import type { Space } from '$lib/types';
let searchQuery = $state('');
@ -131,12 +131,11 @@
onClose={() => (showCreateModal = false)}
/>
<ConfirmDialog
open={deleteTarget !== null}
<ConfirmationModal
visible={deleteTarget !== null}
title="Space löschen?"
message="Alle Dokumente in diesem Space werden ebenfalls gelöscht. Diese Aktion kann nicht rückgängig gemacht werden."
confirmLabel="Löschen"
destructive
onConfirm={handleDeleteConfirm}
onCancel={() => (deleteTarget = null)}
onClose={() => (deleteTarget = null)}
/>

View file

@ -21,7 +21,7 @@
findSpaceById,
} from '$lib/data/queries';
import DocumentCard from '$lib/components/DocumentCard.svelte';
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
import { ConfirmationModal } from '@manacore/shared-ui';
import BatchCreateModal from '$lib/components/BatchCreateModal.svelte';
import type { Space, DocumentType } from '$lib/types';
@ -270,14 +270,13 @@
{/if}
</div>
<ConfirmDialog
open={deleteTarget !== null}
<ConfirmationModal
visible={deleteTarget !== null}
title="Dokument löschen?"
message="Das Dokument wird unwiderruflich gelöscht."
confirmLabel="Löschen"
destructive
onConfirm={handleDeleteConfirm}
onCancel={() => (deleteTarget = null)}
onClose={() => (deleteTarget = null)}
/>
<BatchCreateModal