Files
BetterSEQTA-Plus/src/interface/pages/settings/sections/appearance.svelte
T

91 lines
4.3 KiB
Svelte

<script lang="ts">
import SettingsCard from "../SettingsCard.svelte";
import Switch from "@/interface/components/Switch.svelte";
import Button from "@/interface/components/Button.svelte";
import PickerSwatch from "@/interface/components/PickerSwatch.svelte";
import SidebarAppearance from "@/interface/components/SidebarAppearance.svelte";
import SettingRow from "../SettingRow.svelte";
import PluginSettingsBlocks from "../PluginSettingsBlocks.svelte";
import { settingsState } from "@/seqta/utils/listeners/settingsState";
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
import { matchesSearch, type SettingsSectionSharedProps } from "../shared";
import type { SettingsList } from "@/interface/types/settingsProps";
let {
showColourPicker,
showFontPicker,
showDisclaimer,
searchQuery = "",
}: SettingsSectionSharedProps = $props();
const isEngage = isSeqtaEngageExperience();
</script>
{#if matchesSearch(searchQuery, "Custom Theme Colour", "Interface Font", "Theme of the Month", "Customise the overall theme colour of SEQTA Learn", "Choose the typeface used across SEQTA Learn", "Show the monthly featured theme popup when a new entry is available")}
<SettingsCard class="divide-y divide-zinc-200/60 dark:divide-zinc-700/40">
{#each [{ title: "Custom Theme Colour", description: "Customise the overall theme colour of SEQTA Learn", id: 4, Component: PickerSwatch, props: { onClick: showColourPicker } }, { title: "Interface Font", description: "Choose the typeface used across SEQTA Learn", id: 16, Component: Button, props: { onClick: showFontPicker, text: "Change" } }, { title: "Theme of the Month", description: "Show the monthly featured theme popup when a new entry is available", id: 15, Component: Switch, props: { state: !($settingsState.themeOfTheMonthDisabled ?? false), onChange: (isOn: boolean) => (settingsState.themeOfTheMonthDisabled = !isOn) } }] as unknown as SettingsList[] as option (option.id)}
<SettingRow {...option} {searchQuery} />
{/each}
</SettingsCard>
{/if}
{#if !isEngage && matchesSearch(searchQuery, "Sidebar Style", "Item Size", "Corner Radius", "Active Indicator", "Sidebar Position", "Sidebar Width", "Transparency Effects", "Blur Strength")}
<SidebarAppearance {searchQuery} />
{/if}
{#if matchesSearch(searchQuery, "Adaptive Theme Colour", "Soft Gradient", "Smooth Colour Transition")}
<SettingsCard>
<div class="flex justify-between items-center px-4 py-3">
<div class="pr-4">
<h2 class="text-sm font-bold">Adaptive Theme Colour</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Change the theme colour based on the current class (e.g. when viewing a course or
assessments page)
</p>
</div>
<div>
<Switch
state={$settingsState.adaptiveThemeColour ?? false}
onChange={(isOn: boolean) => (settingsState.adaptiveThemeColour = isOn)}
/>
</div>
</div>
{#if $settingsState.adaptiveThemeColour}
<div
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
>
<div class="pr-4">
<h2 class="text-sm font-bold">Soft Gradient</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Use a soft gradient instead of a solid colour when viewing a class
</p>
</div>
<div>
<Switch
state={$settingsState.adaptiveThemeGradient ?? false}
onChange={(isOn: boolean) => (settingsState.adaptiveThemeGradient = isOn)}
/>
</div>
</div>
<div
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
>
<div class="pr-4">
<h2 class="text-sm font-bold">Smooth Colour Transition</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Ease between class/subject colours when navigating instead of switching instantly
</p>
</div>
<div>
<Switch
state={$settingsState.adaptiveThemeColourTransition ?? true}
onChange={(isOn: boolean) => (settingsState.adaptiveThemeColourTransition = isOn)}
/>
</div>
</div>
{/if}
</SettingsCard>
{/if}
<PluginSettingsBlocks section="appearance" {showDisclaimer} {searchQuery} />