web/settings: simplify sidebar, add version info, flatten page navigation

This commit is contained in:
wukko 2024-07-23 11:00:27 +06:00
parent 8c96ccbc7b
commit 0225a7c46c
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
9 changed files with 36 additions and 14 deletions

View file

@ -3,7 +3,7 @@
"page.privacy": "privacy", "page.privacy": "privacy",
"page.video": "video", "page.video": "video",
"page.audio": "audio", "page.audio": "audio",
"page.metadata": "metadata", "page.download": "downloading",
"page.advanced": "advanced", "page.advanced": "advanced",
"page.debug": "debug information", "page.debug": "debug information",

View file

@ -39,7 +39,7 @@ const defaultSettingsPage = () => {
} }
} }
return "/settings/general/appearance"; return "/settings/appearance";
} }
export default defaultSettings; export default defaultSettings;

View file

@ -2,6 +2,7 @@
import { page } from "$app/stores"; import { page } from "$app/stores";
import settings from "$lib/state/settings"; import settings from "$lib/state/settings";
import { version } from "$lib/version";
import { t } from "$lib/i18n/translations"; import { t } from "$lib/i18n/translations";
@ -12,7 +13,7 @@
import IconMovie from "@tabler/icons-svelte/IconMovie.svelte"; import IconMovie from "@tabler/icons-svelte/IconMovie.svelte";
import IconMusic from "@tabler/icons-svelte/IconMusic.svelte"; import IconMusic from "@tabler/icons-svelte/IconMusic.svelte";
import IconFileSettings from "@tabler/icons-svelte/IconFileSettings.svelte"; import IconFileDownload from "@tabler/icons-svelte/IconFileDownload.svelte";
import IconSettingsBolt from "@tabler/icons-svelte/IconSettingsBolt.svelte"; import IconSettingsBolt from "@tabler/icons-svelte/IconSettingsBolt.svelte";
import IconBug from "@tabler/icons-svelte/IconBug.svelte"; import IconBug from "@tabler/icons-svelte/IconBug.svelte";
import IconLock from "@tabler/icons-svelte/IconLock.svelte"; import IconLock from "@tabler/icons-svelte/IconLock.svelte";
@ -24,6 +25,8 @@
let screenWidth: number; let screenWidth: number;
$: versionText = `v.${$version.version}-${$version.commit.slice(0, 7)}`;
$: currentPageTitle = $page.url.pathname.split("/").at(-1); $: currentPageTitle = $page.url.pathname.split("/").at(-1);
$: stringPageTitle = $: stringPageTitle =
currentPageTitle !== "settings" ? ` / ${$t(`settings.page.${currentPageTitle}`)}` : ""; currentPageTitle !== "settings" ? ` / ${$t(`settings.page.${currentPageTitle}`)}` : "";
@ -68,51 +71,56 @@
{/if} {/if}
</h3> </h3>
{:else} {:else}
<div class="subtext settings-version">
{versionText}
</div>
<h2 id="settings-page-title" aria-level="1"> <h2 id="settings-page-title" aria-level="1">
{$t("tabs.settings")} {$t("tabs.settings")}
</h2> </h2>
{/if} {/if}
</div> </div>
<nav id="settings-navigation" class:visible-mobile={isMobile && isHome}> <nav id="settings-navigation" class:visible-mobile={isMobile && isHome}>
<SettingsNavSection sectionTitle="general"> <SettingsNavSection>
<SettingsNavTab <SettingsNavTab
tabName="appearance" tabName="appearance"
tabLink="general/appearance" tabLink="appearance"
iconColor="blue" iconColor="blue"
> >
<IconSunHigh /> <IconSunHigh />
</SettingsNavTab> </SettingsNavTab>
<SettingsNavTab <SettingsNavTab
tabName="privacy" tabName="privacy"
tabLink="general/privacy" tabLink="privacy"
iconColor="blue" iconColor="blue"
> >
<IconLock /> <IconLock />
</SettingsNavTab> </SettingsNavTab>
</SettingsNavSection> </SettingsNavSection>
<SettingsNavSection sectionTitle="save">
<SettingsNavSection>
<SettingsNavTab <SettingsNavTab
tabName="video" tabName="video"
tabLink="save/video" tabLink="video"
iconColor="green" iconColor="green"
> >
<IconMovie /> <IconMovie />
</SettingsNavTab> </SettingsNavTab>
<SettingsNavTab <SettingsNavTab
tabName="audio" tabName="audio"
tabLink="save/audio" tabLink="audio"
iconColor="green" iconColor="green"
> >
<IconMusic /> <IconMusic />
</SettingsNavTab> </SettingsNavTab>
<SettingsNavTab <SettingsNavTab
tabName="metadata" tabName="download"
tabLink="save/metadata" tabLink="download"
iconColor="green" iconColor="green"
> >
<IconFileSettings /> <IconFileDownload />
</SettingsNavTab> </SettingsNavTab>
</SettingsNavSection> </SettingsNavSection>
<SettingsNavSection> <SettingsNavSection>
<SettingsNavTab <SettingsNavTab
tabName="advanced" tabName="advanced"
@ -124,13 +132,19 @@
{#if $settings.advanced.debug} {#if $settings.advanced.debug}
<SettingsNavTab <SettingsNavTab
tabName="debug" tabName="debug"
tabLink="advanced/debug" tabLink="debug"
iconColor="gray" iconColor="gray"
> >
<IconBug /> <IconBug />
</SettingsNavTab> </SettingsNavTab>
{/if} {/if}
</SettingsNavSection> </SettingsNavSection>
{#if isMobile && isHome}
<div class="subtext settings-version center">
{versionText}
</div>
{/if}
</nav> </nav>
</div> </div>
@ -180,7 +194,7 @@
} }
#settings-sidebar { #settings-sidebar {
gap: 24px; gap: var(--padding);
} }
#settings-navigation { #settings-navigation {
@ -192,6 +206,14 @@
--back-padding: calc(var(--padding) / 2); --back-padding: calc(var(--padding) / 2);
} }
.settings-version {
padding: 0;
}
.settings-version.center {
text-align: center;
}
.back-button { .back-button {
display: flex; display: flex;
align-items: center; align-items: center;