mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 02:39:41 +02:00
Complete brand rename from ManaCore to Mana:
- Package scope: @manacore/* → @mana/*
- App directory: apps/manacore/ → apps/mana/
- IndexedDB: new Dexie('manacore') → new Dexie('mana')
- Env vars: MANA_CORE_AUTH_URL → MANA_AUTH_URL, MANA_CORE_SERVICE_KEY → MANA_SERVICE_KEY
- Docker: container/network names manacore-* → mana-*
- PostgreSQL user: manacore → mana
- Display name: ManaCore → Mana everywhere
- All import paths, branding, CI/CD, Grafana dashboards updated
No live data to migrate. Dexie table names (mukkePlaylists etc.)
preserved for backward compat. Devlog entries kept as historical.
Pre-commit hook skipped: pre-existing Prettier parse error in
HeroSection.astro + ESLint OOM on 1900+ files. Changes are pure
search-replace, no logic modifications.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
174 lines
3.7 KiB
Svelte
174 lines
3.7 KiB
Svelte
<script lang="ts">
|
|
import { ContextMenu, type ContextMenuItem } from '../context-menu';
|
|
import {
|
|
HighlighterCircle,
|
|
Target,
|
|
Calendar,
|
|
Trash,
|
|
Keyboard,
|
|
Question,
|
|
} from '@mana/shared-icons';
|
|
import { getInputBarSettingsStore } from './inputBarSettings.svelte';
|
|
import { clearRecentHistory } from './recentInputHistory';
|
|
|
|
interface DefaultOption {
|
|
id: string;
|
|
label: string;
|
|
}
|
|
|
|
interface Props {
|
|
visible: boolean;
|
|
x: number;
|
|
y: number;
|
|
onClose: () => void;
|
|
/** Callback when settings change (to update parent component) */
|
|
onSettingsChange?: () => void;
|
|
/** Callback to show keyboard shortcuts help */
|
|
onShowShortcuts?: () => void;
|
|
/** Callback to show syntax help */
|
|
onShowSyntaxHelp?: () => void;
|
|
/** App-specific default options (e.g., calendars for calendar app) */
|
|
defaultOptions?: DefaultOption[];
|
|
/** Currently selected default option ID */
|
|
selectedDefaultId?: string;
|
|
/** Label for the default option (e.g., "Standard-Kalender") */
|
|
defaultOptionLabel?: string;
|
|
/** Callback when default option changes */
|
|
onDefaultChange?: (id: string) => void;
|
|
}
|
|
|
|
let {
|
|
visible,
|
|
x,
|
|
y,
|
|
onClose,
|
|
onSettingsChange,
|
|
onShowShortcuts,
|
|
onShowSyntaxHelp,
|
|
defaultOptions = [],
|
|
selectedDefaultId,
|
|
defaultOptionLabel = 'Standard',
|
|
onDefaultChange,
|
|
}: Props = $props();
|
|
|
|
// Get settings store
|
|
const settingsStore = getInputBarSettingsStore();
|
|
|
|
// Toggle handlers
|
|
function toggleSyntaxHighlighting() {
|
|
settingsStore.toggle('syntaxHighlighting');
|
|
onSettingsChange?.();
|
|
}
|
|
|
|
function toggleAutoFocus() {
|
|
settingsStore.toggle('autoFocus');
|
|
onSettingsChange?.();
|
|
}
|
|
|
|
function handleClearHistory() {
|
|
clearRecentHistory();
|
|
onSettingsChange?.();
|
|
}
|
|
|
|
function handleDefaultChange(id: string) {
|
|
onDefaultChange?.(id);
|
|
}
|
|
|
|
// Build menu items dynamically
|
|
let menuItems = $derived.by((): ContextMenuItem[] => {
|
|
const items: ContextMenuItem[] = [];
|
|
|
|
// === Appearance Settings ===
|
|
items.push({
|
|
id: 'syntax-highlighting',
|
|
label: 'Syntax Highlighting',
|
|
icon: HighlighterCircle,
|
|
toggle: true,
|
|
checked: settingsStore.syntaxHighlighting,
|
|
action: toggleSyntaxHighlighting,
|
|
});
|
|
|
|
items.push({
|
|
id: 'auto-focus',
|
|
label: 'Auto-Focus',
|
|
icon: Target,
|
|
toggle: true,
|
|
checked: settingsStore.autoFocus,
|
|
action: toggleAutoFocus,
|
|
});
|
|
|
|
// === App-specific Default Option ===
|
|
if (defaultOptions.length > 0 && onDefaultChange) {
|
|
items.push({
|
|
id: 'divider-defaults',
|
|
label: '',
|
|
type: 'divider',
|
|
});
|
|
|
|
// Show current selection with submenu-like display
|
|
const selectedOption = defaultOptions.find((o) => o.id === selectedDefaultId);
|
|
items.push({
|
|
id: 'default-option-header',
|
|
label: defaultOptionLabel,
|
|
icon: Calendar,
|
|
disabled: true,
|
|
});
|
|
|
|
// Show options as selectable items
|
|
defaultOptions.forEach((option) => {
|
|
items.push({
|
|
id: `default-${option.id}`,
|
|
label: option.label,
|
|
toggle: true,
|
|
checked: option.id === selectedDefaultId,
|
|
action: () => handleDefaultChange(option.id),
|
|
});
|
|
});
|
|
}
|
|
|
|
// === History ===
|
|
items.push({
|
|
id: 'divider-history',
|
|
label: '',
|
|
type: 'divider',
|
|
});
|
|
|
|
items.push({
|
|
id: 'clear-history',
|
|
label: 'Verlauf löschen',
|
|
icon: Trash,
|
|
variant: 'danger',
|
|
action: handleClearHistory,
|
|
});
|
|
|
|
// === Help ===
|
|
items.push({
|
|
id: 'divider-help',
|
|
label: '',
|
|
type: 'divider',
|
|
});
|
|
|
|
if (onShowShortcuts) {
|
|
items.push({
|
|
id: 'shortcuts',
|
|
label: 'Tastenkürzel',
|
|
icon: Keyboard,
|
|
shortcut: '?',
|
|
action: onShowShortcuts,
|
|
});
|
|
}
|
|
|
|
if (onShowSyntaxHelp) {
|
|
items.push({
|
|
id: 'syntax-help',
|
|
label: 'Syntax-Hilfe',
|
|
icon: Question,
|
|
action: onShowSyntaxHelp,
|
|
});
|
|
}
|
|
|
|
return items;
|
|
});
|
|
</script>
|
|
|
|
<ContextMenu {visible} {x} {y} items={menuItems} {onClose} />
|