diff --git a/src/components/dm/GenerationHistory.astro b/src/components/dm/GenerationHistory.astro index 3e67369..35c77b6 100644 --- a/src/components/dm/GenerationHistory.astro +++ b/src/components/dm/GenerationHistory.astro @@ -251,7 +251,7 @@ const { tier, userId } = Astro.props; ); } - async function fetchProHistory(userId: number): Promise { + async function fetchProHistory(): Promise { const response = await fetch(`/api/dm/ai/history?limit=${MAX_HISTORY}`); if (!response.ok) { if (response.status === 401) { @@ -269,7 +269,7 @@ const { tier, userId } = Astro.props; const loadingEl = container.querySelector('#history-loading'); let items: HistoryItem[] = []; - let activeId: number | null = null; + const activeId: number | null = null; function showLoading() { loadingEl?.classList.remove('hidden'); @@ -283,7 +283,7 @@ const { tier, userId } = Astro.props; if (tier === 'pro' && userId) { showLoading(); try { - items = await fetchProHistory(userId); + items = await fetchProHistory(); } catch { items = []; } finally { diff --git a/src/components/dm/InitiativeTracker.astro b/src/components/dm/InitiativeTracker.astro index 1d978e0..77ba27b 100644 --- a/src/components/dm/InitiativeTracker.astro +++ b/src/components/dm/InitiativeTracker.astro @@ -184,7 +184,6 @@ const { tier = 'free', userId } = Astro.props; let activeIndex = 0; let currentSessionId: number | null = null; - let currentSessionName = ''; interface CombatantData { id: string; @@ -559,7 +558,6 @@ const { tier = 'free', userId } = Astro.props; saveCombatants(session.participants); activeIndex = 0; currentSessionId = session.id; - currentSessionName = session.name; if (sessionNameInput) sessionNameInput.value = session.name; updateVisibility(); renderList(); @@ -578,7 +576,6 @@ const { tier = 'free', userId } = Astro.props; const result = await apiSaveSession(name, participants, currentSessionId ?? undefined); if (result) { currentSessionId = result.id; - currentSessionName = result.name; if (sessionNameInput) sessionNameInput.value = result.name; showSessionStatus('Сессия сохранена'); renderSessionList(); @@ -589,7 +586,6 @@ const { tier = 'free', userId } = Astro.props; async function handleNewSession() { currentSessionId = null; - currentSessionName = ''; if (sessionNameInput) sessionNameInput.value = ''; clearAll(); showSessionStatus('Новая сессия'); @@ -602,7 +598,6 @@ const { tier = 'free', userId } = Astro.props; if (ok) { if (currentSessionId === id) { currentSessionId = null; - currentSessionName = ''; if (sessionNameInput) sessionNameInput.value = ''; } renderSessionList(); diff --git a/src/components/dm/NotesPanel.astro b/src/components/dm/NotesPanel.astro index 9f1379e..9e4bda6 100644 --- a/src/components/dm/NotesPanel.astro +++ b/src/components/dm/NotesPanel.astro @@ -49,7 +49,6 @@ const { tier = 'free', userId } = Astro.props; let debounceTimer: ReturnType | null = null; let hideIndicatorTimer: ReturnType | null = null; let dbNoteId: number | null = null; - let isLoading = false; function formatTime(date: Date): string { return date.toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit' }); @@ -123,23 +122,19 @@ const { tier = 'free', userId } = Astro.props; async function loadSavedNotes() { if (isPro) { - isLoading = true; const note = await loadDbNotes(); if (note) { dbNoteId = note.id; textarea.value = note.content ?? ''; } else { - // Try to create a new note if none exists const newId = await createDbNote(''); if (newId) { dbNoteId = newId; textarea.value = ''; } else { - // Fallback to localStorage if DB is unavailable textarea.value = loadNotes(); } } - isLoading = false; } else { const saved = loadNotes(); textarea.value = saved; diff --git a/src/components/dm/Open5eReference.astro b/src/components/dm/Open5eReference.astro index 5522e66..a54fd8a 100644 --- a/src/components/dm/Open5eReference.astro +++ b/src/components/dm/Open5eReference.astro @@ -171,11 +171,7 @@ import DmButton from "./DmButton.astro";