2024-06-24 20:11:04 +02:00
|
|
|
<script lang="ts">
|
|
|
|
import { page } from "$app/stores";
|
2024-08-31 19:46:10 +02:00
|
|
|
import { browser } from "$app/environment";
|
2024-06-24 20:11:04 +02:00
|
|
|
|
2024-07-13 15:17:03 +02:00
|
|
|
import settings from "$lib/state/settings";
|
2024-07-23 07:00:27 +02:00
|
|
|
import { version } from "$lib/version";
|
2024-07-10 19:35:53 +02:00
|
|
|
|
2024-07-03 19:54:44 +02:00
|
|
|
import { t } from "$lib/i18n/translations";
|
|
|
|
|
2024-07-07 17:51:46 +02:00
|
|
|
import SettingsNavTab from "$components/settings/SettingsNavTab.svelte";
|
|
|
|
import SettingsNavSection from "$components/settings/SettingsNavSection.svelte";
|
2024-06-24 15:42:31 +02:00
|
|
|
|
|
|
|
import IconSunHigh from "@tabler/icons-svelte/IconSunHigh.svelte";
|
2024-08-30 13:15:05 +02:00
|
|
|
import IconLock from "@tabler/icons-svelte/IconLock.svelte";
|
2024-06-24 15:42:31 +02:00
|
|
|
|
|
|
|
import IconMovie from "@tabler/icons-svelte/IconMovie.svelte";
|
|
|
|
import IconMusic from "@tabler/icons-svelte/IconMusic.svelte";
|
2024-07-23 07:00:27 +02:00
|
|
|
import IconFileDownload from "@tabler/icons-svelte/IconFileDownload.svelte";
|
2024-08-30 13:15:05 +02:00
|
|
|
|
2024-07-10 19:35:53 +02:00
|
|
|
import IconBug from "@tabler/icons-svelte/IconBug.svelte";
|
2024-08-30 13:15:05 +02:00
|
|
|
import IconWorld from "@tabler/icons-svelte/IconWorld.svelte";
|
|
|
|
import IconSettingsBolt from "@tabler/icons-svelte/IconSettingsBolt.svelte";
|
2024-06-24 20:11:04 +02:00
|
|
|
|
2024-07-23 08:19:38 +02:00
|
|
|
import IconArrowLeft from "@tabler/icons-svelte/IconArrowLeft.svelte";
|
2024-07-10 19:35:53 +02:00
|
|
|
|
2024-07-05 00:25:22 +02:00
|
|
|
import { goto } from "$app/navigation";
|
|
|
|
import { defaultSettingsPage } from "$lib/settings/defaults";
|
2024-06-25 10:50:59 +02:00
|
|
|
|
2024-06-24 20:11:04 +02:00
|
|
|
let screenWidth: number;
|
|
|
|
|
2024-07-23 11:36:49 +02:00
|
|
|
$: versionText = $version ? `v${$version.version}-${$version.commit.slice(0, 8)}` : '\xa0';
|
2024-07-23 07:00:27 +02:00
|
|
|
|
2024-06-25 16:59:25 +02:00
|
|
|
$: currentPageTitle = $page.url.pathname.split("/").at(-1);
|
2024-06-25 17:01:08 +02:00
|
|
|
$: stringPageTitle =
|
2024-07-23 10:04:19 +02:00
|
|
|
currentPageTitle !== "settings"
|
|
|
|
? ` / ${$t(`settings.page.${currentPageTitle}`)}`
|
|
|
|
: "";
|
2024-06-25 16:59:25 +02:00
|
|
|
|
2024-06-24 20:11:04 +02:00
|
|
|
$: isMobile = screenWidth <= 750;
|
2024-07-23 10:04:19 +02:00
|
|
|
$: isHome = $page.url.pathname === "/settings";
|
2024-07-05 00:25:22 +02:00
|
|
|
$: {
|
2024-08-31 19:46:10 +02:00
|
|
|
if (browser && !isMobile && isHome) {
|
2024-07-05 00:25:22 +02:00
|
|
|
goto(defaultSettingsPage(), { replaceState: true });
|
|
|
|
}
|
|
|
|
}
|
2024-06-24 15:42:31 +02:00
|
|
|
</script>
|
|
|
|
|
2024-06-25 17:01:08 +02:00
|
|
|
<svelte:head>
|
|
|
|
<title>
|
2024-08-23 16:02:17 +02:00
|
|
|
{$t("tabs.settings")}{stringPageTitle} ~ {$t("general.cobalt")}
|
2024-06-25 17:01:08 +02:00
|
|
|
</title>
|
|
|
|
</svelte:head>
|
|
|
|
|
2024-06-24 20:11:04 +02:00
|
|
|
<svelte:window bind:innerWidth={screenWidth} />
|
|
|
|
|
2024-06-24 15:42:31 +02:00
|
|
|
<div id="settings-page">
|
2024-07-14 16:52:22 +02:00
|
|
|
<div id="settings-sidebar" class:back-visible={!isHome && isMobile}>
|
|
|
|
<div id="settings-header">
|
2024-06-25 16:59:25 +02:00
|
|
|
{#if isMobile}
|
|
|
|
{#if !isHome}
|
2024-07-03 19:54:44 +02:00
|
|
|
<a
|
|
|
|
class="back-button"
|
|
|
|
href="/settings"
|
|
|
|
role="button"
|
|
|
|
aria-label={$t("a11y.general.back")}
|
|
|
|
>
|
2024-07-23 08:19:38 +02:00
|
|
|
<IconArrowLeft />
|
2024-06-25 16:59:25 +02:00
|
|
|
</a>
|
|
|
|
{/if}
|
2024-07-23 10:04:19 +02:00
|
|
|
<h3
|
|
|
|
id="settings-page-title"
|
|
|
|
aria-level="1"
|
|
|
|
tabindex="-1"
|
2024-07-23 10:41:55 +02:00
|
|
|
data-first-focus
|
|
|
|
data-focus-ring-hidden
|
2024-07-23 10:04:19 +02:00
|
|
|
>
|
2024-06-25 16:59:25 +02:00
|
|
|
{#if !isHome}
|
2024-07-03 19:54:44 +02:00
|
|
|
{$t(`settings.page.${currentPageTitle}`)}
|
2024-07-10 16:19:46 +02:00
|
|
|
{:else}
|
|
|
|
{$t("tabs.settings")}
|
2024-06-25 16:59:25 +02:00
|
|
|
{/if}
|
|
|
|
</h3>
|
2024-06-25 10:50:59 +02:00
|
|
|
{:else}
|
2024-07-23 07:00:27 +02:00
|
|
|
<div class="subtext settings-version">
|
|
|
|
{versionText}
|
|
|
|
</div>
|
2024-07-03 19:54:44 +02:00
|
|
|
<h2 id="settings-page-title" aria-level="1">
|
|
|
|
{$t("tabs.settings")}
|
|
|
|
</h2>
|
2024-06-25 10:50:59 +02:00
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
<nav id="settings-navigation" class:visible-mobile={isMobile && isHome}>
|
2024-07-23 07:00:27 +02:00
|
|
|
<SettingsNavSection>
|
2024-07-07 17:51:46 +02:00
|
|
|
<SettingsNavTab
|
2024-06-24 19:46:37 +02:00
|
|
|
tabName="appearance"
|
2024-07-23 07:00:27 +02:00
|
|
|
tabLink="appearance"
|
2024-06-24 15:42:31 +02:00
|
|
|
iconColor="blue"
|
|
|
|
>
|
2024-06-24 19:46:37 +02:00
|
|
|
<IconSunHigh />
|
2024-07-07 17:51:46 +02:00
|
|
|
</SettingsNavTab>
|
2024-07-14 17:26:55 +02:00
|
|
|
<SettingsNavTab
|
|
|
|
tabName="privacy"
|
2024-07-23 07:00:27 +02:00
|
|
|
tabLink="privacy"
|
2024-07-14 17:26:55 +02:00
|
|
|
iconColor="blue"
|
|
|
|
>
|
|
|
|
<IconLock />
|
|
|
|
</SettingsNavTab>
|
2024-07-07 17:51:46 +02:00
|
|
|
</SettingsNavSection>
|
2024-07-23 07:00:27 +02:00
|
|
|
|
|
|
|
<SettingsNavSection>
|
2024-07-07 17:51:46 +02:00
|
|
|
<SettingsNavTab
|
2024-06-24 19:46:37 +02:00
|
|
|
tabName="video"
|
2024-07-23 07:00:27 +02:00
|
|
|
tabLink="video"
|
2024-06-24 15:42:31 +02:00
|
|
|
iconColor="green"
|
|
|
|
>
|
2024-06-24 19:46:37 +02:00
|
|
|
<IconMovie />
|
2024-07-07 17:51:46 +02:00
|
|
|
</SettingsNavTab>
|
|
|
|
<SettingsNavTab
|
2024-06-24 19:46:37 +02:00
|
|
|
tabName="audio"
|
2024-07-23 07:00:27 +02:00
|
|
|
tabLink="audio"
|
2024-06-24 15:42:31 +02:00
|
|
|
iconColor="green"
|
|
|
|
>
|
2024-06-24 19:46:37 +02:00
|
|
|
<IconMusic />
|
2024-07-07 17:51:46 +02:00
|
|
|
</SettingsNavTab>
|
|
|
|
<SettingsNavTab
|
2024-07-23 07:00:27 +02:00
|
|
|
tabName="download"
|
|
|
|
tabLink="download"
|
2024-06-24 15:42:31 +02:00
|
|
|
iconColor="green"
|
|
|
|
>
|
2024-07-23 07:00:27 +02:00
|
|
|
<IconFileDownload />
|
2024-07-07 17:51:46 +02:00
|
|
|
</SettingsNavTab>
|
|
|
|
</SettingsNavSection>
|
2024-07-23 07:00:27 +02:00
|
|
|
|
2024-07-10 19:35:53 +02:00
|
|
|
<SettingsNavSection>
|
2024-08-03 20:43:24 +02:00
|
|
|
<SettingsNavTab
|
2024-08-30 13:15:05 +02:00
|
|
|
tabName="instances"
|
|
|
|
tabLink="instances"
|
2024-08-03 20:43:24 +02:00
|
|
|
iconColor="gray"
|
|
|
|
>
|
2024-08-30 13:15:05 +02:00
|
|
|
<IconWorld />
|
2024-08-03 20:43:24 +02:00
|
|
|
</SettingsNavTab>
|
2024-07-10 19:35:53 +02:00
|
|
|
<SettingsNavTab
|
|
|
|
tabName="advanced"
|
|
|
|
tabLink="advanced"
|
|
|
|
iconColor="gray"
|
|
|
|
>
|
|
|
|
<IconSettingsBolt />
|
|
|
|
</SettingsNavTab>
|
|
|
|
{#if $settings.advanced.debug}
|
|
|
|
<SettingsNavTab
|
|
|
|
tabName="debug"
|
2024-07-23 07:00:27 +02:00
|
|
|
tabLink="debug"
|
2024-07-10 19:35:53 +02:00
|
|
|
iconColor="gray"
|
|
|
|
>
|
|
|
|
<IconBug />
|
|
|
|
</SettingsNavTab>
|
|
|
|
{/if}
|
|
|
|
</SettingsNavSection>
|
2024-07-23 07:00:27 +02:00
|
|
|
|
2024-07-23 10:04:19 +02:00
|
|
|
{#if isMobile && isHome}
|
|
|
|
<div class="subtext settings-version center">
|
|
|
|
{versionText}
|
|
|
|
</div>
|
|
|
|
{/if}
|
2024-06-24 15:42:31 +02:00
|
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
|
2024-07-22 12:17:06 +02:00
|
|
|
{#if !isMobile || !isHome}
|
2024-07-23 10:41:55 +02:00
|
|
|
<main
|
|
|
|
id="settings-page-content"
|
|
|
|
tabindex="-1"
|
|
|
|
data-first-focus
|
|
|
|
data-focus-ring-hidden
|
|
|
|
>
|
2024-07-22 12:17:06 +02:00
|
|
|
<slot></slot>
|
|
|
|
</main>
|
|
|
|
{/if}
|
2024-06-24 15:42:31 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
2024-06-24 19:05:51 +02:00
|
|
|
#settings-page {
|
|
|
|
--settings-nav-width: 250px;
|
|
|
|
--settings-padding: 30px;
|
2024-06-25 16:59:25 +02:00
|
|
|
--settings-padding-small: calc(
|
|
|
|
var(--settings-padding) - var(--padding)
|
|
|
|
);
|
2024-06-24 19:05:51 +02:00
|
|
|
display: grid;
|
|
|
|
width: 100%;
|
|
|
|
grid-template-columns: var(--settings-nav-width) 1fr;
|
|
|
|
overflow: hidden;
|
2024-06-25 10:50:59 +02:00
|
|
|
padding-left: var(--settings-padding);
|
2024-06-24 19:05:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#settings-page-content {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
max-width: 600px;
|
2024-07-07 17:51:46 +02:00
|
|
|
padding: calc(var(--settings-padding) / 2);
|
2024-06-24 19:05:51 +02:00
|
|
|
overflow-y: scroll;
|
|
|
|
}
|
|
|
|
|
2024-06-24 15:42:31 +02:00
|
|
|
#settings-sidebar,
|
|
|
|
#settings-navigation {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2024-07-12 15:18:47 +02:00
|
|
|
overflow-y: scroll;
|
2024-06-24 15:42:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#settings-sidebar {
|
2024-06-24 19:05:51 +02:00
|
|
|
width: var(--settings-nav-width);
|
2024-07-07 17:51:46 +02:00
|
|
|
padding-top: var(--settings-padding);
|
2024-06-24 15:42:31 +02:00
|
|
|
}
|
|
|
|
|
2024-07-14 16:52:22 +02:00
|
|
|
#settings-sidebar.back-visible {
|
|
|
|
overflow: visible;
|
|
|
|
}
|
|
|
|
|
2024-06-24 15:42:31 +02:00
|
|
|
#settings-sidebar {
|
2024-07-23 07:00:27 +02:00
|
|
|
gap: var(--padding);
|
2024-06-24 15:42:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#settings-navigation {
|
2024-06-25 16:59:25 +02:00
|
|
|
gap: var(--padding);
|
2024-07-12 15:18:47 +02:00
|
|
|
padding-bottom: var(--padding);
|
2024-06-24 15:42:31 +02:00
|
|
|
}
|
2024-06-24 20:11:04 +02:00
|
|
|
|
2024-06-25 10:50:59 +02:00
|
|
|
#settings-header {
|
2024-06-25 16:59:25 +02:00
|
|
|
--back-padding: calc(var(--padding) / 2);
|
2024-06-25 10:50:59 +02:00
|
|
|
}
|
|
|
|
|
2024-07-23 07:00:27 +02:00
|
|
|
.settings-version {
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.settings-version.center {
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
2024-06-25 10:50:59 +02:00
|
|
|
.back-button {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
color: var(--secondary);
|
|
|
|
gap: var(--back-padding);
|
|
|
|
padding: var(--back-padding);
|
2024-06-25 16:59:25 +02:00
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
left: var(--back-padding);
|
2024-06-25 10:50:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.back-button:active {
|
|
|
|
background: var(--button-hover-transparent);
|
|
|
|
border-radius: var(--border-radius);
|
|
|
|
}
|
|
|
|
|
|
|
|
.back-button :global(svg) {
|
2024-07-23 08:20:30 +02:00
|
|
|
stroke-width: 1.8px;
|
2024-07-10 16:19:46 +02:00
|
|
|
height: 22px;
|
|
|
|
width: 22px;
|
2024-07-23 08:19:38 +02:00
|
|
|
will-change: transform;
|
2024-06-25 10:50:59 +02:00
|
|
|
}
|
|
|
|
|
2024-06-24 20:11:04 +02:00
|
|
|
@media screen and (max-width: 750px) {
|
|
|
|
#settings-page {
|
|
|
|
--settings-nav-width: 100%;
|
2024-06-25 10:50:59 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2024-06-24 20:11:04 +02:00
|
|
|
grid-template-columns: 1fr;
|
2024-06-25 10:50:59 +02:00
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#settings-navigation {
|
|
|
|
padding: var(--padding);
|
2024-07-07 17:51:46 +02:00
|
|
|
padding-bottom: calc(var(--padding) * 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
#settings-page-content {
|
|
|
|
padding: var(--padding) 0;
|
|
|
|
padding-top: 0;
|
2024-06-25 10:50:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#settings-page-content {
|
|
|
|
max-width: unset;
|
|
|
|
}
|
|
|
|
|
|
|
|
#settings-header {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
position: sticky;
|
|
|
|
padding: var(--padding);
|
|
|
|
gap: 4px;
|
2024-06-25 16:59:25 +02:00
|
|
|
justify-content: center;
|
2024-06-24 20:11:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#settings-sidebar {
|
2024-06-25 10:50:59 +02:00
|
|
|
gap: 0px;
|
2024-07-07 17:51:46 +02:00
|
|
|
padding: 0;
|
2024-06-25 10:50:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#settings-page-title {
|
|
|
|
text-align: center;
|
2024-06-25 16:59:25 +02:00
|
|
|
letter-spacing: -0.3px;
|
2024-07-10 16:19:46 +02:00
|
|
|
font-size: 16.5px;
|
2024-06-25 10:50:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#settings-navigation {
|
2024-06-24 20:11:04 +02:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2024-06-25 10:50:59 +02:00
|
|
|
#settings-navigation.visible-mobile {
|
2024-06-24 20:11:04 +02:00
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
}
|
2024-06-24 15:42:31 +02:00
|
|
|
</style>
|