refactor(ui): shared SettingsCard and Button variants, pill dropdowns, consistent sidebar text sizes, tidy classmate sharing

This commit is contained in:
SethBurkart123 committed 2026-10-29 11:29:20 +11:00
1 parent 38f934c01f
commit b55415c93b
13 files changed
+397 -386

No files matched your search

+15 -2
View File
@@ -3,18 +3,31 @@
onClick,
text,
disabled = false,
variant = "secondary",
icon,
class: className = "",
} = $props<{
onClick: () => void;
text: string;
disabled?: boolean;
variant?: "primary" | "secondary" | "ghost";
icon?: string;
class?: string;
}>();
const variants = {
primary: "bg-zinc-100 text-zinc-900 border-transparent enabled:hover:bg-white",
secondary: "dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 dark:text-white enabled:hover:brightness-125",
ghost: "bg-transparent border-transparent dark:text-white enabled:hover:bg-zinc-200/60 dark:enabled:hover:bg-zinc-700/50",
};
</script>
<button
type="button"
onclick={onClick}
disabled={disabled}
class="px-5 py-1.5 text-[0.75rem] shadow-2xl border dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 dark:text-white rounded-lg transition enabled:hover:brightness-125 enabled:active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 disabled:cursor-not-allowed disabled:opacity-50"
class="inline-flex items-center justify-center gap-1.5 px-5 py-1.5 text-[0.75rem] shadow-2xl border rounded-lg transition enabled:active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 disabled:cursor-not-allowed disabled:opacity-50 {variants[variant]} {className}"
>
{#if icon}<span class="font-IconFamily text-base" aria-hidden="true">{icon}</span>{/if}
{text}
</button>
</button>
+2 -7
View File
@@ -5,6 +5,7 @@
import { cloudAuth } from "@/seqta/utils/CloudAuth";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
import Button from "./Button.svelte";
const { hidePanel } = $props<{
hidePanel: () => void;
@@ -139,13 +140,7 @@
<p class="text-sm text-zinc-600 dark:text-zinc-400">
Sign in to sync settings across devices, use your cloud profile picture, and more.
</p>
<button
type="button"
onclick={handleSignIn}
class="w-full px-4 py-2.5 text-sm font-medium rounded-lg bg-zinc-800 dark:bg-zinc-200 text-white dark:text-zinc-900 hover:bg-zinc-700 dark:hover:bg-zinc-300 transition-colors duration-200"
>
Sign in with BetterSEQTA Cloud
</button>
<Button class="w-full" icon={""} text="Sign in with BetterSEQTA Cloud" onClick={handleSignIn} />
{#if loginError}
<p class="text-xs text-red-600 dark:text-red-400">{loginError}</p>
{/if}
@@ -280,14 +280,14 @@
}
.title {
font-size: 1.25rem;
font-size: 0.875rem;
font-weight: 700;
line-height: 1.3;
}
.subtitle {
margin-top: 0.15rem;
font-size: 1rem;
font-size: 0.75rem;
color: rgb(82 82 91);
}
@@ -305,12 +305,12 @@
}
.selected-label {
font-size: 0.95rem;
font-size: 0.875rem;
font-weight: 700;
}
.selected-desc {
font-size: 0.8rem;
font-size: 0.75rem;
line-height: 1.35;
color: rgb(113 113 122);
}
@@ -583,14 +583,14 @@
}
.row-title {
font-size: 1.125rem;
font-size: 0.875rem;
font-weight: 700;
line-height: 1.3;
}
.row-desc {
margin-top: 0.1rem;
font-size: 0.95rem;
font-size: 0.75rem;
color: rgb(82 82 91);
}
@@ -2,6 +2,7 @@
import { onDestroy, onMount } from "svelte";
import SkeletonLoader from "@/interface/components/SkeletonLoader.svelte";
import SignInToFavoriteModal from "@/interface/components/SignInToFavoriteModal.svelte";
import Button from "@/interface/components/Button.svelte";
import type { CommunityThemesState } from "@/interface/hooks/communityThemesState.svelte";
import {
formatCustomThemeStatus,
@@ -76,13 +77,11 @@
<p class="mt-3 text-zinc-600 dark:text-zinc-300">
Submit themes for review and track pending, approved, or rejected submissions.
</p>
<button
type="button"
class="mt-6 rounded-lg bg-zinc-900 px-5 py-2.5 font-medium text-white dark:bg-zinc-100 dark:text-zinc-900"
onclick={() => (communityState.showSignInOverlay = true)}
>
Sign in with BetterSEQTA Cloud
</button>
<Button
class="mt-6"
text="Sign in with BetterSEQTA Cloud"
onClick={() => (communityState.showSignInOverlay = true)}
/>
</div>
{:else}
<section class="mb-8">
+6 -7
View File
@@ -1,5 +1,6 @@
<script lang="ts">
import { onMount } from "svelte";
import Button from "@/interface/components/Button.svelte";
import BrowsePanel from "@/interface/components/communityThemes/BrowsePanel.svelte";
import MyThemesPanel from "@/interface/components/communityThemes/MyThemesPanel.svelte";
import OwnerThemeDetailModal from "@/interface/components/communityThemes/OwnerThemeDetailModal.svelte";
@@ -36,16 +37,14 @@
My themes
</button>
</div>
<button
type="button"
class="rounded-lg bg-zinc-900 px-4 py-2 text-sm font-medium text-white transition hover:bg-zinc-700 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white"
onclick={() =>
<Button
variant="primary"
text="Create & submit"
onClick={() =>
void import("@/seqta/utils/launchPageThemeBuilder").then(({ launchPageThemeBuilder }) =>
launchPageThemeBuilder(),
)}
>
Create & submit
</button>
/>
</div>
<p class="mt-2 text-sm text-zinc-500 dark:text-zinc-400">
Community themes are user-submitted and moderated separately from the official theme store.
@@ -1,4 +1,5 @@
<script lang="ts">
import SettingsCard from "./SettingsCard.svelte";
import Switch from "@/interface/components/Switch.svelte";
import Button from "@/interface/components/Button.svelte";
import Slider from "@/interface/components/Slider.svelte";
@@ -69,132 +70,128 @@
{#each visiblePlugins as plugin (plugin.pluginId)}
{@const perfPaused = pluginPerfPaused(plugin.pluginId)}
<div class="border-none">
<div
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40 {!(plugin as PluginSettingsEntry & { disableToggle?: boolean }).disableToggle && Object.keys(plugin.settings).length === 0 ? 'hidden' : ''} {perfPaused ? 'opacity-60' : ''}"
>
{#if perfPaused}
<div
class="flex justify-between items-center px-5 py-3 border-b border-amber-200/60 dark:border-amber-900/40 bg-amber-50/80 dark:bg-amber-950/20"
>
<p class="text-sm text-amber-800 dark:text-amber-200">
Paused by Performance Mode — enable anyway
</p>
<SettingsCard class="{!(plugin as PluginSettingsEntry & { disableToggle?: boolean }).disableToggle && Object.keys(plugin.settings).length === 0 ? 'hidden' : ''} {perfPaused ? 'opacity-60' : ''}">
{#if perfPaused}
<div
class="flex justify-between items-center px-5 py-3 border-b border-amber-200/60 dark:border-amber-900/40 bg-amber-50/80 dark:bg-amber-950/20"
>
<p class="text-sm text-amber-800 dark:text-amber-200">
Paused by Performance Mode — enable anyway
</p>
<Switch
state={$settingsState.performanceModePluginOverrides?.[plugin.pluginId] === true}
onChange={(forceOn: boolean) =>
setPerformanceModePluginOverride(plugin.pluginId, forceOn)}
/>
</div>
{/if}
{#if plugin.disableToggle}
<div class="flex justify-between items-center px-4 py-3 {perfPaused ? 'pointer-events-none' : ''}">
<div class="pr-4">
<h2 class="flex gap-2 items-center text-sm font-bold">
Enable {plugin.name}
{#if plugin.beta}
<span
class="px-2 py-0.5 text-xs font-medium text-orange-800 bg-orange-100 rounded-full border border-orange-300/30 dark:bg-orange-900/30 dark:text-orange-300 dark:border-orange-900/30"
>
Beta
</span>
{/if}
</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">{plugin.description}</p>
</div>
<div>
<Switch
state={$settingsState.performanceModePluginOverrides?.[plugin.pluginId] === true}
onChange={(forceOn: boolean) =>
setPerformanceModePluginOverride(plugin.pluginId, forceOn)}
state={(pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true}
onChange={async (value) => {
if (plugin.pluginId === "assessments-average" && value === true) {
showDisclaimer(
async () => {
await pluginSettingsStore.update(plugin.pluginId, "enabled", true);
},
() => {},
"Assessment Averages Disclaimer",
"This feature calculates a simple average of your assessment grades. It does not take into account:\n• Assessment weightings\n• Different grading scales\n• Other factors used in official reports\n\nThe displayed average may be inaccurate compared to your actual marks found in reports.\n\nDo you want to enable this feature?",
);
return;
}
await pluginSettingsStore.update(plugin.pluginId, "enabled", value);
}}
/>
</div>
{/if}
</div>
{/if}
{#if plugin.disableToggle}
<div class="flex justify-between items-center px-4 py-3 {perfPaused ? 'pointer-events-none' : ''}">
<div class="pr-4">
<h2 class="flex gap-2 items-center text-sm font-bold">
Enable {plugin.name}
{#if plugin.beta}
<span
class="px-2 py-0.5 text-xs font-medium text-orange-800 bg-orange-100 rounded-full border border-orange-300/30 dark:bg-orange-900/30 dark:text-orange-300 dark:border-orange-900/30"
>
Beta
</span>
{/if}
</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">{plugin.description}</p>
</div>
<div>
<Switch
state={(pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true}
onChange={async (value) => {
if (plugin.pluginId === "assessments-average" && value === true) {
showDisclaimer(
async () => {
await pluginSettingsStore.update(plugin.pluginId, "enabled", true);
},
() => {},
"Assessment Averages Disclaimer",
"This feature calculates a simple average of your assessment grades. It does not take into account:\n• Assessment weightings\n• Different grading scales\n• Other factors used in official reports\n\nThe displayed average may be inaccurate compared to your actual marks found in reports.\n\nDo you want to enable this feature?",
);
return;
}
await pluginSettingsStore.update(plugin.pluginId, "enabled", value);
}}
/>
</div>
</div>
{/if}
{#if !perfPaused && (!plugin.disableToggle || ((pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true))}
{#each Object.entries(plugin.settings) as [key, setting] (key)}
{#if key !== "enabled" && !(key === "useCloudPfp" && !cloudState.isLoggedIn)}
<div class="flex justify-between items-center px-4 py-3">
<div class="pr-4">
<h2 class="text-sm font-bold">{setting.title || key}</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">{setting.description || ""}</p>
</div>
<div>
{#if setting.type === "boolean"}
<Switch
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as boolean | undefined) ?? setting.default}
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
/>
{:else if setting.type === "number"}
<div class="w-28 shrink-0">
<Slider
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as number | undefined) ?? setting.default}
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
min={setting.min}
max={setting.max}
step={setting.step}
/>
</div>
{:else if setting.type === "string"}
<input
type="text"
class="px-2 py-1 text-sm rounded-md dark:bg-[#38373D]/50 bg-[#DDDDDD] dark:text-white border-none"
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
oninput={(e) =>
pluginSettingsStore.update(plugin.pluginId, key, e.currentTarget.value)}
/>
{:else if setting.type === "select"}
<Select
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
options={(setting.options as string[]).map((opt) => ({
value: opt,
label: opt.charAt(0).toUpperCase() + opt.slice(1),
}))}
/>
{:else if setting.type === "button"}
<Button onClick={() => setting.trigger?.()} text={setting.title} />
{:else if setting.type === "hotkey"}
<HotkeyInput
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
/>
{:else if setting.type === "component" && setting.component}
{@const Component = setting.component as import("svelte").Component}
<Component />
{/if}
</div>
{#if !perfPaused && (!plugin.disableToggle || ((pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true))}
{#each Object.entries(plugin.settings) as [key, setting] (key)}
{#if key !== "enabled" && !(key === "useCloudPfp" && !cloudState.isLoggedIn)}
<div class="flex justify-between items-center px-4 py-3">
<div class="pr-4">
<h2 class="text-sm font-bold">{setting.title || key}</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">{setting.description || ""}</p>
</div>
{/if}
{/each}
{/if}
{#if plugin.pluginId === "global-search"}
<SettingRow
title="Theme of the Month"
description="Show the monthly featured theme popup when a new entry is available"
id={15}
Component={Switch}
{searchQuery}
props={{
state: !($settingsState.themeOfTheMonthDisabled ?? false),
onChange: (isOn: boolean) => (settingsState.themeOfTheMonthDisabled = !isOn),
}}
/>
{/if}
</div>
</div>
<div>
{#if setting.type === "boolean"}
<Switch
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as boolean | undefined) ?? setting.default}
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
/>
{:else if setting.type === "number"}
<div class="w-28 shrink-0">
<Slider
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as number | undefined) ?? setting.default}
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
min={setting.min}
max={setting.max}
step={setting.step}
/>
</div>
{:else if setting.type === "string"}
<input
type="text"
class="px-2 py-1 text-sm rounded-md dark:bg-[#38373D]/50 bg-[#DDDDDD] dark:text-white border-none"
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
oninput={(e) =>
pluginSettingsStore.update(plugin.pluginId, key, e.currentTarget.value)}
/>
{:else if setting.type === "select"}
<Select
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
options={(setting.options as string[]).map((opt) => ({
value: opt,
label: opt.charAt(0).toUpperCase() + opt.slice(1),
}))}
/>
{:else if setting.type === "button"}
<Button onClick={() => setting.trigger?.()} text={setting.title} />
{:else if setting.type === "hotkey"}
<HotkeyInput
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
/>
{:else if setting.type === "component" && setting.component}
{@const Component = setting.component as import("svelte").Component}
<Component />
{/if}
</div>
</div>
{/if}
{/each}
{/if}
{#if plugin.pluginId === "global-search"}
<SettingRow
title="Theme of the Month"
description="Show the monthly featured theme popup when a new entry is available"
id={15}
Component={Switch}
{searchQuery}
props={{
state: !($settingsState.themeOfTheMonthDisabled ?? false),
onChange: (isOn: boolean) => (settingsState.themeOfTheMonthDisabled = !isOn),
}}
/>
{/if}
</SettingsCard>
{/each}
@@ -0,0 +1,13 @@
<script lang="ts">
import type { Snippet } from "svelte";
let { class: className = "", children }: { class?: string; children: Snippet } = $props();
</script>
<div class="border-none">
<div
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40 {className}"
>
{@render children()}
</div>
</div>
@@ -1,4 +1,5 @@
<script lang="ts">
import SettingsCard from "../SettingsCard.svelte";
import Switch from "@/interface/components/Switch.svelte";
import ConnectMobileApp from "@/interface/components/ConnectMobileApp.svelte";
import CloudSettingsSync from "@/interface/components/CloudSettingsSync.svelte";
@@ -46,65 +47,65 @@
const showCloudAccountCard = $derived(showCloudCardHeader || showFounderBadgeSetting);
</script>
<SettingRow
title="Connect Mobile App"
description="Link your SEQTA session to DesQTA — the modern desktop and mobile app for SEQTA Learn"
id={0}
Component={ConnectMobileApp}
{searchQuery}
props={{}}
/>
{#if matchesSearch(searchQuery, "Connect Mobile App", "Link your SEQTA session to DesQTA — the modern desktop and mobile app for SEQTA Learn")}
<SettingsCard>
<SettingRow
title="Connect Mobile App"
description="Link your SEQTA session to DesQTA — the modern desktop and mobile app for SEQTA Learn"
id={0}
Component={ConnectMobileApp}
{searchQuery}
props={{}}
/>
</SettingsCard>
{/if}
{#if showCloudAccountCard}
<div class="border-none">
<div
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
>
{#if showCloudCardHeader}
<div class="flex justify-between items-center px-4 py-3">
<div class="pr-4">
<h2 class="text-sm font-bold">BetterSEQTA Cloud</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">Account & sync</p>
</div>
<div>
<CloudHeader compact alwaysShowUserName onClick={showCloudPanel} />
</div>
<SettingsCard>
{#if showCloudCardHeader}
<div class="flex justify-between items-center px-4 py-3">
<div class="pr-4">
<h2 class="text-sm font-bold">BetterSEQTA Cloud</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">Account & sync</p>
</div>
{/if}
{#if cloudState.isLoggedIn}
<div class="px-3 pb-3" class:pt-3={!showCloudCardHeader}>
{#if showCloudCardHeader}
<CloudSettingsSync
showDisclaimer={(onConfirm, onCancel) =>
showDisclaimer(
onConfirm,
onCancel,
"Restore from cloud?",
"This will replace your local settings with the cloud backup. Continue?",
)}
/>
{/if}
{#if showFounderBadgeSetting}
<SettingRow
title={founderBadgeSetting.title}
description={founderBadgeSetting.description}
id={17}
Component={Switch}
{searchQuery}
props={{
state: $settingsState.showTitlebarFounderBadge !== false,
onChange: (isOn: boolean) => (settingsState.showTitlebarFounderBadge = isOn),
}}
/>
{/if}
<div>
<CloudHeader compact alwaysShowUserName onClick={showCloudPanel} />
</div>
{:else if showFounderBadgeSetting}
<div class="px-5 pb-4 text-sm text-zinc-600 dark:text-zinc-400">
Sign in to Cloud first.
</div>
{/if}
</div>
</div>
</div>
{/if}
{#if cloudState.isLoggedIn}
<div class="px-3 pb-3" class:pt-3={!showCloudCardHeader}>
{#if showCloudCardHeader}
<CloudSettingsSync
showDisclaimer={(onConfirm, onCancel) =>
showDisclaimer(
onConfirm,
onCancel,
"Restore from cloud?",
"This will replace your local settings with the cloud backup. Continue?",
)}
/>
{/if}
{#if showFounderBadgeSetting}
<SettingRow
title={founderBadgeSetting.title}
description={founderBadgeSetting.description}
id={17}
Component={Switch}
{searchQuery}
props={{
state: $settingsState.showTitlebarFounderBadge !== false,
onChange: (isOn: boolean) => (settingsState.showTitlebarFounderBadge = isOn),
}}
/>
{/if}
</div>
{:else if showFounderBadgeSetting}
<div class="px-5 pb-4 text-sm text-zinc-600 dark:text-zinc-400">
Sign in to Cloud first.
</div>
{/if}
</SettingsCard>
{/if}
<PluginSettingsBlocks section="account" {showDisclaimer} {searchQuery} />
@@ -1,4 +1,5 @@
<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";
@@ -19,24 +20,28 @@
const isEngage = isSeqtaEngageExperience();
</script>
{#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" },
},
] as option (option.id)}
<SettingRow {...option} {searchQuery} />
{/each}
{#if matchesSearch(searchQuery, "Custom Theme Colour", "Interface Font", "Customise the overall theme colour of SEQTA Learn", "Choose the typeface used across SEQTA Learn")}
<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" },
},
] 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")}
<div class="border-none">
@@ -45,61 +50,57 @@
{/if}
{#if matchesSearch(searchQuery, "Adaptive Theme Colour", "Soft Gradient", "Smooth colour transition")}
<div class="border-none">
<div
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
>
<div class="flex justify-between items-center px-4 py-3">
<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">Adaptive Theme Colour</h2>
<h2 class="text-sm font-bold">Soft Gradient</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)
Use a soft gradient instead of a solid colour when viewing a class
</p>
</div>
<div>
<Switch
state={$settingsState.adaptiveThemeColour ?? false}
onChange={(isOn: boolean) => (settingsState.adaptiveThemeColour = isOn)}
state={$settingsState.adaptiveThemeGradient ?? false}
onChange={(isOn: boolean) => (settingsState.adaptiveThemeGradient = 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
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
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>
<Switch
state={$settingsState.adaptiveThemeColourTransition ?? true}
onChange={(isOn: boolean) => (settingsState.adaptiveThemeColourTransition = isOn)}
/>
</div>
{/if}
</div>
</div>
</div>
{/if}
</SettingsCard>
{/if}
<PluginSettingsBlocks section="appearance" {showDisclaimer} {searchQuery} />
@@ -1,4 +1,5 @@
<script lang="ts">
import SettingsCard from "../SettingsCard.svelte";
import Switch from "@/interface/components/Switch.svelte";
import Button from "@/interface/components/Button.svelte";
import Select from "@/interface/components/Select.svelte";
@@ -140,34 +141,38 @@
]);
</script>
{#each generalOptions as option (option.id)}
<SettingRow {...option} {searchQuery} />
{#if option.id === 0 && $settingsState.performanceMode && matchesSearch(searchQuery, "Performance Mode", "Global Search", "Assessment Averages", "enable anyway", "paused")}
<div class="border-none -mt-px">
<div
class="mx-5 mb-4 rounded-xl border border-zinc-200/80 bg-zinc-50/80 px-4 py-3 dark:border-zinc-700/60 dark:bg-zinc-900/40"
>
<p class="mb-3 text-sm font-medium text-zinc-500 dark:text-zinc-400">
Paused for performance — enable anyway:
</p>
<div class="space-y-3">
{#each PERFORMANCE_HEAVY_PLUGINS as heavy (heavy.id)}
<div class="flex justify-between items-center gap-4">
<div class="min-w-0">
<p class="text-sm font-semibold text-zinc-800 dark:text-zinc-100">{heavy.name}</p>
<p class="text-xs text-zinc-500 dark:text-zinc-400">{heavy.description}</p>
</div>
<Switch
state={$settingsState.performanceModePluginOverrides?.[heavy.id] === true}
onChange={(forceOn: boolean) => setPerformanceModePluginOverride(heavy.id, forceOn)}
/>
{#if generalOptions.some((option) => matchesSearch(searchQuery, option.title, option.description))}
<SettingsCard class="divide-y divide-zinc-200/60 dark:divide-zinc-700/40">
{#each generalOptions as option (option.id)}
<SettingRow {...option} {searchQuery} />
{#if option.id === 0 && $settingsState.performanceMode && matchesSearch(searchQuery, "Performance Mode", "Global Search", "Assessment Averages", "enable anyway", "paused")}
<div class="border-none -mt-px">
<div
class="mx-5 mb-4 rounded-xl border border-zinc-200/80 bg-zinc-50/80 px-4 py-3 dark:border-zinc-700/60 dark:bg-zinc-900/40"
>
<p class="mb-3 text-sm font-medium text-zinc-500 dark:text-zinc-400">
Paused for performance — enable anyway:
</p>
<div class="space-y-3">
{#each PERFORMANCE_HEAVY_PLUGINS as heavy (heavy.id)}
<div class="flex justify-between items-center gap-4">
<div class="min-w-0">
<p class="text-sm font-semibold text-zinc-800 dark:text-zinc-100">{heavy.name}</p>
<p class="text-xs text-zinc-500 dark:text-zinc-400">{heavy.description}</p>
</div>
<Switch
state={$settingsState.performanceModePluginOverrides?.[heavy.id] === true}
onChange={(forceOn: boolean) => setPerformanceModePluginOverride(heavy.id, forceOn)}
/>
</div>
{/each}
</div>
{/each}
</div>
</div>
</div>
</div>
{/if}
{/each}
{/if}
{/each}
</SettingsCard>
{/if}
{#if matchesSearch(
searchQuery,
@@ -176,43 +181,41 @@
"Maximum Subjects",
"Maximum Assessments per Subject",
)}
<div class="border-none">
<SettingsCard>
<div class="flex justify-between items-center px-4 py-3">
<div class="pr-4">
<h2 class="text-sm font-bold">Home Page Assessments</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Limit upcoming assessments shown on the home page by subject
</p>
</div>
</div>
<div
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
>
<div class="flex justify-between items-center px-4 py-3">
<div class="pr-4">
<h2 class="text-sm font-bold">Home Page Assessments</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Limit upcoming assessments shown on the home page by subject
</p>
</div>
<div class="pr-4">
<h2 class="text-sm font-bold">Include Past Assessments</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Show past-due assessments from the upcoming list, matching the Assessments page
</p>
</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">Include Past Assessments</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Show past-due assessments from the upcoming list, matching the Assessments page
</p>
</div>
<div>
<Switch
state={$settingsState.homeUpcomingIncludePast ?? true}
onChange={(isOn: boolean) => (settingsState.homeUpcomingIncludePast = isOn)}
/>
</div>
<div>
<Switch
state={$settingsState.homeUpcomingIncludePast ?? true}
onChange={(isOn: boolean) => (settingsState.homeUpcomingIncludePast = isOn)}
/>
</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">Maximum Subjects</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Number of subjects to include, ordered by soonest due date
</p>
</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">Maximum Subjects</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Number of subjects to include, ordered by soonest due date
</p>
</div>
<div class="shrink-0">
<Select
value={String($settingsState.homeUpcomingSubjectsMax ?? 5)}
onChange={(value: string) => (settingsState.homeUpcomingSubjectsMax = Number(value))}
@@ -226,15 +229,17 @@
]}
/>
</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">Maximum Assessments per Subject</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Assessments shown for each included subject
</p>
</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">Maximum Assessments per Subject</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-300">
Assessments shown for each included subject
</p>
</div>
<div class="shrink-0">
<Select
value={String($settingsState.homeUpcomingAssessmentsPerSubjectMax ?? 0)}
onChange={(value: string) =>
@@ -250,5 +255,5 @@
/>
</div>
</div>
</div>
</SettingsCard>
{/if}
+6 -10
View File
@@ -2,6 +2,7 @@
import MotionDiv from '@/interface/components/MotionDiv.svelte';
import { settingsState } from "@/seqta/utils/listeners/SettingsState.ts"
import Switch from "@/interface/components/Switch.svelte"
import Button from "@/interface/components/Button.svelte"
import { onMount } from 'svelte';
import Shortcuts from "@/seqta/content/links.json"
@@ -199,16 +200,11 @@
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.3 }}
>
<button
class="w-full px-4 py-3 mb-4 text-base dark:text-white transition rounded-xl bg-zinc-200 dark:bg-zinc-700/50 enabled:hover:bg-zinc-300 dark:enabled:hover:bg-zinc-700 enabled:active:scale-[0.99]"
onclick={isFormVisible ? addNewCustomShortcut : toggleForm}
>
{#if isFormVisible}
Add
{:else}
Add Custom Shortcut
{/if}
</button>
<Button
class="w-full mb-4"
text={isFormVisible ? "Add" : "Add Custom Shortcut"}
onClick={isFormVisible ? addNewCustomShortcut : toggleForm}
/>
</MotionDiv>
</div>
{/if}
+18 -19
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import BackgroundSelector from "@/interface/components/themes/BackgroundSelector.svelte"
import ThemeSelector from "@/interface/components/themes/ThemeSelector.svelte"
import Button from "@/interface/components/Button.svelte"
import { standalone } from "@/interface/utils/standalone.svelte"
let { section = "all" } = $props<{
@@ -20,24 +21,23 @@
<div class="py-4">
{#if !standalone.standalone}
{#if showBackgrounds}
<button
onclick={() => selectNoBackground()}
<Button
onClick={() => selectNoBackground()}
disabled={section === "backgrounds" && !clearTheme}
class="w-full px-4 py-3 mb-4 text-base dark:text-white transition rounded-xl bg-zinc-200 dark:bg-zinc-700/50 enabled:hover:bg-zinc-300 dark:enabled:hover:bg-zinc-700 enabled:active:scale-[0.99] disabled:opacity-50">
{section === "all"
text={section === "all"
? clearTheme ? 'Clear Theme' : 'Select a Theme'
: clearTheme ? 'Clear Background' : 'No Background Selected'}
</button>
class="w-full mb-4"
/>
{/if}
<div class="w-full">
{#if showThemes || showBackgrounds}
<div class="mb-3 flex justify-end">
<button
onclick={() => editMode = !editMode}
class="inline-flex h-8 items-center rounded-xl bg-zinc-100 px-3 text-lg dark:bg-zinc-700">
<span class="mr-2">{editMode ? 'Done' : 'Remove'}</span>
<span class="font-IconFamily">{editMode ? '\ue9e4' : '\uec38'}</span>
</button>
<Button
onClick={() => editMode = !editMode}
text={editMode ? 'Done' : 'Remove'}
icon={editMode ? '\ue9e4' : '\uec38'}
/>
</div>
{/if}
@@ -46,17 +46,16 @@
{/if}
{#if showThemes}
{#if section === "themes"}
<button
type="button"
class="mb-4 flex h-11 w-full items-center justify-center gap-2 rounded-xl bg-zinc-900 text-sm font-medium text-white dark:bg-zinc-100 dark:text-zinc-900"
onclick={() =>
<Button
variant="primary"
class="w-full mb-4"
icon={""}
text="Open theme builder"
onClick={() =>
void import("@/seqta/utils/launchPageThemeBuilder").then(({ launchPageThemeBuilder }) =>
launchPageThemeBuilder(),
)}
>
<span class="font-IconFamily text-lg" aria-hidden="true">&#xec60;</span>
Open theme builder
</button>
/>
{/if}
<ThemeSelector isEditMode={editMode} showNavigation={section === "all"} />
{/if}
@@ -78,34 +78,27 @@
}
</script>
<div class="flex flex-col items-end gap-2 shrink-0 max-w-[14rem]">
<p class="text-xs text-right text-zinc-500 dark:text-zinc-400">{scopeLabel}</p>
<div class="flex flex-col items-end gap-2 shrink-0 max-w-[14rem]" title={scopeLabel}>
{#if syncOptIn}
<p class="text-xs font-medium text-green-600 dark:text-green-400">Opted in on this site</p>
<div class="flex flex-wrap gap-2 justify-end">
<Button text="Sync now" onClick={() => void syncNow()} disabled={busy} />
<button
type="button"
class="px-3 py-1.5 text-[0.75rem] rounded-lg text-red-600 dark:text-red-400 hover:bg-zinc-200/80 dark:hover:bg-zinc-700/50 disabled:opacity-50 transition-colors duration-200"
disabled={busy}
onclick={startOptOut}
>
Opt out…
</button>
</div>
{:else}
<p class="text-xs text-right text-zinc-500 dark:text-zinc-400">
{cloudAuth.state.isLoggedIn
? "Not sharing yet"
: "Sign in to Cloud in the opt-in guide"}
{cloudAuth.state.isLoggedIn ? "Not sharing yet" : "Sign in to Cloud first"}
</p>
<Button text="Opt in…" onClick={startOptIn} disabled={busy} />
{/if}
{#if status}
<p class="text-xs text-right text-zinc-500 dark:text-zinc-400">{status}</p>
{/if}
{#if syncOptIn}
<div class="flex flex-wrap gap-2 justify-end">
<Button text="Sync now" onClick={() => void syncNow()} disabled={busy} />
<Button variant="ghost" class="text-red-600 dark:text-red-400" text="Opt out…" onClick={startOptOut} disabled={busy} />
</div>
{:else}
<Button text="Opt in…" onClick={startOptIn} disabled={busy} />
{/if}
{#if error}
<p class="text-xs text-right text-red-500">{error}</p>
{/if}