mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
revert: restore IconFamily and pre-Lucide icons
Remove @lucide/svelte and lucide-static in favor of MenuItemSVGKey, IconFamily.woff, Heroicons overview paths, and inline SVGs used on upstream main. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
5bbe1c6a32
commit
f935d0ad9d
74 files changed
+1865
-2350
No files matched your search
Generated
-17
@@ -18,7 +18,6 @@
|
||||
"@codemirror/state": "^6.7.6",
|
||||
"@codemirror/view": "^6.43.15",
|
||||
"@huggingface/transformers": "^3.8.1",
|
||||
"@lucide/svelte": "^1.66.0",
|
||||
"@uiw/codemirror-extensions-color": "^4.25.12",
|
||||
"@uiw/codemirror-theme-github": "^4.25.12",
|
||||
"canvas-confetti": "^1.9.4",
|
||||
@@ -32,7 +31,6 @@
|
||||
"fuse.js": "^7.5.0",
|
||||
"layerchart": "^2.9.2",
|
||||
"localforage": "^1.10.0",
|
||||
"lucide-static": "^1.66.0",
|
||||
"mathjs": "^15.2.0",
|
||||
"motion": "^14.9.0",
|
||||
"pdfjs-dist": "^6.5.438",
|
||||
@@ -2465,15 +2463,6 @@
|
||||
"@lezer/common": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lucide/svelte": {
|
||||
"version": "1.67.0",
|
||||
"resolved": "https://registry.npmjs.org/@lucide/svelte/-/svelte-1.67.0.tgz",
|
||||
"integrity": "sha512-DeqoOkMm3QihcNsrQB5drR/8azWDGuozfagDpm/anIqaJdflLUMhwLFPEANl/W3FLhXx6HmQwEWz7zBtZ6KXcQ==",
|
||||
"license": "ISC",
|
||||
"peerDependencies": {
|
||||
"svelte": "^5"
|
||||
}
|
||||
},
|
||||
"node_modules/@marijn/find-cluster-break": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.4.tgz",
|
||||
@@ -8567,12 +8556,6 @@
|
||||
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/lucide-static": {
|
||||
"version": "1.67.0",
|
||||
"resolved": "https://registry.npmjs.org/lucide-static/-/lucide-static-1.67.0.tgz",
|
||||
"integrity": "sha512-Lu/Ntwfw1GOQiNgTC2iHd/PC4QbqzwktLVFHTB84tldlfUjFgQ+EBWiZc/UPrlNdX97O/KXWRn792hIdQh6nhA==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/lz-string": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
"@codemirror/state": "^6.7.6",
|
||||
"@codemirror/view": "^6.43.15",
|
||||
"@huggingface/transformers": "^3.8.1",
|
||||
"@lucide/svelte": "^1.66.0",
|
||||
"@uiw/codemirror-extensions-color": "^4.25.12",
|
||||
"@uiw/codemirror-theme-github": "^4.25.12",
|
||||
"canvas-confetti": "^1.9.4",
|
||||
@@ -58,7 +57,6 @@
|
||||
"fuse.js": "^7.5.0",
|
||||
"layerchart": "^2.9.2",
|
||||
"localforage": "^1.10.0",
|
||||
"lucide-static": "^1.66.0",
|
||||
"mathjs": "^15.2.0",
|
||||
"motion": "^14.9.0",
|
||||
"pdfjs-dist": "^6.5.438",
|
||||
|
||||
@@ -26,6 +26,14 @@
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "IconFamily";
|
||||
src: url("@/resources/fonts/IconFamily.woff") format("woff");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
}
|
||||
|
||||
@layer base, override;
|
||||
|
||||
@layer override {
|
||||
|
||||
+32
-23
@@ -31,13 +31,10 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@mixin lucide-icon($name, $size) {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
width: $size;
|
||||
height: $size;
|
||||
background: currentColor;
|
||||
mask: url("lucide-static/icons/#{$name}.svg") center / contain no-repeat;
|
||||
button.timetable-zoom.iconFamily,
|
||||
button.bsplus-timetable-control.iconFamily,
|
||||
.iconFamily {
|
||||
font-family: "IconFamily" !important;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
@@ -1236,12 +1233,15 @@ td.colourBar {
|
||||
padding-left: 30px;
|
||||
}
|
||||
#toolbar span:has(.search)::before {
|
||||
@include lucide-icon("search", 16px);
|
||||
content: "\eca5";
|
||||
position: absolute;
|
||||
left: 8px;
|
||||
z-index: 10;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: currentColor;
|
||||
font-size: 16px;
|
||||
font-family: "IconFamily";
|
||||
pointer-events: none;
|
||||
}
|
||||
#container #content .search {
|
||||
@@ -2033,15 +2033,6 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + l
|
||||
z-index: 21 !important;
|
||||
color: var(--better-sub);
|
||||
padding: 8px;
|
||||
|
||||
> svg {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&::before {
|
||||
@include lucide-icon(bell, 24px);
|
||||
background: var(--theme-primary);
|
||||
}
|
||||
}
|
||||
.legacy-root button > svg,
|
||||
.legacy-root a > svg {
|
||||
@@ -3353,23 +3344,35 @@ body:not(.clr-open) .clr-picker,
|
||||
align-items: center;
|
||||
}
|
||||
[data-label="inbox"] > [class*="LabelList__name___"]::before {
|
||||
@include lucide-icon("inbox", 16px);
|
||||
content: "\eb70";
|
||||
color: currentColor;
|
||||
font-size: 16px;
|
||||
margin-right: 8px;
|
||||
font-family: "IconFamily";
|
||||
pointer-events: none;
|
||||
}
|
||||
[data-label="outbox"] > [class*="LabelList__name___"]::before {
|
||||
@include lucide-icon("send", 16px);
|
||||
content: "\eca6";
|
||||
color: currentColor;
|
||||
font-size: 16px;
|
||||
margin-right: 8px;
|
||||
font-family: "IconFamily";
|
||||
pointer-events: none;
|
||||
}
|
||||
[data-label="starred"] > [class*="LabelList__name___"]::before {
|
||||
@include lucide-icon("star", 16px);
|
||||
content: "\ece8";
|
||||
color: currentColor;
|
||||
font-size: 16px;
|
||||
margin-right: 8px;
|
||||
font-family: "IconFamily";
|
||||
pointer-events: none;
|
||||
}
|
||||
[data-label="trash"] > [class*="LabelList__name___"]::before {
|
||||
@include lucide-icon("trash", 16px);
|
||||
content: "\ed2c";
|
||||
color: currentColor;
|
||||
font-size: 16px;
|
||||
margin-right: 8px;
|
||||
font-family: "IconFamily";
|
||||
pointer-events: none;
|
||||
}
|
||||
.outer-circle {
|
||||
@@ -4513,7 +4516,10 @@ div.day-empty {
|
||||
cursor: pointer;
|
||||
}
|
||||
#whatsnewclosebutton::before {
|
||||
@include lucide-icon("x", 24px);
|
||||
content: "\ed8a";
|
||||
color: currentColor;
|
||||
font-size: 24px;
|
||||
font-family: "IconFamily";
|
||||
pointer-events: none;
|
||||
}
|
||||
.whatsnewTextContainer h1:not(.whatsnewTextHeader) {
|
||||
@@ -5699,7 +5705,10 @@ h2.home-subtitle {
|
||||
}
|
||||
|
||||
.bsplus-ld-surprise-close::before {
|
||||
@include lucide-icon("x", 20px);
|
||||
content: "\ed8a";
|
||||
font-family: "IconFamily";
|
||||
font-size: 20px;
|
||||
line-height: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
--animate-spin-fast: spin 0.4s linear infinite;
|
||||
|
||||
--aspect-theme: 5 / 1;
|
||||
|
||||
--font-IconFamily: IconFamily;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<script lang="ts">
|
||||
import type { Component } from "svelte";
|
||||
|
||||
let {
|
||||
onClick,
|
||||
text,
|
||||
disabled = false,
|
||||
variant = "secondary",
|
||||
icon: Icon,
|
||||
icon,
|
||||
class: className = "",
|
||||
}: {
|
||||
onClick: () => void;
|
||||
text: string;
|
||||
disabled?: boolean;
|
||||
variant?: "primary" | "secondary" | "ghost";
|
||||
icon?: Component<{ class?: string; size?: string | number }>;
|
||||
icon?: string;
|
||||
class?: string;
|
||||
} = $props();
|
||||
|
||||
@@ -34,6 +32,6 @@
|
||||
variant
|
||||
]} {className}"
|
||||
>
|
||||
{#if Icon}<Icon size="1em" class="text-base" />{/if}
|
||||
{#if icon}<span class="font-IconFamily text-base" aria-hidden="true">{icon}</span>{/if}
|
||||
{text}
|
||||
</button>
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import XIcon from "@lucide/svelte/icons/x";
|
||||
import { fade } from "svelte/transition";
|
||||
import browser from "@/lib/browser";
|
||||
import QRCode from "qrcode";
|
||||
@@ -80,7 +79,7 @@
|
||||
qrDataUrl = dataUrl;
|
||||
showQrModal = true;
|
||||
} catch (err) {
|
||||
console.error("[BetterSEQTA+] ConnectMobileApp: Failed to generate QR:", err);
|
||||
console.error("[ConnectMobileApp] Failed to generate QR:", err);
|
||||
errorMessage = "Failed to generate QR code. Please try again.";
|
||||
} finally {
|
||||
isLoading = false;
|
||||
@@ -108,11 +107,7 @@
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-1 items-end">
|
||||
<Button
|
||||
onClick={generateQrCode}
|
||||
disabled={isLoading}
|
||||
text={isLoading ? "Generating..." : "Generate QR"}
|
||||
/>
|
||||
<Button onClick={generateQrCode} disabled={isLoading} text={isLoading ? "Generating..." : "Generate QR"} />
|
||||
{#if errorMessage}
|
||||
<p class="text-xs text-right text-amber-600 dark:text-amber-400">{errorMessage}</p>
|
||||
{/if}
|
||||
@@ -121,9 +116,7 @@
|
||||
{#if showQrModal && qrDataUrl}
|
||||
<div
|
||||
use:portal
|
||||
class="fixed cursor-auto inset-0 z-10000 flex justify-center items-center bg-black/50 {isStandalone
|
||||
? 'backdrop-blur-xs'
|
||||
: ''} {$settingsState.DarkMode ? 'dark' : ''}"
|
||||
class="fixed cursor-auto inset-0 z-10000 flex justify-center items-center bg-black/50 {isStandalone ? 'backdrop-blur-xs' : ''} {$settingsState.DarkMode ? 'dark' : ''}"
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
onclick={(e) => {
|
||||
@@ -132,23 +125,22 @@
|
||||
onkeydown={(e) => {
|
||||
if (e.key === "Escape") closeModal();
|
||||
}}
|
||||
transition:fade={{ duration: 150 }}
|
||||
>
|
||||
transition:fade={{ duration: 150 }}>
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="p-6 mx-4 w-full max-w-sm bg-white rounded-2xl shadow-2xl dark:bg-zinc-800"
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
onkeydown={(e) => e.stopPropagation()}
|
||||
>
|
||||
onkeydown={(e) => e.stopPropagation()}>
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-lg font-bold text-zinc-900 dark:text-white">Scan with DesQTA</h2>
|
||||
<button
|
||||
type="button"
|
||||
onclick={closeModal}
|
||||
class="p-2 rounded-lg transition-colors text-zinc-500 hover:text-zinc-700 hover:bg-zinc-100 dark:hover:text-zinc-400 dark:hover:bg-zinc-700"
|
||||
aria-label="Close"
|
||||
>
|
||||
<XIcon class="w-5 h-5" />
|
||||
aria-label="Close">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex justify-center p-4 bg-white rounded-xl dark:bg-zinc-900">
|
||||
@@ -158,15 +150,13 @@
|
||||
<button
|
||||
type="button"
|
||||
onclick={openAppLink}
|
||||
class="px-4 py-2.5 w-full text-sm font-medium text-white bg-indigo-600 rounded-lg transition-colors dark:bg-indigo-500 hover:bg-indigo-700 dark:hover:bg-indigo-600"
|
||||
>
|
||||
class="px-4 py-2.5 w-full text-sm font-medium text-white bg-indigo-600 rounded-lg transition-colors dark:bg-indigo-500 hover:bg-indigo-700 dark:hover:bg-indigo-600">
|
||||
Sign into DesQTA Desktop
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onclick={downloadQrImage}
|
||||
class="px-4 py-2 w-full text-xs font-medium rounded-lg border transition-colors text-zinc-500 dark:text-zinc-400 border-zinc-200 dark:border-zinc-600 hover:bg-zinc-50 dark:hover:bg-zinc-800/50"
|
||||
>
|
||||
class="px-4 py-2 w-full text-xs font-medium rounded-lg border transition-colors text-zinc-500 dark:text-zinc-400 border-zinc-200 dark:border-zinc-600 hover:bg-zinc-50 dark:hover:bg-zinc-800/50">
|
||||
Download QR as image
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<script lang="ts">
|
||||
import XIcon from "@lucide/svelte/icons/x";
|
||||
let {
|
||||
onclick,
|
||||
label = "Close",
|
||||
}: {
|
||||
let { onclick, label = "Close" }: {
|
||||
onclick: () => void;
|
||||
label?: string;
|
||||
} = $props();
|
||||
@@ -12,8 +8,18 @@
|
||||
<button
|
||||
type="button"
|
||||
{onclick}
|
||||
class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] dark:text-zinc-400 dark:hover:text-white"
|
||||
class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] focus:outline-hidden dark:text-zinc-400 dark:hover:text-white"
|
||||
aria-label={label}
|
||||
>
|
||||
<XIcon class="h-6 w-6" />
|
||||
<svg
|
||||
class="h-6 w-6"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M6 6l12 12M18 6 6 18" />
|
||||
</svg>
|
||||
</button>
|
||||
@@ -1,13 +1,8 @@
|
||||
<script lang="ts">
|
||||
import ChevronDownIcon from "@lucide/svelte/icons/chevron-down";
|
||||
let {
|
||||
value,
|
||||
onChange,
|
||||
options,
|
||||
}: {
|
||||
value: string;
|
||||
onChange: (newValue: string) => void;
|
||||
options: Array<{ value: string; label: string }>;
|
||||
let { value, onChange, options }: {
|
||||
value: string,
|
||||
onChange: (newValue: string) => void,
|
||||
options: Array<{ value: string, label: string }>
|
||||
} = $props();
|
||||
|
||||
const listboxId = $props.id();
|
||||
@@ -108,7 +103,13 @@
|
||||
{options.find((option) => option.value === value)?.label ?? value}
|
||||
</span>
|
||||
<span class="select-icon shrink-0" aria-hidden="true">
|
||||
<ChevronDownIcon class="h-4 w-4" />
|
||||
<svg viewBox="0 0 20 20" fill="currentColor" class="h-4 w-4">
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06Z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
@@ -146,8 +147,11 @@
|
||||
--sel-border: var(--theme-offset-bg, var(--theme-secondary, #e5e7eb));
|
||||
--sel-bg: var(--theme-primary, #ffffff);
|
||||
--sel-surface: var(--theme-secondary, #e5e7eb);
|
||||
|
||||
--sel-menu-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.25), 0 8px 10px -6px rgb(0 0 0 / 0.2);
|
||||
--sel-focus-border: color-mix(in srgb, var(--text-primary) 22%, var(--theme-secondary, #e5e7eb) 78%);
|
||||
--sel-ring: 0 0 0 1px color-mix(in srgb, var(--text-primary) 12%, transparent);
|
||||
--sel-menu-shadow:
|
||||
0 10px 25px -5px rgb(0 0 0 / 0.25),
|
||||
0 8px 10px -6px rgb(0 0 0 / 0.2);
|
||||
}
|
||||
|
||||
.select-trigger {
|
||||
@@ -156,8 +160,16 @@
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.select-trigger:hover {
|
||||
.select-trigger:hover,
|
||||
.select-trigger:focus-visible {
|
||||
outline: none;
|
||||
background: var(--sel-surface);
|
||||
border-color: var(--sel-border);
|
||||
}
|
||||
|
||||
.select-trigger:focus-visible {
|
||||
border-color: var(--sel-focus-border);
|
||||
box-shadow: var(--sel-ring);
|
||||
}
|
||||
|
||||
.select-icon {
|
||||
@@ -173,6 +185,7 @@
|
||||
|
||||
.select-menu:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: var(--sel-menu-shadow), var(--sel-ring);
|
||||
}
|
||||
|
||||
.select-option {
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
<script lang="ts">
|
||||
import PipetteIcon from "@lucide/svelte/icons/pipette";
|
||||
import PlusIcon from "@lucide/svelte/icons/plus";
|
||||
import Trash2Icon from "@lucide/svelte/icons/trash-2";
|
||||
import { untrack } from "svelte";
|
||||
import { slide } from "svelte/transition";
|
||||
import {
|
||||
@@ -324,7 +321,7 @@
|
||||
title="Add colour stop"
|
||||
onclick={() => addStop(50)}
|
||||
>
|
||||
<PlusIcon class="size-4" />
|
||||
<svg viewBox="0 0 24 24" class="size-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14" /></svg>
|
||||
</button>
|
||||
{#if model.kind === "linear"}
|
||||
<label
|
||||
@@ -351,7 +348,9 @@
|
||||
disabled={stops.length <= 2}
|
||||
onclick={() => removeStop(selected)}
|
||||
>
|
||||
<Trash2Icon class="size-4" />
|
||||
<svg viewBox="0 0 24 24" class="size-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M3 6h18M8 6V4h8v2m-9 0 1 14h8l1-14" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -389,7 +388,9 @@
|
||||
aria-label="Pick a colour from the screen"
|
||||
onclick={pickFromScreen}
|
||||
>
|
||||
<PipetteIcon class="size-4" />
|
||||
<svg viewBox="0 0 24 24" class="size-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="m2 22 1-1h3l9-9M3 21v-3l9-9m3-3 3.5-3.5a2.1 2.1 0 0 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z" />
|
||||
</svg>
|
||||
</button>
|
||||
{/if}
|
||||
<div class="flex flex-col flex-1 gap-3">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import XIcon from "@lucide/svelte/icons/x";
|
||||
import SkeletonLoader from "@/interface/components/SkeletonLoader.svelte";
|
||||
import ModalFrame from "./ModalFrame.svelte";
|
||||
import type { CommunityThemesState } from "@/interface/hooks/communityThemesState.svelte";
|
||||
@@ -26,9 +25,7 @@
|
||||
<div>
|
||||
<h2 class="text-2xl font-bold">{theme.name}</h2>
|
||||
<span
|
||||
class="mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-semibold {statusBadgeClass(
|
||||
theme.status,
|
||||
)}"
|
||||
class="mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-semibold {statusBadgeClass(theme.status)}"
|
||||
>
|
||||
{formatCustomThemeStatus(theme.status)}
|
||||
</span>
|
||||
@@ -39,7 +36,7 @@
|
||||
aria-label="Close"
|
||||
onclick={() => communityState.closeDetail()}
|
||||
>
|
||||
<XIcon size="1em" />
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -125,8 +122,7 @@
|
||||
accept=".zip,application/zip"
|
||||
class="block w-full text-sm"
|
||||
onchange={(e) => {
|
||||
communityState.replaceZipFile =
|
||||
(e.currentTarget as HTMLInputElement).files?.[0] ?? null;
|
||||
communityState.replaceZipFile = (e.currentTarget as HTMLInputElement).files?.[0] ?? null;
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { LUCIDE_MOON_PATH } from "@/lib/icons/lucideMoon";
|
||||
|
||||
let { class: className = "w-5 h-5" }: { class?: string } = $props();
|
||||
</script>
|
||||
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
class={className}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d={LUCIDE_MOON_PATH} />
|
||||
</svg>
|
||||
@@ -0,0 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { LUCIDE_SUN_PATH } from "@/lib/icons/lucideSun";
|
||||
|
||||
let { class: className = "w-5 h-5" }: { class?: string } = $props();
|
||||
</script>
|
||||
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
class={className}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d={LUCIDE_SUN_PATH} />
|
||||
</svg>
|
||||
@@ -1,36 +1,14 @@
|
||||
<script lang="ts">
|
||||
import DownloadIcon from "@lucide/svelte/icons/download";
|
||||
import TrashIcon from "@lucide/svelte/icons/trash";
|
||||
import {
|
||||
hasEnoughStorageSpace,
|
||||
isIndexedDBSupported,
|
||||
writeData,
|
||||
openDatabase,
|
||||
readAllData,
|
||||
deleteData,
|
||||
} from "@/interface/hooks/backgroundDataLoader";
|
||||
import Spinner from "../Spinner.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { backgroundUpdates } from "@/interface/hooks/backgroundUpdates";
|
||||
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
|
||||
import { hasEnoughStorageSpace, isIndexedDBSupported, writeData, openDatabase, readAllData, deleteData } from '@/interface/hooks/backgroundDataLoader';
|
||||
import Spinner from '../Spinner.svelte';
|
||||
import { settingsState } from '@/seqta/utils/listeners/settingsState'
|
||||
import { backgroundUpdates } from '@/interface/hooks/backgroundUpdates'
|
||||
import { ThemeManager } from '@/plugins/built-in/themes/theme-manager'
|
||||
|
||||
const themeManager = ThemeManager.getInstance();
|
||||
|
||||
type Background = {
|
||||
id: string;
|
||||
category: string;
|
||||
type: string;
|
||||
lowResUrl: string;
|
||||
highResUrl: string;
|
||||
name: string;
|
||||
description: string;
|
||||
featured?: boolean;
|
||||
};
|
||||
let {
|
||||
searchTerm,
|
||||
selectedCategory,
|
||||
onCategoriesChange,
|
||||
}: {
|
||||
type Background = { id: string; category: string; type: string; lowResUrl: string; highResUrl: string; name: string; description: string; featured?: boolean };
|
||||
let { searchTerm, selectedCategory, onCategoriesChange }: {
|
||||
searchTerm: string;
|
||||
selectedCategory: string;
|
||||
onCategoriesChange: (categories: string[]) => void;
|
||||
@@ -42,16 +20,14 @@
|
||||
let isLoading = $state<boolean>(true);
|
||||
let savedBackgrounds = $state<string[]>([]);
|
||||
let installingBackgrounds = $state<Set<string>>(new Set());
|
||||
let debugInfo = $state<string>("");
|
||||
let activeTab = $state<"all" | "installed" | "photos" | "videos">("all");
|
||||
let sortBy = $state<"newest" | "popular" | "name">("newest");
|
||||
let debugInfo = $state<string>('');
|
||||
let activeTab = $state<'all' | 'installed' | 'photos' | 'videos'>('all');
|
||||
let sortBy = $state<'newest' | 'popular' | 'name'>('newest');
|
||||
|
||||
const loadStore = async () => {
|
||||
try {
|
||||
debugInfo = "Fetching backgrounds...";
|
||||
const response = await fetch(
|
||||
"https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Themes/main/store/backgrounds.json",
|
||||
);
|
||||
debugInfo = 'Fetching backgrounds...';
|
||||
const response = await fetch('https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Themes/main/store/backgrounds.json');
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
@@ -61,8 +37,8 @@
|
||||
debugInfo = `Loaded ${backgrounds.length} backgrounds`;
|
||||
await loadSavedBackgrounds();
|
||||
} catch (e) {
|
||||
error = "Failed to load background store";
|
||||
debugInfo = `Error: ${e instanceof Error ? e.message : "Unknown error"}`;
|
||||
error = 'Failed to load background store';
|
||||
debugInfo = `Error: ${e instanceof Error ? e.message : 'Unknown error'}`;
|
||||
} finally {
|
||||
isLoading = false;
|
||||
}
|
||||
@@ -75,16 +51,15 @@
|
||||
}
|
||||
await openDatabase();
|
||||
const data = await readAllData();
|
||||
savedBackgrounds = data.map((item) => item.id);
|
||||
savedBackgrounds = data.map(item => item.id);
|
||||
} catch (e) {
|
||||
error = e instanceof Error ? e.message : "Unknown error occurred";
|
||||
error = e instanceof Error ? e.message : 'Unknown error occurred';
|
||||
}
|
||||
}
|
||||
|
||||
loadStore();
|
||||
|
||||
let filteredBackgrounds = $derived(
|
||||
(() => {
|
||||
let filteredBackgrounds = $derived((() => {
|
||||
let filtered = backgrounds;
|
||||
|
||||
if (searchTerm.trim()) {
|
||||
@@ -95,20 +70,20 @@
|
||||
}
|
||||
|
||||
filtered = filtered.filter((bg: Background) => {
|
||||
return selectedCategory === "All"
|
||||
return selectedCategory === 'All'
|
||||
? true
|
||||
: selectedCategory === "Featured"
|
||||
: selectedCategory === 'Featured'
|
||||
? bg.featured
|
||||
: bg.category === selectedCategory;
|
||||
});
|
||||
|
||||
filtered.sort((a: Background, b: Background) => {
|
||||
switch (sortBy) {
|
||||
case "name":
|
||||
case 'name':
|
||||
return a.name.localeCompare(b.name);
|
||||
case "newest":
|
||||
case 'newest':
|
||||
return -1;
|
||||
case "popular":
|
||||
case 'popular':
|
||||
return -1;
|
||||
default:
|
||||
return 0;
|
||||
@@ -116,10 +91,9 @@
|
||||
});
|
||||
|
||||
return filtered;
|
||||
})(),
|
||||
);
|
||||
})());
|
||||
|
||||
let categories = $derived([...new Set(backgrounds.map((bg) => bg.category))]);
|
||||
let categories = $derived([...new Set(backgrounds.map(bg => bg.category))]);
|
||||
async function saveBackgroundFromUrl(url: string, id: string, fileType: string): Promise<void> {
|
||||
try {
|
||||
if (!isIndexedDBSupported()) {
|
||||
@@ -137,7 +111,7 @@
|
||||
await writeData(id, fileType, blob);
|
||||
savedBackgrounds = [...savedBackgrounds, id];
|
||||
} catch (e) {
|
||||
error = e instanceof Error ? e.message : "Unknown error occurred";
|
||||
error = e instanceof Error ? e.message : 'Unknown error occurred';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,14 +119,13 @@
|
||||
installingBackgrounds = new Set(installingBackgrounds).add(fileId);
|
||||
try {
|
||||
await deleteData(fileId);
|
||||
savedBackgrounds = savedBackgrounds.filter((id) => id !== fileId);
|
||||
savedBackgrounds = savedBackgrounds.filter(id => id !== fileId);
|
||||
|
||||
if (selectedBackground === fileId) {
|
||||
selectNoBackground();
|
||||
}
|
||||
} catch (e) {
|
||||
error =
|
||||
e instanceof Error ? `Failed to delete background: ${e.message}` : "Unknown error occurred";
|
||||
error = e instanceof Error ? `Failed to delete background: ${e.message}` : 'Unknown error occurred';
|
||||
} finally {
|
||||
installingBackgrounds = new Set(installingBackgrounds);
|
||||
installingBackgrounds.delete(fileId);
|
||||
@@ -180,7 +153,7 @@
|
||||
|
||||
function selectNoBackground() {
|
||||
selectedBackground = null;
|
||||
themeManager.setTheme("");
|
||||
themeManager.setTheme('');
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -188,9 +161,7 @@
|
||||
<!-- Header -->
|
||||
<div class="sticky top-0 z-10 p-4 border-b bg-[#F1F1F3] dark:bg-zinc-900 dark:border-zinc-700">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h1 class="text-2xl font-bold">
|
||||
Explore Backgrounds {searchTerm ? `- "${searchTerm}"` : ""}
|
||||
</h1>
|
||||
<h1 class="text-2xl font-bold">Explore Backgrounds {searchTerm ? `- "${searchTerm}"` : ''}</h1>
|
||||
<div class="flex gap-4 items-center">
|
||||
<select
|
||||
bind:value={sortBy}
|
||||
@@ -204,15 +175,12 @@
|
||||
|
||||
<!-- Tabs -->
|
||||
<div class="flex gap-2">
|
||||
{#each ["All", "Installed", "Photos", "Videos"] as tab}
|
||||
{#each ['All', 'Installed', 'Photos', 'Videos'] as tab}
|
||||
<button
|
||||
class={`px-4 py-2 text-sm font-medium transition-colors rounded-full
|
||||
${
|
||||
activeTab === tab.toLowerCase()
|
||||
? "bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700"
|
||||
: "bg-zinc-100 dark:bg-transparent dark:outline-solid dark:outline-zinc-700 hover:bg-zinc-200 dark:hover:bg-zinc-700/20"
|
||||
}`}
|
||||
onclick={() => (activeTab = tab.toLowerCase() as typeof activeTab)}
|
||||
${activeTab === tab.toLowerCase() ? 'bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700' :
|
||||
'bg-zinc-100 dark:bg-transparent dark:outline-solid dark:outline-zinc-700 hover:bg-zinc-200 dark:hover:bg-zinc-700/20'}`}
|
||||
onclick={() => activeTab = tab.toLowerCase() as typeof activeTab}
|
||||
>
|
||||
{tab}
|
||||
</button>
|
||||
@@ -229,9 +197,7 @@
|
||||
<!-- Image placeholder -->
|
||||
<div class="w-full h-48 bg-zinc-200 dark:bg-zinc-800"></div>
|
||||
<!-- Gradient overlay -->
|
||||
<div
|
||||
class="absolute right-0 bottom-0 left-0 h-16 to-transparent bg-linear-to-t from-zinc-300 dark:from-zinc-700"
|
||||
>
|
||||
<div class="absolute right-0 bottom-0 left-0 h-16 to-transparent bg-linear-to-t from-zinc-300 dark:from-zinc-700">
|
||||
<!-- Title placeholder -->
|
||||
<div class="absolute right-2 bottom-2 left-2">
|
||||
<div class="w-2/3 h-4 rounded-full bg-zinc-200 dark:bg-zinc-800"></div>
|
||||
@@ -248,45 +214,38 @@
|
||||
{:else}
|
||||
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{#each filteredBackgrounds.filter((bg: Background) => {
|
||||
if (activeTab === "installed") return savedBackgrounds.includes(bg.id);
|
||||
if (activeTab === "photos") return bg.type === "image";
|
||||
if (activeTab === "videos") return bg.type !== "image";
|
||||
if (activeTab === 'installed') return savedBackgrounds.includes(bg.id);
|
||||
if (activeTab === 'photos') return bg.type === 'image';
|
||||
if (activeTab === 'videos') return bg.type !== 'image';
|
||||
return true;
|
||||
}) as background (background.id)}
|
||||
<div
|
||||
class="overflow-hidden relative rounded-lg shadow-lg cursor-pointer group"
|
||||
onclick={() => toggleBackgroundInstallation(background)}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
toggleBackgroundInstallation(background);
|
||||
}
|
||||
}}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
{#if background.type === "image"}
|
||||
<img
|
||||
src={background.lowResUrl}
|
||||
alt={background.name}
|
||||
class="object-cover w-full h-48 transition-all duration-300 group-hover:scale-105"
|
||||
/>
|
||||
{#if background.type === 'image'}
|
||||
<img src={background.lowResUrl} alt={background.name} class="object-cover w-full h-48 transition-all duration-300 group-hover:scale-105" />
|
||||
{:else}
|
||||
<video src={background.lowResUrl} class="object-cover w-full h-48" muted loop autoplay
|
||||
></video>
|
||||
<video src={background.lowResUrl} class="object-cover w-full h-48" muted loop autoplay></video>
|
||||
{/if}
|
||||
<div
|
||||
class={`flex absolute inset-0 justify-center items-center opacity-0 transition-opacity duration-300 bg-black/50 group-hover:opacity-100 ${installingBackgrounds.has(background.id) ? "opacity-100" : ""}`}
|
||||
>
|
||||
<div class={`flex absolute inset-0 justify-center items-center opacity-0 transition-opacity duration-300 bg-black/50 group-hover:opacity-100 ${installingBackgrounds.has(background.id) ? 'opacity-100' : ''}`}>
|
||||
{#if installingBackgrounds.has(background.id)}
|
||||
<Spinner />
|
||||
{:else if savedBackgrounds.includes(background.id)}
|
||||
<span class="flex items-center text-white">
|
||||
<TrashIcon size="1em" class="mr-2 text-2xl" />
|
||||
<span class="mr-2 text-2xl not-italic font-IconFamily" aria-hidden="true"></span>
|
||||
<span class="text-sm font-semibold">Remove</span>
|
||||
</span>
|
||||
{:else}
|
||||
<span class="flex items-center text-white">
|
||||
<DownloadIcon size="1em" class="mr-2 text-2xl" />
|
||||
<span class="mr-2 text-2xl not-italic font-IconFamily" aria-hidden="true"></span>
|
||||
<span class="text-sm font-semibold">Install</span>
|
||||
</span>
|
||||
{/if}
|
||||
@@ -303,7 +262,7 @@
|
||||
<h3 class="mb-2 font-bold">Debug Info:</h3>
|
||||
<p>{debugInfo}</p>
|
||||
<p>Total backgrounds: {backgrounds.length}</p>
|
||||
<p>Categories: {categories.join(", ") || "<empty>"}</p>
|
||||
<p>Categories: {categories.join(', ') || '<empty>'}</p>
|
||||
<p>Active Tab: {activeTab}</p>
|
||||
<p>Selected Category: {selectedCategory}</p>
|
||||
</div>
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
<script lang="ts">
|
||||
import CircleUserRoundIcon from "@lucide/svelte/icons/circle-user-round";
|
||||
import { onMount } from "svelte";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
|
||||
let {
|
||||
alwaysShowUserName = false,
|
||||
onClick = undefined,
|
||||
compact = false,
|
||||
}: {
|
||||
let { alwaysShowUserName = false, onClick = undefined, compact = false }: {
|
||||
alwaysShowUserName?: boolean;
|
||||
onClick?: () => void;
|
||||
compact?: boolean;
|
||||
@@ -77,9 +72,7 @@
|
||||
<button
|
||||
type="button"
|
||||
onclick={handleButtonClick}
|
||||
class="flex items-center gap-2 bg-zinc-100/80 font-medium text-zinc-700 transition-colors duration-150 hover:bg-zinc-200 hover:text-zinc-950 dark:bg-zinc-900/50 dark:text-zinc-200 dark:hover:bg-zinc-700 dark:hover:text-white {compact
|
||||
? 'h-8 rounded-lg px-3 text-[0.75rem]'
|
||||
: 'h-12 rounded-full px-4 text-sm'}"
|
||||
class="flex items-center gap-2 bg-zinc-100/80 font-medium text-zinc-700 transition-colors duration-150 hover:bg-zinc-200 hover:text-zinc-950 focus:outline-hidden dark:bg-zinc-900/50 dark:text-zinc-200 dark:hover:bg-zinc-700 dark:hover:text-white {compact ? 'h-8 rounded-lg px-3 text-[0.75rem]' : 'h-12 rounded-full px-4 text-sm'}"
|
||||
>
|
||||
{#if cloudState.isLoggedIn}
|
||||
{#if cloudState.user?.pfpUrl}
|
||||
@@ -89,9 +82,7 @@
|
||||
/>
|
||||
{/if}
|
||||
{#if !cloudState.user?.pfpUrl}
|
||||
<div
|
||||
class="flex items-center justify-center w-5 h-5 rounded-full bg-zinc-300 dark:bg-zinc-600 text-zinc-700 dark:text-zinc-200 font-semibold text-[0.6rem]"
|
||||
>
|
||||
<div class="flex items-center justify-center w-5 h-5 rounded-full bg-zinc-300 dark:bg-zinc-600 text-zinc-700 dark:text-zinc-200 font-semibold text-[0.6rem]">
|
||||
{getInitials()}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -100,13 +91,10 @@
|
||||
? "inline max-w-40 truncate"
|
||||
: "hidden max-w-24 truncate sm:inline"}
|
||||
>
|
||||
{cloudState.user?.displayName ||
|
||||
cloudState.user?.username ||
|
||||
cloudState.user?.email ||
|
||||
"User"}
|
||||
{cloudState.user?.displayName || cloudState.user?.username || cloudState.user?.email || "User"}
|
||||
</span>
|
||||
{:else}
|
||||
<CircleUserRoundIcon size="1em" class="text-sm" />
|
||||
<span class="text-sm font-IconFamily" aria-hidden="true">{'\ued53'}</span>
|
||||
<span>Sign in</span>
|
||||
{/if}
|
||||
</button>
|
||||
@@ -134,23 +122,16 @@
|
||||
/>
|
||||
{/if}
|
||||
{#if !cloudState.user?.pfpUrl}
|
||||
<div
|
||||
class="flex items-center justify-center w-12 h-12 rounded-full bg-zinc-300 dark:bg-zinc-600 text-zinc-700 dark:text-zinc-200 font-semibold text-base"
|
||||
>
|
||||
<div class="flex items-center justify-center w-12 h-12 rounded-full bg-zinc-300 dark:bg-zinc-600 text-zinc-700 dark:text-zinc-200 font-semibold text-base">
|
||||
{getInitials()}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="text-base font-medium text-zinc-900 dark:text-white truncate">
|
||||
{cloudState.user?.displayName ||
|
||||
cloudState.user?.username ||
|
||||
cloudState.user?.email ||
|
||||
"User"}
|
||||
{cloudState.user?.displayName || cloudState.user?.username || cloudState.user?.email || "User"}
|
||||
</p>
|
||||
{#if cloudState.user?.email && cloudState.user?.email !== (cloudState.user?.displayName || cloudState.user?.username)}
|
||||
<p class="text-base text-zinc-500 dark:text-zinc-400 truncate">
|
||||
{cloudState.user.email}
|
||||
</p>
|
||||
<p class="text-base text-zinc-500 dark:text-zinc-400 truncate">{cloudState.user.email}</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
<script lang="ts">
|
||||
import ChevronLeftIcon from "@lucide/svelte/icons/chevron-left";
|
||||
import ChevronRightIcon from "@lucide/svelte/icons/chevron-right";
|
||||
import StarIcon from "@lucide/svelte/icons/star";
|
||||
import { fade } from "svelte/transition";
|
||||
import type { ThemeCoverSlide } from "@/interface/types/theme";
|
||||
import emblaCarouselSvelte from "embla-carousel-svelte";
|
||||
import Autoplay from "embla-carousel-autoplay";
|
||||
import { fade } from 'svelte/transition';
|
||||
import type { ThemeCoverSlide } from '@/interface/types/theme';
|
||||
import emblaCarouselSvelte from 'embla-carousel-svelte';
|
||||
import Autoplay from 'embla-carousel-autoplay';
|
||||
|
||||
let {
|
||||
slides,
|
||||
setDisplayTheme,
|
||||
}: {
|
||||
let { slides, setDisplayTheme }: {
|
||||
slides: ThemeCoverSlide[];
|
||||
setDisplayTheme: (theme: import("@/interface/types/theme").Theme) => void;
|
||||
setDisplayTheme: (theme: import('@/interface/types/theme').Theme) => void;
|
||||
} = $props();
|
||||
let emblaApi = $state();
|
||||
|
||||
@@ -40,38 +34,37 @@
|
||||
</script>
|
||||
|
||||
{#if slides.length > 0}
|
||||
<div
|
||||
class="relative w-full overflow-clip rounded-xl ring-1 ring-black/10 transition-opacity dark:ring-white/10"
|
||||
transition:fade
|
||||
>
|
||||
<div class="relative w-full overflow-clip rounded-xl ring-1 ring-black/10 transition-opacity dark:ring-white/10" transition:fade>
|
||||
<div
|
||||
class="w-full overflow-hidden"
|
||||
use:emblaCarouselSvelte={{ options, plugins }}
|
||||
onemblaInit={onInit}
|
||||
>
|
||||
<div class="flex">
|
||||
{#each slides as slide (slide.imageUrl + slide.title + (slide.subtitle ?? ""))}
|
||||
{#each slides as slide (slide.imageUrl + slide.title + (slide.subtitle ?? ''))}
|
||||
<div
|
||||
class="cover-slide relative isolate min-w-0 flex-[0_0_100%] cursor-pointer overflow-hidden"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onkeydown={(e) => {
|
||||
if (e.key === "Enter") setDisplayTheme(slide.openTheme);
|
||||
if (e.key === 'Enter') setDisplayTheme(slide.openTheme);
|
||||
}}
|
||||
onclick={() => setDisplayTheme(slide.openTheme)}
|
||||
>
|
||||
<img
|
||||
src={slide.imageUrl}
|
||||
alt=""
|
||||
class="absolute inset-0 z-0 h-full w-full object-cover"
|
||||
/>
|
||||
<img src={slide.imageUrl} alt="" class="absolute inset-0 z-0 h-full w-full object-cover" />
|
||||
{#if slide.badgeFeatured === true}
|
||||
<div class="absolute top-4 left-4 z-2 pointer-events-none">
|
||||
<span
|
||||
class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100 shadow-xs"
|
||||
aria-label="Featured theme"
|
||||
>
|
||||
<StarIcon class="w-3.5 h-3.5" fill="currentColor" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-3.5 h-3.5">
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
Featured
|
||||
</span>
|
||||
</div>
|
||||
@@ -82,9 +75,7 @@
|
||||
<p class="text-lg font-medium text-white/95 mt-1 line-clamp-2">{slide.subtitle}</p>
|
||||
{/if}
|
||||
{#if slide.openTheme.author && !slide.subtitle}
|
||||
<p class="text-sm text-white/90 mt-1 mb-1 line-clamp-1">
|
||||
By {slide.openTheme.author}
|
||||
</p>
|
||||
<p class="text-sm text-white/90 mt-1 mb-1 line-clamp-1">By {slide.openTheme.author}</p>
|
||||
{/if}
|
||||
{#if slide.openTheme.description && !slide.subtitle}
|
||||
<p class="text-lg text-white line-clamp-3">{slide.openTheme.description}</p>
|
||||
@@ -102,7 +93,9 @@
|
||||
type="button"
|
||||
class="flex justify-center items-center w-8 h-8 text-white rounded-full bg-black/50 dark:bg-zinc-800 transition-all duration-200"
|
||||
>
|
||||
<ChevronLeftIcon class="w-6 h-6" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width={1.5} stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m15.75 19.5-7.5-7.5 7.5-7.5" />
|
||||
</svg>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Next"
|
||||
@@ -110,7 +103,9 @@
|
||||
type="button"
|
||||
class="flex justify-center items-center w-8 h-8 text-white rounded-full bg-black/50 dark:bg-zinc-800 transition-all duration-200"
|
||||
>
|
||||
<ChevronRightIcon class="w-6 h-6" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width={1.5} stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m8.25 4.5 7.5 7.5-7.5 7.5" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -134,7 +129,7 @@
|
||||
rgb(0 0 0 / 8%) 72%,
|
||||
transparent 88%
|
||||
);
|
||||
content: "";
|
||||
content: '';
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,4 @@
|
||||
<script lang="ts">
|
||||
import SearchIcon from "@lucide/svelte/icons/search";
|
||||
import Minimize2Icon from "@lucide/svelte/icons/minimize-2";
|
||||
import darkLogo from "@/resources/icons/betterseqta-dark-full.png";
|
||||
import lightLogo from "@/resources/icons/betterseqta-light-full.png";
|
||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||
@@ -95,9 +93,15 @@
|
||||
>
|
||||
<label class="relative block w-40 md:w-48 xl:w-56">
|
||||
<span class="sr-only">Search {activePage}</span>
|
||||
<SearchIcon
|
||||
<svg
|
||||
class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"
|
||||
/>
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m21 21-4.35-4.35m1.35-5.65a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z" />
|
||||
</svg>
|
||||
<input
|
||||
type="search"
|
||||
placeholder={activePage === "themes" ? "Search themes" : "Search backgrounds"}
|
||||
@@ -114,15 +118,10 @@
|
||||
{/if}
|
||||
|
||||
{#if onToggleSize}
|
||||
<button
|
||||
type="button"
|
||||
onclick={onToggleSize}
|
||||
class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] dark:text-zinc-400 dark:hover:text-white"
|
||||
aria-label="Collapse settings"
|
||||
title="Collapse settings"
|
||||
aria-expanded="true"
|
||||
>
|
||||
<Minimize2Icon size="1em" class="text-2xl" />
|
||||
<button type="button" onclick={onToggleSize}
|
||||
class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] focus:outline-hidden dark:text-zinc-400 dark:hover:text-white"
|
||||
aria-label="Collapse settings" title="Collapse settings" aria-expanded="true">
|
||||
<span class="font-IconFamily text-2xl" aria-hidden="true">{"\uec06"}</span>
|
||||
</button>
|
||||
{/if}
|
||||
<PlainCloseButton onclick={onClose} label="Close settings" />
|
||||
@@ -151,12 +150,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
.store-search {
|
||||
.store-search,
|
||||
.store-search:focus,
|
||||
.store-search:focus-visible {
|
||||
appearance: none;
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
.store-search:focus-visible {
|
||||
outline-offset: -2px;
|
||||
outline: 0 !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,26 +1,13 @@
|
||||
<script lang="ts">
|
||||
import CheckIcon from "@lucide/svelte/icons/check";
|
||||
import DownloadIcon from "@lucide/svelte/icons/download";
|
||||
import HeartIcon from "@lucide/svelte/icons/heart";
|
||||
import StarIcon from "@lucide/svelte/icons/star";
|
||||
import type { Theme } from "@/interface/types/theme";
|
||||
import type { Theme } from '@/interface/types/theme'
|
||||
import {
|
||||
masterGridDisplayDownloadCount,
|
||||
gridCardPreviewImageUrls,
|
||||
} from "@/interface/utils/themeStoreFlavours";
|
||||
import { isStoreThemeInstalled } from "@/interface/utils/themeListFilters";
|
||||
import emblaCarouselSvelte from "embla-carousel-svelte";
|
||||
import Autoplay from "embla-carousel-autoplay";
|
||||
let {
|
||||
theme,
|
||||
onClick,
|
||||
toggleFavorite,
|
||||
isLoggedIn,
|
||||
onRequestSignIn,
|
||||
allStoreThemeRows,
|
||||
installedThemeIds = [],
|
||||
variant = "official",
|
||||
}: {
|
||||
} from '@/interface/utils/themeStoreFlavours'
|
||||
import { isStoreThemeInstalled } from '@/interface/utils/themeListFilters'
|
||||
import emblaCarouselSvelte from 'embla-carousel-svelte';
|
||||
import Autoplay from 'embla-carousel-autoplay';
|
||||
let { theme, onClick, toggleFavorite, isLoggedIn, onRequestSignIn, allStoreThemeRows, installedThemeIds = [], variant = 'official' }: {
|
||||
theme: Theme;
|
||||
onClick: () => void;
|
||||
toggleFavorite: (theme: Theme) => void;
|
||||
@@ -29,7 +16,7 @@
|
||||
/** Raw API themes (includes hidden slaves) for aggregated master download totals */
|
||||
allStoreThemeRows?: Theme[];
|
||||
installedThemeIds?: string[];
|
||||
variant?: "official" | "community";
|
||||
variant?: 'official' | 'community';
|
||||
} = $props();
|
||||
|
||||
const displayDownloadCount = $derived(
|
||||
@@ -42,15 +29,13 @@
|
||||
|
||||
/** Mirrors CoverSwiper (featured bar): horizontal slides + autoplay */
|
||||
function prefersReducedMotion(): boolean {
|
||||
return (
|
||||
typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
||||
);
|
||||
return typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
}
|
||||
|
||||
/** Read once synchronously where `window` exists so reduced-motion doesn’t briefly mount carousel */
|
||||
let allowSlideAutoplay = $state(!prefersReducedMotion());
|
||||
|
||||
const gridEmblaKey = $derived(gridRotatorUrls.join("|"));
|
||||
const gridEmblaKey = $derived(gridRotatorUrls.join('|'));
|
||||
|
||||
const gridEmblaOptions = $derived({ loop: gridRotatorUrls.length > 1 });
|
||||
|
||||
@@ -66,11 +51,11 @@
|
||||
});
|
||||
|
||||
const isInstalled = $derived(isStoreThemeInstalled(theme, installedThemeIds));
|
||||
const isCommunity = $derived(variant === "community");
|
||||
const isCommunity = $derived(variant === 'community');
|
||||
const showFavorites = $derived(!isCommunity);
|
||||
|
||||
function handleCardClick(e: MouseEvent) {
|
||||
if ((e.target as HTMLElement).closest("[data-theme-favorite]")) return;
|
||||
if ((e.target as HTMLElement).closest('[data-theme-favorite]')) return;
|
||||
onClick();
|
||||
}
|
||||
|
||||
@@ -110,26 +95,22 @@
|
||||
class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100 shadow-xs"
|
||||
aria-label="Featured theme"
|
||||
>
|
||||
<StarIcon class="w-3.5 h-3.5" fill="currentColor" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-3.5 h-3.5">
|
||||
<path fill-rule="evenodd" d="M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
Featured
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if isInstalled}
|
||||
<div
|
||||
class="absolute top-2 z-20 pointer-events-none {theme.featured === true
|
||||
? isCommunity
|
||||
? 'left-44'
|
||||
: 'left-22'
|
||||
: isCommunity
|
||||
? 'left-23'
|
||||
: 'left-2'}"
|
||||
>
|
||||
<div class="absolute top-2 z-20 pointer-events-none {theme.featured === true ? (isCommunity ? 'left-44' : 'left-22') : isCommunity ? 'left-23' : 'left-2'}">
|
||||
<span
|
||||
class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-emerald-100 text-emerald-900 dark:bg-emerald-950 dark:text-emerald-100 shadow-xs"
|
||||
aria-label="Installed"
|
||||
>
|
||||
<CheckIcon class="w-3.5 h-3.5" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-3.5 h-3.5">
|
||||
<path fill-rule="evenodd" d="M19.916 4.626a.75.75 0 01.208 1.04l-9 13.5a.75.75 0 01-1.154.114l-6-6a.75.75 0 011.06-1.06l5.353 5.353 8.493-12.739a.75.75 0 011.04-.208z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
Installed
|
||||
</span>
|
||||
</div>
|
||||
@@ -138,23 +119,30 @@
|
||||
<button
|
||||
type="button"
|
||||
data-theme-favorite
|
||||
class="pointer-events-none absolute right-2 top-2 z-20 flex h-10 w-10 scale-[0.25] items-center justify-center rounded-full bg-black/50 text-white opacity-0 blur-xs transition-[opacity,transform,filter,background-color] duration-200 ease-[cubic-bezier(0.2,0,0,1)] hover:bg-black/70 active:scale-[0.96] group-hover:pointer-events-auto group-hover:scale-100 group-hover:opacity-100 group-hover:blur-0 focus-visible:pointer-events-auto focus-visible:scale-100 focus-visible:opacity-100 focus-visible:blur-0"
|
||||
class="pointer-events-none absolute right-2 top-2 z-20 flex h-10 w-10 scale-[0.25] items-center justify-center rounded-full bg-black/50 text-white opacity-0 blur-xs transition-[opacity,transform,filter,background-color] duration-200 ease-[cubic-bezier(0.2,0,0,1)] hover:bg-black/70 active:scale-[0.96] group-hover:pointer-events-auto group-hover:scale-100 group-hover:opacity-100 group-hover:blur-0 focus-visible:pointer-events-auto focus-visible:scale-100 focus-visible:opacity-100 focus-visible:blur-0 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-white"
|
||||
onclick={handleFavoriteClick}
|
||||
aria-label={isLoggedIn
|
||||
? theme.is_favorited
|
||||
? "Remove from favourites"
|
||||
: "Add to favourites"
|
||||
: "Sign in to favourite themes"}
|
||||
? 'Remove from favourites'
|
||||
: 'Add to favourites'
|
||||
: 'Sign in to favourite themes'}
|
||||
title={isLoggedIn
|
||||
? theme.is_favorited
|
||||
? "Remove from favourites"
|
||||
: "Add to favourites"
|
||||
: "Sign in to favourite themes"}
|
||||
? 'Remove from favourites'
|
||||
: 'Add to favourites'
|
||||
: 'Sign in to favourite themes'}
|
||||
>
|
||||
<HeartIcon
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill={theme.is_favorited ? 'currentColor' : 'none'}
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
class="h-5 w-5 {theme.is_favorited ? 'text-red-500' : ''}"
|
||||
fill={theme.is_favorited ? "currentColor" : "none"}
|
||||
/>
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4.318 6.318a4.5 4.5 0 0 1 6.364 0L12 7.636l1.318-1.318a4.5 4.5 0 0 1 6.364 6.364L12 20.364l-7.682-7.682a4.5 4.5 0 0 1 0-6.364Z" />
|
||||
</svg>
|
||||
</button>
|
||||
{/if}
|
||||
<div class="absolute bottom-1 left-3 right-3 z-10 mb-1 flex flex-col gap-0.5">
|
||||
@@ -164,22 +152,23 @@
|
||||
{/if}
|
||||
<div class="flex gap-3 text-xs font-medium text-white/90 drop-shadow-xs">
|
||||
<span class="flex items-center gap-1">
|
||||
<DownloadIcon class="w-3.5 h-3.5" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-3.5 h-3.5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3" />
|
||||
</svg>
|
||||
{displayDownloadCount.toLocaleString()}
|
||||
</span>
|
||||
{#if showFavorites}
|
||||
<span class="flex items-center gap-1">
|
||||
<HeartIcon class="w-3.5 h-3.5" fill={theme.is_favorited ? "currentColor" : "none"} />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill={theme.is_favorited ? 'currentColor' : 'none'} stroke="currentColor" stroke-width="1.5" class="w-3.5 h-3.5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z" />
|
||||
</svg>
|
||||
{(theme.favorite_count ?? 0).toLocaleString()}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{#if gridRotatorUrls.length === 0}
|
||||
<div
|
||||
class="relative w-full h-48 overflow-hidden rounded-md bg-zinc-200 dark:bg-zinc-700"
|
||||
aria-hidden="true"
|
||||
></div>
|
||||
<div class="relative w-full h-48 overflow-hidden rounded-md bg-zinc-200 dark:bg-zinc-700" aria-hidden="true"></div>
|
||||
{:else if !allowSlideAutoplay || gridRotatorUrls.length === 1}
|
||||
<div class="relative w-full h-48 overflow-hidden rounded-md">
|
||||
<img
|
||||
@@ -230,7 +219,7 @@
|
||||
rgb(0 0 0 / 16%) 72%,
|
||||
transparent 88%
|
||||
);
|
||||
content: "";
|
||||
content: '';
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import PlusIcon from "@lucide/svelte/icons/plus";
|
||||
let { onFileChange }: { onFileChange?: (file: File) => void } = $props();
|
||||
|
||||
function handleFileChange(event: Event) {
|
||||
@@ -15,9 +14,10 @@
|
||||
|
||||
<div class="relative w-16 h-16 overflow-hidden transition rounded-xl bg-zinc-100 dark:bg-zinc-900">
|
||||
<div
|
||||
class="flex items-center justify-center w-full h-full text-3xl font-bold text-gray-400 transition hover:text-gray-500 pointer-events-none"
|
||||
class="flex items-center justify-center w-full h-full text-3xl font-bold text-gray-400 transition font-IconFamily hover:text-gray-500 pointer-events-none"
|
||||
>
|
||||
<PlusIcon size="1em" />
|
||||
<!-- Plus icon -->
|
||||
|
||||
</div>
|
||||
<input
|
||||
type="file"
|
||||
|
||||
@@ -1,29 +1,20 @@
|
||||
<script lang="ts">
|
||||
import HeartIcon from "@lucide/svelte/icons/heart";
|
||||
import CloudUploadIcon from "@lucide/svelte/icons/cloud-upload";
|
||||
import PencilIcon from "@lucide/svelte/icons/pencil";
|
||||
import PlusIcon from "@lucide/svelte/icons/plus";
|
||||
import ShoppingCartIcon from "@lucide/svelte/icons/shopping-cart";
|
||||
import UploadIcon from "@lucide/svelte/icons/upload";
|
||||
import type { CustomTheme, ThemeList } from "@/types/customThemes";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import browser from "@/lib/browser";
|
||||
import { themeUpdates } from "@/interface/hooks/themeUpdates";
|
||||
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
import SignInToFavoriteModal from "@/interface/components/SignInToFavoriteModal.svelte";
|
||||
import ThemeBlobImage from "@/interface/components/themes/ThemeBlobImage.svelte";
|
||||
import ThemePlaceholderCover from "@/interface/components/themes/ThemePlaceholderCover.svelte";
|
||||
import { isLocalCustomTheme } from "@/interface/utils/themeListFilters";
|
||||
import { formatCustomThemeApiError } from "@/seqta/utils/customThemes/apiErrors";
|
||||
import type { CustomTheme, ThemeList } from '@/types/customThemes'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import browser from '@/lib/browser'
|
||||
import { themeUpdates } from '@/interface/hooks/themeUpdates'
|
||||
import { ThemeManager } from '@/plugins/built-in/themes/theme-manager'
|
||||
import { cloudAuth } from '@/seqta/utils/cloudAuth'
|
||||
import SignInToFavoriteModal from '@/interface/components/SignInToFavoriteModal.svelte'
|
||||
import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
|
||||
import ThemePlaceholderCover from '@/interface/components/themes/ThemePlaceholderCover.svelte'
|
||||
import { isLocalCustomTheme } from '@/interface/utils/themeListFilters'
|
||||
import { formatCustomThemeApiError } from '@/seqta/utils/customThemes/apiErrors'
|
||||
|
||||
const themeManager = ThemeManager.getInstance();
|
||||
|
||||
let themes = $state<ThemeList | null>(null);
|
||||
let {
|
||||
isEditMode,
|
||||
showNavigation = true,
|
||||
}: {
|
||||
let { isEditMode, showNavigation = true }: {
|
||||
isEditMode: boolean;
|
||||
showNavigation?: boolean;
|
||||
} = $props();
|
||||
@@ -49,50 +40,50 @@
|
||||
if (theme.id === themes?.selectedTheme) {
|
||||
themeManager.setTransitionPoint(e.clientX, e.clientY);
|
||||
await themeManager.disableTheme();
|
||||
themes.selectedTheme = "";
|
||||
themes.selectedTheme = '';
|
||||
} else {
|
||||
themeManager.setTransitionPoint(e.clientX, e.clientY);
|
||||
await themeManager.setTheme(theme.id);
|
||||
if (!themes) return;
|
||||
themes.selectedTheme = theme.id;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const handleThemeDelete = async (themeId: string) => {
|
||||
try {
|
||||
await themeManager.deleteTheme(themeId);
|
||||
if (!themes) return;
|
||||
|
||||
themes.themes = themes.themes.filter((theme) => theme.id !== themeId);
|
||||
themes.themes = themes.themes.filter(theme => theme.id !== themeId);
|
||||
if (themeId === themes.selectedTheme) {
|
||||
themes.selectedTheme = "";
|
||||
themes.selectedTheme = '';
|
||||
await themeManager.disableTheme();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error deleting theme:", error);
|
||||
console.error('Error deleting theme:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleShareTheme = async (theme: CustomTheme) => {
|
||||
try {
|
||||
await themeManager.shareTheme(theme.id);
|
||||
} catch (error) {
|
||||
console.error("Error sharing theme:", error);
|
||||
console.error('Error sharing theme:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const fetchThemes = async () => {
|
||||
themes = {
|
||||
themes: await themeManager.getAvailableThemes(),
|
||||
selectedTheme: themeManager.getSelectedThemeId() || "",
|
||||
};
|
||||
selectedTheme: themeManager.getSelectedThemeId() || '',
|
||||
}
|
||||
if (themes && cloudLoggedIn) {
|
||||
const status: Record<string, boolean> = {};
|
||||
await Promise.all(
|
||||
themes.themes.map(async (t) => {
|
||||
try {
|
||||
const res = (await browser.runtime.sendMessage({
|
||||
type: "fetchThemeDetails",
|
||||
type: 'fetchThemeDetails',
|
||||
themeId: t.id,
|
||||
})) as { success?: boolean; data?: { theme?: { is_favorited?: boolean } } };
|
||||
if (res?.success && res?.data?.theme) {
|
||||
@@ -101,22 +92,23 @@
|
||||
} catch {
|
||||
// Theme may not exist on store (e.g. locally created)
|
||||
}
|
||||
}),
|
||||
})
|
||||
);
|
||||
favoriteStatus = status;
|
||||
} else {
|
||||
favoriteStatus = {};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const openStorePage = async () => {
|
||||
await (await import("@/seqta/ui/renderStore")).openStorePage();
|
||||
};
|
||||
const { openStorePage } = await import('@/seqta/ui/renderStore')
|
||||
await openStorePage()
|
||||
}
|
||||
|
||||
const openThemeCreator = async (themeId?: string) => {
|
||||
const { launchPageThemeBuilder } = await import("@/seqta/utils/launchPageThemeBuilder");
|
||||
await launchPageThemeBuilder(themeId);
|
||||
};
|
||||
const { launchPageThemeBuilder } = await import('@/seqta/utils/launchPageThemeBuilder')
|
||||
await launchPageThemeBuilder(themeId)
|
||||
}
|
||||
|
||||
const submitCustomTheme = async (theme: CustomTheme, e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
@@ -127,14 +119,14 @@
|
||||
}
|
||||
submittingThemeId = theme.id;
|
||||
try {
|
||||
const { submitThemeById } = await import("@/seqta/utils/customThemes/submitLocalTheme");
|
||||
const { submitThemeById } = await import('@/seqta/utils/customThemes/submitLocalTheme');
|
||||
await submitThemeById(theme.id, theme.description?.trim() || undefined);
|
||||
} catch (err) {
|
||||
submitError = formatCustomThemeApiError(err);
|
||||
} finally {
|
||||
submittingThemeId = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const handleToggleFavorite = async (theme: CustomTheme, e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
@@ -144,23 +136,23 @@
|
||||
}
|
||||
const isFavorite = !favoriteStatus[theme.id];
|
||||
const result = (await browser.runtime.sendMessage({
|
||||
type: "cloudFavorite",
|
||||
type: 'cloudFavorite',
|
||||
themeId: theme.id,
|
||||
action: isFavorite ? "favorite" : "unfavorite",
|
||||
action: isFavorite ? 'favorite' : 'unfavorite',
|
||||
})) as { success?: boolean };
|
||||
if (result?.success) {
|
||||
favoriteStatus = { ...favoriteStatus, [theme.id]: isFavorite };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
await fetchThemes();
|
||||
themeUpdates.addListener(fetchThemes);
|
||||
});
|
||||
})
|
||||
|
||||
onDestroy(() => {
|
||||
themeUpdates.removeListener(fetchThemes);
|
||||
});
|
||||
})
|
||||
|
||||
const useTwoColumnLayout = $derived(!showNavigation);
|
||||
</script>
|
||||
@@ -170,26 +162,18 @@
|
||||
role="list"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div class={useTwoColumnLayout ? "grid grid-cols-2 gap-3" : "flex flex-col gap-2 px-2"}>
|
||||
<div class="{useTwoColumnLayout ? 'grid grid-cols-2 gap-3' : 'flex flex-col gap-2 px-2'}">
|
||||
{#if themes}
|
||||
{#each themes.themes as theme (theme.id)}
|
||||
<button
|
||||
class="relative group w-full aspect-theme flex justify-center items-center rounded-xl transition ring-3 dark:ring-white ring-zinc-300 {theme.id ===
|
||||
themes.selectedTheme
|
||||
? 'dark:ring-2 ring-4'
|
||||
: 'ring-0'}"
|
||||
class="relative group w-full aspect-theme flex justify-center items-center rounded-xl transition ring-3 dark:ring-white ring-zinc-300 {theme.id === themes.selectedTheme ? 'dark:ring-2 ring-4' : 'ring-0'}"
|
||||
onclick={(e) => handleThemeClick(theme, e)}
|
||||
>
|
||||
{#if isEditMode}
|
||||
<div
|
||||
class="flex absolute top-2 right-2 z-20 place-items-center p-2 w-6 h-6 text-white bg-red-600 rounded-full opacity-100"
|
||||
onclick={(event) => {
|
||||
event.stopPropagation();
|
||||
handleThemeDelete(theme.id);
|
||||
}}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") handleThemeDelete(theme.id);
|
||||
}}
|
||||
onclick={(event) => { event.stopPropagation(); handleThemeDelete(theme.id) }}
|
||||
onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') handleThemeDelete(theme.id) }}
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
>
|
||||
@@ -198,93 +182,59 @@
|
||||
{/if}
|
||||
|
||||
{#if !isEditMode}
|
||||
<div
|
||||
class="absolute inset-y-0 right-3 z-20 flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100"
|
||||
>
|
||||
<div class="absolute inset-y-0 right-3 z-20 flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100">
|
||||
{#if !isLocalCustomTheme(theme)}
|
||||
<div
|
||||
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-center {(favoriteStatus[
|
||||
theme.id
|
||||
] ?? false)
|
||||
? 'text-red-400'
|
||||
: 'text-white/80'}"
|
||||
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-center {(favoriteStatus[theme.id] ?? false) ? 'text-red-400' : 'text-white/80'}"
|
||||
onclick={(event) => handleToggleFavorite(theme, event)}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ")
|
||||
handleToggleFavorite(theme, event as any);
|
||||
}}
|
||||
onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') handleToggleFavorite(theme, event as any) }}
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
title={cloudLoggedIn
|
||||
? (favoriteStatus[theme.id] ?? false)
|
||||
? "Remove from favorites"
|
||||
: "Add to favorites"
|
||||
: "Sign in to favorite themes"}
|
||||
title={cloudLoggedIn ? ((favoriteStatus[theme.id] ?? false) ? 'Remove from favorites' : 'Add to favorites') : 'Sign in to favorite themes'}
|
||||
>
|
||||
<HeartIcon
|
||||
class="h-5 w-5"
|
||||
fill={(favoriteStatus[theme.id] ?? false) ? "currentColor" : "none"}
|
||||
/>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill={(favoriteStatus[theme.id] ?? false) ? 'currentColor' : 'none'} stroke="currentColor" stroke-width="2" class="h-5 w-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z" />
|
||||
</svg>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div
|
||||
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white/80"
|
||||
onclick={(event) => {
|
||||
event.stopPropagation();
|
||||
handleShareTheme(theme);
|
||||
}}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") handleShareTheme(theme);
|
||||
}}
|
||||
onclick={(event) => { event.stopPropagation(); handleShareTheme(theme) }}
|
||||
onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') handleShareTheme(theme) }}
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
title="Export theme"
|
||||
>
|
||||
<UploadIcon size="1em" class="text-lg" />
|
||||
<span class="text-lg font-IconFamily"></span>
|
||||
</div>
|
||||
|
||||
{#if isLocalCustomTheme(theme)}
|
||||
<div
|
||||
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white"
|
||||
onclick={(event) => {
|
||||
event.stopPropagation();
|
||||
void openThemeCreator(theme.id);
|
||||
}}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") void openThemeCreator(theme.id);
|
||||
}}
|
||||
onclick={(event) => { event.stopPropagation(); void openThemeCreator(theme.id) }}
|
||||
onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') void openThemeCreator(theme.id) }}
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
title="Edit theme"
|
||||
>
|
||||
<PencilIcon size="1em" class="text-lg" />
|
||||
<span class="text-lg font-IconFamily"></span>
|
||||
</div>
|
||||
<div
|
||||
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white {submittingThemeId ===
|
||||
theme.id
|
||||
? 'opacity-60'
|
||||
: ''}"
|
||||
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white {submittingThemeId === theme.id ? 'opacity-60' : ''}"
|
||||
onclick={(event) => void submitCustomTheme(theme, event)}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ")
|
||||
void submitCustomTheme(theme, event as unknown as MouseEvent);
|
||||
}}
|
||||
onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') void submitCustomTheme(theme, event as unknown as MouseEvent) }}
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
title="Submit to community"
|
||||
>
|
||||
<CloudUploadIcon size="1em" class="text-lg" />
|
||||
<span class="text-lg font-IconFamily"></span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div
|
||||
class="relative top-0 z-10 flex justify-center w-full h-full overflow-hidden transition dark:text-white rounded-xl group place-items-center bg-zinc-100 dark:bg-zinc-900 {isEditMode
|
||||
? 'animate-shake brightness-90'
|
||||
: ''}"
|
||||
>
|
||||
<div class="relative top-0 z-10 flex justify-center w-full h-full overflow-hidden transition dark:text-white rounded-xl group place-items-center bg-zinc-100 dark:bg-zinc-900 { isEditMode ? 'animate-shake brightness-90' : ''}">
|
||||
{#if theme.coverImage}
|
||||
<ThemeBlobImage
|
||||
source={theme.coverImage}
|
||||
@@ -306,31 +256,18 @@
|
||||
{/if}
|
||||
|
||||
{#if themes && themes.themes.length === 0}
|
||||
<div
|
||||
class="flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center {useTwoColumnLayout
|
||||
? 'col-span-2'
|
||||
: ''}"
|
||||
>
|
||||
<div class="flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center {useTwoColumnLayout ? 'col-span-2' : ''}">
|
||||
<h3 class="text-xl font-semibold text-zinc-900 dark:text-white" style="text-wrap: balance">
|
||||
No themes installed
|
||||
</h3>
|
||||
<p
|
||||
class="mt-2 max-w-md text-base text-zinc-500 dark:text-zinc-400"
|
||||
style="text-wrap: pretty"
|
||||
>
|
||||
<p class="mt-2 max-w-md text-base text-zinc-500 dark:text-zinc-400" style="text-wrap: pretty">
|
||||
Install a theme from the store or create one of your own.
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if submitError}
|
||||
<p
|
||||
class="whitespace-pre-line text-sm text-red-600 dark:text-red-400 {useTwoColumnLayout
|
||||
? 'col-span-2'
|
||||
: ''}"
|
||||
>
|
||||
{submitError}
|
||||
</p>
|
||||
<p class="whitespace-pre-line text-sm text-red-600 dark:text-red-400 {useTwoColumnLayout ? 'col-span-2' : ''}">{submitError}</p>
|
||||
{/if}
|
||||
|
||||
{#if themes && showNavigation}
|
||||
@@ -340,7 +277,7 @@
|
||||
onclick={() => void openStorePage()}
|
||||
class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white"
|
||||
>
|
||||
<ShoppingCartIcon size="1em" class="text-xl" />
|
||||
<span class="text-xl font-IconFamily"></span>
|
||||
<span class="ml-2">Theme Store</span>
|
||||
</button>
|
||||
|
||||
@@ -348,7 +285,7 @@
|
||||
onclick={() => void openThemeCreator()}
|
||||
class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white"
|
||||
>
|
||||
<PlusIcon size="1em" class="text-xl" />
|
||||
<span class="text-xl font-IconFamily"></span>
|
||||
<span class="ml-2">Create your own</span>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
<script lang="ts">
|
||||
import MessageSquareIcon from "@lucide/svelte/icons/message-square";
|
||||
import SearchIcon from "@lucide/svelte/icons/search";
|
||||
import InfoIcon from "@lucide/svelte/icons/info";
|
||||
import Maximize2Icon from "@lucide/svelte/icons/maximize-2";
|
||||
import MegaphoneIcon from "@lucide/svelte/icons/megaphone";
|
||||
import ShieldIcon from "@lucide/svelte/icons/shield";
|
||||
import TabbedContainer from "../components/TabbedContainer.svelte";
|
||||
import LazyPanel from "../components/LazyPanel.svelte";
|
||||
import darkLogo from "@/resources/icons/betterseqta-dark-full.png";
|
||||
@@ -483,9 +477,9 @@
|
||||
};
|
||||
|
||||
const utilityActions = [
|
||||
{ label: "About", icon: InfoIcon, onclick: openAbout },
|
||||
{ label: "What's new", icon: MegaphoneIcon, onclick: openChangelog },
|
||||
{ label: "Privacy", icon: ShieldIcon, onclick: openPrivacyStatement },
|
||||
{ label: "About", icon: "\ueb73", onclick: openAbout },
|
||||
{ label: "What's new", icon: "\ue929", onclick: openChangelog },
|
||||
{ label: "Privacy", icon: "\uecba", onclick: openPrivacyStatement },
|
||||
] as const;
|
||||
|
||||
onMount(() => {
|
||||
@@ -584,9 +578,20 @@
|
||||
{#if activePage === "settings"}
|
||||
<label class="relative mb-4 block shrink-0">
|
||||
<span class="sr-only">Search settings</span>
|
||||
<SearchIcon
|
||||
<svg
|
||||
class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="m21 21-4.35-4.35m1.35-5.65a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"
|
||||
/>
|
||||
</svg>
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Search settings"
|
||||
@@ -625,7 +630,7 @@
|
||||
onclick={action.onclick}
|
||||
class="flex h-10 w-full items-center gap-3 rounded-lg px-3 text-left text-[16px] font-medium text-zinc-600 transition-[color,background-color,transform] duration-150 hover:bg-zinc-200/70 hover:text-zinc-950 active:scale-[0.96] dark:text-zinc-300 dark:hover:bg-zinc-700/70 dark:hover:text-white"
|
||||
>
|
||||
<action.icon size={18} class="shrink-0" />
|
||||
<span class="w-5 text-center font-IconFamily text-[18px]" aria-hidden="true">{action.icon}</span>
|
||||
<span>{action.label}</span>
|
||||
</button>
|
||||
{/each}
|
||||
@@ -635,7 +640,18 @@
|
||||
onclick={() => openFeedback()}
|
||||
class="mt-2 flex w-full items-center gap-3 rounded-lg bg-zinc-200/70 px-3 py-2.5 text-left text-[16px] font-medium text-zinc-700 transition-[color,background-color,transform] duration-150 hover:bg-zinc-300/80 active:scale-[0.96] dark:bg-zinc-800/80 dark:text-zinc-200 dark:hover:bg-zinc-700"
|
||||
>
|
||||
<MessageSquareIcon class="w-5 h-5 shrink-0" />
|
||||
<svg
|
||||
class="w-5 h-5 shrink-0"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
||||
</svg>
|
||||
<span>Send us feedback!</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -762,7 +778,18 @@
|
||||
title="Expand settings"
|
||||
aria-expanded="false"
|
||||
>
|
||||
<Maximize2Icon size="1em" class="text-2xl" />
|
||||
<svg
|
||||
class="text-2xl"
|
||||
width="1em"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" />
|
||||
</svg>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
<script lang="ts">
|
||||
import XIcon from "@lucide/svelte/icons/x";
|
||||
import UploadIcon from "@lucide/svelte/icons/upload";
|
||||
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";
|
||||
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"
|
||||
|
||||
let { searchQuery = "" }: { searchQuery?: string } = $props();
|
||||
const q = $derived(searchQuery.trim().toLowerCase());
|
||||
@@ -31,14 +29,19 @@
|
||||
|
||||
const switchChange = (shortcut: any) => {
|
||||
const current = settingsState.shortcuts ?? [];
|
||||
const idx = current.findIndex((s) => s.name === shortcut);
|
||||
const idx = current.findIndex(s => s.name === shortcut);
|
||||
if (idx !== -1) {
|
||||
const updated = current.map((s) => (s.name === shortcut ? { ...s, enabled: !s.enabled } : s));
|
||||
const updated = current.map(s =>
|
||||
s.name === shortcut ? { ...s, enabled: !s.enabled } : s
|
||||
);
|
||||
settingsState.setKey("shortcuts", updated);
|
||||
} else {
|
||||
settingsState.setKey("shortcuts", [...current, { name: shortcut, enabled: true }]);
|
||||
settingsState.setKey("shortcuts", [
|
||||
...current,
|
||||
{ name: shortcut, enabled: true },
|
||||
]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let isFormVisible = $state(false);
|
||||
let newTitle = $state("");
|
||||
@@ -75,10 +78,7 @@
|
||||
const isValidTitle = (title: string) => title.trim() !== "";
|
||||
|
||||
const isValidURL = (url: string) => {
|
||||
const pattern = new RegExp(
|
||||
"^(https?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\-]+)*(?::\\d+)?(/[\\w\\-./]*)*$",
|
||||
"i",
|
||||
);
|
||||
const pattern = new RegExp("^(https?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\-]+)*(?::\\d+)?(/[\\w\\-./]*)*$", "i");
|
||||
return pattern.test(url);
|
||||
};
|
||||
|
||||
@@ -114,11 +114,11 @@
|
||||
<div>
|
||||
<MotionDiv
|
||||
initial={{ opacity: 0, height: 0 }}
|
||||
animate={isFormVisible ? { opacity: 1, height: "auto" } : { opacity: 0, height: 0 }}
|
||||
animate={isFormVisible ? { opacity: 1, height: 'auto' } : { opacity: 0, height: 0 }}
|
||||
exit={{ opacity: 0, height: 0 }}
|
||||
transition={{
|
||||
type: "spring",
|
||||
config: { stiffness: 400, damping: 25 },
|
||||
type: 'spring',
|
||||
config: { stiffness: 400, damping: 25 }
|
||||
}}
|
||||
>
|
||||
{#if isFormVisible}
|
||||
@@ -164,11 +164,7 @@
|
||||
{#if newIcon}
|
||||
<div class="flex overflow-hidden items-center">
|
||||
<div class="shrink-0 mr-2 w-6 h-6">
|
||||
<img
|
||||
src={`data:image/svg+xml;base64,${btoa(newIcon)}`}
|
||||
alt="Selected Icon"
|
||||
class="object-contain w-full h-full"
|
||||
/>
|
||||
<img src={`data:image/svg+xml;base64,${btoa(newIcon)}`} alt="Selected Icon" class="object-contain w-full h-full" />
|
||||
</div>
|
||||
<span class="truncate">Selected Icon</span>
|
||||
</div>
|
||||
@@ -177,26 +173,21 @@
|
||||
aria-label="Clear icon"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onclick={(event) => {
|
||||
event.stopPropagation();
|
||||
clearIcon();
|
||||
}}
|
||||
onclick={(event) => { event.stopPropagation(); clearIcon(); }}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
event.preventDefault();
|
||||
clearIcon();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<XIcon class="w-4 h-4" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</span>
|
||||
{:else}
|
||||
<UploadIcon size="1em" />
|
||||
<span class="ml-2"
|
||||
>SVG icon <span class="text-xs italic text-zinc-400 dark:text-zinc-500"
|
||||
>(Optional)</span
|
||||
></span
|
||||
>
|
||||
<span class="font-IconFamily">{ '\ued47' }</span>
|
||||
<span class="ml-2">SVG icon <span class="text-xs italic text-zinc-400 dark:text-zinc-500">(Optional)</span></span>
|
||||
{/if}
|
||||
</button>
|
||||
</MotionDiv>
|
||||
@@ -219,34 +210,33 @@
|
||||
{/if}
|
||||
|
||||
<!-- Custom Shortcuts Section -->
|
||||
{#each $settingsState.customshortcuts ?? [] as shortcut, index}
|
||||
{#each ($settingsState.customshortcuts ?? []) as shortcut, index}
|
||||
{#if !q || shortcut.name.toLowerCase().includes(q)}
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
{shortcut.name}
|
||||
<button aria-label="Delete Shortcut" onclick={() => deleteCustomShortcut(index)}>
|
||||
<XIcon class="w-6 h-6" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width={1.5} stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
{#each Object.entries(Shortcuts) as shortcut}
|
||||
{#if !q || shortcut[1].DisplayName?.toLowerCase().includes(q) || shortcut[0]
|
||||
.toLowerCase()
|
||||
.includes(q)}
|
||||
{#if !q || shortcut[1].DisplayName?.toLowerCase().includes(q) || shortcut[0].toLowerCase().includes(q)}
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
<!-- Use DisplayName if it exists, otherwise use the key (shortcut[0]) as a fallback -->
|
||||
<h2 class="text-lg font-medium">{shortcut[1].DisplayName || shortcut[0]}</h2>
|
||||
</div>
|
||||
<Switch
|
||||
state={$settingsState.shortcuts.find((s) => s.name === shortcut[0])?.enabled ?? false}
|
||||
onChange={() => switchChange(shortcut[0])}
|
||||
/>
|
||||
<Switch state={$settingsState.shortcuts.find(s => s.name === shortcut[0])?.enabled ?? false} onChange={() => switchChange(shortcut[0])} />
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
{:else}
|
||||
<div class="p-4 text-center">Loading shortcuts...</div>
|
||||
<div class="p-4 text-center">
|
||||
Loading shortcuts...
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -1,19 +1,15 @@
|
||||
<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 CheckIcon from "@lucide/svelte/icons/check";
|
||||
import PencilIcon from "@lucide/svelte/icons/pencil";
|
||||
import { standalone } from "@/interface/utils/standalone.svelte";
|
||||
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",
|
||||
}: {
|
||||
let { section = "all" }: {
|
||||
section?: "all" | "themes" | "backgrounds";
|
||||
} = $props();
|
||||
|
||||
let selectedBackground = $state<string | null>(null);
|
||||
let selectNoBackground = $state<() => void>(() => {});
|
||||
let selectNoBackground = $state<() => void>(() => { });
|
||||
|
||||
let clearTheme = $derived(selectedBackground !== null);
|
||||
let editMode = $state<boolean>(false);
|
||||
@@ -28,12 +24,8 @@
|
||||
onClick={() => selectNoBackground()}
|
||||
disabled={section === "backgrounds" && !clearTheme}
|
||||
text={section === "all"
|
||||
? clearTheme
|
||||
? "Clear Theme"
|
||||
: "Select a Theme"
|
||||
: clearTheme
|
||||
? "Clear Background"
|
||||
: "No Background Selected"}
|
||||
? clearTheme ? 'Clear Theme' : 'Select a Theme'
|
||||
: clearTheme ? 'Clear Background' : 'No Background Selected'}
|
||||
class="w-full mb-4"
|
||||
/>
|
||||
{/if}
|
||||
@@ -41,25 +33,26 @@
|
||||
{#if showThemes || showBackgrounds}
|
||||
<div class="mb-3 flex justify-end">
|
||||
<Button
|
||||
onClick={() => (editMode = !editMode)}
|
||||
text={editMode ? "Done" : "Remove"}
|
||||
icon={editMode ? CheckIcon : PencilIcon}
|
||||
onClick={() => editMode = !editMode}
|
||||
text={editMode ? 'Done' : 'Remove'}
|
||||
icon={editMode ? '\ue9e4' : '\uec38'}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if showBackgrounds}
|
||||
<BackgroundSelector isEditMode={editMode} bind:selectedBackground bind:selectNoBackground />
|
||||
<BackgroundSelector isEditMode={editMode} bind:selectedBackground={selectedBackground} bind:selectNoBackground={selectNoBackground} />
|
||||
{/if}
|
||||
{#if showThemes}
|
||||
{#if section === "themes"}
|
||||
<Button
|
||||
variant="primary"
|
||||
class="w-full mb-4"
|
||||
icon={""}
|
||||
text="Open theme builder"
|
||||
onClick={() =>
|
||||
void import("@/seqta/utils/launchPageThemeBuilder").then(
|
||||
({ launchPageThemeBuilder }) => launchPageThemeBuilder(),
|
||||
void import("@/seqta/utils/launchPageThemeBuilder").then(({ launchPageThemeBuilder }) =>
|
||||
launchPageThemeBuilder(),
|
||||
)}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -1,62 +1,59 @@
|
||||
<script lang="ts">
|
||||
import ChevronDownIcon from "@lucide/svelte/icons/chevron-down";
|
||||
import Maximize2Icon from "@lucide/svelte/icons/maximize-2";
|
||||
import Minimize2Icon from "@lucide/svelte/icons/minimize-2";
|
||||
import CircleQuestionMarkIcon from "@lucide/svelte/icons/circle-question-mark";
|
||||
import PlusIcon from "@lucide/svelte/icons/plus";
|
||||
import XIcon from "@lucide/svelte/icons/x";
|
||||
import { onMount } from "svelte";
|
||||
import { slide } from "svelte/transition";
|
||||
import { fade } from "svelte/transition";
|
||||
import { onMount } from 'svelte';
|
||||
import { slide } from 'svelte/transition';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { type LoadedCustomTheme, shouldForceThemeAppearance } from "@/types/customThemes";
|
||||
import {
|
||||
type LoadedCustomTheme,
|
||||
shouldForceThemeAppearance,
|
||||
} from '@/types/customThemes'
|
||||
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { settingsState } from '@/seqta/utils/listeners/settingsState'
|
||||
|
||||
import Divider from "@/interface/components/themeCreator/divider.svelte";
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import Slider from "@/interface/components/Slider.svelte";
|
||||
import ColourPicker from "../components/ColourPicker.svelte";
|
||||
import CodeEditor from "../components/CodeEditor.svelte";
|
||||
import Divider from '@/interface/components/themeCreator/divider.svelte'
|
||||
import Switch from '@/interface/components/Switch.svelte'
|
||||
import Button from '@/interface/components/Button.svelte'
|
||||
import Slider from '@/interface/components/Slider.svelte'
|
||||
import ColourPicker from '../components/ColourPicker.svelte'
|
||||
import CodeEditor from '../components/CodeEditor.svelte'
|
||||
|
||||
import {
|
||||
handleImageUpload,
|
||||
handleRemoveImage,
|
||||
handleImageVariableChange,
|
||||
} from "../utils/themeImageHandlers";
|
||||
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
|
||||
import { themeUpdates } from "../hooks/themeUpdates";
|
||||
import { closeThemeCreator } from "@/plugins/built-in/themes/themeCreator";
|
||||
import { submitLocalThemeToCommunity } from "@/seqta/utils/customThemes/submitLocalTheme";
|
||||
import { formatCustomThemeApiError } from "@/seqta/utils/customThemes/apiErrors";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
import MoonIcon from "@lucide/svelte/icons/moon";
|
||||
import SunIcon from "@lucide/svelte/icons/sun";
|
||||
import SidebarAppearance from "@/interface/components/SidebarAppearance.svelte";
|
||||
import { FONT_PRESETS, DEFAULT_FONT_ID } from "@/seqta/ui/fonts/presets";
|
||||
import { applySelectedFont, ensureFontPickerFontsLoaded } from "@/seqta/ui/fonts/fontManager";
|
||||
} from '../utils/themeImageHandlers';
|
||||
import { ThemeManager } from '@/plugins/built-in/themes/theme-manager'
|
||||
import { themeUpdates } from '../hooks/themeUpdates'
|
||||
import { closeThemeCreator } from '@/plugins/built-in/themes/themeCreator'
|
||||
import { submitLocalThemeToCommunity } from '@/seqta/utils/customThemes/submitLocalTheme'
|
||||
import { formatCustomThemeApiError } from '@/seqta/utils/customThemes/apiErrors'
|
||||
import { cloudAuth } from '@/seqta/utils/cloudAuth'
|
||||
import LucideMoon from '@/interface/components/icons/LucideMoon.svelte'
|
||||
import LucideSun from '@/interface/components/icons/LucideSun.svelte'
|
||||
import SidebarAppearance from '@/interface/components/SidebarAppearance.svelte'
|
||||
import { FONT_PRESETS, DEFAULT_FONT_ID } from '@/seqta/ui/fonts/presets'
|
||||
import { applySelectedFont, ensureFontPickerFontsLoaded } from '@/seqta/ui/fonts/fontManager'
|
||||
import {
|
||||
applySidebarSettings,
|
||||
defaultThemeCreatorMeta,
|
||||
mergeThemeWithCreatorMeta,
|
||||
snapshotSidebarSettings,
|
||||
} from "@/interface/utils/themeCreatorMeta";
|
||||
import { ensureThemeCoverImage } from "@/interface/utils/themePlaceholderCover";
|
||||
import ThemeBlobImage from "@/interface/components/themes/ThemeBlobImage.svelte";
|
||||
import type { ThemeCreatorMeta } from "@/types/customThemes";
|
||||
} from '@/interface/utils/themeCreatorMeta'
|
||||
import { ensureThemeCoverImage } from '@/interface/utils/themePlaceholderCover'
|
||||
import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
|
||||
import type { ThemeCreatorMeta } from '@/types/customThemes'
|
||||
|
||||
const { themeID }: { themeID: string } = $props();
|
||||
const { themeID }: { themeID: string } = $props()
|
||||
const themeManager = ThemeManager.getInstance();
|
||||
|
||||
let theme = $state<LoadedCustomTheme>({
|
||||
id: crypto.randomUUID(),
|
||||
name: "",
|
||||
description: "",
|
||||
defaultColour: "blue",
|
||||
name: '',
|
||||
description: '',
|
||||
defaultColour: 'blue',
|
||||
CanChangeColour: true,
|
||||
allowBackgrounds: true,
|
||||
CustomCSS: "",
|
||||
CustomCSS: '',
|
||||
CustomImages: [],
|
||||
coverImage: null,
|
||||
isEditable: true,
|
||||
@@ -64,8 +61,8 @@
|
||||
forceTheme: undefined,
|
||||
forceDark: undefined,
|
||||
adaptiveCssVariables: [],
|
||||
});
|
||||
let closedAccordions = $state<string[]>([]);
|
||||
})
|
||||
let closedAccordions = $state<string[]>([])
|
||||
let themeLoaded = $state(false);
|
||||
let codeEditorFullscreen = $state(false);
|
||||
let communityBusy = $state(false);
|
||||
@@ -91,27 +88,27 @@
|
||||
composeVisuals = true;
|
||||
}
|
||||
|
||||
function imageUsage(imageId: string): "decorative" | "page-background" | "cover" {
|
||||
if (creatorMeta.pageBackgroundImageId === imageId) return "page-background";
|
||||
function imageUsage(imageId: string): 'decorative' | 'page-background' | 'cover' {
|
||||
if (creatorMeta.pageBackgroundImageId === imageId) return 'page-background';
|
||||
const image = theme.CustomImages.find((item) => item.id === imageId);
|
||||
if (image && theme.coverImage === image.blob) return "cover";
|
||||
return "decorative";
|
||||
if (image && theme.coverImage === image.blob) return 'cover';
|
||||
return 'decorative';
|
||||
}
|
||||
|
||||
function setImageUsage(imageId: string, usage: "decorative" | "page-background" | "cover") {
|
||||
function setImageUsage(imageId: string, usage: 'decorative' | 'page-background' | 'cover') {
|
||||
const image = theme.CustomImages.find((item) => item.id === imageId);
|
||||
if (!image) return;
|
||||
|
||||
let nextMeta = { ...creatorMeta };
|
||||
let coverImage = theme.coverImage;
|
||||
|
||||
if (usage === "page-background") {
|
||||
if (usage === 'page-background') {
|
||||
nextMeta = { ...nextMeta, pageBackgroundImageId: imageId };
|
||||
} else if (nextMeta.pageBackgroundImageId === imageId) {
|
||||
nextMeta = { ...nextMeta, pageBackgroundImageId: null };
|
||||
}
|
||||
|
||||
if (usage === "cover") {
|
||||
if (usage === 'cover') {
|
||||
coverImage = image.blob;
|
||||
} else if (coverImage === image.blob) {
|
||||
coverImage = null;
|
||||
@@ -140,12 +137,12 @@
|
||||
|
||||
function toggleAccordion(title: string, e: MouseEvent | KeyboardEvent) {
|
||||
// if the target is the fullscreen button return
|
||||
if (e.target instanceof Element && e.target.closest(".fullscreen-toggle")) {
|
||||
if (e.target instanceof HTMLButtonElement && e.target.classList.contains('fullscreen-toggle')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (closedAccordions.includes(title)) {
|
||||
closedAccordions = closedAccordions.filter((t) => t !== title);
|
||||
closedAccordions = closedAccordions.filter(t => t !== title);
|
||||
} else {
|
||||
closedAccordions = [...closedAccordions, title];
|
||||
}
|
||||
@@ -194,7 +191,9 @@
|
||||
theme = {
|
||||
...tempTheme,
|
||||
adaptiveCssVariables: tempTheme.adaptiveCssVariables ?? [],
|
||||
forceTheme: tempTheme.forceTheme ?? (tempTheme.forceDark !== undefined ? true : undefined),
|
||||
forceTheme:
|
||||
tempTheme.forceTheme ??
|
||||
(tempTheme.forceDark !== undefined ? true : undefined),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -278,30 +277,13 @@
|
||||
void themeManager.updatePreviewDebounced(snapshot);
|
||||
});
|
||||
|
||||
type SettingType =
|
||||
| "switch"
|
||||
| "button"
|
||||
| "slider"
|
||||
| "select"
|
||||
| "codeEditor"
|
||||
| "imageUpload"
|
||||
| "conditional"
|
||||
| "lightDarkToggle";
|
||||
type SettingType = 'switch' | 'button' | 'slider' | 'select' | 'codeEditor' | 'imageUpload' | 'conditional' | 'lightDarkToggle';
|
||||
|
||||
type SwitchProps = { state: boolean; onChange: (value: boolean) => void };
|
||||
type ButtonProps = { onClick: () => void; text: string };
|
||||
type SliderProps = {
|
||||
state: number;
|
||||
onChange: (value: number) => void;
|
||||
min?: number;
|
||||
max?: number;
|
||||
};
|
||||
type SliderProps = { state: number; onChange: (value: number) => void; min?: number; max?: number };
|
||||
|
||||
type SelectProps = {
|
||||
options: Array<{ value: string; label: string }>;
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
};
|
||||
type SelectProps = { options: Array<{ value: string; label: string }>; value: string; onChange: (value: string) => void };
|
||||
type CodeEditorProps = { value: string; onChange: (value: string) => void };
|
||||
type LightDarkToggleProps = { state: boolean; onChange: (value: boolean) => void };
|
||||
|
||||
@@ -310,107 +292,73 @@
|
||||
children: SettingItem;
|
||||
};
|
||||
|
||||
type ComponentProps =
|
||||
| SwitchProps
|
||||
| ButtonProps
|
||||
| SliderProps
|
||||
| SelectProps
|
||||
| CodeEditorProps
|
||||
| LightDarkToggleProps
|
||||
| ConditionalProps;
|
||||
type ComponentProps = SwitchProps | ButtonProps | SliderProps | SelectProps | CodeEditorProps | LightDarkToggleProps | ConditionalProps;
|
||||
|
||||
type SettingItem = {
|
||||
type: SettingType;
|
||||
title: string;
|
||||
description: string;
|
||||
direction?: "horizontal" | "vertical";
|
||||
direction?: 'horizontal' | 'vertical';
|
||||
props: ComponentProps;
|
||||
};
|
||||
</script>
|
||||
|
||||
{#snippet settingItem(item: SettingItem)}
|
||||
{#if item.type === "conditional"}
|
||||
{#if (item.props as ConditionalProps).condition}
|
||||
{#if item.type === 'conditional'}
|
||||
{#if (item.props as ConditionalProps).condition }
|
||||
<div transition:slide={{ duration: 300 }}>
|
||||
{@render settingItem((item.props as ConditionalProps).children)}
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<div
|
||||
class="flex justify-between {item.direction === 'vertical'
|
||||
? 'flex-col items-start'
|
||||
: 'items-center'} py-3"
|
||||
>
|
||||
<div class="flex justify-between {item.direction === 'vertical' ? 'flex-col items-start' : 'items-center'} py-3">
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
onclick={(e) => {
|
||||
item.direction === "vertical" && toggleAccordion(item.title, e);
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
e.key === "Enter" && item.direction === "vertical" && toggleAccordion(item.title, e);
|
||||
}}
|
||||
class="flex justify-between pr-4 {item.direction === 'vertical'
|
||||
? 'cursor-pointer w-full select-none'
|
||||
: ''}"
|
||||
>
|
||||
onclick={(e) => { item.direction === 'vertical' && toggleAccordion(item.title, e) }}
|
||||
onkeydown={(e) => { e.key === 'Enter' && item.direction === 'vertical' && toggleAccordion(item.title, e) }}
|
||||
class="flex justify-between pr-4 {item.direction === 'vertical' ? 'cursor-pointer w-full select-none' : ''}">
|
||||
|
||||
<div>
|
||||
<h2 class="text-sm font-bold">{item.title}</h2>
|
||||
<p class="text-xs">{item.description}</p>
|
||||
</div>
|
||||
|
||||
{#if item.direction === "vertical"}
|
||||
<div
|
||||
class="flex justify-center items-center h-full text-xl font-light text-zinc-500 dark:text-zinc-300"
|
||||
>
|
||||
{#if item.type === "codeEditor"}
|
||||
{#if item.direction === 'vertical'}
|
||||
<div class="flex justify-center items-center h-full text-xl font-light text-zinc-500 dark:text-zinc-300">
|
||||
{#if item.type === 'codeEditor'}
|
||||
<!-- Fullscreen toggle button -->
|
||||
<button
|
||||
onclick={toggleCodeEditorFullscreen}
|
||||
class="px-2 mr-2 text-lg fullscreen-toggle"
|
||||
aria-label="Expand editor"
|
||||
>
|
||||
<Maximize2Icon size="1em" />
|
||||
<button onclick={toggleCodeEditorFullscreen} class="px-2 mr-2 text-lg font-IconFamily fullscreen-toggle">
|
||||
{'\uebdb'}
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<ChevronDownIcon
|
||||
size="1em"
|
||||
class="transition-transform duration-300 {closedAccordions.includes(item.title)
|
||||
? 'rotate-180'
|
||||
: ''}"
|
||||
/>
|
||||
<span class='font-IconFamily transition-transform duration-300 {closedAccordions.includes(item.title) ? 'rotate-180' : ''}'>{'\ue9e6'}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if !closedAccordions.includes(item.title)}
|
||||
<div
|
||||
class={item.direction === "vertical" ? "w-full mt-2" : ""}
|
||||
transition:slide={{ duration: 300 }}
|
||||
>
|
||||
{#if item.type === "switch"}
|
||||
<Switch {...item.props as SwitchProps} />
|
||||
{:else if item.type === "button"}
|
||||
<Button {...item.props as ButtonProps} />
|
||||
{:else if item.type === "slider"}
|
||||
<Slider {...item.props as SliderProps} />
|
||||
{:else if item.type === "codeEditor"}
|
||||
<div class="{item.direction === 'vertical' ? 'w-full mt-2' : ''}" transition:slide={{ duration: 300 }}>
|
||||
{#if item.type === 'switch'}
|
||||
<Switch {...(item.props as SwitchProps)} />
|
||||
{:else if item.type === 'button'}
|
||||
<Button {...(item.props as ButtonProps)} />
|
||||
{:else if item.type === 'slider'}
|
||||
<Slider {...(item.props as SliderProps)} />
|
||||
|
||||
{:else if item.type === 'codeEditor'}
|
||||
{#if !codeEditorFullscreen}
|
||||
{#key themeLoaded}
|
||||
<!-- Only render inline if not fullscreen -->
|
||||
<CodeEditor className="h-[400px]" {...item.props as CodeEditorProps} />
|
||||
<CodeEditor className="h-[400px]" {...(item.props as CodeEditorProps)} />
|
||||
{/key}
|
||||
{/if}
|
||||
{:else if item.type === "imageUpload"}
|
||||
{:else if item.type === 'imageUpload'}
|
||||
{#each theme.CustomImages as image (image.id)}
|
||||
<div class="mb-4 space-y-2 rounded-lg bg-white px-2 py-2 shadow-lg dark:bg-zinc-700">
|
||||
<div class="flex h-16 items-center gap-2">
|
||||
<div class="h-full">
|
||||
<ThemeBlobImage
|
||||
source={image.blob}
|
||||
alt={image.variableName}
|
||||
class="object-contain h-full rounded-sm"
|
||||
/>
|
||||
<ThemeBlobImage source={image.blob} alt={image.variableName} class="object-contain h-full rounded-sm" />
|
||||
</div>
|
||||
<input
|
||||
type="text"
|
||||
@@ -419,12 +367,8 @@
|
||||
placeholder="CSS variable name"
|
||||
class="grow flex-3 rounded-lg border-0 bg-zinc-200 p-2 transition dark:bg-zinc-600/50 dark:placeholder-zinc-300 focus:bg-zinc-300/50 dark:focus:bg-zinc-600"
|
||||
/>
|
||||
<button
|
||||
onclick={() => onRemoveImage(image.id)}
|
||||
class="p-2 transition dark:text-white"
|
||||
type="button"
|
||||
>
|
||||
<XIcon size="1em" class="text-xl" />
|
||||
<button onclick={() => onRemoveImage(image.id)} class="p-2 transition dark:text-white" type="button">
|
||||
<span class='text-xl font-IconFamily'>{'\ued8c'}</span>
|
||||
</button>
|
||||
</div>
|
||||
<label class="block text-xs text-zinc-600 dark:text-zinc-300">
|
||||
@@ -433,10 +377,7 @@
|
||||
class="mt-1 w-full rounded-lg border-0 bg-zinc-200 px-2 py-1.5 text-sm dark:bg-zinc-600"
|
||||
value={imageUsage(image.id)}
|
||||
onchange={(e) =>
|
||||
setImageUsage(
|
||||
image.id,
|
||||
e.currentTarget.value as "decorative" | "page-background" | "cover",
|
||||
)}
|
||||
setImageUsage(image.id, e.currentTarget.value as 'decorative' | 'page-background' | 'cover')}
|
||||
>
|
||||
<option value="decorative">Decorative (CSS variable only)</option>
|
||||
<option value="page-background">SEQTA page background</option>
|
||||
@@ -446,25 +387,15 @@
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
<div
|
||||
class="flex overflow-hidden relative gap-1 justify-center place-items-center w-full h-8 rounded-lg transition bg-zinc-200 dark:bg-zinc-700"
|
||||
>
|
||||
<PlusIcon size="1em" />
|
||||
<span class="dark:text-white">Add image</span>
|
||||
<input
|
||||
type="file"
|
||||
accept="image/*"
|
||||
onchange={onImageUpload}
|
||||
class="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
|
||||
/>
|
||||
<div class="flex overflow-hidden relative gap-1 justify-center place-items-center w-full h-8 rounded-lg transition bg-zinc-200 dark:bg-zinc-700">
|
||||
<span class='font-IconFamily'>{'\uec60'}</span>
|
||||
<span class='dark:text-white'>Add image</span>
|
||||
<input type="file" accept='image/*' onchange={onImageUpload} class="absolute inset-0 w-full h-full opacity-0 cursor-pointer" />
|
||||
</div>
|
||||
{:else if item.type === "lightDarkToggle"}
|
||||
{:else if item.type === 'lightDarkToggle'}
|
||||
<button
|
||||
class="overflow-hidden relative flex justify-center items-center px-4 py-1 text-xl font-medium rounded-lg transition bg-zinc-200 dark:bg-zinc-700 hover:bg-zinc-300 dark:hover:bg-zinc-600"
|
||||
onclick={() =>
|
||||
(item.props as LightDarkToggleProps).onChange(
|
||||
!(item.props as LightDarkToggleProps).state,
|
||||
)}
|
||||
onclick={() => (item.props as LightDarkToggleProps).onChange(!(item.props as LightDarkToggleProps).state)}
|
||||
>
|
||||
{#key (item.props as LightDarkToggleProps).state}
|
||||
<span
|
||||
@@ -473,13 +404,13 @@
|
||||
out:fade={{ duration: 150 }}
|
||||
>
|
||||
{#if (item.props as LightDarkToggleProps).state}
|
||||
<MoonIcon class="w-5 h-5" />
|
||||
<LucideMoon class="w-5 h-5" />
|
||||
{:else}
|
||||
<SunIcon class="w-5 h-5" />
|
||||
<LucideSun class="w-5 h-5" />
|
||||
{/if}
|
||||
</span>
|
||||
{/key}
|
||||
<span class="opacity-0 inline-flex"><MoonIcon class="w-5 h-5" /></span>
|
||||
<span class="opacity-0 inline-flex"><LucideMoon class="w-5 h-5" /></span>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -494,11 +425,7 @@
|
||||
<div class="sticky top-0 px-2 h-screen">
|
||||
<div class="flex justify-between items-center my-4">
|
||||
<h2 class="text-xl font-bold">Custom CSS</h2>
|
||||
<button
|
||||
onclick={toggleCodeEditorFullscreen}
|
||||
class="pr-14 text-xl"
|
||||
aria-label="Collapse editor"><Minimize2Icon size="1em" /></button
|
||||
>
|
||||
<button onclick={toggleCodeEditorFullscreen} class="pr-14 text-xl font-IconFamily">{'\uec06'}</button>
|
||||
</div>
|
||||
<CodeEditor
|
||||
className="editorHeight"
|
||||
@@ -508,9 +435,8 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div
|
||||
class="relative flex min-h-full w-full flex-col bg-zinc-100 p-2 text-zinc-900 dark:bg-zinc-800 dark:text-white"
|
||||
>
|
||||
<div class="relative flex min-h-full w-full flex-col bg-zinc-100 p-2 text-zinc-900 dark:bg-zinc-800 dark:text-white">
|
||||
|
||||
<div class="mb-2 flex items-start justify-between gap-2">
|
||||
<h1 class="text-xl font-semibold">Theme Creator</h1>
|
||||
<button
|
||||
@@ -519,51 +445,42 @@
|
||||
aria-label="Close theme creator"
|
||||
onclick={() => void closeThemeCreator()}
|
||||
>
|
||||
<XIcon size="1em" />
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
<a
|
||||
href="https://docs.betterseqta.org/theme-creation/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="text-sm font-light text-zinc-500 dark:text-zinc-400"
|
||||
>
|
||||
<CircleQuestionMarkIcon size="1em" class="pr-0.5" />
|
||||
<span class="underline"> Need help? Check out the docs! </span>
|
||||
<a href='https://docs.betterseqta.org/theme-creation/' target='_blank' rel='noopener noreferrer' class='text-sm font-light text-zinc-500 dark:text-zinc-400'>
|
||||
<span class='pr-0.5 no-underline font-IconFamily'>{'\ueb44'}</span>
|
||||
<span class='underline'>
|
||||
Need help? Check out the docs!
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<Divider />
|
||||
|
||||
<div>
|
||||
<div class="pb-2 text-sm">Theme Name</div>
|
||||
<div class='pb-2 text-sm'>Theme Name</div>
|
||||
<input
|
||||
id="themeName"
|
||||
type="text"
|
||||
placeholder="What is your theme called?"
|
||||
id='themeName'
|
||||
type='text'
|
||||
placeholder='What is your theme called?'
|
||||
bind:value={theme.name}
|
||||
class="p-2 mb-4 w-full rounded-lg border-0 transition dark:placeholder-zinc-300 bg-zinc-200 dark:bg-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600"
|
||||
/>
|
||||
class='p-2 mb-4 w-full rounded-lg border-0 transition dark:placeholder-zinc-300 bg-zinc-200 dark:bg-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600' />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="pb-2 text-sm">
|
||||
Description <span class="italic font-light opacity-80">(optional)</span>
|
||||
</div>
|
||||
<div class='pb-2 text-sm'>Description <span class='italic font-light opacity-80'>(optional)</span></div>
|
||||
<textarea
|
||||
id="themeDescription"
|
||||
id='themeDescription'
|
||||
placeholder="Don't worry, this one's optional!"
|
||||
bind:value={theme.description}
|
||||
class="p-2 w-full rounded-lg border-0 transition dark:placeholder-zinc-300 bg-zinc-200 dark:bg-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600"
|
||||
></textarea>
|
||||
class='p-2 w-full rounded-lg border-0 transition dark:placeholder-zinc-300 bg-zinc-200 dark:bg-zinc-700 focus:outline-hidden focus:ring-1 focus:ring-zinc-100 dark:focus:ring-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600'></textarea>
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
|
||||
<div class="py-3">
|
||||
<h2 class="text-sm font-bold">Accent colour</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-400">
|
||||
Default accent and gradient start colour.
|
||||
</p>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-400">Default accent and gradient start colour.</p>
|
||||
<div class="mt-2">
|
||||
<ColourPicker
|
||||
savePresets={false}
|
||||
@@ -598,8 +515,7 @@
|
||||
<div>
|
||||
<h2 class="text-sm font-bold">Images & page background</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-400">
|
||||
Upload images, then choose how each one is used. Set one as the live SEQTA page background
|
||||
to preview it on the main page.
|
||||
Upload images, then choose how each one is used. Set one as the live SEQTA page background to preview it on the main page.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -614,22 +530,15 @@
|
||||
placeholder="CSS variable"
|
||||
class="min-w-0 flex-1 rounded-lg border-0 bg-zinc-100 p-2 text-sm dark:bg-zinc-600 dark:text-white"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="p-2 dark:text-white"
|
||||
onclick={() => onRemoveImage(image.id)}
|
||||
>
|
||||
<XIcon size="1em" class="text-xl" />
|
||||
<button type="button" class="p-2 dark:text-white" onclick={() => onRemoveImage(image.id)}>
|
||||
<span class="text-xl font-IconFamily">{'\ued8c'}</span>
|
||||
</button>
|
||||
</div>
|
||||
<select
|
||||
class="w-full rounded-lg border-0 bg-zinc-100 px-2 py-1.5 text-sm dark:bg-zinc-600"
|
||||
value={imageUsage(image.id)}
|
||||
onchange={(e) =>
|
||||
setImageUsage(
|
||||
image.id,
|
||||
e.currentTarget.value as "decorative" | "page-background" | "cover",
|
||||
)}
|
||||
setImageUsage(image.id, e.currentTarget.value as 'decorative' | 'page-background' | 'cover')}
|
||||
>
|
||||
<option value="decorative">Decorative only (CSS variable)</option>
|
||||
<option value="page-background">SEQTA page background</option>
|
||||
@@ -638,10 +547,8 @@
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
<label
|
||||
class="flex h-10 cursor-pointer items-center justify-center gap-2 rounded-lg bg-zinc-200 dark:bg-zinc-700"
|
||||
>
|
||||
<PlusIcon size="1em" />
|
||||
<label class="flex h-10 cursor-pointer items-center justify-center gap-2 rounded-lg bg-zinc-200 dark:bg-zinc-700">
|
||||
<span class="font-IconFamily">{'\uec60'}</span>
|
||||
<span class="text-sm dark:text-white">Add image</span>
|
||||
<input type="file" accept="image/*" class="hidden" onchange={onImageUpload} />
|
||||
</label>
|
||||
@@ -694,14 +601,11 @@
|
||||
<div class="py-3">
|
||||
<h2 class="text-sm font-bold">Adaptive CSS variables</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-400">
|
||||
One per line, each must start with <code class="text-xs">--</code>. These receive the same
|
||||
colour as the adaptive accent when "Adaptive theme colour" is enabled in general
|
||||
settings. Use them in Custom CSS, e.g.
|
||||
<code class="text-xs">border-color: var(--my-accent);</code>
|
||||
One per line, each must start with <code class="text-xs">--</code>. These receive the same colour as the adaptive accent when "Adaptive theme colour" is enabled in general settings. Use them in Custom CSS, e.g. <code class="text-xs">border-color: var(--my-accent);</code>
|
||||
</p>
|
||||
<textarea
|
||||
placeholder="--my-accent --class-banner"
|
||||
value={theme.adaptiveCssVariables?.join("\n") ?? ""}
|
||||
value={theme.adaptiveCssVariables?.join('\n') ?? ''}
|
||||
oninput={(e) => {
|
||||
const lines = e.currentTarget.value
|
||||
.split(/\r?\n/)
|
||||
@@ -709,7 +613,7 @@
|
||||
.filter(Boolean);
|
||||
theme = { ...theme, adaptiveCssVariables: lines };
|
||||
}}
|
||||
class="p-2 mt-2 w-full min-h-20 font-mono text-sm rounded-lg border-0 transition dark:placeholder-zinc-400 bg-zinc-200 dark:bg-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600"
|
||||
class="p-2 mt-2 w-full min-h-20 font-mono text-sm rounded-lg border-0 transition dark:placeholder-zinc-400 bg-zinc-200 dark:bg-zinc-700 focus:outline-hidden focus:ring-1 focus:ring-zinc-100 dark:focus:ring-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600"
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
@@ -721,13 +625,58 @@
|
||||
|
||||
<Divider />
|
||||
|
||||
{#each [{ type: "switch", title: "Hide Theme Name", description: "Useful when your cover image contains text", props: { state: theme.hideThemeName, onChange: (value: boolean) => (theme = { ...theme, hideThemeName: value }) } }, { type: "switch", title: "Force Theme", description: "Force users to use either dark or light mode", props: { state: shouldForceThemeAppearance(theme), onChange: (value: boolean) => {
|
||||
{#each [
|
||||
{
|
||||
type: 'switch',
|
||||
title: 'Hide Theme Name',
|
||||
description: 'Useful when your cover image contains text',
|
||||
props: {
|
||||
state: theme.hideThemeName,
|
||||
onChange: (value: boolean) => theme = { ...theme, hideThemeName: value }
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'switch',
|
||||
title: 'Force Theme',
|
||||
description: 'Force users to use either dark or light mode',
|
||||
props: {
|
||||
state: shouldForceThemeAppearance(theme),
|
||||
onChange: (value: boolean) => {
|
||||
if (value) {
|
||||
theme = { ...theme, forceTheme: true, forceDark: false };
|
||||
} else {
|
||||
theme = { ...theme, forceTheme: false, forceDark: undefined };
|
||||
}
|
||||
} } }, { type: "conditional", props: { condition: shouldForceThemeAppearance(theme), children: { type: "lightDarkToggle", title: "Mode", description: "Choose whether to force light or dark mode", props: { state: theme.forceDark === true, onChange: (value: boolean) => (theme = { ...theme, forceDark: value, forceTheme: true }) } } } }, { type: "codeEditor", title: "Custom CSS", description: "Extra CSS appended after generated theme rules", direction: "vertical", props: { value: creatorMeta.userCustomCss, onChange: (value: string) => patchCreatorMeta( { userCustomCss: value } ) } }] as SettingItem[] as setting}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'conditional',
|
||||
props: {
|
||||
condition: shouldForceThemeAppearance(theme),
|
||||
children: {
|
||||
type: 'lightDarkToggle',
|
||||
title: 'Mode',
|
||||
description: 'Choose whether to force light or dark mode',
|
||||
props: {
|
||||
state: theme.forceDark === true,
|
||||
onChange: (value: boolean) =>
|
||||
(theme = { ...theme, forceDark: value, forceTheme: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'codeEditor',
|
||||
title: 'Custom CSS',
|
||||
description: 'Extra CSS appended after generated theme rules',
|
||||
direction: 'vertical',
|
||||
props: {
|
||||
value: creatorMeta.userCustomCss,
|
||||
onChange: (value: string) => patchCreatorMeta({ userCustomCss: value })
|
||||
}
|
||||
}
|
||||
] as SettingItem[] as setting}
|
||||
{@render settingItem(setting)}
|
||||
{/each}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
type IconOptions = {
|
||||
class?: string;
|
||||
id?: string;
|
||||
size?: number | string;
|
||||
style?: string;
|
||||
};
|
||||
|
||||
export function icon(svg: string, options: IconOptions = {}): string {
|
||||
const size = options.size ?? 24;
|
||||
let markup = svg
|
||||
.trim()
|
||||
.replace(/\swidth="24"/, ` width="${size}"`)
|
||||
.replace(/\sheight="24"/, ` height="${size}"`)
|
||||
.replace("<svg", '<svg aria-hidden="true"');
|
||||
if (options.class) markup = markup.replace('class="lucide', `class="${options.class} lucide`);
|
||||
if (options.id) markup = markup.replace("<svg", `<svg id="${options.id}"`);
|
||||
if (options.style) markup = markup.replace("<svg", `<svg style="${options.style}"`);
|
||||
return markup;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/** Material "dark_mode" moon icon — filled style to match SEQTA menu bar icons. */
|
||||
export const LUCIDE_MOON_PATH =
|
||||
"M12,3C7.03,3 3,7.03 3,12C3,16.97 7.03,21 12,21C16.97,21 21,16.97 21,12C21,11.54 20.96,11.08 20.9,10.64C19.92,12.01 18.32,12.9 16.5,12.9C13.52,12.9 11.1,10.48 11.1,7.5C11.1,5.68 11.99,4.08 13.36,3.1C12.92,3.04 12.46,3 12,3Z";
|
||||
|
||||
export const LUCIDE_MOON_ICON_SVG = `<path fill="currentColor" d="${LUCIDE_MOON_PATH}"/>`;
|
||||
@@ -0,0 +1,5 @@
|
||||
/** Material "light_mode" sun icon — filled style to match SEQTA menu bar icons. */
|
||||
export const LUCIDE_SUN_PATH =
|
||||
"M12,7C9.24,7 7,9.24 7,12C7,14.76 9.24,17 12,17C14.76,17 17,14.76 17,12C17,9.24 14.76,7 12,7M2,13H4C4.55,13 5,12.55 5,12C5,11.45 4.55,11 4,11H2C1.45,11 1,11.45 1,12C1,12.55 1.45,13 2,13M20,13H22C22.55,13 23,12.55 23,12C23,11.45 22.55,11 22,11H20C19.45,11 19,11.45 19,12C19,12.55 19.45,13 20,13M11,2V4C11,4.55 11.45,5 12,5C12.55,5 13,4.55 13,4V2C13,1.45 12.55,1 12,1C11.45,1 11,1.45 11,2M11,20V22C11,22.55 11.45,23 12,23C12.55,23 13,22.55 13,22V20C13,19.45 12.55,19 12,19C11.45,19 11,19.45 11,20M5.99,4.58C5.6,4.19 4.96,4.19 4.58,4.58C4.19,4.96 4.19,5.6 4.58,5.99L5.64,7.05C6.03,7.44 6.67,7.44 7.05,7.05C7.44,6.67 7.44,6.03 7.05,5.64L5.99,4.58M18.36,16.95C17.97,16.56 17.33,16.56 16.95,16.95C16.56,17.33 16.56,17.97 16.95,18.36L18.01,19.42C18.4,19.81 19.04,19.81 19.42,19.42C19.81,19.04 19.81,18.4 19.42,18.01L18.36,16.95M19.42,5.99C19.81,5.6 19.81,4.96 19.42,4.58C19.04,4.19 18.4,4.19 18.01,4.58L16.95,5.64C16.56,6.03 16.56,6.67 16.95,7.05C17.33,7.44 17.97,7.44 18.36,7.05L19.42,5.99M7.05,18.36C7.44,17.97 7.44,17.33 7.05,16.95C6.67,16.56 6.03,16.56 5.64,16.95L4.58,18.01C4.19,18.4 4.19,19.04 4.58,19.42C4.96,19.81 5.6,19.81 5.99,19.42L7.05,18.36Z";
|
||||
|
||||
export const LUCIDE_SUN_ICON_SVG = `<path fill="currentColor" d="${LUCIDE_SUN_PATH}"/>`;
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { RotateCw } from "lucide-static";
|
||||
import type { AssessmentsAverageApi } from "./pluginApi";
|
||||
import stringToHTML from "@/seqta/utils/stringToHTML";
|
||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||
@@ -183,7 +181,7 @@ async function renderSubjectAverage(api: AssessmentsAverageApi) {
|
||||
} else if (hasRefreshingWeighting) {
|
||||
warningHTML = /* html */ `
|
||||
<div style="margin-top: 4px; font-size: 11px; color: rgba(255, 255, 255, 0.55); opacity: 0.8; line-height: 1.3; white-space: nowrap;" title="Some weightings are being re-checked; the average may change shortly">
|
||||
${icon(RotateCw, { size: "1em", style: "vertical-align: -0.125em" })} Refreshing weightings
|
||||
↻ Refreshing weightings
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { ClipboardCopy } from "lucide-static";
|
||||
import debounce from "@/seqta/utils/debounce";
|
||||
|
||||
const RUBRIC_SELECTOR =
|
||||
@@ -90,8 +88,10 @@ function ensureStyles() {
|
||||
}
|
||||
|
||||
.betterseqta-rubric-copy-btn:focus-visible {
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px !important;
|
||||
outline: none !important;
|
||||
box-shadow:
|
||||
0 0 0 2px rgba(255, 255, 255, 0.95),
|
||||
0 0 0 4px rgba(59, 130, 246, 0.85) !important;
|
||||
}
|
||||
|
||||
.betterseqta-rubric-copy-btn svg {
|
||||
@@ -291,7 +291,9 @@ function createCopyButton(rubric: Element): HTMLButtonElement {
|
||||
button.className = "betterseqta-rubric-copy-btn";
|
||||
button.setAttribute("aria-label", "Copy rubric");
|
||||
button.innerHTML = `
|
||||
${icon(ClipboardCopy)}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184" />
|
||||
</svg>
|
||||
<span class="betterseqta-rubric-copy-label">Copy rubric</span>
|
||||
`;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { RotateCw } from "lucide-static";
|
||||
import { getUserInfo } from "@/seqta/utils/userInfo";
|
||||
import ReactFiber from "@/seqta/utils/ReactFiber.ts";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
@@ -319,7 +317,7 @@ function updateWeightLabelContent(
|
||||
input.placeholder = "Set %";
|
||||
input.setAttribute("aria-label", "Assessment weighting percentage");
|
||||
input.style.cssText =
|
||||
"width:52px;padding:1px 4px;border-radius:4px;border:1px solid rgba(128,128,128,0.35);background:rgba(128,128,128,0.08);color:inherit;font-size:inherit;";
|
||||
"width:52px;padding:1px 4px;border-radius:4px;border:1px solid rgba(128,128,128,0.35);background:rgba(128,128,128,0.08);color:inherit;font-size:inherit;outline:none;";
|
||||
attachWeightInputListeners(input, api, assessmentID);
|
||||
weightLabel.appendChild(input);
|
||||
weightLabel.title = "Enter assessment weighting %";
|
||||
@@ -329,8 +327,7 @@ function updateWeightLabelContent(
|
||||
const span = document.createElement("span");
|
||||
span.className = "betterseqta-weight-value";
|
||||
const baseText = weighting && weighting !== "N/A" ? formatWeightDisplay(weighting) : "N/A";
|
||||
span.textContent = baseText;
|
||||
if (refreshing) span.insertAdjacentHTML("beforeend", ` ${icon(RotateCw, { size: "1em" })}`);
|
||||
span.textContent = refreshing ? `${baseText} ↻` : baseText;
|
||||
if (refreshing) {
|
||||
span.style.opacity = "0.7";
|
||||
weightLabel.title = "Re-checking weighting…";
|
||||
@@ -1096,6 +1093,7 @@ function renderWeightingTabHtml(sheet: HTMLElement, context: WeightingTabContext
|
||||
background:rgba(128,128,128,0.08);
|
||||
color:inherit;
|
||||
font-size:13px;
|
||||
outline:none;
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -10,15 +10,11 @@
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import { buildEngageAssessmentPagePath } from "@/seqta/utils/engageAssessmentStudent";
|
||||
import CalendarDaysIcon from "@lucide/svelte/icons/calendar-days";
|
||||
import ClipboardListIcon from "@lucide/svelte/icons/clipboard-list";
|
||||
import EllipsisVerticalIcon from "@lucide/svelte/icons/ellipsis-vertical";
|
||||
import EyeIcon from "@lucide/svelte/icons/eye";
|
||||
import OverviewIcon from "./OverviewIcon.svelte";
|
||||
import {
|
||||
DEFAULT_COLUMN_ICON,
|
||||
GROUP_SORT_ICONS,
|
||||
STATUS_COLUMN_ICONS,
|
||||
type OverviewIcon,
|
||||
type OverviewIconName,
|
||||
} from "./icons";
|
||||
import confetti from "canvas-confetti";
|
||||
|
||||
@@ -34,43 +30,18 @@
|
||||
key: string;
|
||||
title: string;
|
||||
className: string;
|
||||
icon: OverviewIcon;
|
||||
icon: OverviewIconName;
|
||||
};
|
||||
|
||||
const HIDDEN_ASSESSMENTS_KEY = "betterseqta-hidden-assessments";
|
||||
const COMPLETED_ASSESSMENTS_KEY = "betterseqta-completed-assessments";
|
||||
|
||||
const STATUS_COLUMNS: Column[] = [
|
||||
{
|
||||
key: "UPCOMING",
|
||||
title: "Upcoming",
|
||||
className: "column-upcoming",
|
||||
icon: STATUS_COLUMN_ICONS.UPCOMING,
|
||||
},
|
||||
{
|
||||
key: "DUE_SOON",
|
||||
title: "Due Soon",
|
||||
className: "column-due-soon",
|
||||
icon: STATUS_COLUMN_ICONS.DUE_SOON,
|
||||
},
|
||||
{
|
||||
key: "OVERDUE",
|
||||
title: "Overdue",
|
||||
className: "column-overdue",
|
||||
icon: STATUS_COLUMN_ICONS.OVERDUE,
|
||||
},
|
||||
{
|
||||
key: "SUBMITTED",
|
||||
title: "Submitted",
|
||||
className: "column-submitted",
|
||||
icon: STATUS_COLUMN_ICONS.SUBMITTED,
|
||||
},
|
||||
{
|
||||
key: "MARKS_RELEASED",
|
||||
title: "Marked",
|
||||
className: "column-marked",
|
||||
icon: STATUS_COLUMN_ICONS.MARKS_RELEASED,
|
||||
},
|
||||
{ key: "UPCOMING", title: "Upcoming", className: "column-upcoming", icon: "calendar-days" },
|
||||
{ key: "DUE_SOON", title: "Due Soon", className: "column-due-soon", icon: "clock" },
|
||||
{ key: "OVERDUE", title: "Overdue", className: "column-overdue", icon: "exclamation-triangle" },
|
||||
{ key: "SUBMITTED", title: "Submitted", className: "column-submitted", icon: "document-check" },
|
||||
{ key: "MARKS_RELEASED", title: "Marked", className: "column-marked", icon: "check-circle" },
|
||||
];
|
||||
|
||||
const isEngage = isSeqtaEngageExperience();
|
||||
@@ -172,11 +143,7 @@
|
||||
if (hiddenIds.includes(String(a.id))) return false;
|
||||
if (subjectFilters[a.code] === false) return false;
|
||||
if (currentFilters.subject !== "all" && a.code !== currentFilters.subject) return false;
|
||||
if (
|
||||
isEngage &&
|
||||
currentFilters.student !== "all" &&
|
||||
String(a.studentId) !== currentFilters.student
|
||||
) {
|
||||
if (isEngage && currentFilters.student !== "all" && String(a.studentId) !== currentFilters.student) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -189,7 +156,7 @@
|
||||
return { filteredAssessments: filtered, statusGroups: groups, columns: STATUS_COLUMNS };
|
||||
}
|
||||
|
||||
const icon = GROUP_SORT_ICONS[currentFilters.sortBy] ?? DEFAULT_COLUMN_ICON;
|
||||
const icon = GROUP_SORT_ICONS[currentFilters.sortBy] ?? "queue-list";
|
||||
const keys = Object.keys(groups);
|
||||
const subjectTitles = new Map<string, string>(
|
||||
data?.subjects?.map((s: any) => [s.code, `${s.code} - ${s.title}`]) ?? [],
|
||||
@@ -260,15 +227,7 @@
|
||||
if (overdueCount === 0 && dueSoonCount === 0) {
|
||||
setTimeout(() => {
|
||||
const end = Date.now() + 100;
|
||||
const side = {
|
||||
particleCount: 17,
|
||||
spread: 65,
|
||||
startVelocity: 40,
|
||||
scalar: 2,
|
||||
gravity: 2,
|
||||
decay: 0.97,
|
||||
ticks: 300,
|
||||
};
|
||||
const side = { particleCount: 17, spread: 65, startVelocity: 40, scalar: 2, gravity: 2, decay: 0.97, ticks: 300 };
|
||||
const frame = () => {
|
||||
fireConfetti({ ...side, angle: 60, drift: 0.8, origin: { x: 0, y: 1 } });
|
||||
fireConfetti({ ...side, angle: 120, drift: -0.8, origin: { x: 1, y: 1 } });
|
||||
@@ -334,11 +293,7 @@
|
||||
<option value={subject.code}>{subject.code} - {subject.title}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<select
|
||||
class="filter-select"
|
||||
bind:value={currentFilters.sortBy}
|
||||
title="Group by - columns change based on this"
|
||||
>
|
||||
<select class="filter-select" bind:value={currentFilters.sortBy} title="Group by - columns change based on this">
|
||||
<option value="due">Group: Status</option>
|
||||
<option value="year">Group: Year</option>
|
||||
<option value="subject">Group: Subject</option>
|
||||
@@ -352,7 +307,7 @@
|
||||
onclick={() => (showVisibilityPanel = !showVisibilityPanel)}
|
||||
title="Manage hidden subjects and assessments"
|
||||
>
|
||||
<EyeIcon size={18} class="bsplus-overview-icon" />
|
||||
<OverviewIcon name="eye" size={18} />
|
||||
<span>Visibility ({hiddenSubjects.length + hiddenAssessmentsWithInfo.length})</span>
|
||||
</button>
|
||||
{/if}
|
||||
@@ -369,10 +324,7 @@
|
||||
{#each hiddenSubjects as subject}
|
||||
<span class="visibility-chip">
|
||||
{subject.code}
|
||||
<button
|
||||
class="visibility-unhide"
|
||||
onclick={() => setSubjectVisible(subject.code, true)}>Show</button
|
||||
>
|
||||
<button class="visibility-unhide" onclick={() => setSubjectVisible(subject.code, true)}>Show</button>
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -385,9 +337,7 @@
|
||||
{#each hiddenAssessmentsWithInfo as assessment}
|
||||
<span class="visibility-chip">
|
||||
{assessment.title}
|
||||
<button class="visibility-unhide" onclick={() => unhideAssessment(assessment.id)}
|
||||
>Show</button
|
||||
>
|
||||
<button class="visibility-unhide" onclick={() => unhideAssessment(assessment.id)}>Show</button>
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -399,7 +349,7 @@
|
||||
<div id="main-grid-content" class="bsplus-overview-animate bsplus-overview-delay-1">
|
||||
{#if board.filteredAssessments.length === 0}
|
||||
<div class="empty-state">
|
||||
<ClipboardListIcon size={40} class="bsplus-overview-icon empty-icon" />
|
||||
<OverviewIcon name="clipboard-document-list" size={40} class="empty-icon" />
|
||||
<p>No assessments found matching your filters</p>
|
||||
</div>
|
||||
{:else}
|
||||
@@ -411,7 +361,10 @@
|
||||
<div class="column-header">
|
||||
<div class="column-title">
|
||||
<span class="column-title-main">
|
||||
<column.icon size={18} class="bsplus-overview-icon" />
|
||||
<OverviewIcon
|
||||
name={column.icon ?? STATUS_COLUMN_ICONS[column.key] ?? "queue-list"}
|
||||
size={18}
|
||||
/>
|
||||
{column.title}
|
||||
</span>
|
||||
<span class="column-count">{board.statusGroups[column.key].length}</span>
|
||||
@@ -431,7 +384,7 @@
|
||||
onclick={(e) => handleCardClick(assessment, e)}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onkeydown={(e) => e.key === "Enter" && handleCardClick(assessment, e)}
|
||||
onkeydown={(e) => e.key === 'Enter' && handleCardClick(assessment, e)}
|
||||
>
|
||||
<div class="card-labels">
|
||||
{#if isEngage && assessment.studentName}
|
||||
@@ -439,16 +392,10 @@
|
||||
{/if}
|
||||
<span class="card-label label-subject">{assessment.code}</span>
|
||||
{#if assessment.submitted}
|
||||
<span
|
||||
class="card-label label-submitted"
|
||||
style="background: #10b981; color: white;">Submitted</span
|
||||
>
|
||||
<span class="card-label label-submitted" style="background: #10b981; color: white;">Submitted</span>
|
||||
{/if}
|
||||
{#if isCompleted && status === "MARKS_RELEASED" && !assessmentHasGradeDisplay(assessment)}
|
||||
<span
|
||||
class="card-label label-completed"
|
||||
style="background: #059669; color: white;">Completed</span
|
||||
>
|
||||
<span class="card-label label-completed" style="background: #059669; color: white;">Completed</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -460,37 +407,22 @@
|
||||
onclick={(e) => toggleMenu(assessment.id, e)}
|
||||
aria-label="Open menu"
|
||||
>
|
||||
<EllipsisVerticalIcon size={16} class="bsplus-overview-icon" />
|
||||
<OverviewIcon name="ellipsis-vertical" size={16} />
|
||||
</button>
|
||||
<div
|
||||
class="menu-dropdown"
|
||||
style="display: {openMenuId === assessment.id ? 'block' : 'none'};"
|
||||
>
|
||||
<div class="menu-dropdown" style="display: {openMenuId === assessment.id ? 'block' : 'none'};">
|
||||
{#if status !== "MARKS_RELEASED"}
|
||||
<button
|
||||
class="menu-item mark-completed"
|
||||
onclick={() => markAssessmentCompleted(assessment)}
|
||||
>
|
||||
<button class="menu-item mark-completed" onclick={() => markAssessmentCompleted(assessment)}>
|
||||
Mark as Completed
|
||||
</button>
|
||||
{:else if isCompleted}
|
||||
<button
|
||||
class="menu-item mark-not-completed"
|
||||
onclick={() => unmarkAssessmentCompleted(assessment)}
|
||||
>
|
||||
<button class="menu-item mark-not-completed" onclick={() => unmarkAssessmentCompleted(assessment)}>
|
||||
Mark as Not Complete
|
||||
</button>
|
||||
{/if}
|
||||
<button
|
||||
class="menu-item menu-item-hide"
|
||||
onclick={() => hideAssessment(assessment)}
|
||||
>
|
||||
<button class="menu-item menu-item-hide" onclick={() => hideAssessment(assessment)}>
|
||||
Hide assessment
|
||||
</button>
|
||||
<button
|
||||
class="menu-item menu-item-hide"
|
||||
onclick={() => hideSubject(assessment.code)}
|
||||
>
|
||||
<button class="menu-item menu-item-hide" onclick={() => hideSubject(assessment.code)}>
|
||||
Hide subject ({assessment.code})
|
||||
</button>
|
||||
</div>
|
||||
@@ -502,11 +434,8 @@
|
||||
{#if !assessmentHasGradeDisplay(assessment) && !isCompleted}
|
||||
<div class="assessment-meta">
|
||||
<div class="due-date {dueDateClass}">
|
||||
<CalendarDaysIcon size={14} class="bsplus-overview-icon" />
|
||||
{formatDate(
|
||||
assessment.due || assessment.date || assessment.dueDate || "",
|
||||
assessment.submitted,
|
||||
)}
|
||||
<OverviewIcon name="calendar-days" size={14} />
|
||||
{formatDate(assessment.due || assessment.date || assessment.dueDate || "", assessment.submitted)}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -515,10 +444,7 @@
|
||||
{@const gradeLabel = getDisplayGrade(assessment, isLetterGradeMode())}
|
||||
{@const barPercent = getThermoscorePercent(assessment) ?? 0}
|
||||
<div class="card-footer">
|
||||
<div
|
||||
class="Thermoscore__Thermoscore___WFpL3"
|
||||
style="--fill-colour: {color}"
|
||||
>
|
||||
<div class="Thermoscore__Thermoscore___WFpL3" style="--fill-colour: {color}">
|
||||
<div style="width: {barPercent}%" class="Thermoscore__fill___ojxDI">
|
||||
<div title={gradeLabel} class="Thermoscore__text___XSR_M">
|
||||
{gradeLabel}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import CircleAlertIcon from "@lucide/svelte/icons/circle-alert";
|
||||
import OverviewIcon from "./OverviewIcon.svelte";
|
||||
|
||||
let { error }: { error: string } = $props();
|
||||
</script>
|
||||
|
||||
<div class="error-container bsplus-overview-animate">
|
||||
<CircleAlertIcon size={40} class="bsplus-overview-icon error-icon" />
|
||||
<OverviewIcon name="exclamation-circle" size={40} class="error-icon" />
|
||||
<p class="error-text">Failed to load assessments</p>
|
||||
<p class="error-detail">{error}</p>
|
||||
</div>
|
||||
@@ -0,0 +1,32 @@
|
||||
<script lang="ts">
|
||||
import { OVERVIEW_ICON_PATHS, type OverviewIconName } from "./icons";
|
||||
|
||||
interface Props {
|
||||
name: OverviewIconName;
|
||||
class?: string;
|
||||
size?: number;
|
||||
}
|
||||
|
||||
let { name, class: className = "", size = 20 }: Props = $props();
|
||||
|
||||
const paths = $derived.by(() => {
|
||||
const raw = OVERVIEW_ICON_PATHS[name];
|
||||
return Array.isArray(raw) ? raw : [raw];
|
||||
});
|
||||
</script>
|
||||
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
width={size}
|
||||
height={size}
|
||||
class="bsplus-overview-icon {className}"
|
||||
aria-hidden="true"
|
||||
>
|
||||
{#each paths as path, index (index)}
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d={path} />
|
||||
{/each}
|
||||
</svg>
|
||||
@@ -1,41 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { STATUS_COLUMN_ICONS, type OverviewIcon } from "./icons";
|
||||
import OverviewIcon from "./OverviewIcon.svelte";
|
||||
import type { OverviewIconName } from "./icons";
|
||||
|
||||
const columns: {
|
||||
key: string;
|
||||
title: string;
|
||||
className: string;
|
||||
icon: OverviewIcon;
|
||||
icon: OverviewIconName;
|
||||
skeletonCount: number;
|
||||
}[] = [
|
||||
{
|
||||
key: "UPCOMING",
|
||||
title: "Upcoming",
|
||||
className: "column-upcoming",
|
||||
icon: STATUS_COLUMN_ICONS.UPCOMING,
|
||||
skeletonCount: 3,
|
||||
},
|
||||
{
|
||||
key: "DUE_SOON",
|
||||
title: "Due Soon",
|
||||
className: "column-due-soon",
|
||||
icon: STATUS_COLUMN_ICONS.DUE_SOON,
|
||||
skeletonCount: 2,
|
||||
},
|
||||
{
|
||||
key: "OVERDUE",
|
||||
title: "Overdue",
|
||||
className: "column-overdue",
|
||||
icon: STATUS_COLUMN_ICONS.OVERDUE,
|
||||
skeletonCount: 1,
|
||||
},
|
||||
{
|
||||
key: "MARKS_RELEASED",
|
||||
title: "Marked",
|
||||
className: "column-marked",
|
||||
icon: STATUS_COLUMN_ICONS.MARKS_RELEASED,
|
||||
skeletonCount: 4,
|
||||
},
|
||||
{ key: "UPCOMING", title: "Upcoming", className: "column-upcoming", icon: "calendar-days", skeletonCount: 3 },
|
||||
{ key: "DUE_SOON", title: "Due Soon", className: "column-due-soon", icon: "clock", skeletonCount: 2 },
|
||||
{ key: "OVERDUE", title: "Overdue", className: "column-overdue", icon: "exclamation-triangle", skeletonCount: 1 },
|
||||
{ key: "MARKS_RELEASED", title: "Marked", className: "column-marked", icon: "check-circle", skeletonCount: 4 },
|
||||
];
|
||||
</script>
|
||||
|
||||
@@ -63,7 +40,7 @@
|
||||
<div class="column-header">
|
||||
<div class="column-title">
|
||||
<span class="column-title-main">
|
||||
<column.icon size={18} class="bsplus-overview-icon" />
|
||||
<OverviewIcon name={column.icon} size={18} />
|
||||
{column.title}
|
||||
</span>
|
||||
<span class="column-count">…</span>
|
||||
|
||||
@@ -1,28 +1,60 @@
|
||||
import BookOpenIcon from "@lucide/svelte/icons/book-open";
|
||||
import CalendarIcon from "@lucide/svelte/icons/calendar";
|
||||
import CalendarDaysIcon from "@lucide/svelte/icons/calendar-days";
|
||||
import ChartColumnIcon from "@lucide/svelte/icons/chart-column";
|
||||
import CircleCheckIcon from "@lucide/svelte/icons/circle-check";
|
||||
import ClockIcon from "@lucide/svelte/icons/clock";
|
||||
import FileCheckIcon from "@lucide/svelte/icons/file-check";
|
||||
import ListIcon from "@lucide/svelte/icons/list";
|
||||
import TriangleAlertIcon from "@lucide/svelte/icons/triangle-alert";
|
||||
/** Heroicons v2 outline paths (https://heroicons.com) */
|
||||
export type OverviewIconName =
|
||||
| "calendar-days"
|
||||
| "clock"
|
||||
| "exclamation-triangle"
|
||||
| "document-check"
|
||||
| "check-circle"
|
||||
| "book-open"
|
||||
| "calendar"
|
||||
| "chart-bar"
|
||||
| "queue-list"
|
||||
| "eye"
|
||||
| "clipboard-document-list"
|
||||
| "ellipsis-vertical"
|
||||
| "exclamation-circle";
|
||||
|
||||
export type OverviewIcon = typeof ListIcon;
|
||||
|
||||
export const DEFAULT_COLUMN_ICON: OverviewIcon = ListIcon;
|
||||
|
||||
export const STATUS_COLUMN_ICONS: Record<string, OverviewIcon> = {
|
||||
UPCOMING: CalendarDaysIcon,
|
||||
DUE_SOON: ClockIcon,
|
||||
OVERDUE: TriangleAlertIcon,
|
||||
SUBMITTED: FileCheckIcon,
|
||||
MARKS_RELEASED: CircleCheckIcon,
|
||||
export const OVERVIEW_ICON_PATHS: Record<OverviewIconName, string | string[]> = {
|
||||
"calendar-days":
|
||||
"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5",
|
||||
clock: "M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z",
|
||||
"exclamation-triangle":
|
||||
"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",
|
||||
"document-check":
|
||||
"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9zm3.75 8.625a2.625 2.625 0 100-5.25 2.625 2.625 0 000 5.25zm0 0l-3 3m3-3l3 3",
|
||||
"check-circle": "M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z",
|
||||
"book-open":
|
||||
"M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25",
|
||||
calendar:
|
||||
"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5",
|
||||
"chart-bar":
|
||||
"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z",
|
||||
"queue-list":
|
||||
"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 010 3.75H5.625a1.875 1.875 0 010-3.75z",
|
||||
eye: [
|
||||
"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z",
|
||||
"M15 12a3 3 0 11-6 0 3 3 0 016 0z",
|
||||
],
|
||||
"clipboard-document-list": [
|
||||
"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 17.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z",
|
||||
"M8.25 6.75V4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V6.75H8.25z",
|
||||
],
|
||||
"ellipsis-vertical":
|
||||
"M12 6.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 12.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 18.75a.75.75 0 110-1.5.75.75 0 010 1.5z",
|
||||
"exclamation-circle": "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z",
|
||||
};
|
||||
|
||||
export const GROUP_SORT_ICONS: Record<string, OverviewIcon> = {
|
||||
year: CalendarIcon,
|
||||
subject: BookOpenIcon,
|
||||
grade: ChartColumnIcon,
|
||||
title: ListIcon,
|
||||
export const STATUS_COLUMN_ICONS: Record<string, OverviewIconName> = {
|
||||
UPCOMING: "calendar-days",
|
||||
DUE_SOON: "clock",
|
||||
OVERDUE: "exclamation-triangle",
|
||||
SUBMITTED: "document-check",
|
||||
MARKS_RELEASED: "check-circle",
|
||||
};
|
||||
|
||||
export const GROUP_SORT_ICONS: Record<string, OverviewIconName> = {
|
||||
year: "calendar",
|
||||
subject: "book-open",
|
||||
grade: "chart-bar",
|
||||
title: "queue-list",
|
||||
};
|
||||
@@ -1,102 +1,89 @@
|
||||
<script lang="ts">
|
||||
import UploadIcon from "@lucide/svelte/icons/upload";
|
||||
import localforage from "localforage";
|
||||
import { onMount } from "svelte";
|
||||
import localforage from 'localforage'
|
||||
import { onMount } from 'svelte'
|
||||
|
||||
let fileInput = $state<HTMLInputElement | undefined>(undefined);
|
||||
let dragging = $state(false);
|
||||
let filename = $state<string | undefined>(undefined);
|
||||
let durationText = $state<string | undefined>(undefined);
|
||||
let fileInput = $state<HTMLInputElement | undefined>(undefined)
|
||||
let dragging = $state(false)
|
||||
let filename = $state<string | undefined>(undefined)
|
||||
let durationText = $state<string | undefined>(undefined)
|
||||
|
||||
const store = localforage.createInstance({
|
||||
name: "background-music-store",
|
||||
storeName: "music",
|
||||
});
|
||||
name: 'background-music-store',
|
||||
storeName: 'music',
|
||||
})
|
||||
|
||||
async function loadExisting() {
|
||||
const name = await store.getItem<string>("audio-name");
|
||||
filename = name ?? undefined;
|
||||
const name = await store.getItem<string>('audio-name')
|
||||
filename = name ?? undefined
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
loadExisting();
|
||||
});
|
||||
onMount(() => { loadExisting() })
|
||||
|
||||
function triggerSelect() {
|
||||
fileInput?.click();
|
||||
}
|
||||
function triggerSelect() { fileInput?.click() }
|
||||
|
||||
async function handleFiles(files: FileList | null) {
|
||||
const file = files?.[0];
|
||||
if (!file) return;
|
||||
const isSupported =
|
||||
file.type === "audio/wav" ||
|
||||
file.type === "audio/mpeg" ||
|
||||
file.name.toLowerCase().endsWith(".wav") ||
|
||||
file.name.toLowerCase().endsWith(".mp3");
|
||||
const file = files?.[0]
|
||||
if (!file) return
|
||||
const isSupported = file.type === 'audio/wav' || file.type === 'audio/mpeg' ||
|
||||
file.name.toLowerCase().endsWith('.wav') || file.name.toLowerCase().endsWith('.mp3')
|
||||
if (!isSupported) {
|
||||
alert("Please select a .wav or .mp3 audio file");
|
||||
return;
|
||||
alert('Please select a .wav or .mp3 audio file')
|
||||
return
|
||||
}
|
||||
|
||||
await store.setItem("audio-blob", file);
|
||||
await store.setItem("audio-name", file.name);
|
||||
filename = file.name;
|
||||
await store.setItem('audio-blob', file)
|
||||
await store.setItem('audio-name', file.name)
|
||||
filename = file.name
|
||||
|
||||
try {
|
||||
const url = URL.createObjectURL(file);
|
||||
const audio = new Audio(url);
|
||||
const url = URL.createObjectURL(file)
|
||||
const audio = new Audio(url)
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
audio.onloadedmetadata = () => resolve();
|
||||
audio.onerror = () => reject();
|
||||
});
|
||||
audio.onloadedmetadata = () => resolve()
|
||||
audio.onerror = () => reject()
|
||||
})
|
||||
if (!isNaN(audio.duration) && audio.duration !== Infinity) {
|
||||
const minutes = Math.floor(audio.duration / 60);
|
||||
const seconds = Math.round(audio.duration % 60);
|
||||
durationText = `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
||||
const minutes = Math.floor(audio.duration / 60)
|
||||
const seconds = Math.round(audio.duration % 60)
|
||||
durationText = `${minutes}:${seconds.toString().padStart(2, '0')}`
|
||||
} else {
|
||||
durationText = undefined;
|
||||
durationText = undefined
|
||||
}
|
||||
URL.revokeObjectURL(url);
|
||||
URL.revokeObjectURL(url)
|
||||
} catch {
|
||||
durationText = undefined;
|
||||
durationText = undefined
|
||||
}
|
||||
|
||||
window.dispatchEvent(new Event("betterseqta-background-music-updated"));
|
||||
window.dispatchEvent(new Event('betterseqta-background-music-updated'))
|
||||
}
|
||||
|
||||
function onFileChange() {
|
||||
handleFiles(fileInput?.files || null);
|
||||
}
|
||||
function onFileChange() { handleFiles(fileInput?.files || null) }
|
||||
|
||||
function onDrop(event: DragEvent) {
|
||||
event.preventDefault();
|
||||
dragging = false;
|
||||
handleFiles(event.dataTransfer?.files || null);
|
||||
event.preventDefault()
|
||||
dragging = false
|
||||
handleFiles(event.dataTransfer?.files || null)
|
||||
}
|
||||
|
||||
async function removeAudio() {
|
||||
await store.removeItem("audio-blob");
|
||||
await store.removeItem("audio-name");
|
||||
filename = undefined;
|
||||
durationText = undefined;
|
||||
window.dispatchEvent(new Event("betterseqta-background-music-stop"));
|
||||
await store.removeItem('audio-blob')
|
||||
await store.removeItem('audio-name')
|
||||
filename = undefined
|
||||
durationText = undefined
|
||||
window.dispatchEvent(new Event('betterseqta-background-music-stop'))
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="relative cursor-pointer select-none"
|
||||
onclick={() => triggerSelect()}
|
||||
ondragover={(e) => {
|
||||
e.stopPropagation();
|
||||
dragging = true;
|
||||
}}
|
||||
ondragleave={() => (dragging = false)}
|
||||
ondragover={(e) => { e.stopPropagation(); dragging = true }}
|
||||
ondragleave={() => dragging = false}
|
||||
ondrop={onDrop}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
triggerSelect();
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault()
|
||||
triggerSelect()
|
||||
}
|
||||
}}
|
||||
role="button"
|
||||
@@ -111,30 +98,21 @@
|
||||
</div>
|
||||
<button
|
||||
class="flex justify-center items-center m-1 text-lg dark:text-white size-7"
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
removeAudio();
|
||||
}}
|
||||
aria-label="Remove audio">×</button
|
||||
>
|
||||
onclick={(e) => { e.stopPropagation(); removeAudio() }}
|
||||
aria-label="Remove audio"
|
||||
>×</button>
|
||||
</div>
|
||||
{:else}
|
||||
<div
|
||||
class="flex gap-2 items-center px-3 py-1 text-xs rounded-lg border border-dashed transition border-zinc-300 dark:border-zinc-600 text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-300 text-nowrap"
|
||||
>
|
||||
<UploadIcon size="1em" class="text-lg" />
|
||||
<div class="flex gap-2 items-center px-3 py-1 text-xs rounded-lg border border-dashed transition border-zinc-300 dark:border-zinc-600 text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-300 text-nowrap">
|
||||
<span class="text-lg font-IconFamily">{'\ued47'}</span>
|
||||
<span>Upload audio</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<input
|
||||
type="file"
|
||||
accept="audio/wav,audio/mpeg"
|
||||
class="hidden"
|
||||
bind:this={fileInput}
|
||||
onchange={onFileChange}
|
||||
/>
|
||||
<input type="file" accept="audio/wav,audio/mpeg" class="hidden" bind:this={fileInput} onchange={onFileChange} />
|
||||
{#if dragging}
|
||||
<div class="absolute inset-0 rounded-lg bg-zinc-200/40 dark:bg-zinc-700/40"></div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { ChevronLeft, ChevronRight } from "lucide-static";
|
||||
import type { Plugin } from "@/plugins/core/types";
|
||||
import { BasePlugin } from "@/plugins/core/settings";
|
||||
import { booleanSetting, defineSettings, Setting } from "@/plugins/core/settingsHelpers";
|
||||
@@ -195,10 +193,10 @@ const ensureArrows = (course: HTMLElement) => {
|
||||
container.id = ARROW_CONTAINER_ID;
|
||||
container.innerHTML = `
|
||||
<button type="button" class="en-arrow" data-en-action="prev" title="Previous lesson" aria-label="Previous lesson">
|
||||
${icon(ChevronLeft)}
|
||||
<svg viewBox="0 0 24 24"><path d="M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>
|
||||
</button>
|
||||
<button type="button" class="en-arrow" data-en-action="next" title="Next lesson" aria-label="Next lesson">
|
||||
${icon(ChevronRight)}
|
||||
<svg viewBox="0 0 24 24"><path d="M8.59 16.59 10 18l6-6-6-6-1.41 1.41L13.17 12z"/></svg>
|
||||
</button>
|
||||
`;
|
||||
document.body.appendChild(container);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<script lang="ts">
|
||||
import ArrowRightIcon from "@lucide/svelte/icons/arrow-right";
|
||||
import { onDestroy } from "svelte";
|
||||
import { calculateExpression } from "../utils/calculator";
|
||||
import { onDestroy } from 'svelte';
|
||||
import { calculateExpression } from '../utils/calculator';
|
||||
|
||||
let {
|
||||
searchTerm = "",
|
||||
searchTerm = '',
|
||||
isSelected = false,
|
||||
onresult,
|
||||
}: {
|
||||
@@ -15,8 +14,8 @@
|
||||
|
||||
let result = $state<string | null>(null);
|
||||
let isCalculating = $state(false);
|
||||
let inputUnit = $state<string>("");
|
||||
let outputUnit = $state<string>("");
|
||||
let inputUnit = $state<string>('');
|
||||
let outputUnit = $state<string>('');
|
||||
let isPartial = $state(false);
|
||||
|
||||
let calcGen = 0;
|
||||
@@ -37,16 +36,16 @@
|
||||
onresult(calcResult.result);
|
||||
} else {
|
||||
result = null;
|
||||
inputUnit = "";
|
||||
outputUnit = "";
|
||||
inputUnit = '';
|
||||
outputUnit = '';
|
||||
isPartial = false;
|
||||
onresult(null);
|
||||
}
|
||||
} catch {
|
||||
if (gen !== calcGen) return;
|
||||
result = null;
|
||||
inputUnit = "";
|
||||
outputUnit = "";
|
||||
inputUnit = '';
|
||||
outputUnit = '';
|
||||
isPartial = false;
|
||||
onresult(null);
|
||||
} finally {
|
||||
@@ -64,58 +63,40 @@
|
||||
</script>
|
||||
|
||||
{#if result !== null}
|
||||
<div class="">
|
||||
<p class="text-[0.85rem] p-1 pb-0.5 pt-0 font-semibold text-zinc-500 dark:text-zinc-400">
|
||||
Calculator
|
||||
</p>
|
||||
<div
|
||||
class="flex items-center justify-between gap-8 rounded-lg border border-transparent {isSelected
|
||||
? 'bg-zinc-900/5 dark:bg-white/10 border-zinc-900/5 dark:border-zinc-100/5'
|
||||
: ''}"
|
||||
>
|
||||
<div class="">
|
||||
<p class="text-[0.85rem] p-1 pb-0.5 pt-0 font-semibold text-zinc-500 dark:text-zinc-400">Calculator</p>
|
||||
<div class="flex items-center justify-between gap-8 rounded-lg border border-transparent {isSelected ? 'bg-zinc-900/5 dark:bg-white/10 border-zinc-900/5 dark:border-zinc-100/5' : ''}">
|
||||
<div class="flex flex-col flex-1 items-center py-4 pl-4 min-w-0">
|
||||
<div
|
||||
class="overflow-hidden py-2 w-full font-semibold text-center whitespace-nowrap text-zinc-900 dark:text-white text-ellipsis"
|
||||
style="--char-count: {searchTerm?.length ||
|
||||
10}; font-size: min(2.5rem, max(1rem, calc(35vw / var(--char-count, 10))))"
|
||||
>
|
||||
<div class="overflow-hidden py-2 w-full font-semibold text-center whitespace-nowrap text-zinc-900 dark:text-white text-ellipsis"
|
||||
style="--char-count: {searchTerm?.length || 10}; font-size: min(2.5rem, max(1rem, calc(35vw / var(--char-count, 10))))">
|
||||
{searchTerm}
|
||||
</div>
|
||||
<div
|
||||
class="px-3 py-1 mt-1 text-sm rounded-md text-zinc-900 dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-100/10"
|
||||
>
|
||||
{inputUnit || "Question"}
|
||||
<div class="px-3 py-1 mt-1 text-sm rounded-md text-zinc-900 dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-100/10">
|
||||
{inputUnit || 'Question'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col shrink-0 justify-center items-center w-12">
|
||||
<div class="h-8 w-px bg-zinc-900/5 dark:bg-zinc-100/5"></div>
|
||||
<div class="text-2xl text-zinc-900 dark:text-zinc-100">
|
||||
<ArrowRightIcon size="1em" />
|
||||
→
|
||||
</div>
|
||||
<div class="h-8 w-px bg-zinc-900/5 dark:bg-zinc-100/5"></div>
|
||||
</div>
|
||||
|
||||
{#if !isCalculating}
|
||||
<div class="flex flex-col flex-1 items-center py-4 pr-4 min-w-0">
|
||||
<div
|
||||
class="overflow-hidden py-2 w-full font-semibold text-center whitespace-nowrap text-zinc-900 dark:text-white text-ellipsis"
|
||||
style="--char-count: {result?.length ||
|
||||
10}; font-size: min(2.5rem, max(1rem, calc(30vw / var(--char-count, 10))))"
|
||||
>
|
||||
<div class="overflow-hidden py-2 w-full font-semibold text-center whitespace-nowrap text-zinc-900 dark:text-white text-ellipsis"
|
||||
style="--char-count: {result?.length || 10}; font-size: min(2.5rem, max(1rem, calc(30vw / var(--char-count, 10))))">
|
||||
{result}
|
||||
</div>
|
||||
<div
|
||||
class="px-3 py-1 mt-1 text-sm rounded-md text-zinc-900 dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-100/10"
|
||||
>
|
||||
{outputUnit || (isPartial ? "Partial" : "Result")}
|
||||
<div class="px-3 py-1 mt-1 text-sm rounded-md text-zinc-900 dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-100/10">
|
||||
{outputUnit || (isPartial ? 'Partial' : 'Result')}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div
|
||||
class="w-6 h-6 rounded-full border-2 animate-spin border-zinc-300 dark:border-zinc-700 border-t-zinc-600 dark:border-t-zinc-300"
|
||||
></div>
|
||||
<div class="w-6 h-6 rounded-full border-2 animate-spin border-zinc-300 dark:border-zinc-700 border-t-zinc-600 dark:border-t-zinc-300"></div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1,36 +1,28 @@
|
||||
<script lang="ts">
|
||||
import FolderOpenIcon from "@lucide/svelte/icons/folder-open";
|
||||
import SearchIcon from "./SearchIcon.svelte";
|
||||
import { iconForCategory } from "../core/searchIcons";
|
||||
import { onMount, tick } from "svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { fade, scale } from "svelte/transition";
|
||||
import { circOut, quintOut } from "svelte/easing";
|
||||
import { type StaticCommandItem } from "../core/commands";
|
||||
import type { CombinedResult } from "../core/types";
|
||||
import {
|
||||
createSearchIndexes,
|
||||
applyDynamicIndexDelta,
|
||||
performSearch as doSearch,
|
||||
type DynamicItemsUpdatedDetail,
|
||||
} from "../search/searchUtils";
|
||||
import Fuse from "fuse.js";
|
||||
import Calculator from "./Calculator.svelte";
|
||||
import { actionMap } from "../indexing/actions";
|
||||
import type { IndexItem } from "../indexing/types";
|
||||
import debounce from "@/seqta/utils/debounce";
|
||||
import { renderComponentMap } from "../indexing/renderComponents";
|
||||
import HighlightedText from "../utils/HighlightedText.svelte";
|
||||
import { matchesHotkey } from "../utils/hotkeyUtils";
|
||||
import { warmUpVectorSearchOnInteraction } from "../search/vector/vectorSearch";
|
||||
import browser from "@/lib/browser";
|
||||
import { onMount, tick } from 'svelte';
|
||||
import { settingsState } from '@/seqta/utils/listeners/settingsState'
|
||||
import { fade, scale } from 'svelte/transition';
|
||||
import { circOut, quintOut } from 'svelte/easing';
|
||||
import { type StaticCommandItem } from '../core/commands';
|
||||
import type { CombinedResult } from '../core/types';
|
||||
import { createSearchIndexes, applyDynamicIndexDelta, performSearch as doSearch, type DynamicItemsUpdatedDetail } from '../search/searchUtils';
|
||||
import Fuse from 'fuse.js';
|
||||
import Calculator from './Calculator.svelte';
|
||||
import { actionMap } from '../indexing/actions';
|
||||
import type { IndexItem } from '../indexing/types';
|
||||
import debounce from '@/seqta/utils/debounce';
|
||||
import { renderComponentMap } from '../indexing/renderComponents';
|
||||
import HighlightedText from '../utils/HighlightedText.svelte';
|
||||
import { matchesHotkey } from '../utils/hotkeyUtils';
|
||||
import { warmUpVectorSearchOnInteraction } from '../search/vector/vectorSearch';
|
||||
import browser from '@/lib/browser';
|
||||
|
||||
const {
|
||||
transparencyEffects,
|
||||
searchHotkey: initialSearchHotkey,
|
||||
searchHotkey: initialSearchHotkey
|
||||
}: {
|
||||
transparencyEffects: boolean;
|
||||
searchHotkey: string;
|
||||
transparencyEffects: boolean,
|
||||
searchHotkey: string
|
||||
} = $props();
|
||||
|
||||
let currentSearchHotkey = $derived(initialSearchHotkey);
|
||||
@@ -42,7 +34,7 @@
|
||||
const commandIdToItemMap = $state(new Map<string, StaticCommandItem>());
|
||||
|
||||
let commandPalleteOpen = $state(false);
|
||||
let searchTerm = $state("");
|
||||
let searchTerm = $state('');
|
||||
let selectedIndex = $state(0);
|
||||
let combinedResults = $state<CombinedResult[]>([]);
|
||||
let searchbar = $state<HTMLInputElement>();
|
||||
@@ -58,13 +50,13 @@
|
||||
// the `world w` pass and clobbers the more relevant matches.
|
||||
let searchRequestId = 0;
|
||||
|
||||
|
||||
let keydownHandler: ((e: KeyboardEvent) => void) | null = null;
|
||||
|
||||
$effect(() => {
|
||||
const loadSettings = async () => {
|
||||
const settings = await browser.storage.local.get("plugin.global-search.settings");
|
||||
const pluginSettings = settings["plugin.global-search.settings"] as
|
||||
{ searchHotkey?: string } | undefined;
|
||||
const settings = await browser.storage.local.get('plugin.global-search.settings');
|
||||
const pluginSettings = settings['plugin.global-search.settings'] as { searchHotkey?: string } | undefined;
|
||||
if (pluginSettings?.searchHotkey) {
|
||||
currentSearchHotkey = pluginSettings.searchHotkey;
|
||||
}
|
||||
@@ -73,9 +65,8 @@
|
||||
loadSettings();
|
||||
|
||||
const handleStorageChange = (changes: any, area: string) => {
|
||||
if (area === "local" && changes["plugin.global-search.settings"]) {
|
||||
const newSettings = changes["plugin.global-search.settings"].newValue as
|
||||
{ searchHotkey?: string } | undefined;
|
||||
if (area === 'local' && changes['plugin.global-search.settings']) {
|
||||
const newSettings = changes['plugin.global-search.settings'].newValue as { searchHotkey?: string } | undefined;
|
||||
if (newSettings?.searchHotkey) {
|
||||
currentSearchHotkey = newSettings.searchHotkey;
|
||||
}
|
||||
@@ -92,7 +83,7 @@
|
||||
// Update keydown handler when hotkey changes
|
||||
$effect(() => {
|
||||
if (keydownHandler) {
|
||||
window.removeEventListener("keydown", keydownHandler);
|
||||
window.removeEventListener('keydown', keydownHandler);
|
||||
}
|
||||
|
||||
keydownHandler = (e: KeyboardEvent) => {
|
||||
@@ -102,16 +93,16 @@
|
||||
commandPalleteOpen = true;
|
||||
tick().then(() => searchbar?.focus());
|
||||
}
|
||||
if (e.key === "Escape") {
|
||||
if (e.key === 'Escape') {
|
||||
commandPalleteOpen = false;
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("keydown", keydownHandler);
|
||||
window.addEventListener('keydown', keydownHandler);
|
||||
|
||||
return () => {
|
||||
if (keydownHandler) {
|
||||
window.removeEventListener("keydown", keydownHandler);
|
||||
window.removeEventListener('keydown', keydownHandler);
|
||||
keydownHandler = null;
|
||||
}
|
||||
};
|
||||
@@ -121,13 +112,21 @@
|
||||
const applyItemsUpdate = (event: Event) => {
|
||||
const detail = (event as CustomEvent<DynamicItemsUpdatedDetail>).detail;
|
||||
|
||||
if (detail?.vectorUpdate && !detail.changedItems?.length && !detail.removedIds?.length) {
|
||||
if (
|
||||
detail?.vectorUpdate &&
|
||||
!detail.changedItems?.length &&
|
||||
!detail.removedIds?.length
|
||||
) {
|
||||
performSearch();
|
||||
return;
|
||||
}
|
||||
|
||||
if (detail?.incremental && !detail.fullRebuild) {
|
||||
const updatedFuse = applyDynamicIndexDelta(dynamicContentFuse, dynamicIdToItemMap, detail);
|
||||
const updatedFuse = applyDynamicIndexDelta(
|
||||
dynamicContentFuse,
|
||||
dynamicIdToItemMap,
|
||||
detail,
|
||||
);
|
||||
if (updatedFuse) {
|
||||
dynamicContentFuse = updatedFuse;
|
||||
performSearch();
|
||||
@@ -153,7 +152,7 @@
|
||||
});
|
||||
};
|
||||
|
||||
window.addEventListener("dynamic-items-updated", itemsUpdatedHandler);
|
||||
window.addEventListener('dynamic-items-updated', itemsUpdatedHandler);
|
||||
|
||||
setupSearchIndexes();
|
||||
|
||||
@@ -165,17 +164,12 @@
|
||||
|
||||
return () => {
|
||||
if (itemsUpdateRaf) cancelAnimationFrame(itemsUpdateRaf);
|
||||
window.removeEventListener("dynamic-items-updated", itemsUpdatedHandler);
|
||||
window.removeEventListener('dynamic-items-updated', itemsUpdatedHandler);
|
||||
};
|
||||
});
|
||||
|
||||
function setupSearchIndexes() {
|
||||
const {
|
||||
commandsFuse: cfuse,
|
||||
dynamicContentFuse: dfuse,
|
||||
commands,
|
||||
dynamicItems,
|
||||
} = createSearchIndexes();
|
||||
const { commandsFuse: cfuse, dynamicContentFuse: dfuse, commands, dynamicItems } = createSearchIndexes();
|
||||
|
||||
commandsFuse = cfuse;
|
||||
dynamicContentFuse = dfuse;
|
||||
@@ -183,8 +177,8 @@
|
||||
dynamicIdToItemMap.clear();
|
||||
commandIdToItemMap.clear();
|
||||
|
||||
dynamicItems.forEach((item) => dynamicIdToItemMap.set(item.id, item));
|
||||
commands.forEach((item) => commandIdToItemMap.set(item.id, item));
|
||||
dynamicItems.forEach(item => dynamicIdToItemMap.set(item.id, item));
|
||||
commands.forEach(item => commandIdToItemMap.set(item.id, item));
|
||||
}
|
||||
|
||||
const performSearch = async () => {
|
||||
@@ -193,7 +187,7 @@
|
||||
|
||||
tick().then(() => {
|
||||
const selectedElement = resultsList?.querySelector(`li:nth-child(1)`);
|
||||
selectedElement?.scrollIntoView({ block: "nearest" });
|
||||
selectedElement?.scrollIntoView({ block: 'nearest' });
|
||||
});
|
||||
|
||||
const term = searchTerm.trim().toLowerCase();
|
||||
@@ -235,7 +229,7 @@
|
||||
|
||||
$effect(() => {
|
||||
if (commandPalleteOpen) {
|
||||
if (searchTerm === "") {
|
||||
if (searchTerm === '') {
|
||||
// Immediate search for empty query (shows recent items)
|
||||
performSearch();
|
||||
} else if (searchTerm.length <= 2) {
|
||||
@@ -247,7 +241,7 @@
|
||||
}
|
||||
tick().then(() => searchbar?.focus());
|
||||
} else {
|
||||
searchTerm = "";
|
||||
searchTerm = '';
|
||||
selectedIndex = 0;
|
||||
combinedResults = [];
|
||||
}
|
||||
@@ -265,7 +259,7 @@
|
||||
selectedIndex++;
|
||||
tick().then(() => {
|
||||
const selectedElement = resultsList?.querySelector(`li:nth-child(${selectedIndex + 1})`);
|
||||
selectedElement?.scrollIntoView({ block: "nearest" });
|
||||
selectedElement?.scrollIntoView({ block: 'nearest' });
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -275,15 +269,15 @@
|
||||
selectedIndex--;
|
||||
tick().then(() => {
|
||||
const selectedElement = resultsList?.querySelector(`li:nth-child(${selectedIndex + 1})`);
|
||||
selectedElement?.scrollIntoView({ block: "nearest" });
|
||||
selectedElement?.scrollIntoView({ block: 'nearest' });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function executeItemAction(item: StaticCommandItem | IndexItem) {
|
||||
if ("action" in item && typeof item.action === "function") {
|
||||
if ('action' in item && typeof item.action === 'function') {
|
||||
(item as StaticCommandItem).action();
|
||||
} else if ("actionId" in item && item.actionId && actionMap[item.actionId]) {
|
||||
} else if ('actionId' in item && item.actionId && actionMap[item.actionId]) {
|
||||
actionMap[item.actionId](item as IndexItem);
|
||||
}
|
||||
commandPalleteOpen = false;
|
||||
@@ -303,62 +297,56 @@
|
||||
};
|
||||
|
||||
const handleKeyNav = (e: KeyboardEvent) => {
|
||||
if (e.key === "ArrowDown") {
|
||||
if (e.key === 'ArrowDown') {
|
||||
e.preventDefault();
|
||||
selectNext();
|
||||
} else if (e.key === "ArrowUp") {
|
||||
} else if (e.key === 'ArrowUp') {
|
||||
e.preventDefault();
|
||||
selectPrev();
|
||||
} else if (e.key === "Enter") {
|
||||
} else if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
executeSelected();
|
||||
} else if (e.key === "Escape") {
|
||||
} else if (e.key === 'Escape') {
|
||||
commandPalleteOpen = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if commandPalleteOpen}
|
||||
<div role="dialog" aria-modal="true" class={settingsState.DarkMode ? "dark" : ""}>
|
||||
<div role="dialog" aria-modal="true" class={settingsState.DarkMode ? 'dark' : ''}>
|
||||
<div
|
||||
class="fixed inset-0 z-50000 bg-zinc-900/40 dark:bg-black/60"
|
||||
transition:fade={{ duration: 150, easing: quintOut }}
|
||||
></div>
|
||||
|
||||
<div
|
||||
class="fixed inset-0 z-50000 flex justify-center place-items-start p-8 sm:p-6 md:p-8 select-none scale-120 origin-top"
|
||||
onclick={() => (commandPalleteOpen = false)}
|
||||
onkeydown={(e: KeyboardEvent) => e.key === "Escape" && (commandPalleteOpen = false)}
|
||||
<div class="fixed inset-0 z-50000 flex justify-center place-items-start p-8 sm:p-6 md:p-8 select-none scale-120 origin-top"
|
||||
onclick={() => commandPalleteOpen = false}
|
||||
onkeydown={(e: KeyboardEvent) => e.key === 'Escape' && (commandPalleteOpen = false)}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
tabindex="0">
|
||||
<div
|
||||
class="w-full max-w-2xl overflow-clip rounded-xl ring-1 shadow-2xl ring-black/5 dark:ring-white/10 {transparencyEffects
|
||||
? 'bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl'
|
||||
: 'bg-white dark:bg-zinc-900'}"
|
||||
class="w-full max-w-2xl overflow-clip rounded-xl ring-1 shadow-2xl ring-black/5 dark:ring-white/10 { transparencyEffects ? 'bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl' : 'bg-white dark:bg-zinc-900' }"
|
||||
transition:scale={{ duration: 100, start: 0.95, opacity: 0, easing: circOut }}
|
||||
onclick={(e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
onkeydown={(e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") {
|
||||
if (e.key === 'Escape') {
|
||||
commandPalleteOpen = false;
|
||||
}
|
||||
}}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
tabindex="0">
|
||||
|
||||
<div class="relative p-2 border-b border-zinc-900/5 dark:border-zinc-100/5">
|
||||
<div
|
||||
class="absolute top-1/2 translate-y-[calc(-50%-3px)] scale-105 left-5 w-6 h-6 text-[1.3rem] text-zinc-900/40 dark:text-zinc-400/40 pointer-events-none"
|
||||
>
|
||||
<SearchIcon name="search" />
|
||||
<div class="absolute top-1/2 translate-y-[calc(-50%-3px)] scale-105 left-5 w-6 h-6 text-[1.3rem] text-zinc-900/40 dark:text-zinc-400/40 pointer-events-none font-IconFamily">
|
||||
{'\ueca5'}
|
||||
</div>
|
||||
<input
|
||||
bind:this={searchbar}
|
||||
bind:value={searchTerm}
|
||||
onkeydown={handleKeyNav}
|
||||
class="pr-4 pl-12 w-full h-10 text-lg bg-transparent border-0 outline-hidden placeholder-zinc-400 text-zinc-700 dark:placeholder-zinc-500 dark:text-white sm:text-xl"
|
||||
class="pr-4 pl-12 w-full h-10 text-lg bg-transparent border-0 outline-hidden placeholder-zinc-400 text-zinc-700 dark:placeholder-zinc-500 dark:text-white focus:ring-0 sm:text-xl"
|
||||
placeholder="Search..."
|
||||
/>
|
||||
</div>
|
||||
@@ -368,7 +356,7 @@
|
||||
class="overflow-y-auto max-h-96 text-base scroll-py-2 p-2 gap-0.5 flex flex-col"
|
||||
>
|
||||
<Calculator
|
||||
{searchTerm}
|
||||
searchTerm={searchTerm}
|
||||
isSelected={selectedIndex === 0}
|
||||
onresult={(result) => (calculatorResult = result)}
|
||||
/>
|
||||
@@ -378,39 +366,26 @@
|
||||
{@const isSelected = selectedIndex === (calculatorResult ? i + 1 : i)}
|
||||
{@const item = result.item}
|
||||
<li>
|
||||
{#if result.type === "command"}
|
||||
{#if result.type === 'command'}
|
||||
{@const staticItem = item as StaticCommandItem}
|
||||
<button
|
||||
class="w-full flex items-center px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50
|
||||
{isSelected
|
||||
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm'
|
||||
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
{isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
onclick={() => executeItemAction(staticItem)}
|
||||
>
|
||||
<div
|
||||
class="flex-none scale-90 w-8 h-8 text-xl flex items-center justify-center bg-linear-to-br {staticItem.category ===
|
||||
'navigation'
|
||||
? 'from-[#FA5D5D] to-[#DC2F30]'
|
||||
: 'from-[#4FBBFE] to-[#2090F3]'} rounded-md text-white"
|
||||
>
|
||||
<SearchIcon name={staticItem.icon} />
|
||||
</div>
|
||||
<div class="flex-none scale-90 w-8 h-8 text-xl font-IconFamily flex items-center justify-center bg-linear-to-br {staticItem.category === 'navigation' ? 'from-[#FA5D5D] to-[#DC2F30]' : 'from-[#4FBBFE] to-[#2090F3]'} rounded-md text-white">{staticItem.icon}</div>
|
||||
<span class="ml-4 text-lg truncate">
|
||||
<HighlightedText
|
||||
text={staticItem.text}
|
||||
term={searchTerm}
|
||||
matches={result.matches}
|
||||
/>
|
||||
<HighlightedText text={staticItem.text} term={searchTerm} matches={result.matches} />
|
||||
</span>
|
||||
</button>
|
||||
{:else if result.type === "dynamic"}
|
||||
{:else if result.type === 'dynamic'}
|
||||
{@const dynamicItem = item as IndexItem}
|
||||
{@const RenderComponent = renderComponentMap[dynamicItem.renderComponentId]}
|
||||
{#if RenderComponent}
|
||||
<RenderComponent
|
||||
item={dynamicItem}
|
||||
{isSelected}
|
||||
{searchTerm}
|
||||
isSelected={isSelected}
|
||||
searchTerm={searchTerm}
|
||||
matches={result.matches}
|
||||
onclick={() => executeItemAction(dynamicItem)}
|
||||
onkeydown={() => executeItemAction(dynamicItem)}
|
||||
@@ -420,39 +395,21 @@
|
||||
{:else}
|
||||
<button
|
||||
class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group
|
||||
{isSelected
|
||||
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px]'
|
||||
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
{isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px]' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
onclick={() => executeItemAction(dynamicItem)}
|
||||
>
|
||||
<div class="flex items-center w-full">
|
||||
<div
|
||||
class="flex-none w-8 h-8 text-xl flex items-center justify-center {isSelected
|
||||
? 'text-zinc-900 dark:text-white'
|
||||
: 'text-zinc-600 dark:text-zinc-400'}"
|
||||
>
|
||||
<SearchIcon name={iconForCategory(dynamicItem.category)} />
|
||||
</div>
|
||||
<div class="flex-none w-8 h-8 text-xl font-IconFamily flex items-center justify-center {isSelected ? 'text-zinc-900 dark:text-white' : 'text-zinc-600 dark:text-zinc-400'}">{dynamicItem.metadata?.icon || '\ue924'}</div>
|
||||
<span class="ml-4 text-lg truncate">
|
||||
<HighlightedText
|
||||
text={dynamicItem.text}
|
||||
term={searchTerm}
|
||||
matches={result.matches}
|
||||
/>
|
||||
<HighlightedText text={dynamicItem.text} term={searchTerm} matches={result.matches} />
|
||||
</span>
|
||||
<span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400">
|
||||
{dynamicItem.category}
|
||||
</span>
|
||||
</div>
|
||||
{#if dynamicItem.content}
|
||||
<div
|
||||
class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start"
|
||||
>
|
||||
<HighlightedText
|
||||
text={dynamicItem.content}
|
||||
term={searchTerm}
|
||||
matches={result.matches}
|
||||
/>
|
||||
<div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start">
|
||||
<HighlightedText text={dynamicItem.content} term={searchTerm} matches={result.matches} />
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
@@ -463,12 +420,12 @@
|
||||
{:else if !calculatorResult}
|
||||
<div class="px-8 py-16 text-center text-zinc-900 dark:text-zinc-200 sm:px-16">
|
||||
{#if isLoading}
|
||||
<div
|
||||
class="mx-auto w-8 h-8 rounded-full border-2 animate-spin border-zinc-300 dark:border-zinc-700 border-t-zinc-600 dark:border-t-zinc-300"
|
||||
></div>
|
||||
<div class="mx-auto w-8 h-8 rounded-full border-2 animate-spin border-zinc-300 dark:border-zinc-700 border-t-zinc-600 dark:border-t-zinc-300"></div>
|
||||
<p class="mt-4 text-lg dark:text-zinc-300">Searching...</p>
|
||||
{:else}
|
||||
<FolderOpenIcon class="mx-auto w-8 h-8" />
|
||||
<svg class="mx-auto w-8 h-8" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z" />
|
||||
</svg>
|
||||
<p class="mt-6 text-lg dark:text-zinc-300">No matches found. Try something else.</p>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -476,15 +433,13 @@
|
||||
</ul>
|
||||
<div class="px-3 py-2 w-full border-t border-zinc-900/5 dark:border-zinc-100/5 bg-white/5">
|
||||
{#if combinedResults.length > 0 || calculatorResult}
|
||||
<div
|
||||
class="flex justify-between items-center h-7 text-sm text-zinc-500 dark:text-zinc-400"
|
||||
>
|
||||
<div class="flex justify-between items-center h-7 text-sm text-zinc-500 dark:text-zinc-400">
|
||||
<div class="flex gap-4 items-center">
|
||||
{@render Shortcut({ text: "Navigate", keybind: ["↑", "↓"] })}
|
||||
{@render Shortcut({ text: 'Navigate', keybind: ['↑', '↓']})}
|
||||
{#if calculatorResult && selectedIndex === 0}
|
||||
{@render Shortcut({ text: "Copy result", keybind: ["↵"] })}
|
||||
{@render Shortcut({ text: 'Copy result', keybind: ['↵']})}
|
||||
{:else}
|
||||
{@render Shortcut({ text: "Select", keybind: ["↵"] })}
|
||||
{@render Shortcut({ text: 'Select', keybind: ['↵']})}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -495,14 +450,11 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#snippet Shortcut({ text, keybind }: { text: string; keybind: string[] })}
|
||||
{#snippet Shortcut({ text, keybind }: { text: string, keybind: string[] }) }
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="flex gap-1 items-center">
|
||||
{#each keybind as key}
|
||||
<kbd
|
||||
class="size-6 text-[0.9rem] flex justify-center items-center rounded-sm bg-zinc-100 dark:bg-zinc-100/10"
|
||||
>{key}</kbd
|
||||
>
|
||||
<kbd class="size-6 text-[0.9rem] flex justify-center items-center rounded-sm bg-zinc-100 dark:bg-zinc-100/10">{key}</kbd>
|
||||
{/each}
|
||||
</div>
|
||||
<span>{text}</span>
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<script lang="ts">
|
||||
import AppWindowIcon from "@lucide/svelte/icons/app-window";
|
||||
import BookOpenIcon from "@lucide/svelte/icons/book-open";
|
||||
import CalendarIcon from "@lucide/svelte/icons/calendar";
|
||||
import ClipboardListIcon from "@lucide/svelte/icons/clipboard-list";
|
||||
import FileChartColumnIcon from "@lucide/svelte/icons/file-chart-column";
|
||||
import FileTextIcon from "@lucide/svelte/icons/file-text";
|
||||
import HouseIcon from "@lucide/svelte/icons/house";
|
||||
import InboxIcon from "@lucide/svelte/icons/inbox";
|
||||
import LayoutDashboardIcon from "@lucide/svelte/icons/layout-dashboard";
|
||||
import MegaphoneIcon from "@lucide/svelte/icons/megaphone";
|
||||
import MessageSquareIcon from "@lucide/svelte/icons/message-square";
|
||||
import MessageSquareMoreIcon from "@lucide/svelte/icons/message-square-more";
|
||||
import MessageSquarePlusIcon from "@lucide/svelte/icons/message-square-plus";
|
||||
import MessagesSquareIcon from "@lucide/svelte/icons/messages-square";
|
||||
import RouteIcon from "@lucide/svelte/icons/route";
|
||||
import SearchIcon from "@lucide/svelte/icons/search";
|
||||
import SunIcon from "@lucide/svelte/icons/sun";
|
||||
import TargetIcon from "@lucide/svelte/icons/target";
|
||||
import type { SearchIconName } from "../core/searchIcons";
|
||||
|
||||
let { name, class: className = "" }: { name: SearchIconName; class?: string } = $props();
|
||||
|
||||
const ICONS = {
|
||||
"app-window": AppWindowIcon,
|
||||
"book-open": BookOpenIcon,
|
||||
calendar: CalendarIcon,
|
||||
"clipboard-list": ClipboardListIcon,
|
||||
"file-chart-column": FileChartColumnIcon,
|
||||
"file-text": FileTextIcon,
|
||||
house: HouseIcon,
|
||||
inbox: InboxIcon,
|
||||
"layout-dashboard": LayoutDashboardIcon,
|
||||
megaphone: MegaphoneIcon,
|
||||
"message-square": MessageSquareIcon,
|
||||
"message-square-more": MessageSquareMoreIcon,
|
||||
"message-square-plus": MessageSquarePlusIcon,
|
||||
"messages-square": MessagesSquareIcon,
|
||||
route: RouteIcon,
|
||||
search: SearchIcon,
|
||||
sun: SunIcon,
|
||||
target: TargetIcon,
|
||||
} satisfies Record<SearchIconName, unknown>;
|
||||
|
||||
const Icon = $derived(ICONS[name]);
|
||||
</script>
|
||||
|
||||
<Icon size="1em" class={className} />
|
||||
@@ -1,16 +1,9 @@
|
||||
<script lang="ts">
|
||||
import SearchIcon from "../SearchIcon.svelte";
|
||||
import HighlightedText from "../../utils/HighlightedText.svelte";
|
||||
import type { DynamicContentItem } from "../../utils/dynamicItems";
|
||||
import type { FuseResultMatch } from "../../core/types";
|
||||
import HighlightedText from '../../utils/HighlightedText.svelte';
|
||||
import type { DynamicContentItem } from '../../utils/dynamicItems';
|
||||
import type { FuseResultMatch } from '../../core/types';
|
||||
|
||||
const {
|
||||
item,
|
||||
isSelected,
|
||||
searchTerm,
|
||||
matches,
|
||||
onclick,
|
||||
}: {
|
||||
const { item, isSelected, searchTerm, matches, onclick }: {
|
||||
item: DynamicContentItem;
|
||||
isSelected: boolean;
|
||||
searchTerm: string;
|
||||
@@ -21,19 +14,13 @@
|
||||
|
||||
<button
|
||||
class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50
|
||||
{isSelected
|
||||
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm'
|
||||
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
{onclick}
|
||||
>
|
||||
<div class="flex items-center w-full">
|
||||
<div
|
||||
class="flex-none scale-90 w-8 h-8 text-xl flex items-center justify-center bg-linear-to-br from-[#59F675] to-[#1BC636] rounded-md text-white"
|
||||
{isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
onclick={onclick}
|
||||
>
|
||||
<SearchIcon name="message-square-more" />
|
||||
</div>
|
||||
<div class="flex items-center w-full">
|
||||
<div class="flex-none scale-90 w-8 h-8 text-xl font-IconFamily flex items-center justify-center bg-linear-to-br from-[#59F675] to-[#1BC636] rounded-md text-white">{item.metadata?.icon || '\uebee'}</div>
|
||||
<span class="ml-4 text-lg truncate">
|
||||
<HighlightedText text={item.text} term={searchTerm} {matches} />
|
||||
<HighlightedText text={item.text} term={searchTerm} matches={matches} />
|
||||
</span>
|
||||
<span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400">
|
||||
{item.category}
|
||||
@@ -41,7 +28,7 @@
|
||||
</div>
|
||||
{#if item.content}
|
||||
<div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start">
|
||||
<HighlightedText text={item.content} term={searchTerm} {matches} />
|
||||
<HighlightedText text={item.content} term={searchTerm} matches={matches} />
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
@@ -1,16 +1,9 @@
|
||||
<script lang="ts">
|
||||
import SearchIcon from "../SearchIcon.svelte";
|
||||
import HighlightedText from "../../utils/HighlightedText.svelte";
|
||||
import type { DynamicContentItem } from "../../utils/dynamicItems";
|
||||
import type { FuseResultMatch } from "../../core/types";
|
||||
import HighlightedText from '../../utils/HighlightedText.svelte';
|
||||
import type { DynamicContentItem } from '../../utils/dynamicItems';
|
||||
import type { FuseResultMatch } from '../../core/types';
|
||||
|
||||
const {
|
||||
item,
|
||||
isSelected,
|
||||
searchTerm,
|
||||
matches,
|
||||
onclick,
|
||||
}: {
|
||||
const { item, isSelected, searchTerm, matches, onclick }: {
|
||||
item: DynamicContentItem;
|
||||
isSelected: boolean;
|
||||
searchTerm: string;
|
||||
@@ -21,19 +14,13 @@
|
||||
|
||||
<button
|
||||
class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50
|
||||
{isSelected
|
||||
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm'
|
||||
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
{onclick}
|
||||
>
|
||||
<div class="flex items-center w-full">
|
||||
<div
|
||||
class="flex-none scale-90 w-8 h-8 text-xl flex items-center justify-center text-white bg-linear-to-br from-[#59aaf6] to-[#1b62c6] rounded-md"
|
||||
{isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
onclick={onclick}
|
||||
>
|
||||
<SearchIcon name="messages-square" />
|
||||
</div>
|
||||
<div class="flex items-center w-full">
|
||||
<div class="flex-none scale-90 w-8 h-8 text-xl font-IconFamily flex items-center justify-center text-white bg-linear-to-br from-[#59aaf6] to-[#1b62c6] rounded-md">{item.metadata?.icon || '\uebe7'}</div>
|
||||
<span class="ml-4 text-lg truncate {item.metadata?.closed ? 'line-through opacity-80' : ''}">
|
||||
<HighlightedText text={item.text} term={searchTerm} {matches} />
|
||||
<HighlightedText text={item.text} term={searchTerm} matches={matches} />
|
||||
</span>
|
||||
<span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400">
|
||||
{item.category}
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
<script lang="ts">
|
||||
import SearchIcon from "../SearchIcon.svelte";
|
||||
import { iconForCategory } from "../../core/searchIcons";
|
||||
import HighlightedText from "../../utils/HighlightedText.svelte";
|
||||
import type { DynamicContentItem } from "../../utils/dynamicItems";
|
||||
import type { FuseResultMatch } from "../../core/types";
|
||||
import HighlightedText from '../../utils/HighlightedText.svelte';
|
||||
import type { DynamicContentItem } from '../../utils/dynamicItems';
|
||||
import type { FuseResultMatch } from '../../core/types';
|
||||
|
||||
const {
|
||||
item,
|
||||
isSelected,
|
||||
searchTerm,
|
||||
matches,
|
||||
onclick,
|
||||
}: {
|
||||
const { item, isSelected, searchTerm, matches, onclick }: {
|
||||
item: DynamicContentItem;
|
||||
isSelected: boolean;
|
||||
searchTerm: string;
|
||||
@@ -20,51 +12,70 @@
|
||||
} = $props();
|
||||
|
||||
const categoryLabel = (category: string): string => {
|
||||
if (!category) return "";
|
||||
if (!category) return '';
|
||||
return category.charAt(0).toUpperCase() + category.slice(1);
|
||||
};
|
||||
|
||||
const gradientForCategory = (category: string): string => {
|
||||
switch (category) {
|
||||
case "courses":
|
||||
return "from-[#7c5fe0] to-[#4d2bb8]";
|
||||
case "notices":
|
||||
return "from-[#f6c453] to-[#d39007]";
|
||||
case "documents":
|
||||
return "from-[#4FBBFE] to-[#2090F3]";
|
||||
case "folio":
|
||||
return "from-[#22c55e] to-[#0f9b3a]";
|
||||
case "portals":
|
||||
return "from-[#22d3ee] to-[#0e7490]";
|
||||
case "reports":
|
||||
return "from-[#f97316] to-[#c2410c]";
|
||||
case "goals":
|
||||
return "from-[#10b981] to-[#047857]";
|
||||
case "passive":
|
||||
return "from-[#6b7280] to-[#374151]";
|
||||
case 'courses':
|
||||
return 'from-[#7c5fe0] to-[#4d2bb8]';
|
||||
case 'notices':
|
||||
return 'from-[#f6c453] to-[#d39007]';
|
||||
case 'documents':
|
||||
return 'from-[#4FBBFE] to-[#2090F3]';
|
||||
case 'folio':
|
||||
return 'from-[#22c55e] to-[#0f9b3a]';
|
||||
case 'portals':
|
||||
return 'from-[#22d3ee] to-[#0e7490]';
|
||||
case 'reports':
|
||||
return 'from-[#f97316] to-[#c2410c]';
|
||||
case 'goals':
|
||||
return 'from-[#10b981] to-[#047857]';
|
||||
case 'passive':
|
||||
return 'from-[#6b7280] to-[#374151]';
|
||||
default:
|
||||
return "from-[#4FBBFE] to-[#2090F3]";
|
||||
return 'from-[#4FBBFE] to-[#2090F3]';
|
||||
}
|
||||
};
|
||||
|
||||
const fallbackIcon = (category: string): string => {
|
||||
switch (category) {
|
||||
case 'courses':
|
||||
return '\ueb4d';
|
||||
case 'notices':
|
||||
return '\ueb24';
|
||||
case 'documents':
|
||||
return '\ueb6f';
|
||||
case 'folio':
|
||||
return '\ueb16';
|
||||
case 'portals':
|
||||
return '\ueb01';
|
||||
case 'reports':
|
||||
return '\ueb70';
|
||||
case 'goals':
|
||||
return '\uea15';
|
||||
case 'passive':
|
||||
return '\ueb71';
|
||||
default:
|
||||
return '\ue924';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<button
|
||||
class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50
|
||||
{isSelected
|
||||
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm'
|
||||
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
{onclick}
|
||||
{isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
onclick={onclick}
|
||||
>
|
||||
<div class="flex items-center w-full">
|
||||
<div
|
||||
class="flex-none scale-90 w-8 h-8 text-xl flex items-center justify-center text-white rounded-md bg-linear-to-br {gradientForCategory(
|
||||
item.category,
|
||||
)}"
|
||||
class="flex-none scale-90 w-8 h-8 text-xl font-IconFamily flex items-center justify-center text-white rounded-md bg-linear-to-br {gradientForCategory(item.category)}"
|
||||
>
|
||||
<SearchIcon name={iconForCategory(item.category)} />
|
||||
{item.metadata?.icon || fallbackIcon(item.category)}
|
||||
</div>
|
||||
<span class="ml-4 text-lg truncate">
|
||||
<HighlightedText text={item.text} term={searchTerm} {matches} />
|
||||
<HighlightedText text={item.text} term={searchTerm} matches={matches} />
|
||||
</span>
|
||||
<span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400">
|
||||
{item.metadata?.subjectCode || categoryLabel(item.category)}
|
||||
@@ -72,7 +83,7 @@
|
||||
</div>
|
||||
{#if item.content}
|
||||
<div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start">
|
||||
<HighlightedText text={item.content} term={searchTerm} {matches} />
|
||||
<HighlightedText text={item.content} term={searchTerm} matches={matches} />
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
@@ -1,8 +1,7 @@
|
||||
<script lang="ts">
|
||||
import SearchIcon from "../SearchIcon.svelte";
|
||||
import HighlightedText from "../../utils/HighlightedText.svelte";
|
||||
import type { IndexItem } from "../../indexing/types";
|
||||
import type { FuseResultMatch } from "../../core/types";
|
||||
import HighlightedText from '../../utils/HighlightedText.svelte';
|
||||
import type { IndexItem } from '../../indexing/types';
|
||||
import type { FuseResultMatch } from '../../core/types';
|
||||
|
||||
let {
|
||||
item,
|
||||
@@ -21,36 +20,23 @@
|
||||
|
||||
<button
|
||||
class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50
|
||||
{isSelected
|
||||
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm'
|
||||
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
{onclick}
|
||||
{isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||
onclick={onclick}
|
||||
>
|
||||
<div class="flex items-center w-full">
|
||||
<div
|
||||
class="flex-none scale-90 w-8 h-8 text-xl flex items-center justify-center text-white {item
|
||||
.metadata?.type === 'assessments'
|
||||
? 'bg-linear-to-br from-[#fa915d] to-[#dc6c2f] rounded-md'
|
||||
: 'bg-linear-to-br from-[#4FBBFE] to-[#2090F3] rounded-md'} {item.metadata.isActive
|
||||
? 'opacity-100'
|
||||
: 'opacity-80'}"
|
||||
>
|
||||
<SearchIcon name={item.metadata?.type === "assessments" ? "clipboard-list" : "book-open"} />
|
||||
<div class="flex-none scale-90 w-8 h-8 text-xl font-IconFamily flex items-center justify-center text-white {item.metadata?.type === 'assessments' ? 'bg-linear-to-br from-[#fa915d] to-[#dc6c2f] rounded-md' : 'bg-linear-to-br from-[#4FBBFE] to-[#2090F3] rounded-md'} {item.metadata.isActive ? 'opacity-100' : 'opacity-80'}">
|
||||
{item.metadata?.type === 'assessments' ? '\ueac3' : '\ueb4d'}
|
||||
</div>
|
||||
<span class="ml-4 text-lg truncate {item.metadata.isActive ? 'opacity-100' : 'opacity-70'}">
|
||||
<HighlightedText text={item.text} term={searchTerm} {matches} />
|
||||
<HighlightedText text={item.text} term={searchTerm} matches={matches} />
|
||||
</span>
|
||||
<span
|
||||
class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400 {item.metadata.isActive
|
||||
? 'opacity-100'
|
||||
: 'opacity-70'}"
|
||||
>
|
||||
<span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400 {item.metadata.isActive ? 'opacity-100' : 'opacity-70'}">
|
||||
{item.metadata?.subjectCode}
|
||||
</span>
|
||||
</div>
|
||||
{#if item.content}
|
||||
<div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start">
|
||||
<HighlightedText text={item.content} term={searchTerm} {matches} />
|
||||
<HighlightedText text={item.content} term={searchTerm} matches={matches} />
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { SearchIconName } from "./searchIcons";
|
||||
import type { HomeTimetableLesson } from "@/seqta/utils/loaders/homePageTypes";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { loadHomePage } from "@/seqta/utils/loaders/loadHomePage";
|
||||
@@ -8,7 +7,7 @@ export interface BaseCommandItem {
|
||||
id: string;
|
||||
text: string;
|
||||
category: string;
|
||||
icon: SearchIconName;
|
||||
icon: string;
|
||||
action: () => void;
|
||||
keywords?: string[];
|
||||
priority?: number;
|
||||
@@ -135,7 +134,7 @@ function formatDate(date: Date): string {
|
||||
const staticCommands: StaticCommandItem[] = [
|
||||
{
|
||||
id: "home",
|
||||
icon: "house",
|
||||
icon: "\ueb4c",
|
||||
category: "navigation",
|
||||
text: "Home",
|
||||
action: () => {
|
||||
@@ -146,7 +145,7 @@ const staticCommands: StaticCommandItem[] = [
|
||||
},
|
||||
{
|
||||
id: "messages",
|
||||
icon: "message-square",
|
||||
icon: "\uebfd",
|
||||
category: "navigation",
|
||||
text: "Direct Messages",
|
||||
action: () => {
|
||||
@@ -156,7 +155,7 @@ const staticCommands: StaticCommandItem[] = [
|
||||
},
|
||||
{
|
||||
id: "timetable",
|
||||
icon: "calendar",
|
||||
icon: "\ue9cd",
|
||||
category: "navigation",
|
||||
text: "Timetable",
|
||||
action: () => {
|
||||
@@ -166,7 +165,7 @@ const staticCommands: StaticCommandItem[] = [
|
||||
},
|
||||
{
|
||||
id: "Current Lesson",
|
||||
icon: "book-open",
|
||||
icon: "\ue9a5",
|
||||
category: "navigation",
|
||||
text: "Current Lesson",
|
||||
priority: 4,
|
||||
@@ -181,7 +180,7 @@ const staticCommands: StaticCommandItem[] = [
|
||||
},
|
||||
{
|
||||
id: "assessments",
|
||||
icon: "clipboard-list",
|
||||
icon: "\ueac3",
|
||||
category: "navigation",
|
||||
text: "Assessments",
|
||||
keybind: ["alt+a"],
|
||||
@@ -193,7 +192,7 @@ const staticCommands: StaticCommandItem[] = [
|
||||
},
|
||||
{
|
||||
id: "dashboard",
|
||||
icon: "layout-dashboard",
|
||||
icon: "\ueb87",
|
||||
category: "navigation",
|
||||
text: "Dashboard",
|
||||
priority: 4,
|
||||
@@ -203,7 +202,7 @@ const staticCommands: StaticCommandItem[] = [
|
||||
},
|
||||
{
|
||||
id: "compose-message",
|
||||
icon: "message-square-plus",
|
||||
icon: "\ue924",
|
||||
category: "action",
|
||||
text: "Compose Message",
|
||||
action: () => {
|
||||
@@ -223,7 +222,7 @@ const staticCommands: StaticCommandItem[] = [
|
||||
},
|
||||
{
|
||||
id: "toggle-dark-mode",
|
||||
icon: "sun",
|
||||
icon: "\uecfe",
|
||||
category: "action",
|
||||
text: "Toggle Dark Mode",
|
||||
action: () => (settingsState.DarkMode = !settingsState.DarkMode),
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { Search } from "lucide-static";
|
||||
import SearchBar from "../components/SearchBar.svelte";
|
||||
import { unmount } from "svelte";
|
||||
import { warmUpVectorSearchOnInteraction } from "../search/vector/vectorSearch";
|
||||
@@ -22,7 +20,8 @@ type AppRef = {
|
||||
ownedTrigger?: boolean;
|
||||
};
|
||||
|
||||
const SEARCH_SVG = icon(Search, { size: 16 });
|
||||
const SEARCH_SVG =
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>';
|
||||
|
||||
async function resolveTriggerWrapper(titleElement: Element): Promise<HTMLElement | null> {
|
||||
const existing = titleElement.querySelector(".search-trigger-wrapper") as HTMLElement | null;
|
||||
@@ -113,7 +112,7 @@ export async function mountSearchBar(titleElement: Element, api: GlobalSearchApi
|
||||
!progressBar ||
|
||||
!progressText
|
||||
) {
|
||||
console.error("[BetterSEQTA+] Global Search: Search trigger markup incomplete");
|
||||
console.error("[Global Search] Search trigger markup incomplete");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
export type SearchIconName =
|
||||
| "app-window"
|
||||
| "book-open"
|
||||
| "calendar"
|
||||
| "clipboard-list"
|
||||
| "file-chart-column"
|
||||
| "file-text"
|
||||
| "house"
|
||||
| "inbox"
|
||||
| "layout-dashboard"
|
||||
| "megaphone"
|
||||
| "message-square"
|
||||
| "message-square-more"
|
||||
| "message-square-plus"
|
||||
| "messages-square"
|
||||
| "route"
|
||||
| "search"
|
||||
| "sun"
|
||||
| "target";
|
||||
|
||||
const CATEGORY_ICONS: Record<string, SearchIconName> = {
|
||||
courses: "book-open",
|
||||
notices: "megaphone",
|
||||
documents: "file-text",
|
||||
folio: "route",
|
||||
portals: "app-window",
|
||||
reports: "file-chart-column",
|
||||
goals: "target",
|
||||
passive: "inbox",
|
||||
};
|
||||
|
||||
export function iconForCategory(category: string): SearchIconName {
|
||||
return CATEGORY_ICONS[category] ?? "message-square-plus";
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
<script lang="ts">
|
||||
import CheckIcon from "@lucide/svelte/icons/check";
|
||||
import XIcon from "@lucide/svelte/icons/x";
|
||||
import { fade, scale } from "svelte/transition";
|
||||
import type { AnalyticsClassGroup, AnalyticsClassOption } from "./types";
|
||||
import { animationsEnabled } from "@/seqta/utils/performanceMode";
|
||||
@@ -147,7 +145,7 @@
|
||||
aria-label="Delete {group.name}"
|
||||
onclick={() => deleteGroup(group.id)}
|
||||
>
|
||||
<XIcon size="1em" />
|
||||
×
|
||||
</button>
|
||||
</li>
|
||||
{/each}
|
||||
@@ -178,10 +176,7 @@
|
||||
>
|
||||
<header class="bsplus-analytics-class-groups-dialog-head">
|
||||
<div>
|
||||
<h2
|
||||
id="bsplus-class-group-modal-title"
|
||||
class="bsplus-analytics-class-groups-dialog-title"
|
||||
>
|
||||
<h2 id="bsplus-class-group-modal-title" class="bsplus-analytics-class-groups-dialog-title">
|
||||
{editingId ? "Edit combined classes" : "Combine classes"}
|
||||
</h2>
|
||||
<p class="bsplus-analytics-class-groups-dialog-desc">
|
||||
@@ -194,7 +189,7 @@
|
||||
aria-label="Close"
|
||||
onclick={cancelEditor}
|
||||
>
|
||||
<XIcon size="1em" />
|
||||
×
|
||||
</button>
|
||||
</header>
|
||||
|
||||
@@ -227,7 +222,7 @@
|
||||
onchange={() => toggleDraftClass(option.key)}
|
||||
/>
|
||||
<span class="bsplus-analytics-class-groups-check" aria-hidden="true">
|
||||
{#if picked}<CheckIcon size="1em" />{/if}
|
||||
{#if picked}✓{/if}
|
||||
</span>
|
||||
<span class="bsplus-analytics-class-groups-pick-text">
|
||||
<span class="bsplus-analytics-class-groups-pick-label">{option.title}</span>
|
||||
@@ -240,7 +235,9 @@
|
||||
</div>
|
||||
|
||||
<footer class="bsplus-analytics-class-groups-dialog-actions">
|
||||
<button type="button" class="bsplus-analytics-btn" onclick={cancelEditor}> Cancel </button>
|
||||
<button type="button" class="bsplus-analytics-btn" onclick={cancelEditor}>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="bsplus-analytics-btn bsplus-analytics-btn-primary"
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<script lang="ts">
|
||||
import CheckIcon from "@lucide/svelte/icons/check";
|
||||
import { onMount, onDestroy } from "svelte";
|
||||
import { fade } from "svelte/transition";
|
||||
import type { AnalyticsClassGroup, AnalyticsClassOption, Assessment } from "./types";
|
||||
import type {
|
||||
AnalyticsClassGroup,
|
||||
AnalyticsClassOption,
|
||||
Assessment,
|
||||
} from "./types";
|
||||
import {
|
||||
loadGradeAnalytics,
|
||||
syncGradeAnalytics,
|
||||
@@ -39,7 +42,8 @@
|
||||
|
||||
let { simpleMode = false }: { simpleMode?: boolean } = $props();
|
||||
|
||||
const LOAD_ERROR = "Unable to load analytics. Check your connection, then select Refresh data.";
|
||||
const LOAD_ERROR =
|
||||
"Unable to load analytics. Check your connection, then select Refresh data.";
|
||||
const SYNC_ERROR_WITH_DATA =
|
||||
"Unable to sync. Showing saved data. Select Refresh data to try again.";
|
||||
|
||||
@@ -62,7 +66,9 @@
|
||||
let classCatalog: AnalyticsClassOption[] = $state([]);
|
||||
let activeClassGroupId: string | null = $state(null);
|
||||
let studentId: number | null = $state(null);
|
||||
let gradeInference = $state<AnalyticsGradeInferenceSettings>(DEFAULT_ANALYTICS_GRADE_INFERENCE);
|
||||
let gradeInference = $state<AnalyticsGradeInferenceSettings>(
|
||||
DEFAULT_ANALYTICS_GRADE_INFERENCE,
|
||||
);
|
||||
|
||||
let timeRangeTrigger: HTMLButtonElement | null = $state(null);
|
||||
let subjectsTrigger: HTMLButtonElement | null = $state(null);
|
||||
@@ -80,7 +86,9 @@
|
||||
return lastUpdated ? formatLastUpdated(lastUpdated) : "";
|
||||
});
|
||||
|
||||
const activeClassGroup = $derived(classGroups.find((g) => g.id === activeClassGroupId) ?? null);
|
||||
const activeClassGroup = $derived(
|
||||
classGroups.find((g) => g.id === activeClassGroupId) ?? null,
|
||||
);
|
||||
|
||||
const activeClassKeys = $derived(activeClassGroup?.classKeys ?? []);
|
||||
|
||||
@@ -122,7 +130,9 @@
|
||||
filterAssessmentsByTimeRange(filteredData, timeRange, customTimeRange),
|
||||
);
|
||||
|
||||
const gradedFiltered = $derived(timeScopedData.filter((a) => a.finalGrade !== undefined));
|
||||
const gradedFiltered = $derived(
|
||||
timeScopedData.filter((a) => a.finalGrade !== undefined),
|
||||
);
|
||||
|
||||
const statsAverage = $derived.by(() => {
|
||||
if (!gradedFiltered.length) return null;
|
||||
@@ -130,7 +140,9 @@
|
||||
return Math.round((sum / gradedFiltered.length) * 10) / 10;
|
||||
});
|
||||
|
||||
const statsSubjectCount = $derived(new Set(timeScopedData.map((a) => a.subject)).size);
|
||||
const statsSubjectCount = $derived(
|
||||
new Set(timeScopedData.map((a) => a.subject)).size,
|
||||
);
|
||||
|
||||
const timeRangeLabel = $derived(getTimeRangeLabel(timeRange, customTimeRange));
|
||||
|
||||
@@ -319,7 +331,8 @@
|
||||
}
|
||||
|
||||
const ttl = getCacheTtlMs(24);
|
||||
const needsSync = !lastUpdated || Date.now() - lastUpdated.getTime() > ttl;
|
||||
const needsSync =
|
||||
!lastUpdated || Date.now() - lastUpdated.getTime() > ttl;
|
||||
if (needsSync) {
|
||||
void runSync();
|
||||
}
|
||||
@@ -343,11 +356,7 @@
|
||||
<p class="bsplus-analytics-sr-only" role="status">{statusMessage}</p>
|
||||
|
||||
{#if error && hasData}
|
||||
<p
|
||||
class="bsplus-analytics-alert bsplus-analytics-animate"
|
||||
role="alert"
|
||||
transition:fade={{ duration: fadeDuration }}
|
||||
>
|
||||
<p class="bsplus-analytics-alert bsplus-analytics-animate" role="alert" transition:fade={{ duration: fadeDuration }}>
|
||||
{error}
|
||||
</p>
|
||||
{/if}
|
||||
@@ -368,16 +377,18 @@
|
||||
<div class="bsplus-analytics-filters-head">
|
||||
<h2 class="bsplus-analytics-filters-title">Filters</h2>
|
||||
{#if hasActiveFilters}
|
||||
<button type="button" class="bsplus-analytics-filters-clear" onclick={clearFilters}>
|
||||
<button
|
||||
type="button"
|
||||
class="bsplus-analytics-filters-clear"
|
||||
onclick={clearFilters}
|
||||
>
|
||||
Clear all
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="bsplus-analytics-filter-group">
|
||||
<span class="bsplus-analytics-field-label" id="bsplus-analytics-time-label"
|
||||
>Time period</span
|
||||
>
|
||||
<span class="bsplus-analytics-field-label" id="bsplus-analytics-time-label">Time period</span>
|
||||
<div class="bsplus-analytics-dropdown" data-analytics-dropdown>
|
||||
<button
|
||||
bind:this={timeRangeTrigger}
|
||||
@@ -402,9 +413,7 @@
|
||||
aria-pressed={selected}
|
||||
onclick={() => selectTimeRange(option.value)}
|
||||
>
|
||||
<span class="bsplus-analytics-dropdown-check" aria-hidden="true"
|
||||
>{#if selected}<CheckIcon size="1em" />{/if}</span
|
||||
>
|
||||
<span class="bsplus-analytics-dropdown-check" aria-hidden="true">{selected ? "✓" : ""}</span>
|
||||
<span>{option.label}</span>
|
||||
</button>
|
||||
{/each}
|
||||
@@ -436,9 +445,7 @@
|
||||
</div>
|
||||
|
||||
<div class="bsplus-analytics-filter-group">
|
||||
<span class="bsplus-analytics-field-label" id="bsplus-analytics-subjects-label"
|
||||
>Subjects</span
|
||||
>
|
||||
<span class="bsplus-analytics-field-label" id="bsplus-analytics-subjects-label">Subjects</span>
|
||||
<div class="bsplus-analytics-dropdown" data-analytics-dropdown>
|
||||
<button
|
||||
bind:this={subjectsTrigger}
|
||||
@@ -462,9 +469,7 @@
|
||||
aria-pressed={allSelected}
|
||||
onclick={selectAllSubjects}
|
||||
>
|
||||
<span class="bsplus-analytics-dropdown-check" aria-hidden="true"
|
||||
>{#if allSelected}<CheckIcon size="1em" />{/if}</span
|
||||
>
|
||||
<span class="bsplus-analytics-dropdown-check" aria-hidden="true">{allSelected ? "✓" : ""}</span>
|
||||
<span>All subjects</span>
|
||||
</button>
|
||||
{#each uniqueSubjects as subject (subject)}
|
||||
@@ -476,9 +481,7 @@
|
||||
aria-pressed={selected}
|
||||
onclick={() => toggleSubject(subject)}
|
||||
>
|
||||
<span class="bsplus-analytics-dropdown-check" aria-hidden="true"
|
||||
>{#if selected}<CheckIcon size="1em" />{/if}</span
|
||||
>
|
||||
<span class="bsplus-analytics-dropdown-check" aria-hidden="true">{selected ? "✓" : ""}</span>
|
||||
<span class="bsplus-analytics-filter-subject-name">{subject}</span>
|
||||
</button>
|
||||
{/each}
|
||||
@@ -520,9 +523,7 @@
|
||||
role="group"
|
||||
aria-labelledby="bsplus-analytics-grade-label"
|
||||
>
|
||||
<span class="bsplus-analytics-field-label" id="bsplus-analytics-grade-label"
|
||||
>Grade range</span
|
||||
>
|
||||
<span class="bsplus-analytics-field-label" id="bsplus-analytics-grade-label">Grade range</span>
|
||||
<GradeRangeSlider bind:value={gradeRange} />
|
||||
</div>
|
||||
|
||||
@@ -565,10 +566,7 @@
|
||||
<p class="bsplus-analytics-meta">Loading analytics…</p>
|
||||
</div>
|
||||
{:else if hasData}
|
||||
<div
|
||||
class="bsplus-analytics-stats bsplus-analytics-animate"
|
||||
aria-label="Summary statistics"
|
||||
>
|
||||
<div class="bsplus-analytics-stats bsplus-analytics-animate" aria-label="Summary statistics">
|
||||
<div class="bsplus-analytics-stat">
|
||||
<div class="bsplus-analytics-stat-label">Average grade</div>
|
||||
<div class="bsplus-analytics-stat-value">
|
||||
@@ -617,8 +615,8 @@
|
||||
{:else}
|
||||
<h2>No analytics data yet</h2>
|
||||
<p>
|
||||
Data syncs when you visit this page. Assessments with released marks will appear here
|
||||
with trends and grade breakdowns.
|
||||
Data syncs when you visit this page. Assessments with released marks will
|
||||
appear here with trends and grade breakdowns.
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script lang="ts">
|
||||
import ChevronDownIcon from "@lucide/svelte/icons/chevron-down";
|
||||
import XIcon from "@lucide/svelte/icons/x";
|
||||
import {
|
||||
createGradeBand,
|
||||
DEFAULT_ANALYTICS_GRADE_INFERENCE,
|
||||
@@ -33,7 +31,9 @@
|
||||
function updateBand(id: string, patch: Partial<GradeBandMapping>) {
|
||||
draft = {
|
||||
...draft,
|
||||
gradeBands: draft.gradeBands.map((band) => (band.id === id ? { ...band, ...patch } : band)),
|
||||
gradeBands: draft.gradeBands.map((band) =>
|
||||
band.id === id ? { ...band, ...patch } : band,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -83,10 +83,7 @@
|
||||
>
|
||||
<span class="bsplus-analytics-field-label">Grade inference (optional)</span>
|
||||
<span class="bsplus-analytics-grade-inference-chevron" aria-hidden="true"
|
||||
><ChevronDownIcon
|
||||
size="1em"
|
||||
style={expanded ? undefined : "transform: rotate(-90deg)"}
|
||||
/></span
|
||||
>{expanded ? "▾" : "▸"}</span
|
||||
>
|
||||
</button>
|
||||
|
||||
@@ -101,7 +98,8 @@
|
||||
type="checkbox"
|
||||
checked={draft.useCustomGradeBands}
|
||||
disabled={disabled || saving}
|
||||
onchange={(e) => updateDraft({ useCustomGradeBands: e.currentTarget.checked })}
|
||||
onchange={(e) =>
|
||||
updateDraft({ useCustomGradeBands: e.currentTarget.checked })}
|
||||
/>
|
||||
<span>Map rubric / letter bands to percentages</span>
|
||||
</label>
|
||||
@@ -116,7 +114,8 @@
|
||||
placeholder="Band label (e.g. A, Proficient)"
|
||||
value={band.label}
|
||||
disabled={disabled || saving}
|
||||
oninput={(e) => updateBand(band.id, { label: e.currentTarget.value })}
|
||||
oninput={(e) =>
|
||||
updateBand(band.id, { label: e.currentTarget.value })}
|
||||
/>
|
||||
<input
|
||||
type="number"
|
||||
@@ -126,7 +125,8 @@
|
||||
step="1"
|
||||
value={band.percent}
|
||||
disabled={disabled || saving}
|
||||
oninput={(e) => updateBand(band.id, { percent: Number(e.currentTarget.value) })}
|
||||
oninput={(e) =>
|
||||
updateBand(band.id, { percent: Number(e.currentTarget.value) })}
|
||||
/>
|
||||
<span class="bsplus-analytics-grade-band-suffix">%</span>
|
||||
<button
|
||||
@@ -136,7 +136,7 @@
|
||||
disabled={disabled || saving}
|
||||
onclick={() => removeBand(band.id)}
|
||||
>
|
||||
<XIcon size="1em" />
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
{/each}
|
||||
@@ -156,7 +156,8 @@
|
||||
type="checkbox"
|
||||
checked={draft.rollupCriteriaGrades}
|
||||
disabled={disabled || saving}
|
||||
onchange={(e) => updateDraft({ rollupCriteriaGrades: e.currentTarget.checked })}
|
||||
onchange={(e) =>
|
||||
updateDraft({ rollupCriteriaGrades: e.currentTarget.checked })}
|
||||
/>
|
||||
<span>Estimate overall % from marked criteria (sub-assessments)</span>
|
||||
</label>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { pageIcon } from "@/seqta/utils/pageIcons";
|
||||
import MenuitemSVGKey from "@/seqta/content/MenuItemSVGKey.json";
|
||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import {
|
||||
@@ -14,7 +14,7 @@ import { applyMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
|
||||
import { getNativeMenuList } from "@/seqta/ui/sidebar/parseNativeMenu";
|
||||
import { rafThrottle } from "@/seqta/utils/rafThrottle";
|
||||
|
||||
const ANALYTICS_MENU_ICON = pageIcon("analytics")!;
|
||||
const ANALYTICS_MENU_ICON = MenuitemSVGKey.analytics;
|
||||
export const ANALYTICS_MENU_CLASS = "betterseqta-grade-analytics-item";
|
||||
export const ANALYTICS_MENU_KEY = "analytics";
|
||||
|
||||
|
||||
@@ -1,29 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import {
|
||||
Book,
|
||||
Briefcase,
|
||||
Calendar,
|
||||
Check,
|
||||
ChevronDown,
|
||||
FileText,
|
||||
Flame,
|
||||
Folder,
|
||||
GripHorizontal,
|
||||
Heart,
|
||||
House,
|
||||
Inbox,
|
||||
Lightbulb,
|
||||
MessageSquare,
|
||||
Music,
|
||||
NotepadText,
|
||||
Pencil,
|
||||
Plus,
|
||||
Star,
|
||||
Target,
|
||||
Trash,
|
||||
Users,
|
||||
X,
|
||||
} from "lucide-static";
|
||||
import type { Plugin } from "../../core/types";
|
||||
import type { MessageFoldersSettings } from "./lazy";
|
||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||
@@ -32,8 +6,7 @@ interface Folder {
|
||||
id: string;
|
||||
name: string;
|
||||
color: string;
|
||||
icon: FolderIconName;
|
||||
emoji?: string;
|
||||
emoji: string;
|
||||
}
|
||||
|
||||
const FOLDER_COLORS = [
|
||||
@@ -47,70 +20,73 @@ const FOLDER_COLORS = [
|
||||
"#f97316",
|
||||
];
|
||||
|
||||
const FOLDER_ICONS = {
|
||||
folder: Folder,
|
||||
inbox: Inbox,
|
||||
star: Star,
|
||||
heart: Heart,
|
||||
flame: Flame,
|
||||
lightbulb: Lightbulb,
|
||||
"file-text": FileText,
|
||||
target: Target,
|
||||
calendar: Calendar,
|
||||
"notepad-text": NotepadText,
|
||||
users: Users,
|
||||
"message-square": MessageSquare,
|
||||
briefcase: Briefcase,
|
||||
house: House,
|
||||
book: Book,
|
||||
music: Music,
|
||||
};
|
||||
const folderHeroicon = (inner: string) =>
|
||||
`<svg style="width:16px;height:16px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${inner}</svg>`;
|
||||
|
||||
type FolderIconName = keyof typeof FOLDER_ICONS;
|
||||
|
||||
const FOLDER_ICON_NAMES = Object.keys(FOLDER_ICONS) as FolderIconName[];
|
||||
|
||||
const LEGACY_FOLDER_ICON_MARKERS: [string, FolderIconName][] = [
|
||||
["10 9 9 9 8 9", "file-text"],
|
||||
["M22 19a2", "folder"],
|
||||
["22 12 16 12", "inbox"],
|
||||
["12 2 15.09", "star"],
|
||||
["M20.84 4.61", "heart"],
|
||||
["M8.5 14.5", "flame"],
|
||||
["M9 18h6", "lightbulb"],
|
||||
["M14 2H6", "notepad-text"],
|
||||
['r="10"', "target"],
|
||||
['y="4" width="18"', "calendar"],
|
||||
["M17 21v-2", "users"],
|
||||
["M21 15a2", "message-square"],
|
||||
['y="7" width="20"', "briefcase"],
|
||||
["M3 9l9-7", "house"],
|
||||
["M4 19.5A2.5", "book"],
|
||||
["M9 18V5", "music"],
|
||||
const FOLDER_HEROICONS = [
|
||||
folderHeroicon(
|
||||
'<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<path d="M9 18h6"/><path d="M10 22h4"/><path d="M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0 0 18 8 6 6 0 0 0 6 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 0 1 8.91 14"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
|
||||
),
|
||||
folderHeroicon('<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>'),
|
||||
folderHeroicon(
|
||||
'<rect x="2" y="7" width="20" height="14" rx="2" ry="2"/><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/>',
|
||||
),
|
||||
folderHeroicon(
|
||||
'<path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/>',
|
||||
),
|
||||
];
|
||||
|
||||
const folderIconSvg = (name: FolderIconName) => icon(FOLDER_ICONS[name], { size: 16 });
|
||||
|
||||
const FOLDER_ICON_SVG = icon(Folder);
|
||||
const PLUS_SVG = icon(Plus, { size: 14, style: "color: #888" });
|
||||
const CHECK_SVG_WHITE = icon(Check, { size: 14, style: "color: #fff" });
|
||||
const CLOSE_SVG = icon(X, { size: 14, style: "color: #888" });
|
||||
const EDIT_SVG = icon(Pencil, { size: 12, style: "color: #888" });
|
||||
const TRASH_SVG = icon(Trash, { size: 12, style: "color: #888" });
|
||||
const CHEVRON_SVG = icon(ChevronDown, {
|
||||
size: 12,
|
||||
style: "color: #888; transition: transform 0.2s",
|
||||
});
|
||||
const DRAG_SVG = icon(GripHorizontal, { size: 14, style: "color: #888; cursor: grab" });
|
||||
const FOLDER_ICON_SVG = `<svg style="width:24px;height:24px;flex-shrink:0" viewBox="0 0 24 24"><path fill="currentColor" d="M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/></svg>`;
|
||||
const PLUS_SVG = `<svg style="width:14px;height:14px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>`;
|
||||
const CHECK_SVG_WHITE = `<svg style="width:14px;height:14px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#fff" d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>`;
|
||||
const CLOSE_SVG = `<svg style="width:14px;height:14px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>`;
|
||||
const EDIT_SVG = `<svg style="width:12px;height:12px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/></svg>`;
|
||||
const TRASH_SVG = `<svg style="width:12px;height:12px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>`;
|
||||
const CHEVRON_SVG = `<svg style="width:12px;height:12px;flex-shrink:0;transition:transform .2s" viewBox="0 0 24 24"><path fill="#888" d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg>`;
|
||||
const DRAG_SVG = `<svg style="width:14px;height:14px;flex-shrink:0;cursor:grab" viewBox="0 0 24 24"><path fill="#888" d="M6.5 12.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5.5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5.5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"/></svg>`;
|
||||
|
||||
function isAllowedFolderColor(color: unknown): color is string {
|
||||
return typeof color === "string" && FOLDER_COLORS.includes(color);
|
||||
}
|
||||
|
||||
function folderIconName(value: unknown): FolderIconName {
|
||||
if (typeof value !== "string") return "folder";
|
||||
if (Object.hasOwn(FOLDER_ICONS, value)) return value as FolderIconName;
|
||||
return LEGACY_FOLDER_ICON_MARKERS.find(([marker]) => value.includes(marker))?.[1] ?? "folder";
|
||||
function isAllowedFolderIcon(icon: unknown): icon is string {
|
||||
return typeof icon === "string" && FOLDER_HEROICONS.includes(icon);
|
||||
}
|
||||
|
||||
function normalizeFolder(folder: Folder): Folder {
|
||||
@@ -118,22 +94,26 @@ function normalizeFolder(folder: Folder): Folder {
|
||||
id: typeof folder.id === "string" && folder.id ? folder.id : crypto.randomUUID(),
|
||||
name: typeof folder.name === "string" ? folder.name.trim().slice(0, 30) : "Folder",
|
||||
color: isAllowedFolderColor(folder.color) ? folder.color : FOLDER_COLORS[0],
|
||||
icon: folderIconName(folder.icon ?? folder.emoji),
|
||||
emoji: isAllowedFolderIcon(folder.emoji) ? folder.emoji : FOLDER_HEROICONS[0],
|
||||
};
|
||||
}
|
||||
|
||||
function setFolderIcon(parent: HTMLElement, name: FolderIconName): void {
|
||||
parent.innerHTML = folderIconSvg(name);
|
||||
function setSvgIconContent(parent: HTMLElement, svgMarkup: string): void {
|
||||
parent.replaceChildren();
|
||||
const template = document.createElement("template");
|
||||
template.innerHTML = svgMarkup.trim();
|
||||
const node = template.content.firstElementChild;
|
||||
if (node) parent.appendChild(node);
|
||||
}
|
||||
|
||||
function appendFolderBadgeContent(badge: HTMLElement, folder: Folder): void {
|
||||
badge.replaceChildren();
|
||||
if (folder.icon) {
|
||||
if (folder.emoji) {
|
||||
const iconWrap = document.createElement("span");
|
||||
iconWrap.style.display = "inline-flex";
|
||||
iconWrap.style.verticalAlign = "middle";
|
||||
iconWrap.style.marginRight = "2px";
|
||||
setFolderIcon(iconWrap, folder.icon);
|
||||
setSvgIconContent(iconWrap, folder.emoji);
|
||||
badge.appendChild(iconWrap);
|
||||
}
|
||||
badge.appendChild(document.createTextNode(folder.name));
|
||||
@@ -355,7 +335,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
|
||||
const allItem = document.createElement("div");
|
||||
allItem.className = `bsplus-folder-item bsplus-all-msgs${activeFolderId === null ? " bsplus-folder-active" : ""}`;
|
||||
allItem.innerHTML = `
|
||||
${icon(Inbox, { size: 14, style: "opacity: 0.5" })}
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" style="fill: currentcolor; opacity: 0.5; flex-shrink: 0;"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></svg>
|
||||
<span class="bsplus-folder-name">All Messages</span>
|
||||
`;
|
||||
allItem.addEventListener("click", () => {
|
||||
@@ -388,7 +368,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
|
||||
|
||||
const iconSpan = document.createElement("span");
|
||||
iconSpan.className = "bsplus-folder-icon";
|
||||
setFolderIcon(iconSpan, folder.icon);
|
||||
setSvgIconContent(iconSpan, folder.emoji || FOLDER_HEROICONS[0]);
|
||||
item.appendChild(iconSpan);
|
||||
|
||||
const name = document.createElement("span");
|
||||
@@ -545,7 +525,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
|
||||
let selectedColor =
|
||||
editFolder?.color ?? FOLDER_COLORS[Math.floor(Math.random() * FOLDER_COLORS.length)];
|
||||
let selectedIcon =
|
||||
editFolder?.icon ?? FOLDER_ICON_NAMES[Math.floor(Math.random() * FOLDER_ICON_NAMES.length)];
|
||||
editFolder?.emoji ?? FOLDER_HEROICONS[Math.floor(Math.random() * FOLDER_HEROICONS.length)];
|
||||
|
||||
const row = document.createElement("div");
|
||||
row.className = "bsplus-folder-input";
|
||||
@@ -559,7 +539,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
|
||||
const iconBtn = document.createElement("button");
|
||||
iconBtn.className = "bsplus-folder-icon-btn";
|
||||
iconBtn.title = "Pick icon";
|
||||
iconBtn.innerHTML = folderIconSvg(selectedIcon);
|
||||
iconBtn.innerHTML = selectedIcon;
|
||||
iconBtn.addEventListener("click", (e) => {
|
||||
e.stopPropagation();
|
||||
const picker = container.querySelector(".bsplus-icon-picker") as HTMLElement | null;
|
||||
@@ -567,9 +547,9 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
|
||||
picker.remove();
|
||||
return;
|
||||
}
|
||||
showIconPicker(container, (name) => {
|
||||
selectedIcon = name;
|
||||
iconBtn.innerHTML = folderIconSvg(name);
|
||||
showIconPicker(container, (iconSvg) => {
|
||||
selectedIcon = iconSvg;
|
||||
iconBtn.innerHTML = iconSvg;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -612,7 +592,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
|
||||
if (!name) return;
|
||||
if (editFolder) {
|
||||
const folders = getFolders().map((f) =>
|
||||
f.id === editFolder.id ? { ...f, name, color: selectedColor, icon: selectedIcon } : f,
|
||||
f.id === editFolder.id ? { ...f, name, color: selectedColor, emoji: selectedIcon } : f,
|
||||
);
|
||||
saveFolders(folders);
|
||||
} else {
|
||||
@@ -620,7 +600,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
|
||||
id: crypto.randomUUID(),
|
||||
name,
|
||||
color: selectedColor,
|
||||
icon: selectedIcon,
|
||||
emoji: selectedIcon,
|
||||
};
|
||||
saveFolders([...getFolders(), folder]);
|
||||
}
|
||||
@@ -646,20 +626,19 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
|
||||
requestAnimationFrame(() => input.focus());
|
||||
};
|
||||
|
||||
const showIconPicker = (container: Element, onSelect: (name: FolderIconName) => void) => {
|
||||
const showIconPicker = (container: Element, onSelect: (iconSvg: string) => void) => {
|
||||
const existing = container.querySelector(".bsplus-icon-picker");
|
||||
if (existing) existing.remove();
|
||||
|
||||
const picker = document.createElement("div");
|
||||
picker.className = "bsplus-icon-picker";
|
||||
for (const name of FOLDER_ICON_NAMES) {
|
||||
for (const icon of FOLDER_HEROICONS) {
|
||||
const btn = document.createElement("button");
|
||||
btn.className = "bsplus-icon-opt";
|
||||
btn.setAttribute("aria-label", name);
|
||||
btn.innerHTML = folderIconSvg(name);
|
||||
btn.innerHTML = icon;
|
||||
btn.addEventListener("click", (e) => {
|
||||
e.stopPropagation();
|
||||
onSelect(name);
|
||||
onSelect(icon);
|
||||
picker.remove();
|
||||
});
|
||||
picker.appendChild(btn);
|
||||
@@ -731,7 +710,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
|
||||
|
||||
const iconSpan = document.createElement("span");
|
||||
iconSpan.className = "bsplus-folder-icon";
|
||||
setFolderIcon(iconSpan, folder.icon);
|
||||
setSvgIconContent(iconSpan, folder.emoji || FOLDER_HEROICONS[0]);
|
||||
|
||||
const name = document.createElement("span");
|
||||
name.textContent = folder.name;
|
||||
@@ -836,7 +815,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
|
||||
dot.style.background = folder.color;
|
||||
const iconSpan = document.createElement("span");
|
||||
iconSpan.className = "bsplus-folder-icon";
|
||||
setFolderIcon(iconSpan, folder.icon);
|
||||
setSvgIconContent(iconSpan, folder.emoji || FOLDER_HEROICONS[0]);
|
||||
const name = document.createElement("span");
|
||||
name.textContent = folder.name;
|
||||
item.appendChild(dot);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { Check } from "lucide-static";
|
||||
import type { PluginAPI, PluginSettings } from "../../core/types";
|
||||
import ReactFiber from "@/seqta/utils/ReactFiber";
|
||||
import { delay } from "@/seqta/utils/delay";
|
||||
@@ -81,7 +79,7 @@ export function applyBackupBadges(archive: ArchiveMap) {
|
||||
const badge = document.createElement("span");
|
||||
badge.className = BACKUP_BADGE_CLASS;
|
||||
badge.title = "Saved locally";
|
||||
badge.innerHTML = icon(Check, { size: "1em" });
|
||||
badge.textContent = "✓";
|
||||
itemEl.appendChild(badge);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
<script lang="ts">
|
||||
import UploadIcon from "@lucide/svelte/icons/upload";
|
||||
import UserIcon from "@lucide/svelte/icons/user";
|
||||
import XIcon from "@lucide/svelte/icons/x";
|
||||
import { onMount } from "svelte";
|
||||
import browser from "@/lib/browser";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
@@ -70,7 +67,7 @@
|
||||
aria-label="Remove profile picture"
|
||||
onclick={() => setLocalPicture(null)}
|
||||
>
|
||||
<XIcon size={16} />
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18" /></svg>
|
||||
</button>
|
||||
<div
|
||||
class="flex overflow-hidden justify-center items-center rounded-full size-10 bg-zinc-200 dark:bg-zinc-700 text-zinc-400"
|
||||
@@ -78,7 +75,7 @@
|
||||
{#if src}
|
||||
<img {src} alt="Your avatar" class="object-cover size-full" />
|
||||
{:else}
|
||||
<UserIcon size={20} />
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z" /></svg>
|
||||
{/if}
|
||||
</div>
|
||||
<button
|
||||
@@ -92,7 +89,7 @@
|
||||
void save(event.dataTransfer?.files[0]);
|
||||
}}
|
||||
>
|
||||
<UploadIcon size={16} />
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M12 3v12"/><path d="m7 10 5 5 5-5"/><path d="M5 21h14"/></svg>
|
||||
Upload
|
||||
</button>
|
||||
<input
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import CalendarIcon from "@lucide/svelte/icons/calendar";
|
||||
import { onMount } from "svelte";
|
||||
import type { Snippet } from "svelte";
|
||||
import { fade, fly } from "svelte/transition";
|
||||
@@ -77,9 +76,7 @@
|
||||
const isBusy = $derived(busy !== null);
|
||||
const anyConnected = $derived(googleStatus.connected || outlookStatus.connected);
|
||||
const modalOpen = $derived(showDisconnect || showDeleteEvents);
|
||||
const modalBusy = $derived(
|
||||
showDisconnect ? busy?.phase === "disconnect" : busy?.phase === "delete",
|
||||
);
|
||||
const modalBusy = $derived(showDisconnect ? busy?.phase === "disconnect" : busy?.phase === "delete");
|
||||
const providerLabel = $derived(calendarProviderLabel(modalProvider ?? "google"));
|
||||
const showTriggerProgress = $derived(
|
||||
isBusy &&
|
||||
@@ -381,7 +378,11 @@
|
||||
|
||||
busy = { provider, phase: "disconnect" };
|
||||
try {
|
||||
const ok = await disconnectProvider(provider, label, `Disconnected from ${label} Calendar.`);
|
||||
const ok = await disconnectProvider(
|
||||
provider,
|
||||
label,
|
||||
`Disconnected from ${label} Calendar.`,
|
||||
);
|
||||
if (ok) showDisconnect = false;
|
||||
} catch (err) {
|
||||
showToastMessage(err instanceof Error ? err.message : "Disconnect failed.", true);
|
||||
@@ -583,7 +584,7 @@
|
||||
>
|
||||
<span class="bsplus-cal-trigger-fill" aria-hidden="true"></span>
|
||||
<span class="bsplus-cal-trigger-content">
|
||||
<CalendarIcon size="1em" class="bsplus-cal-trigger-icon" />
|
||||
<span class="bsplus-cal-trigger-icon iconFamily" aria-hidden="true"></span>
|
||||
<span class="bsplus-cal-trigger-text">{triggerStatusText}</span>
|
||||
</span>
|
||||
</button>
|
||||
@@ -599,9 +600,7 @@
|
||||
>
|
||||
<div class="bsplus-cal-menu-header">
|
||||
<span class="bsplus-cal-menu-title">Calendar sync</span>
|
||||
<span class="bsplus-cal-menu-sub"
|
||||
>Sync classes and optional assessment due dates to Google or Outlook</span
|
||||
>
|
||||
<span class="bsplus-cal-menu-sub">Sync classes and optional assessment due dates to Google or Outlook</span>
|
||||
</div>
|
||||
|
||||
{@render providerPanel(
|
||||
@@ -656,9 +655,7 @@
|
||||
<label class="bsplus-cal-setting bsplus-cal-setting--toggle">
|
||||
<div class="bsplus-cal-setting-copy">
|
||||
<span class="bsplus-cal-setting-label">Sync assessment due dates</span>
|
||||
<span class="bsplus-cal-setting-desc"
|
||||
>Uses the same weeks window. Update calendar once after enabling.</span
|
||||
>
|
||||
<span class="bsplus-cal-setting-desc">Uses the same weeks window. Update calendar once after enabling.</span>
|
||||
</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -699,8 +696,8 @@
|
||||
Disconnect {providerLabel} Calendar?
|
||||
</h2>
|
||||
<p class="bsplus-cal-modal-body">
|
||||
Disconnecting normally removes synced classes from {providerLabel} Calendar and signs you
|
||||
out. Keep this tab open while that runs. You can also disconnect without deleting your events.
|
||||
Disconnecting normally removes synced classes from {providerLabel} Calendar and signs you out.
|
||||
Keep this tab open while that runs. You can also disconnect without deleting your events.
|
||||
</p>
|
||||
<div class="bsplus-cal-modal-actions bsplus-cal-modal-actions--disconnect">
|
||||
<button
|
||||
@@ -729,7 +726,9 @@
|
||||
</button>
|
||||
</div>
|
||||
{:else}
|
||||
<h2 id="bsplus-cal-modal-title" class="bsplus-cal-modal-title">Delete synced classes?</h2>
|
||||
<h2 id="bsplus-cal-modal-title" class="bsplus-cal-modal-title">
|
||||
Delete synced classes?
|
||||
</h2>
|
||||
<p class="bsplus-cal-modal-body">
|
||||
Removes every BetterSEQTA+ timetable event from your {providerLabel} Calendar for this school.
|
||||
Your account stays connected — use Update calendar to sync again.
|
||||
@@ -773,8 +772,8 @@
|
||||
Do not close this tab
|
||||
</h2>
|
||||
<p id="bsplus-cal-disconnect-desc" class="bsplus-cal-disconnect-body">
|
||||
Removing synced classes and disconnecting {providerLabel} Calendar. Closing SEQTA now may leave
|
||||
events behind or interrupt sign-out.
|
||||
Removing synced classes and disconnecting {providerLabel} Calendar. Closing SEQTA now may
|
||||
leave events behind or interrupt sign-out.
|
||||
</p>
|
||||
<div
|
||||
class="bsplus-cal-disconnect-progress"
|
||||
@@ -784,7 +783,9 @@
|
||||
aria-valuenow={overlayProgressPercent}
|
||||
aria-label={overlayStatusText}
|
||||
>
|
||||
<span class="bsplus-cal-disconnect-progress-fill" style:width="{overlayProgressPercent}%"
|
||||
<span
|
||||
class="bsplus-cal-disconnect-progress-fill"
|
||||
style:width="{overlayProgressPercent}%"
|
||||
></span>
|
||||
</div>
|
||||
<p class="bsplus-cal-disconnect-status">{overlayStatusText}</p>
|
||||
@@ -825,7 +826,7 @@
|
||||
/>
|
||||
<path
|
||||
d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"
|
||||
fill="#EA4335"
|
||||
fill="#EB4335"
|
||||
/>
|
||||
</svg>
|
||||
{/snippet}
|
||||
@@ -894,7 +895,8 @@
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.bsplus-cal-trigger-content :global(.bsplus-cal-trigger-icon) {
|
||||
.bsplus-cal-trigger-icon {
|
||||
font-family: "IconFamily" !important;
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
opacity: 0.9;
|
||||
@@ -942,8 +944,7 @@
|
||||
margin: 8px 0 10px;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid
|
||||
var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 12%, transparent));
|
||||
border: 1px solid var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 12%, transparent));
|
||||
background: color-mix(in srgb, var(--bsplus-cal-surface, #fff) 92%, transparent);
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
@@ -984,8 +985,7 @@
|
||||
flex: 0 0 auto;
|
||||
padding: 6px 8px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid
|
||||
var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 18%, transparent));
|
||||
border: 1px solid var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 18%, transparent));
|
||||
background: var(--bsplus-cal-surface, #fff);
|
||||
color: var(--bsplus-cal-text, var(--text-primary, #111));
|
||||
font-size: 12px;
|
||||
@@ -1007,8 +1007,7 @@
|
||||
border-radius: 14px;
|
||||
background: var(--bsplus-cal-surface, #fff);
|
||||
color: var(--bsplus-cal-text, #18181b);
|
||||
border: 1px solid
|
||||
var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 12%, transparent));
|
||||
border: 1px solid var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 12%, transparent));
|
||||
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
|
||||
font-family: var(--bsplus-cal-font-family, var(--betterseqta-font-family, Rubik), sans-serif);
|
||||
}
|
||||
@@ -1019,8 +1018,7 @@
|
||||
|
||||
.bsplus-cal-menu-header {
|
||||
padding: 6px 8px 10px;
|
||||
border-bottom: 1px solid
|
||||
var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 10%, transparent));
|
||||
border-bottom: 1px solid var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 10%, transparent));
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
@@ -1040,10 +1038,7 @@
|
||||
.bsplus-cal-provider {
|
||||
padding: 8px;
|
||||
border-radius: 10px;
|
||||
background: var(
|
||||
--bsplus-cal-surface-muted,
|
||||
color-mix(in srgb, var(--bsplus-cal-text) 4%, transparent)
|
||||
);
|
||||
background: var(--bsplus-cal-surface-muted, color-mix(in srgb, var(--bsplus-cal-text) 4%, transparent));
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
@@ -1117,10 +1112,7 @@
|
||||
}
|
||||
|
||||
.bsplus-cal-action--ghost {
|
||||
background: var(
|
||||
--bsplus-cal-surface-muted,
|
||||
color-mix(in srgb, var(--bsplus-cal-text) 8%, transparent)
|
||||
);
|
||||
background: var(--bsplus-cal-surface-muted, color-mix(in srgb, var(--bsplus-cal-text) 8%, transparent));
|
||||
color: var(--bsplus-cal-text, #18181b);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { Eye, ZoomIn, ZoomOut } from "lucide-static";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import type { Plugin } from "../../core/types";
|
||||
import { attachTimetableColorisRecovery } from "@/seqta/utils/patchSeqtaMenuUpdateColours";
|
||||
@@ -101,15 +99,13 @@ function handleTimetableZoom(): void {
|
||||
|
||||
const zoomIn = document.createElement("button");
|
||||
zoomIn.type = "button";
|
||||
zoomIn.className = "timetable-zoom bsplus-timetable-control";
|
||||
zoomIn.setAttribute("aria-label", "Zoom in");
|
||||
zoomIn.innerHTML = icon(ZoomIn, { size: 16 });
|
||||
zoomIn.className = "timetable-zoom iconFamily bsplus-timetable-control";
|
||||
zoomIn.innerHTML = ""; // Unicode for zoom in icon (custom iconfamily)
|
||||
|
||||
const zoomOut = document.createElement("button");
|
||||
zoomOut.type = "button";
|
||||
zoomOut.className = "timetable-zoom bsplus-timetable-control";
|
||||
zoomOut.setAttribute("aria-label", "Zoom out");
|
||||
zoomOut.innerHTML = icon(ZoomOut, { size: 16 });
|
||||
zoomOut.className = "timetable-zoom iconFamily bsplus-timetable-control";
|
||||
zoomOut.innerHTML = ""; // Unicode for zoom out icon (custom iconfamily)
|
||||
|
||||
zoomControls.appendChild(zoomOut);
|
||||
zoomControls.appendChild(zoomIn);
|
||||
@@ -148,9 +144,8 @@ function handleTimetableAssessmentHide(): void {
|
||||
|
||||
const hideOn = document.createElement("button");
|
||||
hideOn.type = "button";
|
||||
hideOn.className = "timetable-hide bsplus-timetable-control";
|
||||
hideOn.setAttribute("aria-label", "Highlight assessments");
|
||||
hideOn.innerHTML = icon(Eye, { size: 16 });
|
||||
hideOn.className = "timetable-hide iconFamily bsplus-timetable-control";
|
||||
hideOn.innerHTML = "";
|
||||
|
||||
hideControls.appendChild(hideOn);
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import UsersIcon from "@lucide/svelte/icons/users";
|
||||
import { onMount } from "svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { syncCalendarSyncTheme } from "@/plugins/built-in/timetable/calendarSyncUi";
|
||||
@@ -72,7 +71,7 @@
|
||||
onclick={() => void handleClick()}
|
||||
>
|
||||
<span class="bsplus-cal-trigger-content">
|
||||
<UsersIcon size="1em" class="bsplus-cal-trigger-icon" />
|
||||
<span class="bsplus-cal-trigger-icon iconFamily" aria-hidden="true"></span>
|
||||
<span class="bsplus-cal-trigger-text">
|
||||
{busy ? "Syncing…" : error ? "Sync failed" : "Sync with Friends"}
|
||||
</span>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import CircleCheckIcon from "@lucide/svelte/icons/circle-check";
|
||||
import { onMount } from "svelte";
|
||||
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
|
||||
import { cloudAuth, type CloudUser } from "@/seqta/utils/cloudAuth";
|
||||
@@ -50,9 +49,7 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
const canSubmit = $derived(
|
||||
agreeShare && agreeJoin && cloudLoggedIn && !busy && $accountsAvailability.available,
|
||||
);
|
||||
const canSubmit = $derived(agreeShare && agreeJoin && cloudLoggedIn && !busy && $accountsAvailability.available);
|
||||
const checksDisabled = $derived(busy || !cloudLoggedIn);
|
||||
|
||||
async function signInWithCloud() {
|
||||
@@ -107,7 +104,7 @@
|
||||
<span class="bsplus-tc-cloud-user-sub">{cloudSubtitle(cloudUser)}</span>
|
||||
{/if}
|
||||
</div>
|
||||
<CircleCheckIcon size="1em" class="bsplus-tc-cloud-check" />
|
||||
<span class="bsplus-tc-cloud-check iconFamily" aria-hidden="true"></span>
|
||||
</div>
|
||||
{:else}
|
||||
<p class="bsplus-tc-cloud-lead">
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { Pencil } from "lucide-static";
|
||||
import type { PluginAPI } from "../../core/types";
|
||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||
|
||||
@@ -28,7 +26,8 @@ function getRoomAndTeacherElements(entry: HTMLElement): {
|
||||
return { roomEl, teacherEl };
|
||||
}
|
||||
|
||||
const EDIT_ICON_SVG = icon(Pencil, { size: 20 });
|
||||
const EDIT_ICON_SVG =
|
||||
'<svg width="20" height="20" viewBox="0 0 24 24"><g style="fill: currentcolor;"><path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"/></g></svg>';
|
||||
|
||||
function showEditModal(
|
||||
item: TimetableEntryData,
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<circle cx="256" cy="256" r="256" fill="#151415"/>
|
||||
<circle cx="248" cy="250" r="117.75" fill="none" stroke="#fff" stroke-width="38.5"/>
|
||||
<rect x="248" y="348.5" width="165" height="38.5" fill="#fff"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 276 B |
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"welcome": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M7.03 4.95L3.5 8.5C.17 11.81 .17 17.19 3.5 20.5S12.19 23.83 15.5 20.5L21.5 14.5C22.5 13.53 22.5 11.94 21.5 10.96C21.4 10.84 21.27 10.73 21.13 10.64L21.5 10.25C22.5 9.28 22.5 7.69 21.5 6.71C21.36 6.55 21.17 6.41 21 6.3C21.38 5.38 21.21 4.28 20.46 3.53C19.59 2.66 18.24 2.57 17.26 3.25C17.16 3.1 17.05 2.96 16.92 2.83C15.95 1.86 14.36 1.86 13.38 2.83L10.87 5.34C10.78 5.2 10.67 5.07 10.55 4.95C9.58 4 8 4 7.03 4.95M8.44 6.37C8.64 6.17 8.95 6.17 9.15 6.37S9.35 6.88 9.15 7.08L5.97 10.26C7.14 11.43 7.14 13.33 5.97 14.5L7.38 15.91C8.83 14.46 9.2 12.34 8.5 10.55L14.8 4.25C15 4.05 15.31 4.05 15.5 4.25S15.71 4.76 15.5 4.96L10.91 9.56L12.32 10.97L18.33 4.96C18.53 4.76 18.84 4.76 19.04 4.96C19.24 5.16 19.24 5.47 19.04 5.67L13.03 11.68L14.44 13.09L19.39 8.14C19.59 7.94 19.9 7.94 20.1 8.14C20.3 8.34 20.3 8.65 20.1 8.85L14.44 14.5L15.85 15.92L19.39 12.38C19.59 12.18 19.9 12.18 20.1 12.38C20.3 12.58 20.3 12.89 20.1 13.09L14.1 19.1C11.56 21.64 7.45 21.64 4.91 19.1S2.37 12.45 4.91 9.91L8.44 6.37M23 17C23 20.31 20.31 23 17 23V21.5C19.5 21.5 21.5 19.5 21.5 17H23M1 7C1 3.69 3.69 1 7 1V2.5C4.5 2.5 2.5 4.5 2.5 7H1Z\" />\n </svg>",
|
||||
"assessments": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M6 20H13V22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H18C19.11 2 20 2.9 20 4V12.54L18.5 11.72L18 12V4H13V12L10.5 9.75L8 12V4H6V20M24 17L18.5 14L13 17L18.5 20L24 17M15 19.09V21.09L18.5 23L22 21.09V19.09L18.5 21L15 19.09Z\" />\n</svg>",
|
||||
"courses": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M19 1L14 6V17L19 12.5V1M21 5V18.5C19.9 18.15 18.7 18 17.5 18C15.8 18 13.35 18.65 12 19.5V6C10.55 4.9 8.45 4.5 6.5 4.5C4.55 4.5 2.45 4.9 1 6V20.65C1 20.9 1.25 21.15 1.5 21.15C1.6 21.15 1.65 21.1 1.75 21.1C3.1 20.45 5.05 20 6.5 20C8.45 20 10.55 20.4 12 21.5C13.35 20.65 15.8 20 17.5 20C19.15 20 20.85 20.3 22.25 21.05C22.35 21.1 22.4 21.1 22.5 21.1C22.75 21.1 23 20.85 23 20.6V6C22.4 5.55 21.75 5.25 21 5M10 18.41C8.75 18.09 7.5 18 6.5 18C5.44 18 4.18 18.19 3 18.5V7.13C3.91 6.73 5.14 6.5 6.5 6.5C7.86 6.5 9.09 6.73 10 7.13V18.41Z\" />\n</svg>",
|
||||
"dashboard": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z\" />\n</svg>",
|
||||
"messages": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M20,2H4A2,2 0 0,0 2,4V22L6,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M8,14H6V12H8V14M8,11H6V9H8V11M8,8H6V6H8V8M15,14H10V12H15V14M18,11H10V9H18V11M18,8H10V6H18V8Z\" />\n</svg>",
|
||||
"notices": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M12,15H10V13H12V15M18,15H14V13H18V15M8,11H6V9H8V11M18,11H10V9H18V11M20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20M4,6V18H20V6H4Z\" />\n</svg>",
|
||||
"portals": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M15,4A8,8 0 0,1 23,12A8,8 0 0,1 15,20A8,8 0 0,1 7,12A8,8 0 0,1 15,4M15,18A6,6 0 0,0 21,12A6,6 0 0,0 15,6A6,6 0 0,0 9,12A6,6 0 0,0 15,18M3,12C3,14.61 4.67,16.83 7,17.65V19.74C3.55,18.85 1,15.73 1,12C1,8.27 3.55,5.15 7,4.26V6.35C4.67,7.17 3,9.39 3,12Z\" />\n</svg>",
|
||||
"reports": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M18 2H12V9L9.5 7.5L7 9V2H6A2 2 0 0 0 4 4V20A2 2 0 0 0 6 22H18A2 2 0 0 0 20 20V4A2 2 0 0 0 18 2M14 12A2 2 0 1 1 12 14A2 2 0 0 1 14 12M18 20H10V19C10 17.67 12.67 17 14 17S18 17.67 18 19Z\" />\n</svg>",
|
||||
"settings": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z\" />\n</svg>",
|
||||
"timetable": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M9,10V12H7V10H9M13,10V12H11V10H13M17,10V12H15V10H17M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5A2,2 0 0,1 5,3H6V1H8V3H16V1H18V3H19M19,19V8H5V19H19M9,14V16H7V14H9M13,14V16H11V14H13M17,14V16H15V14H17Z\" />\n</svg>",
|
||||
"analytics": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 32 32\" aria-hidden=\"true\">\n <path fill=\"currentColor\" d=\"M4,2H2V28a2,2,0,0,0,2,2H30V28H4Z\" />\n <path fill=\"currentColor\" d=\"M30,9H23v2h3.59L19,18.59l-4.29-4.3a1,1,0,0,0-1.42,0L6,21.59,7.41,23,14,16.41l4.29,4.3a1,1,0,0,0,1.42,0L28,12.41V16h2Z\" />\n</svg>"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export default /* html */ `
|
||||
<svg style="width:24px;height:24px;border-radius:0;" viewBox="0 0 24 24">
|
||||
<path fill="currentColor" d="M6 20H13V22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H18C19.11 2 20 2.9 20 4V12.54L18.5 11.72L18 12V4H13V12L10.5 9.75L8 12V4H6V20M24 17L18.5 14L13 17L18.5 20L24 17M15 19.09V21.09L18.5 23L22 21.09V19.09L18.5 21L15 19.09Z"></path>
|
||||
</svg>
|
||||
`;
|
||||
@@ -0,0 +1,5 @@
|
||||
export default /* html */ `
|
||||
<svg style="width:24px;height:24px;border-radius:0;" viewBox="0 0 24 24">
|
||||
<path fill="currentColor" d="M19 1L14 6V17L19 12.5V1M21 5V18.5C19.9 18.15 18.7 18 17.5 18C15.8 18 13.35 18.65 12 19.5V6C10.55 4.9 8.45 4.5 6.5 4.5C4.55 4.5 2.45 4.9 1 6V20.65C1 20.9 1.25 21.15 1.5 21.15C1.6 21.15 1.65 21.1 1.75 21.1C3.1 20.45 5.05 20 6.5 20C8.45 20 10.55 20.4 12 21.5C13.35 20.65 15.8 20 17.5 20C19.15 20 20.85 20.3 22.25 21.05C22.35 21.1 22.4 21.1 22.5 21.1C22.75 21.1 23 20.85 23 20.6V6C22.4 5.55 21.75 5.25 21 5M10 18.41C8.75 18.09 7.5 18 6.5 18C5.44 18 4.18 18.19 3 18.5V7.13C3.91 6.73 5.14 6.5 6.5 6.5C7.86 6.5 9.09 6.73 10 7.13V18.41Z"></path>
|
||||
</svg>
|
||||
`;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { LogOut, Moon, Sun, Wrench } from "lucide-static";
|
||||
import { LUCIDE_MOON_ICON_SVG } from "@/lib/icons/lucideMoon";
|
||||
import { LUCIDE_SUN_ICON_SVG } from "@/lib/icons/lucideSun";
|
||||
import { waitForEngageMenuList } from "@/seqta/utils/waitForEngageMenuList";
|
||||
import { addExtensionSettings } from "@/seqta/utils/adders/addExtensionSettings";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
@@ -39,6 +39,15 @@ import { getUserInfo } from "@/seqta/utils/userInfo";
|
||||
|
||||
const USER_AVATAR_SVG = `<svg class="userInfosvg" viewBox="0 0 24 24"><path fill="var(--text-primary)" d="M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"></path></svg>`;
|
||||
|
||||
const LOGOUT_ICON_SVG = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>`;
|
||||
|
||||
const SETTINGS_WRENCH_SVG = `<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M23.182,6.923c-.29,0-3.662,2.122-4.142,2.4l-2.8-1.555V4.511l4.257-2.456a.518.518,0,0,0,.233-.408.479.479,0,0,0-.233-.407,6.511,6.511,0,1,0-3.327,12.107,6.582,6.582,0,0,0,6.148-4.374,5.228,5.228,0,0,0,.333-1.542A.461.461,0,0,0,23.182,6.923Z"></path><path fill="currentColor" d="M9.73,10.418,7.376,12.883c-.01.01-.021.016-.03.025L1.158,19.1a2.682,2.682,0,1,0,3.793,3.793l4.583-4.582,0,0,4.1-4.005-.037-.037A9.094,9.094,0,0,1,9.73,10.418ZM3.053,21.888A.894.894,0,1,1,3.946,21,.893.893,0,0,1,3.053,21.888Z"></path></svg>`;
|
||||
|
||||
function themeToggleIconMarkup(): string {
|
||||
const path = settingsState.DarkMode ? LUCIDE_SUN_ICON_SVG : LUCIDE_MOON_ICON_SVG;
|
||||
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true">${path}</svg>`;
|
||||
}
|
||||
|
||||
let lightDarkToggleStreak = 0;
|
||||
let sidebarAccessibilityObserver: MutationObserver | null = null;
|
||||
let sidebarTabOrderAnimationFrame: number | null = null;
|
||||
@@ -158,7 +167,7 @@ function updateUserInfo(info: Awaited<ReturnType<typeof getUserInfo>>) {
|
||||
${USER_AVATAR_SVG}
|
||||
<div class="bsplus-tooltip-bubble">
|
||||
<button class="bsplus-logout" type="button" aria-label="Log out">
|
||||
${icon(LogOut, { size: 20 })}
|
||||
${LOGOUT_ICON_SVG}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -284,7 +293,7 @@ async function createSettingsButton(parent?: Element) {
|
||||
target.append(
|
||||
stringToHTML(/* html */ `
|
||||
<button class="addedButton" id="AddedSettings" type="button" aria-label="BetterSEQTA+ settings">
|
||||
${icon(Wrench)}
|
||||
${SETTINGS_WRENCH_SVG}
|
||||
</button>
|
||||
`).firstChild!,
|
||||
);
|
||||
@@ -370,7 +379,7 @@ async function addEngageUserInfo() {
|
||||
${USER_AVATAR_SVG}
|
||||
<div class="bsplus-tooltip-bubble">
|
||||
<button class="bsplus-logout" type="button" aria-label="Log out">
|
||||
${icon(LogOut, { size: 20 })}
|
||||
${LOGOUT_ICON_SVG}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -457,7 +466,7 @@ async function addDarkLightToggle(parent?: Element) {
|
||||
toggleTarget.append(
|
||||
stringToHTML(/* html */ `
|
||||
<button class="addedButton DarkLightButton" id="LightDarkModeButton" type="button" aria-label="${getLightDarkModeString()}">
|
||||
${icon(settingsState.DarkMode ? Sun : Moon)}
|
||||
${themeToggleIconMarkup()}
|
||||
</button>
|
||||
`).firstChild!,
|
||||
);
|
||||
@@ -484,7 +493,7 @@ async function addDarkLightToggle(parent?: Element) {
|
||||
settingsState.DarkMode = !settingsState.DarkMode;
|
||||
updateAllColors();
|
||||
|
||||
lightDarkModeButtonElement.innerHTML = icon(settingsState.DarkMode ? Sun : Moon);
|
||||
lightDarkModeButtonElement.innerHTML = themeToggleIconMarkup();
|
||||
lightDarkModeButtonElement.setAttribute("aria-label", getLightDarkModeString());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import SearchIcon from "@lucide/svelte/icons/search";
|
||||
import { titleBarState } from "./titleBarState.svelte";
|
||||
</script>
|
||||
|
||||
@@ -10,14 +9,26 @@
|
||||
<div class="search-trigger-anchor">
|
||||
<div class="search-trigger">
|
||||
<span>
|
||||
<SearchIcon size={16} />
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="11" cy="11" r="8"></circle>
|
||||
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
||||
</svg>
|
||||
</span>
|
||||
<p>Quick search...</p>
|
||||
<span
|
||||
class="search-trigger-hotkey"
|
||||
style="margin-left: auto; display: flex; align-items: center; color: rgb(119, 119, 119); font-size: 12px;"
|
||||
>{titleBarState.searchHotkeyLabel}</span
|
||||
>
|
||||
>{titleBarState.searchHotkeyLabel}</span>
|
||||
</div>
|
||||
<div class="search-progress-bar-wrapper">
|
||||
<div class="search-progress-track">
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { Wrench } from "lucide-static";
|
||||
import stringToHTML from "@/seqta/utils/stringToHTML";
|
||||
import { addExtensionSettings } from "@/seqta/utils/adders/addExtensionSettings";
|
||||
import { setupSettingsButton } from "@/seqta/utils/setupSettingsButton";
|
||||
@@ -7,6 +5,8 @@ import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
const SETTINGS_WRENCH_SVG = `<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M23.182,6.923c-.29,0-3.662,2.122-4.142,2.4l-2.8-1.555V4.511l4.257-2.456a.518.518,0,0,0,.233-.408.479.479,0,0,0-.233-.407,6.511,6.511,0,1,0-3.327,12.107,6.582,6.582,0,0,0,6.148-4.374,5.228,5.228,0,0,0,.333-1.542A.461.461,0,0,0,23.182,6.923Z"></path><path fill="currentColor" d="M9.73,10.418,7.376,12.883c-.01.01-.021.016-.03.025L1.158,19.1a2.682,2.682,0,1,0,3.793,3.793l4.583-4.582,0,0,4.1-4.005-.037-.037A9.094,9.094,0,0,1,9.73,10.418ZM3.053,21.888A.894.894,0,1,1,3.946,21,.893.893,0,0,1,3.053,21.888Z"></path></svg>`;
|
||||
|
||||
export async function ensureSettingsAccess(): Promise<void> {
|
||||
addExtensionSettings();
|
||||
if (document.getElementById("AddedSettings")) {
|
||||
@@ -48,7 +48,7 @@ export async function ensureSettingsAccess(): Promise<void> {
|
||||
parent.append(
|
||||
stringToHTML(/* html */ `
|
||||
<button class="addedButton" id="AddedSettings" type="button" aria-label="BetterSEQTA+ settings">
|
||||
${icon(Wrench)}
|
||||
${SETTINGS_WRENCH_SVG}
|
||||
</button>
|
||||
`).firstChild!,
|
||||
);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { Flame, Sparkles, Star, SwatchBook, Trophy } from "lucide-static";
|
||||
/** Keep in sync with betterseqta-accounts `utils/badges.ts` / `utils/badgeVisuals.ts`. */
|
||||
|
||||
export const BADGE_TIERS = [
|
||||
@@ -165,16 +163,20 @@ export function badgeVisualForKey(key: string, labelFallback = key): BadgeVisual
|
||||
return { key, label: labelFallback, ...UNKNOWN_ACHIEVEMENT_VISUAL };
|
||||
}
|
||||
|
||||
const BADGE_ICONS: Record<string, string> = {
|
||||
sparkles: Sparkles,
|
||||
star: Star,
|
||||
trophy: Trophy,
|
||||
fire: Flame,
|
||||
swatch: SwatchBook,
|
||||
const ICON_PATHS: Record<string, string> = {
|
||||
sparkles:
|
||||
"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z",
|
||||
star: "M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005z",
|
||||
trophy:
|
||||
"M16.5 18.75h-9m9 0a3 3 0 013 3h-15a3 3 0 013-3m9 0v-3.375c0-.621-.503-1.125-1.125-1.125h-.871M7.5 18.75v-3.375c0-.621.504-1.125 1.125-1.125h.872m5.007 0H9.497m5.007 0a7.454 7.454 0 01-.982-3.172M9.497 14.25a7.454 7.454 0 00.981-3.172M5.25 4.236c-.982.143-1.954.317-2.916.52A6.003 6.003 0 007.73 9.728M5.25 4.236V4.5c0 2.108.966 3.99 2.48 5.228M5.25 4.236V2.721C7.456 2.41 9.71 2.25 12 2.25c2.291 0 4.545.16 6.75.47v1.516M7.73 9.728a6.726 6.726 0 002.748 1.35m8.272-6.842V4.5c0 2.108-.966 3.99-2.48 5.228m2.48-5.492a46.32 46.32 0 012.916.52 6.003 6.003 0 01-5.395 4.972m0 0a6.726 6.726 0 01-2.749 1.35m0 0a6.726 6.726 0 01-3.128 0m3.128 0a6.726 6.726 0 01-3.128 0",
|
||||
fire: "M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48zM12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z",
|
||||
swatch:
|
||||
"M4.098 19.902a3.75 3.75 0 005.304 0l6.401-6.402M6.75 21A3.75 3.75 0 013 17.25V4.125C3 3.504 3.504 3 4.125 3h5.25c.621 0 1.125.504 1.125 1.125v4.072M6.75 21a3.75 3.75 0 003.75-3.75V8.197M6.75 21h13.125c.621 0 1.125-.504 1.125-1.125v-5.25c0-.621-.504-1.125-1.125-1.125h-4.072M10.5 8.197l2.88-2.88c.438-.439 1.15-.439 1.59 0l3.712 3.713c.44.44.44 1.152 0 1.59l-2.879 2.88M6.75 17.25h.008v.008H6.75v-.008z",
|
||||
};
|
||||
|
||||
function badgeIconSvg(name: string, size = 15): string {
|
||||
return icon(BADGE_ICONS[name] ?? Sparkles, { class: "bsplus-founder-badge__icon", size });
|
||||
function badgeIconSvg(icon: string, size = 15): string {
|
||||
const path = ICON_PATHS[icon] ?? ICON_PATHS.sparkles;
|
||||
return `<svg class="bsplus-founder-badge__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="${size}" height="${size}" aria-hidden="true"><path d="${path}"/></svg>`;
|
||||
}
|
||||
|
||||
function badgeBlobStyle(visual: Pick<BadgeVisual, "base" | "blobs">): string {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { ChevronLeft, ChevronRight } from "lucide-static";
|
||||
import LogoLight from "@/resources/icons/betterseqta-light-icon.png";
|
||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||
import { convertTo12HourFormat } from "@/seqta/utils/convertTo12HourFormat";
|
||||
@@ -20,6 +18,9 @@ import {
|
||||
import { resolveNoticeFilterTokens } from "@/seqta/utils/notices/noticeLabelFilters";
|
||||
import { fetchNoticesForDate } from "@/seqta/utils/notices/noticeHomeUi";
|
||||
|
||||
const TIMETABLE_CHEVRON_BACK = `<svg width="24" height="24" viewBox="0 0 24 24" style="transform: scale(-1,1)" id="engage-home-timetable-back"><path fill="currentColor" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" /></svg>`;
|
||||
const TIMETABLE_CHEVRON_FORWARD = `<svg width="24" height="24" viewBox="0 0 24 24" id="engage-home-timetable-forward"><path fill="currentColor" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" /></svg>`;
|
||||
|
||||
export function updateEngageHomeMenuActive(isHome: boolean): void {
|
||||
const home = document.getElementById("homebutton");
|
||||
if (!home) return;
|
||||
@@ -290,8 +291,8 @@ export async function loadEngageHomePage(): Promise<void> {
|
||||
<select id="engage-child-selector" class="engage-child-select" aria-label="Student"></select>
|
||||
</div>
|
||||
<div class="timetable-arrows">
|
||||
${icon(ChevronLeft, { id: "engage-home-timetable-back" })}
|
||||
${icon(ChevronRight, { id: "engage-home-timetable-forward" })}
|
||||
${TIMETABLE_CHEVRON_BACK}
|
||||
${TIMETABLE_CHEVRON_FORWARD}
|
||||
</div>
|
||||
</div>
|
||||
<div class="day-container loading" id="engage-day-container"></div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { BookOpen, ChevronLeft, ChevronRight, ClipboardList } from "lucide-static";
|
||||
import assessmentsicon from "@/seqta/icons/assessmentsIcon";
|
||||
import coursesicon from "@/seqta/icons/coursesIcon";
|
||||
import { animate, stagger } from "motion";
|
||||
import LogoLight from "@/resources/icons/betterseqta-light-icon.png";
|
||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||
@@ -37,6 +37,11 @@ let homeTeardown: (() => void) | null = null;
|
||||
let currentSelectedDate = new Date();
|
||||
let loadingTimeout: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
const TIMETABLE_CHEVRON_BACK = `<svg width="24" height="24" viewBox="0 0 24 24" style="transform: scale(-1,1)" id="home-timetable-back"><path fill="currentColor" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" /></svg>`;
|
||||
const TIMETABLE_CHEVRON_FORWARD = `<svg width="24" height="24" viewBox="0 0 24 24" id="home-timetable-forward"><path fill="currentColor" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" /></svg>`;
|
||||
const ASSESSMENTS_ICON_LG = `<svg style="width:28px;height:28px;border-radius:0;" viewBox="0 0 24 24"><path fill="currentColor" d="M6 20H13V22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H18C19.11 2 20 2.9 20 4V12.54L18.5 11.72L18 12V4H13V12L10.5 9.75L8 12V4H6V20M24 17L18.5 14L13 17L18.5 20L24 17M15 19.09V21.09L18.5 23L22 21.09V19.09L18.5 21L15 19.09Z" /></svg>`;
|
||||
const ASSESSMENTS_ICON_WHITE = `<svg viewBox="0 0 24 24" style="width:35px;height:35px;fill:white;"><path d="M6 20H13V22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H18C19.11 2 20 2.9 20 4V12.54L18.5 11.72L18 12V4H13V12L10.5 9.75L8 12V4H6V20M24 17L18.5 14L13 17L18.5 20L24 17M15 19.09V21.09L18.5 23L22 21.09V19.09L18.5 21L15 19.09Z" /></svg>`;
|
||||
|
||||
function clearLessonInterval(): void {
|
||||
if (lessonInterval !== null) {
|
||||
clearInterval(lessonInterval);
|
||||
@@ -78,8 +83,8 @@ export async function loadHomePage() {
|
||||
<div class="home-subtitle">
|
||||
<h2 id="home-lesson-subtitle">Today's Lessons</h2>
|
||||
<div class="timetable-arrows">
|
||||
${icon(ChevronLeft, { id: "home-timetable-back" })}
|
||||
${icon(ChevronRight, { id: "home-timetable-forward" })}
|
||||
${TIMETABLE_CHEVRON_BACK}
|
||||
${TIMETABLE_CHEVRON_FORWARD}
|
||||
</div>
|
||||
</div>
|
||||
<div class="day-container loading" id="day-container">
|
||||
@@ -467,8 +472,8 @@ function makeLessonDiv(lesson: HomeTimetableLesson, num: number) {
|
||||
if (type == "class") {
|
||||
if (programmeID !== 0) {
|
||||
lessonString += `
|
||||
<a class="day-button clickable" style="right: 5px;" href="${buildAssessmentURL(programmeID, metaID)}" aria-label="Assessments">${icon(ClipboardList)}</a>
|
||||
<a class="day-button clickable" style="right: 35px;" href="../#?page=/courses/${programmeID}:${metaID}" aria-label="Course">${icon(BookOpen)}</a>
|
||||
<a class="day-button clickable" style="right: 5px;" href="${buildAssessmentURL(programmeID, metaID)}" aria-label="Assessments">${assessmentsicon}</a>
|
||||
<a class="day-button clickable" style="right: 35px;" href="../#?page=/courses/${programmeID}:${metaID}" aria-label="Course">${coursesicon}</a>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -482,7 +487,7 @@ function makeLessonDiv(lesson: HomeTimetableLesson, num: number) {
|
||||
|
||||
lessonString += `
|
||||
<div class="bsplus-tooltip assessmenttooltip" tabindex="0" aria-label="Assessments for this lesson">
|
||||
${icon(ClipboardList, { size: 28, style: "color: #ed3939" })}
|
||||
${ASSESSMENTS_ICON_LG}
|
||||
<div class="bsplus-tooltip-bubble">${assessmentString}</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -678,7 +683,7 @@ function createAssessmentDateDiv(
|
||||
const titlediv = document.createElement("div");
|
||||
titlediv.classList.add("upcoming-subject-title");
|
||||
titlediv.append(
|
||||
stringToHTML(icon(ClipboardList, { size: 35, style: "color: #fff" })).firstChild!,
|
||||
stringToHTML(ASSESSMENTS_ICON_WHITE).firstChild!,
|
||||
);
|
||||
|
||||
const detailsdiv = document.createElement("div");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import { ChevronLeft, ChevronRight, Maximize2, Minimize2 } from "lucide-static";
|
||||
import browser from "@/lib/browser";
|
||||
import stringToHTML from "../stringToHTML";
|
||||
import { settingsState } from "../listeners/settingsState";
|
||||
@@ -192,8 +190,8 @@ function renderGallerySlidesHtml(slides: PopupGallerySlide[]): string {
|
||||
const nav =
|
||||
slides.length > 1
|
||||
? `
|
||||
<button type="button" class="themeOfTheMonthCardGalleryPrev" aria-label="Previous image">${icon(ChevronLeft, { size: "1em" })}</button>
|
||||
<button type="button" class="themeOfTheMonthCardGalleryNext" aria-label="Next image">${icon(ChevronRight, { size: "1em" })}</button>
|
||||
<button type="button" class="themeOfTheMonthCardGalleryPrev" aria-label="Previous image">‹</button>
|
||||
<button type="button" class="themeOfTheMonthCardGalleryNext" aria-label="Next image">›</button>
|
||||
<div class="themeOfTheMonthCardGalleryDots" role="tablist" aria-label="Theme previews">
|
||||
${slides
|
||||
.map(
|
||||
@@ -212,8 +210,8 @@ function renderGallerySlidesHtml(slides: PopupGallerySlide[]): string {
|
||||
`;
|
||||
}
|
||||
|
||||
const POPOUT_EXPAND_SVG = /* svg */ icon(Maximize2, { size: 15 });
|
||||
const POPOUT_COLLAPSE_SVG = /* svg */ icon(Minimize2, { size: 15 });
|
||||
const POPOUT_EXPAND_SVG = /* svg */ `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 3h6v6"/><path d="M9 21H3v-6"/><path d="M21 3l-7 7"/><path d="M3 21l7-7"/></svg>`;
|
||||
const POPOUT_COLLAPSE_SVG = /* svg */ `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 14h6v6"/><path d="M20 10h-6V4"/><path d="M14 10l7-7"/><path d="M3 21l7-7"/></svg>`;
|
||||
|
||||
const TOTM_MARGIN_PX = 18;
|
||||
const TOTM_EXPANDED_SHELL_MAX_PX = 560;
|
||||
|
||||
@@ -1,45 +1,12 @@
|
||||
import { icon } from "@/lib/icon";
|
||||
import {
|
||||
AppWindow,
|
||||
BookOpen,
|
||||
Calendar,
|
||||
ChartLine,
|
||||
ClipboardList,
|
||||
FileChartColumn,
|
||||
FolderOpen,
|
||||
GraduationCap,
|
||||
Hand,
|
||||
House,
|
||||
LayoutDashboard,
|
||||
Megaphone,
|
||||
MessageSquare,
|
||||
MessagesSquare,
|
||||
Newspaper,
|
||||
Settings,
|
||||
Target,
|
||||
} from "lucide-static";
|
||||
import MenuitemSVGKey from "@/seqta/content/MenuItemSVGKey.json";
|
||||
|
||||
const PAGE_ICONS: Record<string, string> = {
|
||||
analytics: ChartLine,
|
||||
assessments: ClipboardList,
|
||||
courses: BookOpen,
|
||||
dashboard: LayoutDashboard,
|
||||
documents: FolderOpen,
|
||||
forums: MessagesSquare,
|
||||
goals: Target,
|
||||
home: House,
|
||||
messages: MessageSquare,
|
||||
myed: GraduationCap,
|
||||
news: Newspaper,
|
||||
notices: Megaphone,
|
||||
portals: AppWindow,
|
||||
reports: FileChartColumn,
|
||||
settings: Settings,
|
||||
timetable: Calendar,
|
||||
welcome: Hand,
|
||||
const EXTRA_ICONS: Record<string, string> = {
|
||||
home: `<svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z" /></svg>`,
|
||||
news: `<svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M5 7H10V13H5V7M19 17H5V15H19V17M19 13H12V11H19V13M19 9H12V7H19V9Z" /></svg>`,
|
||||
};
|
||||
|
||||
const menuIcons = MenuitemSVGKey as Record<string, string>;
|
||||
|
||||
export function pageIcon(key: string): string | undefined {
|
||||
const svg = PAGE_ICONS[key];
|
||||
return svg && icon(svg);
|
||||
return menuIcons[key] ?? EXTRA_ICONS[key];
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { pageIcon } from "@/seqta/utils/pageIcons";
|
||||
import MenuitemSVGKey from "@/seqta/content/MenuItemSVGKey.json";
|
||||
import { changeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
||||
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
@@ -61,9 +61,9 @@ export function replaceMenuSVG(element: HTMLElement, svg: string) {
|
||||
export function processMenuItemNode(node: HTMLElement) {
|
||||
if (!isTopLevelSidebarItem(node) || isMenuOptionsOpen()) return;
|
||||
|
||||
const svg = node.dataset.key ? pageIcon(node.dataset.key) : undefined;
|
||||
if (svg) {
|
||||
replaceMenuSVG(node, svg);
|
||||
const key = node.dataset.key as keyof typeof MenuitemSVGKey | undefined;
|
||||
if (key && MenuitemSVGKey[key]) {
|
||||
replaceMenuSVG(node, MenuitemSVGKey[key]);
|
||||
} else {
|
||||
const label = getMenuLabel(node);
|
||||
if (label) wrapMenuLabelText(label);
|
||||
|
||||
Reference in new issue
Block a user