+++ /dev/null
-<script context="module">
- // main navigation for the application
- import Settings from '$lib/Settings.svelte';
- import Statistics from '$lib/Statistics.svelte';
- import Admin from '$lib/Admin.svelte';
-
- // these are our 'pages' to navigate through (in order for this export to work the script tag MUST include context="module")
- export const navOptions = [
- { page: 'Settings', component: Settings },
- { page: 'Statistics', component: Statistics },
- { page: 'Admin', component: Admin }
- ];
-</script>
days: dayStats.filter((d) => d.isBookmarked).length.toLocaleString($tolgee.getLanguage())
})}
</li>
- <li>
- {$t('tags.tags')}:<br />
- {#each $tags as tag (tag.id)}
- <span class="d-inline-block me-3 mb-2">
- <Tag {tag} />
-
- {@html $t('settings.statistics.tagUsedCount', {
- count: dayStats
- .filter((d) => d.tags.includes(tag.id))
- .length.toLocaleString($tolgee.getLanguage())
- })}
- </span>
- <br />
- {/each}
- </li>
+ {#if $tags.length > 0}
+ <li>
+ {$t('tags.tags')}:<br />
+ {#each $tags as tag (tag.id)}
+ <span class="d-inline-block me-3 mb-2">
+ <Tag {tag} />
+
+ {@html $t('settings.statistics.tagUsedCount', {
+ count: dayStats
+ .filter((d) => d.tags.includes(tag.id))
+ .length.toLocaleString($tolgee.getLanguage())
+ })}
+ </span>
+ <br />
+ {/each}
+ </li>
+ {/if}
</ul>
<h4 class="headerTotal">{$t('settings.statistics.funFacts')}</h4>
settingsSections = [];
}
+ function reinitializeSettingsScrollSpy() {
+ // Destroy existing ScrollSpy first
+ destroySettingsScrollSpy();
+
+ // Re-setup the settings content scroll behavior
+ const contentEl = document.getElementById('settings-content');
+ const navEl = document.getElementById('settings-nav');
+ const modalBody = document.getElementById('modal-body');
+
+ if (contentEl && navEl && modalBody) {
+ const height = modalBody.clientHeight;
+ contentEl.style.height = 'calc(' + height + 'px - 2rem)';
+ navEl.style.height = 'calc(' + height + 'px - 2rem)';
+ contentEl.style.overflowY = 'auto';
+ contentEl.scrollTop = 0;
+ activeSettingsSection = 'appearance';
+ // Short timeout to allow layout calculation before reading offsets
+ setTimeout(initSettingsScrollSpy, 100);
+ }
+ }
+
+ function switchToSettingsTab() {
+ activeSettingsView = 'settings';
+ // Reinitialize ScrollSpy when switching to settings tab
+ setTimeout(reinitializeSettingsScrollSpy, 50);
+ }
+
+ function switchToStatsTab() {
+ activeSettingsView = 'stats';
+ // Destroy settings ScrollSpy when leaving settings tab
+ destroySettingsScrollSpy();
+ }
+
+ function switchToAdminTab() {
+ activeSettingsView = 'admin';
+ // Destroy settings ScrollSpy when leaving settings tab
+ destroySettingsScrollSpy();
+ }
+
function openSettingsModal() {
activeSettingsView = 'settings';
$tempSettings = JSON.parse(JSON.stringify($settings));
<button
type="button"
class="btn btn-outline-primary {activeSettingsView === 'settings' ? 'active' : ''}"
- onclick={() => (activeSettingsView = 'settings')}
+ onclick={switchToSettingsTab}
>
{$t('settings.title')}
</button>
<button
type="button"
class="btn btn-outline-primary {activeSettingsView === 'stats' ? 'active' : ''}"
- onclick={() => (activeSettingsView = 'stats')}
+ onclick={switchToStatsTab}
>
{$t('settings.statistics.title')}
</button>
<button
type="button"
class="btn btn-outline-primary {activeSettingsView === 'admin' ? 'active' : ''}"
- onclick={() => (activeSettingsView = 'admin')}
+ onclick={switchToAdminTab}
>
{$t('settings.admin.title')}
</button>
></button>
</div>
</div>
- <div class="modal-body" id="modal-body">
+ <div
+ class="modal-body {activeSettingsView !== 'settings' ? 'modal-body-scrollable' : ''}"
+ id="modal-body"
+ >
<div class="row">
{#if activeSettingsView === 'settings'}
<div class="col-4 overflow-y-auto d-none d-md-block">
}
.modal-body {
+ /* For settings tab, let internal elements handle scrolling */
overflow-y: hidden;
}
+ .modal-body.modal-body-scrollable {
+ /* For stats/admin tabs, let modal-body handle scrolling */
+ max-height: calc(100vh - 200px);
+ overflow-y: auto;
+ }
+
.modal-header {
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}