mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
Merge main into better-looking-theme-tab and trim PR scope
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
80a1f7a7ba
148 files changed
+6566
-4973
No files matched your search
@@ -11,9 +11,6 @@ on:
|
||||
schedule:
|
||||
# 13:30 UTC = 00:00 Adelaide during daylight saving (ACDT, UTC+10:30)
|
||||
- cron: "30 13 * * *"
|
||||
# 14:30 UTC = 00:00 Adelaide during standard time (ACST, UTC+9:30)
|
||||
- cron: "30 14 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -29,33 +26,15 @@ jobs:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Check Adelaide midnight
|
||||
id: time_check
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
echo "proceed=true" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
export TZ=Australia/Adelaide
|
||||
NOW="$(date +'%Y-%m-%d %H:%M %Z')"
|
||||
if [ "$(date +%H%M)" = "0000" ]; then
|
||||
echo "proceed=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "proceed=false" >> "$GITHUB_OUTPUT"
|
||||
echo "Skipping: not midnight Australia/Adelaide ($NOW)"
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
if: steps.time_check.outputs.proceed == 'true'
|
||||
|
||||
- name: Set build date
|
||||
id: build_date
|
||||
if: steps.time_check.outputs.proceed == 'true'
|
||||
run: echo "date=$(TZ=Australia/Adelaide date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build extension
|
||||
id: build
|
||||
if: steps.time_check.outputs.proceed == 'true'
|
||||
uses: ./.github/actions/build-extension
|
||||
with:
|
||||
gh_release_update_check: "true"
|
||||
@@ -64,7 +43,6 @@ jobs:
|
||||
release_repo: ${{ github.repository }}
|
||||
|
||||
- name: Ensure nightly release exists
|
||||
if: steps.time_check.outputs.proceed == 'true'
|
||||
run: |
|
||||
TITLE="Nightly (${{ steps.build_date.outputs.date }})"
|
||||
if ! gh release view "${{ env.NIGHTLY_TAG }}" 2>/dev/null; then
|
||||
@@ -77,7 +55,6 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Upload nightly assets
|
||||
if: steps.time_check.outputs.proceed == 'true'
|
||||
run: |
|
||||
gh release upload "${{ env.NIGHTLY_TAG }}" \
|
||||
--clobber \
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -24,4 +24,4 @@ export default {
|
||||
'src/**/*.ts',
|
||||
'!src/**/*.d.ts',
|
||||
],
|
||||
};
|
||||
};
|
||||
@@ -1,20 +0,0 @@
|
||||
// ref: https://stackoverflow.com/a/76920975
|
||||
import type { Plugin } from "vite";
|
||||
|
||||
/** Exit with code 1 on build failure; do not exit on success (multi-target builds). */
|
||||
export default function ClosePlugin(): Plugin {
|
||||
return {
|
||||
name: "ClosePlugin",
|
||||
buildEnd(error) {
|
||||
if (error) {
|
||||
console.error("Error bundling", error);
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log("Build ended");
|
||||
}
|
||||
},
|
||||
closeBundle() {
|
||||
console.log("Bundle closed");
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import { readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { dirname, relative } from "node:path/posix";
|
||||
import { globSync } from "glob";
|
||||
import type { Plugin } from "rollup";
|
||||
|
||||
const hash = (path: string) =>
|
||||
createHash("sha256").update(readFileSync(path)).digest("hex");
|
||||
|
||||
/** Reuse identical files already copied to stable extension paths. */
|
||||
export default (): Plugin => ({
|
||||
name: "dedupe-public-assets",
|
||||
writeBundle({ dir }) {
|
||||
if (!dir) return;
|
||||
const files = globSync("**/*", { cwd: dir, nodir: true });
|
||||
const stable = new Map<string, string>();
|
||||
const duplicates = new Map<string, string>();
|
||||
for (const file of files) {
|
||||
if (file.startsWith("resources/"))
|
||||
stable.set(hash(resolve(dir, file)), file);
|
||||
}
|
||||
for (const file of files) {
|
||||
const match = file.startsWith("assets/")
|
||||
? stable.get(hash(resolve(dir, file)))
|
||||
: undefined;
|
||||
if (match) duplicates.set(file, match);
|
||||
}
|
||||
for (const file of files.filter((file) =>
|
||||
/\.(?:css|html|js)$/.test(file),
|
||||
)) {
|
||||
const path = resolve(dir, file);
|
||||
let output = readFileSync(path, "utf8");
|
||||
for (const [asset, canonical] of duplicates) {
|
||||
output = output.replaceAll(
|
||||
relative(dirname(file), asset),
|
||||
relative(dirname(file), canonical),
|
||||
);
|
||||
}
|
||||
writeFileSync(path, output);
|
||||
}
|
||||
for (const file of duplicates.keys()) unlinkSync(resolve(dir, file));
|
||||
|
||||
const manifestPath = resolve(dir, "manifest.json");
|
||||
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
||||
for (const entry of manifest.web_accessible_resources ?? []) {
|
||||
entry.resources = entry.resources.filter(
|
||||
(file: string) => !duplicates.has(file),
|
||||
);
|
||||
}
|
||||
writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
|
||||
},
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Plugin } from "vite";
|
||||
import { build } from "esbuild";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
/** Bundle worker entry points imported with `?inlineWorker` as Blob-backed Workers in dev. */
|
||||
export default function InlineWorkerDevPlugin(): Plugin {
|
||||
@@ -16,6 +17,12 @@ export default function InlineWorkerDevPlugin(): Plugin {
|
||||
platform: "browser",
|
||||
format: "iife",
|
||||
target: "esnext",
|
||||
minify: true,
|
||||
alias: {
|
||||
"@huggingface/transformers": resolve(
|
||||
"node_modules/@huggingface/transformers/dist/transformers.web.js",
|
||||
),
|
||||
},
|
||||
external: ["webextension-polyfill"],
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
"browserslist": "> 0.5%, last 2 versions, not dead",
|
||||
"scripts": {
|
||||
"compile:layerchart": "node scripts/compile-layerchart-vendor.mjs",
|
||||
"postinstall": "node scripts/copy-pdfjs-assets.mjs && node scripts/copy-ort-wasm-assets.mjs && npm run compile:layerchart",
|
||||
"postinstall": "node scripts/copy-runtime-assets.mjs && npm run compile:layerchart",
|
||||
"autoaudit": "npm audit && npm audit fix && npm run build",
|
||||
"dev": "cross-env MODE=chrome vite dev",
|
||||
"dev:firefox": "cross-env MODE=firefox vite build --watch",
|
||||
@@ -25,7 +25,7 @@
|
||||
"test:ci": "npm run test:unit && npm run build && npm run test:smoke",
|
||||
"release": "gh release create $npm_package_version --repo BetterSEQTA/BetterSEQTA-Plus ./dist/*.zip --generate-notes",
|
||||
"publish": "bun lib/publish.js --b",
|
||||
"zip": "bedframe zip"
|
||||
"zip": "node scripts/package-extension-zips.mjs"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": {
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
* Chrome trace analyzer — aggregates hotspots for BetterSEQTA+ optimization.
|
||||
* Usage: node scripts/analyze-trace.mjs <path-to-trace.json>
|
||||
*/
|
||||
import fs from "node:fs";
|
||||
|
||||
const path = process.argv[2];
|
||||
if (!path) {
|
||||
console.error("Usage: node scripts/analyze-trace.mjs <trace.json>");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const raw = fs.readFileSync(path, "utf8");
|
||||
const { traceEvents } = JSON.parse(raw);
|
||||
|
||||
const DURATION_PHASES = new Set(["X", "b", "e"]);
|
||||
const openStacks = new Map(); // key -> { name, cat, args, ts }
|
||||
|
||||
const byName = new Map();
|
||||
const byCat = new Map();
|
||||
const byUrl = new Map();
|
||||
const byFunction = new Map();
|
||||
const layoutEvents = [];
|
||||
const paintEvents = [];
|
||||
const longTasks = [];
|
||||
const timers = [];
|
||||
const observers = [];
|
||||
const hitTests = [];
|
||||
const betterseqtaHits = new Map();
|
||||
const ipcMessages = new Map();
|
||||
const gcEvents = [];
|
||||
|
||||
let minTs = Infinity;
|
||||
let maxTs = -Infinity;
|
||||
|
||||
function add(map, key, dur, count = 1) {
|
||||
const e = map.get(key) ?? { dur: 0, count: 0 };
|
||||
e.dur += dur;
|
||||
e.count += count;
|
||||
map.set(key, e);
|
||||
}
|
||||
|
||||
function stackKey(ev) {
|
||||
return `${ev.pid}:${ev.tid}:${ev.name}:${ev.ts}`;
|
||||
}
|
||||
|
||||
for (const ev of traceEvents) {
|
||||
if (ev.ts != null) {
|
||||
minTs = Math.min(minTs, ev.ts);
|
||||
maxTs = Math.max(maxTs, ev.ts);
|
||||
}
|
||||
|
||||
const ph = ev.ph;
|
||||
const name = ev.name ?? "";
|
||||
const cat = ev.cat ?? "";
|
||||
const args = ev.args ?? {};
|
||||
|
||||
if (ph === "b") {
|
||||
openStacks.set(`${ev.pid}:${ev.tid}:${ev.id ?? name}`, ev);
|
||||
continue;
|
||||
}
|
||||
|
||||
let dur = ev.dur ?? 0;
|
||||
if (ph === "e" && ev.id != null) {
|
||||
const start = openStacks.get(`${ev.pid}:${ev.tid}:${ev.id}`);
|
||||
if (start) dur = ev.ts - start.ts;
|
||||
}
|
||||
if (dur <= 0 && ph !== "X") continue;
|
||||
|
||||
add(byName, name, dur);
|
||||
|
||||
const catParts = cat.split(",").filter(Boolean);
|
||||
for (const c of catParts.length ? catParts : [cat || "(none)"]) {
|
||||
add(byCat, c, dur);
|
||||
}
|
||||
|
||||
const url =
|
||||
args.data?.url ??
|
||||
args.url ??
|
||||
args.fileName ??
|
||||
args.data?.scriptName ??
|
||||
args.data?.frame ??
|
||||
"";
|
||||
if (url && typeof url === "string" && dur > 0) {
|
||||
add(byUrl, url.slice(0, 200), dur);
|
||||
}
|
||||
|
||||
const fn =
|
||||
args.data?.functionName ??
|
||||
args.functionName ??
|
||||
args.data?.columnNumber != null
|
||||
? `${args.data?.functionName ?? name}@${args.data?.url ?? ""}:${args.data?.lineNumber ?? "?"}`
|
||||
: "";
|
||||
if (fn && dur > 100) {
|
||||
add(byFunction, String(fn).slice(0, 250), dur);
|
||||
}
|
||||
|
||||
if (/Layout|UpdateLayoutTree|InvalidateLayout|LocalFrameView::performLayout/i.test(name)) {
|
||||
layoutEvents.push({ name, dur, ts: ev.ts, cat });
|
||||
}
|
||||
if (/Paint|Raster|DrawFrame|CompositeLayers|UpdateLayer/i.test(name)) {
|
||||
paintEvents.push({ name, dur, ts: ev.ts });
|
||||
}
|
||||
if (name === "RunTask" && dur > 50000) {
|
||||
longTasks.push({ dur, ts: ev.ts, cat, args: JSON.stringify(args).slice(0, 300) });
|
||||
}
|
||||
if (/Timer|setTimeout|setInterval|FireIdleCallback|requestAnimationFrame|RequestAnimationFrame/i.test(name)) {
|
||||
timers.push({ name, dur, ts: ev.ts });
|
||||
}
|
||||
if (/MutationObserver|ResizeObserver|IntersectionObserver|DeliverObservations|NotifyMutation/i.test(name)) {
|
||||
observers.push({ name, dur, ts: ev.ts });
|
||||
}
|
||||
if (/HitTest|FindElement|ElementAt/i.test(name)) {
|
||||
hitTests.push({ name, dur, ts: ev.ts });
|
||||
}
|
||||
if (/V8\.GC|GC_|MajorGC|MinorGC|IncrementalMarking/i.test(name)) {
|
||||
gcEvents.push({ name, dur, ts: ev.ts });
|
||||
}
|
||||
if (/IPC|MessagePort|postMessage/i.test(name)) {
|
||||
add(ipcMessages, name, dur);
|
||||
}
|
||||
|
||||
const blob = JSON.stringify(args);
|
||||
if (/betterseqta|BetterSEQTA|bsplus|SEQTA\.ts|monofile|AddBetterSEQTA/i.test(blob + name + url)) {
|
||||
const key = `${name} | ${(url || blob).slice(0, 120)}`;
|
||||
add(betterseqtaHits, key, dur);
|
||||
}
|
||||
}
|
||||
|
||||
function top(map, n = 40, minCount = 1) {
|
||||
return [...map.entries()]
|
||||
.filter(([, v]) => v.count >= minCount)
|
||||
.sort((a, b) => b[1].dur - a[1].dur)
|
||||
.slice(0, n)
|
||||
.map(([k, v]) => ({
|
||||
key: k,
|
||||
totalMs: (v.dur / 1000).toFixed(1),
|
||||
count: v.count,
|
||||
avgMs: (v.dur / v.count / 1000).toFixed(2),
|
||||
}));
|
||||
}
|
||||
|
||||
const traceDurationMs = ((maxTs - minTs) / 1000).toFixed(0);
|
||||
|
||||
console.log(JSON.stringify({
|
||||
summary: {
|
||||
traceDurationMs,
|
||||
eventCount: traceEvents.length,
|
||||
layoutCount: layoutEvents.length,
|
||||
layoutTotalMs: (layoutEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||
paintCount: paintEvents.length,
|
||||
paintTotalMs: (paintEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||
longTaskCount: longTasks.length,
|
||||
longTaskTotalMs: (longTasks.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||
timerCount: timers.length,
|
||||
timerTotalMs: (timers.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||
observerCount: observers.length,
|
||||
observerTotalMs: (observers.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||
hitTestCount: hitTests.length,
|
||||
hitTestTotalMs: (hitTests.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||
gcCount: gcEvents.length,
|
||||
gcTotalMs: (gcEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||
},
|
||||
topEventNames: top(byName, 50),
|
||||
topCategories: top(byCat, 30),
|
||||
topUrls: top(byUrl, 40),
|
||||
topFunctions: top(byFunction, 40, 1),
|
||||
topBetterseqta: top(betterseqtaHits, 50),
|
||||
topLongTasks: longTasks.sort((a, b) => b.dur - a.dur).slice(0, 20).map(e => ({
|
||||
ms: (e.dur / 1000).toFixed(1),
|
||||
cat: e.cat,
|
||||
args: e.args,
|
||||
})),
|
||||
topLayout: layoutEvents.sort((a, b) => b.dur - a.dur).slice(0, 15).map(e => ({
|
||||
name: e.name, ms: (e.dur / 1000).toFixed(2),
|
||||
})),
|
||||
topObservers: observers.sort((a, b) => b.dur - a.dur).slice(0, 15).map(e => ({
|
||||
name: e.name, ms: (e.dur / 1000).toFixed(2), count: 1,
|
||||
})),
|
||||
}, null, 2));
|
||||
@@ -1,28 +0,0 @@
|
||||
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
||||
import { createRequire } from "node:module";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
const transformersDist = dirname(require.resolve("@huggingface/transformers"));
|
||||
const outDir = join(root, "src", "public", "resources", "ort");
|
||||
|
||||
mkdirSync(outDir, { recursive: true });
|
||||
|
||||
const ortFiles = [
|
||||
"ort-wasm-simd-threaded.jsep.mjs",
|
||||
"ort-wasm-simd-threaded.jsep.wasm",
|
||||
];
|
||||
|
||||
for (const file of ortFiles) {
|
||||
const src = join(transformersDist, file);
|
||||
if (!existsSync(src)) {
|
||||
throw new Error(
|
||||
`Missing ONNX Runtime WASM asset: ${src}\n` +
|
||||
"Ensure @huggingface/transformers is installed (direct dependency).",
|
||||
);
|
||||
}
|
||||
copyFileSync(src, join(outDir, file));
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { copyFileSync, mkdirSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const pdfjsRoot = join(root, "node_modules", "pdfjs-dist");
|
||||
const outDir = join(root, "src", "public", "resources", "pdfjs");
|
||||
|
||||
mkdirSync(outDir, { recursive: true });
|
||||
copyFileSync(
|
||||
join(pdfjsRoot, "build", "pdf.worker.min.mjs"),
|
||||
join(outDir, "pdf.worker.min.mjs"),
|
||||
);
|
||||
copyFileSync(
|
||||
join(pdfjsRoot, "legacy", "build", "pdf.min.mjs"),
|
||||
join(outDir, "pdf.legacy.min.mjs"),
|
||||
);
|
||||
@@ -0,0 +1,24 @@
|
||||
import { copyFileSync, mkdirSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const resources = join(root, "src", "public", "resources");
|
||||
const files = [
|
||||
["pdfjs-dist/build/pdf.worker.min.mjs", "pdfjs/pdf.worker.min.mjs"],
|
||||
["pdfjs-dist/legacy/build/pdf.min.mjs", "pdfjs/pdf.legacy.min.mjs"],
|
||||
[
|
||||
"@huggingface/transformers/dist/ort-wasm-simd-threaded.jsep.mjs",
|
||||
"ort/ort-wasm-simd-threaded.jsep.mjs",
|
||||
],
|
||||
[
|
||||
"@huggingface/transformers/dist/ort-wasm-simd-threaded.jsep.wasm",
|
||||
"ort/ort-wasm-simd-threaded.jsep.wasm",
|
||||
],
|
||||
];
|
||||
|
||||
for (const [source, target] of files) {
|
||||
const output = join(resources, target);
|
||||
mkdirSync(dirname(output), { recursive: true });
|
||||
copyFileSync(join(root, "node_modules", source), output);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ const buildLabel = process.env.BUILD_LABEL || "";
|
||||
const base =
|
||||
updateChannel === "nightly" && buildLabel
|
||||
? `betterseqtaplus-nightly-${buildLabel}`
|
||||
: `betterseqtaplus-${version}`;
|
||||
: `${pkg.name}@${version}`;
|
||||
|
||||
const chromeZip = `dist/${base}-chrome.zip`;
|
||||
const firefoxZip = `dist/${base}-firefox.zip`;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
@layer override {
|
||||
.legacy-root,
|
||||
.legacy-root * {
|
||||
.legacy-root *:not(.iconFamily) {
|
||||
font-family: var(--betterseqta-font-family, Rubik), sans-serif !important;
|
||||
}
|
||||
|
||||
|
||||
+380
-194
@@ -16,6 +16,7 @@
|
||||
@include meta.load-css("injected/sidebar-styles.scss");
|
||||
@include meta.load-css("injected/theme.scss");
|
||||
@include meta.load-css("injected/transparency.scss");
|
||||
@include meta.load-css("injected/performance-mode.scss");
|
||||
|
||||
:root {
|
||||
background: var(--better-main) !important;
|
||||
@@ -44,12 +45,12 @@ button.bsplus-timetable-control.iconFamily,
|
||||
body,
|
||||
.legacy-root input,
|
||||
.legacy-root textarea,
|
||||
.legacy-root button,
|
||||
.legacy-root button:not(.iconFamily),
|
||||
.legacy-root select,
|
||||
.legacy-root option,
|
||||
.legacy-root .input,
|
||||
html {
|
||||
font-family: Rubik, sans-serif !important;
|
||||
font-family: var(--betterseqta-font-family, Rubik), sans-serif !important;
|
||||
}
|
||||
|
||||
.legacy-root {
|
||||
@@ -126,9 +127,17 @@ select option {
|
||||
background: var(--auto-background) !important;
|
||||
}
|
||||
.legacy-root,
|
||||
.legacy-root * {
|
||||
font-family: Rubik, sans-serif !important;
|
||||
--theme-fg-parts: white;
|
||||
.legacy-root *:not(.iconFamily) {
|
||||
font-family: var(--betterseqta-font-family, Rubik), sans-serif !important;
|
||||
}
|
||||
|
||||
/* SEQTA uses `rgb(var(--theme-fg-parts))` — must be an rgb triplet, not `white`. */
|
||||
html.dark .legacy-root {
|
||||
--theme-fg-parts: 255, 255, 255;
|
||||
}
|
||||
|
||||
html:not(.dark) .legacy-root {
|
||||
--theme-fg-parts: 0, 0, 0;
|
||||
}
|
||||
.extension-editor {
|
||||
background: var(--background-primary);
|
||||
@@ -487,15 +496,15 @@ ul.magicDelete > li.deleting {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#menu li.hasChildren.active > .sub {
|
||||
#menu li.hasChildren:is(.active, .bsplus-active) > .sub {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
#menu li.hasChildren.active > .sub:has(.hasChildren.active) {
|
||||
#menu li.hasChildren:is(.active, .bsplus-active) > .sub:has(.hasChildren:is(.active, .bsplus-active)) {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
#menu li.hasChildren.active .hasChildren.active > .sub {
|
||||
#menu li.hasChildren:is(.active, .bsplus-active) .hasChildren:is(.active, .bsplus-active) > .sub {
|
||||
pointer-events: auto !important;
|
||||
}
|
||||
|
||||
@@ -532,8 +541,7 @@ ul.magicDelete > li.deleting {
|
||||
visibility: visible !important;
|
||||
}
|
||||
|
||||
/* Edit rows should match normal custom-sidebar item size (not shrunk). */
|
||||
#menu.bsplus-sidebar-edit-mode > #bsplus-sidebar-root > li.item.draggable,
|
||||
/* Edit rows should match normal sidebar item size (not shrunk). */
|
||||
#menu.bsplus-sidebar-edit-mode .item.draggable {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
@@ -619,26 +627,6 @@ ul.magicDelete > li.deleting {
|
||||
transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
/* Hide native menu as soon as possible (during loading), before Svelte mounts.
|
||||
Keep `#bsplus-sidebar-root` visible — themes target `#menu > ul > li.item` on it. */
|
||||
html.bsplus-custom-sidebar-pending #menu > ul:not(#bsplus-sidebar-root),
|
||||
html.bsplus-custom-sidebar-pending #menu > #userInfo,
|
||||
html.bsplus-custom-sidebar-pending #menu > .icon-cover,
|
||||
#menu.bsplus-custom-sidebar > ul:not(#bsplus-sidebar-root),
|
||||
#menu.bsplus-custom-sidebar > #userInfo,
|
||||
#menu.bsplus-custom-sidebar > .icon-cover {
|
||||
position: absolute !important;
|
||||
left: -10000px !important;
|
||||
width: 1px !important;
|
||||
height: 1px !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
overflow: hidden !important;
|
||||
opacity: 0 !important;
|
||||
pointer-events: none !important;
|
||||
clip: rect(0, 0, 0, 0) !important;
|
||||
}
|
||||
|
||||
/* Custom title bar: keep native `#title` children for sync, hide them visually.
|
||||
Loading overlay stays until waitForCustomTitleBarReady() so this is ready underneath. */
|
||||
html.bsplus-custom-title-pending #title > :not(#bsplus-title-root),
|
||||
@@ -665,157 +653,6 @@ html.bsplus-custom-title-pending #title > :not(#bsplus-title-root),
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Custom Svelte sidebar: keep `#menu > ul > li.item` / `.sub` shape for theme CSS. */
|
||||
#menu.bsplus-custom-sidebar {
|
||||
position: absolute !important;
|
||||
top: 0 !important;
|
||||
bottom: 0 !important;
|
||||
left: 0 !important;
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
box-sizing: border-box !important;
|
||||
height: auto !important;
|
||||
max-height: none !important;
|
||||
overflow: hidden !important;
|
||||
|
||||
> #bsplus-sidebar-root {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
padding-top: 0 !important;
|
||||
|
||||
/*
|
||||
* Extend the logo spacer for the same gap as between items.
|
||||
* SEQTA's #menu>ul::before border-bottom is the hairline under the logo.
|
||||
*/
|
||||
&::before {
|
||||
box-shadow: none !important;
|
||||
border-bottom: none !important;
|
||||
height: calc(71px + 8px) !important;
|
||||
}
|
||||
}
|
||||
|
||||
li.hasChildren {
|
||||
position: static !important;
|
||||
}
|
||||
|
||||
/* Native list may keep `.active` after click-through; force our rows clickable,
|
||||
then lock siblings only while a custom drill `.sub` is open. */
|
||||
> #bsplus-sidebar-root > li.item {
|
||||
pointer-events: auto !important;
|
||||
width: auto !important;
|
||||
max-width: none !important;
|
||||
margin: 0 6px 8px !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
|
||||
&:has(> #bsplus-sidebar-root > li.hasChildren.active > .sub)
|
||||
> #bsplus-sidebar-root
|
||||
> li:not(.hasChildren.active),
|
||||
&:has(> #bsplus-sidebar-root > li.hasChildren.active > .sub)
|
||||
> #bsplus-sidebar-root
|
||||
> li:not(.hasChildren.active)
|
||||
* {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
/* Same locks keyed off `.drilling` so nested leaf clicks do not flicker when
|
||||
SEQTA briefly strips `.active` from folder rows. */
|
||||
> #bsplus-sidebar-root.drilling > li:not(.hasChildren),
|
||||
> #bsplus-sidebar-root.drilling > li:not(.hasChildren) * {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
> #bsplus-sidebar-root .sub {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
> #bsplus-sidebar-root li.hasChildren.active > .sub {
|
||||
pointer-events: auto;
|
||||
background: transparent !important;
|
||||
background-image: none !important;
|
||||
}
|
||||
|
||||
> #bsplus-sidebar-root li.hasChildren.active > .sub:has(.hasChildren.active) {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
> #bsplus-sidebar-root li.hasChildren.active .hasChildren.active > .sub {
|
||||
pointer-events: auto !important;
|
||||
background: transparent !important;
|
||||
background-image: none !important;
|
||||
}
|
||||
|
||||
> #bsplus-sidebar-root.drilling li.hasChildren > .sub:not(:has(.sub)) {
|
||||
pointer-events: auto !important;
|
||||
background: transparent !important;
|
||||
background-image: none !important;
|
||||
}
|
||||
|
||||
> #bsplus-sidebar-root.drilling li.hasChildren > .sub:has(.sub) {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
> #bsplus-sidebar-root.drilling li.hasChildren > .sub .sub {
|
||||
pointer-events: auto !important;
|
||||
background: transparent !important;
|
||||
background-image: none !important;
|
||||
}
|
||||
|
||||
> #bsplus-sidebar-root > li.hasChildren.active > label,
|
||||
> #bsplus-sidebar-root.drilling > li.hasChildren > label {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
/* Theme decorations on root leaves (Beach palm/sand) must not show through
|
||||
the transparent drill `.sub` panel. */
|
||||
> #bsplus-sidebar-root:has(> li.hasChildren.active > .sub)
|
||||
> li:not(.hasChildren.active)::before,
|
||||
> #bsplus-sidebar-root:has(> li.hasChildren.active > .sub)
|
||||
> li:not(.hasChildren.active)::after {
|
||||
content: none !important;
|
||||
display: none !important;
|
||||
animation: none !important;
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
||||
> #bsplus-sidebar-root.drilling > li:not(.hasChildren)::before,
|
||||
> #bsplus-sidebar-root.drilling > li:not(.hasChildren)::after {
|
||||
content: none !important;
|
||||
display: none !important;
|
||||
animation: none !important;
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
||||
#bsplus-sidebar-root .sub .back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 12px 16px 8px;
|
||||
cursor: pointer;
|
||||
font-weight: 700;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#bsplus-sidebar-root .sub .back:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
#bsplus-sidebar-root .sub .backLabel {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
#bsplus-sidebar-root .sub > ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 0 16px;
|
||||
}
|
||||
}
|
||||
|
||||
#menu li > label > svg,
|
||||
#menu section > label > svg {
|
||||
margin: 0 10px 0 4px;
|
||||
@@ -824,7 +661,7 @@ html.bsplus-custom-title-pending #title > :not(#bsplus-title-root),
|
||||
}
|
||||
|
||||
/* Icon Only Sidebar - compact mode. When submenu is open, all styles are disabled so it behaves as normal sidebar. */
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren.active)) {
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active))) {
|
||||
#menu {
|
||||
width: 70px !important;
|
||||
transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
@@ -910,6 +747,7 @@ body.icon-only-sidebar:not(:has(#menu li.hasChildren.active)) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[class*="notifications__items___"] {
|
||||
-ms-overflow-style: none !important;
|
||||
scrollbar-width: none !important;
|
||||
@@ -959,7 +797,7 @@ body > .sortable-fallback.bsplus-sortable-drag,
|
||||
}
|
||||
|
||||
#menu {
|
||||
li.active > .sub > ul > .item:not(.hasChildren) {
|
||||
li:is(.active, .hasChildren.bsplus-active) > .sub > ul > .item:not(.hasChildren) {
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
@@ -974,10 +812,11 @@ body > .sortable-fallback.bsplus-sortable-drag,
|
||||
width 100ms,
|
||||
transform 0.3s ease;
|
||||
border-radius: 8px 0 0 8px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:hover::before,
|
||||
&.active::before {
|
||||
&:is(.active, .bsplus-active)::before {
|
||||
width: 6px;
|
||||
background: var(--item-colour, transparent);
|
||||
}
|
||||
@@ -1116,9 +955,9 @@ ol:has([class*="MessageList__avatar___"] svg) {
|
||||
-webkit-box-shadow: 0px 5px 16px 6px rgba(0, 0, 0, 0.2) !important;
|
||||
box-shadow: 0px 0px 4px 2px rgba(0, 0, 0, 0.2) !important;
|
||||
}
|
||||
/* Custom sidebar: keep title depth to the right, not a hairline under the logo into the menu. */
|
||||
body:has(#menu.bsplus-custom-sidebar) #container #content #title,
|
||||
body:has(#menu.bsplus-custom-sidebar).menuShown #container #content #title {
|
||||
/* Styled sidebar: keep title depth to the right, not a hairline under the logo into the menu. */
|
||||
body:has(#menu.bsplus-styled-sidebar) #container #content #title,
|
||||
body:has(#menu.bsplus-styled-sidebar).menuShown #container #content #title {
|
||||
-webkit-box-shadow: 6px 0 8px -4px rgba(0, 0, 0, 0.25) !important;
|
||||
box-shadow: 6px 0 8px -4px rgba(0, 0, 0, 0.25) !important;
|
||||
}
|
||||
@@ -1420,7 +1259,7 @@ html.transparencyEffects
|
||||
transform: translatex(var(--bsplus-sidebar-width, 270px));
|
||||
}
|
||||
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren.active)) {
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active))) {
|
||||
#menu {
|
||||
-webkit-transform: translatex(-70px);
|
||||
transform: translatex(-70px);
|
||||
@@ -2027,11 +1866,11 @@ html.transparencyEffects
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
}
|
||||
.dark .legacy-root button::after {
|
||||
.dark .legacy-root button.iconFamily::after {
|
||||
background: white;
|
||||
}
|
||||
.legacy-root button::after {
|
||||
background: black !important;
|
||||
.legacy-root button.iconFamily::after {
|
||||
background: currentColor;
|
||||
}
|
||||
.legacy-root button:not([disabled]):focus {
|
||||
border-color: var(--better-sub);
|
||||
@@ -2063,11 +1902,21 @@ html.transparencyEffects
|
||||
box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
/* Smoothed by attachNotificationsPanelAnimation (matches #ExtensionPopup spring) */
|
||||
/* Smoothed by attachNotificationsPanelAnimation (CSS transition, no JS spring ticks) */
|
||||
.bsplus-notifications-panel {
|
||||
transform-origin: top right;
|
||||
will-change: opacity, transform;
|
||||
opacity: 0;
|
||||
transform: scale(0.94);
|
||||
transition:
|
||||
opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1),
|
||||
transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
filter: drop-shadow(0px 0px 20px rgba(0, 0, 0, 0.35));
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.bsplus-notifications-panel--open {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
#menu li.active {
|
||||
@@ -3836,18 +3685,320 @@ div.day-empty {
|
||||
.userInfo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-top: 4px;
|
||||
padding: 4px 0;
|
||||
}
|
||||
.userInfoText {
|
||||
text-align: end;
|
||||
padding: 2px 0;
|
||||
}
|
||||
.userInfoName {
|
||||
margin: 0 !important;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.userInfoCode {
|
||||
margin: 0 !important;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.userInfoNameRow {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 6px;
|
||||
}
|
||||
.userInfoDetails {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 2px;
|
||||
}
|
||||
.userInfoHouseWrap {
|
||||
display: inline-block;
|
||||
margin: 0 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.userInfoHouseWrap .userInfohouse {
|
||||
display: block;
|
||||
margin: 0 !important;
|
||||
padding: 0 6px !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.userInfoHouseWrap .bsplus-founder-badge-slot {
|
||||
width: 100%;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.userInfoHouseWrap .bsplus-founder-badge-slot[hidden],
|
||||
.bsplus-founder-badge-slot[hidden] {
|
||||
display: none;
|
||||
}
|
||||
.bsplus-founder-badge--titlebar {
|
||||
display: block;
|
||||
width: 100%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.bsplus-founder-badge--titlebar .bsplus-founder-badge__glass,
|
||||
.bsplus-founder-badge--titlebar .bsplus-founder-badge__content {
|
||||
width: 100%;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.bsplus-founder-badge--titlebar .bsplus-founder-badge__content {
|
||||
justify-content: center;
|
||||
padding: 0 6px;
|
||||
gap: 0;
|
||||
min-height: 0;
|
||||
height: auto;
|
||||
font-size: 15px;
|
||||
line-height: normal;
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgba(255, 255, 255, 0.28),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.16),
|
||||
inset 0 -1px 0 rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
.bsplus-founder-badge--titlebar .bsplus-founder-badge__label {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
.bsplus-founder-badge--titlebar:focus-visible .bsplus-founder-badge__content {
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgba(255, 255, 255, 0.28),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.16),
|
||||
inset 0 -1px 0 rgba(0, 0, 0, 0.12),
|
||||
0 0 0 2px var(--theme-primary, #f97316),
|
||||
0 0 0 4px rgba(249, 115, 22, 0.35);
|
||||
}
|
||||
.legacy-root .bsplus-founder-badge,
|
||||
.legacy-root .bsplus-founder-badge-actions .bsplus-cal-btn {
|
||||
background: transparent !important;
|
||||
}
|
||||
.legacy-root .bsplus-founder-badge::after,
|
||||
.legacy-root .bsplus-founder-badge-actions .bsplus-cal-btn::after {
|
||||
display: none !important;
|
||||
content: none !important;
|
||||
}
|
||||
.legacy-root .bsplus-founder-badge-actions .bsplus-cal-btn--ghost {
|
||||
background: color-mix(in srgb, var(--text-primary, #111) 8%, transparent) !important;
|
||||
}
|
||||
.legacy-root .bsplus-founder-badge-actions .bsplus-cal-btn--ghost:hover {
|
||||
background: color-mix(in srgb, var(--text-primary, #111) 14%, transparent) !important;
|
||||
}
|
||||
.legacy-root .bsplus-founder-badge-actions .bsplus-cal-btn--primary {
|
||||
background: var(--better-main, #3b82f6) !important;
|
||||
}
|
||||
.bsplus-founder-badge {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: transparent;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
font-family: var(--betterseqta-font-family, Rubik), sans-serif !important;
|
||||
transition: transform 0.2s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.bsplus-founder-badge--hero {
|
||||
border-radius: 12px;
|
||||
}
|
||||
.bsplus-founder-badge:hover {
|
||||
transform: scale(1.02);
|
||||
}
|
||||
.bsplus-founder-badge:focus {
|
||||
outline: none;
|
||||
}
|
||||
.bsplus-founder-badge:focus-visible .bsplus-founder-badge__glass {
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgba(255, 255, 255, 0.78),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.52),
|
||||
inset 0 2px 8px rgba(255, 255, 255, 0.14),
|
||||
inset 0 -1px 0 rgba(0, 0, 0, 0.08),
|
||||
0 0 0 2px var(--theme-primary, #f97316),
|
||||
0 0 0 4px rgba(249, 115, 22, 0.35);
|
||||
}
|
||||
.bsplus-founder-badge__glass {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
overflow: hidden;
|
||||
border-radius: inherit;
|
||||
background: var(--badge-base, #1e293b);
|
||||
}
|
||||
.bsplus-founder-badge__blobs {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background:
|
||||
radial-gradient(ellipse 72% 68% at 18% 42%, var(--badge-blob-a), transparent 72%),
|
||||
radial-gradient(ellipse 68% 62% at 82% 58%, var(--badge-blob-b), transparent 70%),
|
||||
radial-gradient(ellipse 64% 56% at 50% 88%, var(--badge-blob-c), transparent 68%);
|
||||
filter: blur(1px);
|
||||
}
|
||||
.bsplus-founder-badge__content {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 0 10px;
|
||||
min-height: 22px;
|
||||
border-radius: inherit;
|
||||
color: #fff;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 22px;
|
||||
letter-spacing: 0.01em;
|
||||
font-family: inherit;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
|
||||
backdrop-filter: blur(14px) saturate(1.3);
|
||||
-webkit-backdrop-filter: blur(14px) saturate(1.3);
|
||||
background: rgba(255, 255, 255, 0.16);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgba(255, 255, 255, 0.78),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.52),
|
||||
inset 0 2px 8px rgba(255, 255, 255, 0.14),
|
||||
inset 0 -1px 0 rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
.bsplus-founder-badge--hero .bsplus-founder-badge__content {
|
||||
gap: 8px;
|
||||
padding: 10px 16px;
|
||||
min-height: auto;
|
||||
font-size: 14px;
|
||||
line-height: 1.2;
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
.bsplus-founder-badge--hero .bsplus-founder-badge__glass {
|
||||
background: transparent;
|
||||
}
|
||||
.bsplus-founder-badge__icon {
|
||||
flex-shrink: 0;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
opacity: 0.95;
|
||||
}
|
||||
.bsplus-founder-badge--hero .bsplus-founder-badge__icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
.bsplus-founder-badge-hero {
|
||||
position: relative;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
margin: 0 auto;
|
||||
width: 90%;
|
||||
aspect-ratio: 16 / 9;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
||||
background: var(--badge-base, #0f172a);
|
||||
}
|
||||
.bsplus-founder-badge-hero__blobs {
|
||||
position: absolute;
|
||||
inset: -22%;
|
||||
pointer-events: none;
|
||||
background:
|
||||
radial-gradient(ellipse 72% 62% at 18% 34%, var(--badge-blob-a), transparent 76%),
|
||||
radial-gradient(ellipse 68% 58% at 82% 42%, var(--badge-blob-b), transparent 74%),
|
||||
radial-gradient(ellipse 74% 64% at 52% 88%, var(--badge-blob-c), transparent 76%),
|
||||
radial-gradient(ellipse 78% 68% at 48% 52%, var(--badge-blob-b), transparent 78%);
|
||||
filter: blur(10px);
|
||||
}
|
||||
.bsplus-founder-badge-hero__vignette {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background: radial-gradient(ellipse at center, transparent 34%, rgba(0, 0, 0, 0.62) 100%);
|
||||
opacity: 0.84;
|
||||
}
|
||||
.bsplus-founder-badge-hero__stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
pointer-events: none;
|
||||
}
|
||||
.bsplus-founder-badge-hero__stage .bsplus-founder-badge {
|
||||
pointer-events: auto;
|
||||
}
|
||||
.whatsnewTextContainer.bsplus-founder-badge-body p {
|
||||
margin: 0 0 1rem;
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.whatsnewTextContainer.bsplus-founder-badge-body a {
|
||||
color: inherit;
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
}
|
||||
.bsplus-founder-badge-signup {
|
||||
margin: 0 0 1rem !important;
|
||||
padding: 0.55rem 0.75rem;
|
||||
border-radius: 0.6rem;
|
||||
border: 1px solid color-mix(in srgb, var(--text-primary) 12%, transparent);
|
||||
background: color-mix(in srgb, var(--text-primary) 5%, transparent);
|
||||
font-size: 1rem !important;
|
||||
font-weight: 600;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.bsplus-founder-badge-header {
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
|
||||
h1,
|
||||
p {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.bsplus-founder-badge-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: center;
|
||||
margin-top: 1.25rem;
|
||||
}
|
||||
.bsplus-founder-badge-actions .bsplus-cal-btn {
|
||||
padding: 8px 14px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
line-height: 1.25;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.bsplus-founder-badge-actions .bsplus-cal-btn:focus-visible {
|
||||
outline: none;
|
||||
box-shadow:
|
||||
0 0 0 2px var(--background-primary, #fff),
|
||||
0 0 0 4px var(--better-main, #3b82f6);
|
||||
}
|
||||
.bsplus-founder-badge-actions .bsplus-cal-btn--ghost {
|
||||
background: color-mix(in srgb, var(--text-primary, #111) 8%, transparent);
|
||||
color: var(--text-primary, #111);
|
||||
}
|
||||
.bsplus-founder-badge-actions .bsplus-cal-btn--ghost:hover {
|
||||
background: color-mix(in srgb, var(--text-primary, #111) 14%, transparent);
|
||||
transform: scale(1.02);
|
||||
}
|
||||
.bsplus-founder-badge-actions .bsplus-cal-btn--primary {
|
||||
background: var(--better-main, #3b82f6);
|
||||
color: #fff;
|
||||
}
|
||||
.bsplus-founder-badge-actions .bsplus-cal-btn--primary:hover {
|
||||
filter: brightness(1.06);
|
||||
transform: scale(1.02);
|
||||
}
|
||||
.bsplus-founder-badge-actions .bsplus-cal-btn:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
.userInfosvg {
|
||||
width: 50px;
|
||||
@@ -3890,6 +4041,7 @@ div.day-empty {
|
||||
color: var(--text-primary);
|
||||
background: var(--auto-background);
|
||||
outline: solid 1px black;
|
||||
text-align: center;
|
||||
}
|
||||
.DarkLightButton {
|
||||
right: 145px !important;
|
||||
@@ -3978,6 +4130,40 @@ div.day-empty {
|
||||
z-index: 49;
|
||||
transform: scale(1) !important;
|
||||
}
|
||||
|
||||
/* Lightweight popup motion (performance mode) — fade + scale, no blur springs. */
|
||||
.whatsnewBackground.bsplus-popup-css-animate {
|
||||
opacity: 0;
|
||||
transition: opacity var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1));
|
||||
|
||||
.whatsnewContainer {
|
||||
opacity: 0;
|
||||
transform: scale(0.94);
|
||||
transition:
|
||||
opacity var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)),
|
||||
transform var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1));
|
||||
}
|
||||
|
||||
&.bsplus-popup-css-animate--open {
|
||||
opacity: 1;
|
||||
|
||||
.whatsnewContainer {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.whatsnewBackground.bsplus-popup-backdrop--lite {
|
||||
backdrop-filter: none !important;
|
||||
-webkit-backdrop-filter: none !important;
|
||||
background: rgba(0, 0, 0, 0.55) !important;
|
||||
|
||||
.whatsnewContainer {
|
||||
backdrop-filter: none !important;
|
||||
-webkit-backdrop-filter: none !important;
|
||||
}
|
||||
}
|
||||
.whatsnewImgContainer {
|
||||
width: 96%;
|
||||
display: flex;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
html.performanceMode {
|
||||
--bs-settings-ease: 0.2s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
--bs-motion-duration: 0.2s;
|
||||
--bs-motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
||||
|
||||
backdrop-filter: none !important;
|
||||
-webkit-backdrop-filter: none !important;
|
||||
filter: none !important;
|
||||
|
||||
/* Inline page loaders only — boot overlay lives in #loading shadow DOM. */
|
||||
.bkloading-inline .big-circle,
|
||||
.bkloading-inline .small-circle,
|
||||
.bkloading-inline .outer-circle {
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
/* Custom title: cheaper hit-testing during mouse moves (trace showed many HitTests). */
|
||||
.bsplus-custom-title,
|
||||
#title.bsplus-custom-title {
|
||||
contain: layout style paint;
|
||||
}
|
||||
|
||||
/* Settings backdrop — skip expensive blur in performance mode. */
|
||||
#ExtensionPopup ~ *,
|
||||
.outside-container.hide {
|
||||
backdrop-filter: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
html.performanceModeSimpleUi {
|
||||
.bsplus-analytics-charts,
|
||||
.bsplus-analytics-chart-cell {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Boot loading spinner uses shadow DOM; custom properties inherit from the host. */
|
||||
#loading.bkloading {
|
||||
--bk-stage-duration: 0.85s !important;
|
||||
--bk-spin-outer: 1s !important;
|
||||
--bk-spin-inner: 3s !important;
|
||||
--bk-spin-small: 3s !important;
|
||||
}
|
||||
|
||||
html.performanceMode.transparencyEffects,
|
||||
html.performanceMode .backdrop-blur-xl,
|
||||
html.performanceMode .backdrop-blur-sm,
|
||||
html.performanceMode [class*="backdrop-blur"] {
|
||||
backdrop-filter: none !important;
|
||||
-webkit-backdrop-filter: none !important;
|
||||
}
|
||||
@@ -34,9 +34,21 @@
|
||||
#ExtensionPopup {
|
||||
border-radius: 0;
|
||||
filter: none;
|
||||
/* Avoid transform on the host — it makes shadow `position: fixed` children
|
||||
size to the host instead of the viewport on Engage stacking contexts. */
|
||||
transform-origin: center center;
|
||||
will-change: opacity;
|
||||
transition: opacity 0.05s;
|
||||
opacity: 0;
|
||||
transition: opacity var(--bs-motion-duration, 0.2s) cubic-bezier(0.22, 1, 0.36, 1);
|
||||
}
|
||||
|
||||
#ExtensionPopup.bsplus-settings-host--open {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#ExtensionPopup.bsplus-settings-host--closing {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Feedback modal scrollport — host overflow:hidden otherwise clips fixed overlays. */
|
||||
#ExtensionPopup.bsplus-feedback-open {
|
||||
overflow: auto !important;
|
||||
}
|
||||
@@ -1,20 +1,22 @@
|
||||
#menu ul:has(li.hasChildren.active) li.hasChildren.active {
|
||||
#menu ul:has(li.hasChildren:is(.active, .bsplus-active))
|
||||
li.hasChildren:is(.active, .bsplus-active) {
|
||||
box-shadow: inset 0px 0 var(--item-colour, transparent) !important;
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
#menu ul:not(:has(li.hasChildren.active)) {
|
||||
#menu ul:not(:has(li.hasChildren:is(.active, .bsplus-active))) {
|
||||
overflow-y: scroll !important;
|
||||
}
|
||||
|
||||
#menu > ul:has(li.hasChildren.active) > li::before,
|
||||
#menu > ul:has(li.hasChildren.active) > li::after,
|
||||
#menu > ul ul:has(li.hasChildren.active) > li::before,
|
||||
#menu > ul ul:has(li.hasChildren.active) > li::after,
|
||||
#menu > ul:has(li.hasChildren.active) > li > label,
|
||||
#menu > ul:has(li.hasChildren.active) > li > svg,
|
||||
#menu > ul ul:has(li.hasChildren.active) > li > label,
|
||||
#menu > ul ul:has(li.hasChildren.active) > li > svg {
|
||||
#menu > ul:has(li.hasChildren:is(.active, .bsplus-active)) > li::before,
|
||||
#menu > ul:has(li.hasChildren:is(.active, .bsplus-active)) > li::after,
|
||||
#menu > ul ul:has(li.hasChildren:is(.active, .bsplus-active)) > li::before,
|
||||
#menu > ul ul:has(li.hasChildren:is(.active, .bsplus-active)) > li::after,
|
||||
#menu > ul:has(li.hasChildren:is(.active, .bsplus-active)) > li > label,
|
||||
#menu > ul:has(li.hasChildren:is(.active, .bsplus-active)) > li > svg,
|
||||
#menu > ul ul:has(li.hasChildren:is(.active, .bsplus-active)) > li > label,
|
||||
#menu > ul ul:has(li.hasChildren:is(.active, .bsplus-active)) > li > svg {
|
||||
/* !important beats theme animations (e.g. Beach palm-slide forwards). */
|
||||
transform: translateX(-320px) !important;
|
||||
animation: none !important;
|
||||
}
|
||||
@@ -24,16 +26,65 @@
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
/* Frontmost drill panel: rows move with `.sub` only — no separate enter animation. */
|
||||
#menu
|
||||
li.hasChildren:is(.active, .bsplus-active):not(
|
||||
:has(.sub li.hasChildren:is(.active, .bsplus-active))
|
||||
)
|
||||
> .sub
|
||||
> ul
|
||||
> li,
|
||||
#menu
|
||||
li.hasChildren:is(.active, .bsplus-active):not(
|
||||
:has(.sub li.hasChildren:is(.active, .bsplus-active))
|
||||
)
|
||||
> .sub
|
||||
> ul
|
||||
> li
|
||||
> label,
|
||||
#menu
|
||||
li.hasChildren:is(.active, .bsplus-active):not(
|
||||
:has(.sub li.hasChildren:is(.active, .bsplus-active))
|
||||
)
|
||||
> .sub
|
||||
> ul
|
||||
> li
|
||||
> svg,
|
||||
#menu
|
||||
li.hasChildren:is(.active, .bsplus-active):not(
|
||||
:has(.sub li.hasChildren:is(.active, .bsplus-active))
|
||||
)
|
||||
> .sub
|
||||
> ul
|
||||
> li::before,
|
||||
#menu
|
||||
li.hasChildren:is(.active, .bsplus-active):not(
|
||||
:has(.sub li.hasChildren:is(.active, .bsplus-active))
|
||||
)
|
||||
> .sub
|
||||
> ul
|
||||
> li::after {
|
||||
animation: none !important;
|
||||
transition: none !important;
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
#menu .sub {
|
||||
transition: transform 0.3s ease, left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
#menu > ul:has(li.hasChildren.active) > li.active {
|
||||
#menu .sub ul:has(> li.hasChildren:is(.active, .bsplus-active))
|
||||
> li:not(:is(.active, .bsplus-active)) {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
#menu > ul:has(li.hasChildren:is(.active, .bsplus-active))
|
||||
> li:is(.active, .bsplus-active) {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
#menu li.hasChildren:not(.active) li .sub {
|
||||
display: none;
|
||||
#menu li.hasChildren:not(:is(.active, .bsplus-active)) li .sub {
|
||||
display: none; // improves performance
|
||||
}
|
||||
|
||||
.sub .sub {
|
||||
@@ -41,87 +92,20 @@
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.sub:has(ul > li.hasChildren.active) > .nav > .back {
|
||||
.sub:has(ul > li.hasChildren:is(.active, .bsplus-active)) > .nav > .back {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren.active)) #menu > ul:has(li.hasChildren.active) > li::before,
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren.active)) #menu > ul ul:has(li.hasChildren.active) > li::before,
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren.active)) #menu > ul:has(li.hasChildren.active) > li > label,
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren.active)) #menu > ul:has(li.hasChildren.active) > li > svg,
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren.active)) #menu > ul ul:has(li.hasChildren.active) > li > label,
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren.active)) #menu > ul ul:has(li.hasChildren.active) > li > svg {
|
||||
transform: translateX(-70px);
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom sidebar drill slides — use `.drilling` / `.drill-entering` / `.drill-returning`,
|
||||
* not `:has(.active)` (SEQTA strips `.active` on nested clicks).
|
||||
*/
|
||||
#menu.bsplus-custom-sidebar #bsplus-sidebar-root {
|
||||
#menu {
|
||||
--bsplus-slide-off: -320px;
|
||||
|
||||
.sub {
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
&.drilling {
|
||||
overflow: hidden !important;
|
||||
|
||||
&:not(.drill-returning) > li::before,
|
||||
&:not(.drill-returning) > li::after,
|
||||
&:not(.drill-returning) > li > label,
|
||||
&:not(.drill-returning) > li > svg,
|
||||
&:not(.drill-returning) .sub:has(.sub) > ul > li::before,
|
||||
&:not(.drill-returning) .sub:has(.sub) > ul > li::after,
|
||||
&:not(.drill-returning) .sub:has(.sub) > ul > li > label,
|
||||
&:not(.drill-returning) .sub:has(.sub) > ul > li > svg {
|
||||
transform: translateX(var(--bsplus-slide-off)) !important;
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
&:not(.drill-entering):not(.drill-returning) {
|
||||
> li::before,
|
||||
> li::after,
|
||||
> li > label,
|
||||
> li > svg,
|
||||
.sub:has(.sub) > ul > li::before,
|
||||
.sub:has(.sub) > ul > li::after,
|
||||
.sub:has(.sub) > ul > li > label,
|
||||
.sub:has(.sub) > ul > li > svg {
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
.sub {
|
||||
transform: translateX(0) !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.sub:has(.sub) > .nav > .back {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.drill-entering .sub.bsplus-sub-enter {
|
||||
animation: bsplus-submenu-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
}
|
||||
|
||||
&.drill-returning:not(.drilling) > li::before,
|
||||
&.drill-returning:not(.drilling) > li::after,
|
||||
&.drill-returning:not(.drilling) > li > label,
|
||||
&.drill-returning:not(.drilling) > li > svg,
|
||||
&.drilling.drill-returning > li.hasChildren > .sub > ul > li::before,
|
||||
&.drilling.drill-returning > li.hasChildren > .sub > ul > li::after,
|
||||
&.drilling.drill-returning > li.hasChildren > .sub > ul > li > label,
|
||||
&.drilling.drill-returning > li.hasChildren > .sub > ul > li > svg {
|
||||
transition: none !important;
|
||||
animation: bsplus-sidebar-return 0.32s cubic-bezier(0.22, 1, 0.36, 1) both !important;
|
||||
}
|
||||
}
|
||||
|
||||
body.icon-only-sidebar #menu.bsplus-custom-sidebar #bsplus-sidebar-root {
|
||||
--bsplus-slide-off: -70px;
|
||||
/* Reverse slide when drilling back — label/svg motion is driven inline in JS
|
||||
so text stays off-screen until `.active` clears. Pseudo-elements use CSS. */
|
||||
#menu.bsplus-sidebar-returning ul.bsplus-drill-return-target > li::before,
|
||||
#menu.bsplus-sidebar-returning ul.bsplus-drill-return-target > li::after {
|
||||
animation: bsplus-sidebar-return 0.3s cubic-bezier(0.4, 0, 0.2, 1) both !important;
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
@keyframes bsplus-sidebar-return {
|
||||
@@ -133,13 +117,41 @@ body.icon-only-sidebar #menu.bsplus-custom-sidebar #bsplus-sidebar-root {
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes bsplus-submenu-enter {
|
||||
from {
|
||||
opacity: 0.35;
|
||||
transform: translateX(28px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
/* Icon-only collapsed: submenu slides over narrow icons. */
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active)))
|
||||
#menu
|
||||
> ul:has(li.hasChildren:is(.active, .bsplus-active))
|
||||
> li::before,
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active)))
|
||||
#menu
|
||||
> ul
|
||||
ul:has(li.hasChildren:is(.active, .bsplus-active))
|
||||
> li::before,
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active)))
|
||||
#menu
|
||||
> ul:has(li.hasChildren:is(.active, .bsplus-active))
|
||||
> li
|
||||
> label,
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active)))
|
||||
#menu
|
||||
> ul:has(li.hasChildren:is(.active, .bsplus-active))
|
||||
> li
|
||||
> svg,
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active)))
|
||||
#menu
|
||||
> ul
|
||||
ul:has(li.hasChildren:is(.active, .bsplus-active))
|
||||
> li
|
||||
> label,
|
||||
body.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active)))
|
||||
#menu
|
||||
> ul
|
||||
ul:has(li.hasChildren:is(.active, .bsplus-active))
|
||||
> li
|
||||
> svg {
|
||||
transform: translateX(-70px);
|
||||
}
|
||||
|
||||
body.icon-only-sidebar #menu {
|
||||
--bsplus-slide-off: -70px;
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/* Sidebar on the right edge — layout, drill direction, and mirrored accents. */
|
||||
|
||||
body.bsplus-sidebar-right {
|
||||
#menu {
|
||||
left: auto !important;
|
||||
right: 0 !important;
|
||||
width: var(--bsplus-sidebar-width, 270px) !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
#content {
|
||||
left: 0 !important;
|
||||
right: var(--bsplus-sidebar-width, 270px) !important;
|
||||
transition:
|
||||
right 0.4s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
left 0.4s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
transform 0.4s ease !important;
|
||||
}
|
||||
|
||||
/* Sub panels open to the left of the menu — anchor to menu edge, not viewport. */
|
||||
#menu .sub {
|
||||
left: auto !important;
|
||||
right: 100% !important;
|
||||
width: var(--bsplus-sidebar-width, 270px) !important;
|
||||
}
|
||||
|
||||
/* Title bar spans the full viewport; only page content respects sidebar inset. */
|
||||
#container #content #title,
|
||||
#title {
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
width: 100% !important;
|
||||
max-width: none !important;
|
||||
}
|
||||
|
||||
&.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active))) {
|
||||
#menu {
|
||||
width: 70px !important;
|
||||
}
|
||||
|
||||
#content {
|
||||
right: 70px !important;
|
||||
}
|
||||
|
||||
#menu .sub {
|
||||
right: 100% !important;
|
||||
width: var(--bsplus-sidebar-width, 270px) !important;
|
||||
}
|
||||
}
|
||||
|
||||
&:has(#menu.bsplus-styled-sidebar) #container #content #title,
|
||||
&.menuShown:has(#menu.bsplus-styled-sidebar) #container #content #title {
|
||||
box-shadow: -6px 0 8px -4px rgb(0 0 0 / 0.25) !important;
|
||||
}
|
||||
|
||||
#menu.bsplus-styled-sidebar {
|
||||
&.bsplus-sidebar-indicator-bar:not(.bsplus-sidebar-style-strip) {
|
||||
> ul > li.item.active:not(.hasChildren)::after,
|
||||
.sub li.item.active:not(.hasChildren)::after {
|
||||
left: auto !important;
|
||||
right: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.bsplus-sidebar-style-strip {
|
||||
> ul > li.item.active:not(.hasChildren)::after,
|
||||
.sub li.item.active:not(.hasChildren)::after {
|
||||
left: auto !important;
|
||||
right: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#menu li:is(.active, .hasChildren.bsplus-active) > .sub > ul > .item:not(.hasChildren)::before {
|
||||
left: auto !important;
|
||||
right: 0 !important;
|
||||
border-radius: 0 8px 8px 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
body.bsplus-sidebar-right {
|
||||
#menu {
|
||||
left: auto !important;
|
||||
right: 0 !important;
|
||||
transform: translateX(var(--bsplus-sidebar-width, 270px)) !important;
|
||||
}
|
||||
|
||||
&.menuShown #menu {
|
||||
transform: translateX(0) !important;
|
||||
}
|
||||
|
||||
#content {
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
}
|
||||
|
||||
&.menuShown #content {
|
||||
transform: translateX(calc(-1 * var(--bsplus-sidebar-width, 270px))) !important;
|
||||
}
|
||||
|
||||
&.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active))) {
|
||||
#menu {
|
||||
transform: translateX(70px) !important;
|
||||
}
|
||||
|
||||
&.menuShown #content {
|
||||
transform: translateX(-70px) !important;
|
||||
}
|
||||
}
|
||||
|
||||
#menuToggle {
|
||||
left: auto !important;
|
||||
right: 8px !important;
|
||||
}
|
||||
|
||||
#container #content #title,
|
||||
#title {
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
/* Counter `#content` slide so the fixed title stays viewport-wide. */
|
||||
&.menuShown #container #content #title {
|
||||
transform: translateX(var(--bsplus-sidebar-width, 270px)) !important;
|
||||
}
|
||||
|
||||
&.icon-only-sidebar.menuShown #container #content #title {
|
||||
transform: translateX(70px) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Custom sidebar style presets + Look (density / radius / indicator). */
|
||||
/* Native sidebar style presets + Look (density / radius / indicator). */
|
||||
|
||||
$sidebar-motion: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
|
||||
@@ -18,25 +18,36 @@ $sidebar-motion: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
#menu.bsplus-custom-sidebar {
|
||||
$item: "> #bsplus-sidebar-root > li.item:not(.bsplus-sidebar-edit-header):not(.bsplus-sidebar-edit-actions)";
|
||||
$label: "> #bsplus-sidebar-root > li.item > label:not(.toggle)";
|
||||
$active: "> #bsplus-sidebar-root > li.item.active:not(.hasChildren)";
|
||||
#menu.bsplus-styled-sidebar {
|
||||
$rootItem: "> ul > li.item";
|
||||
$subItem: ".sub li.item";
|
||||
$item: "#{$rootItem}, #{$subItem}";
|
||||
$rootLabel: "> ul > li.item > label:not(.toggle)";
|
||||
$subLabel: ".sub li.item > label:not(.toggle)";
|
||||
$label: "#{$rootLabel}, #{$subLabel}";
|
||||
$active: "> ul > li.item.active:not(.hasChildren), .sub li.item.active:not(.hasChildren)";
|
||||
|
||||
/* Look: base radius (pill / sharp / strip override).
|
||||
Density/radius animate with the same easing as sidebar width. */
|
||||
#{$item} {
|
||||
/* Look: base radius — layout transitions only on root rows (settings tweaks).
|
||||
Submenu rows must not animate margin/padding during folder drill slides. */
|
||||
#{$rootItem} {
|
||||
border-radius: var(--bsplus-sidebar-radius, 12px) !important;
|
||||
transition:
|
||||
padding $sidebar-motion,
|
||||
margin $sidebar-motion,
|
||||
border-radius $sidebar-motion,
|
||||
background-color 0.2s ease,
|
||||
box-shadow 0.2s ease,
|
||||
opacity 0.2s ease;
|
||||
box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
#{$label} {
|
||||
#{$subItem} {
|
||||
border-radius: var(--bsplus-sidebar-radius, 12px) !important;
|
||||
transition:
|
||||
background-color 0.2s ease,
|
||||
box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
#{$rootLabel} {
|
||||
min-height: 28px !important;
|
||||
transition:
|
||||
font-size $sidebar-motion,
|
||||
line-height $sidebar-motion,
|
||||
@@ -51,6 +62,11 @@ $sidebar-motion: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
#{$subLabel} {
|
||||
min-height: 28px !important;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
/* —— Style presets —— */
|
||||
&.bsplus-sidebar-style-soft {
|
||||
#{$item} {
|
||||
@@ -74,13 +90,23 @@ $sidebar-motion: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
&.bsplus-sidebar-style-glass {
|
||||
#{$item} {
|
||||
/* Never put backdrop-filter on an open folder — it becomes a clip
|
||||
containing-block and hides `.sub` labels on Chromium/Edge. */
|
||||
#{$item}:not(:has(> .sub)) {
|
||||
margin: 0 8px 8px !important;
|
||||
background: rgba(255, 255, 255, 0.1) !important;
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
|
||||
}
|
||||
#{$item}:has(> .sub) {
|
||||
background: transparent !important;
|
||||
backdrop-filter: none !important;
|
||||
-webkit-backdrop-filter: none !important;
|
||||
box-shadow: none !important;
|
||||
overflow: visible !important;
|
||||
contain: none !important;
|
||||
}
|
||||
#{$active} {
|
||||
background: rgba(255, 255, 255, 0.2) !important;
|
||||
box-shadow:
|
||||
@@ -147,7 +173,7 @@ $sidebar-motion: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
margin: 0 !important;
|
||||
font-size: 13px !important;
|
||||
line-height: 1.2 !important;
|
||||
min-height: 0 !important;
|
||||
min-height: 20px !important;
|
||||
height: auto !important;
|
||||
white-space: nowrap !important;
|
||||
|
||||
@@ -169,6 +195,7 @@ $sidebar-motion: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
padding: 0 !important;
|
||||
font-size: 17px !important;
|
||||
line-height: 1.25 !important;
|
||||
min-height: 30px !important;
|
||||
|
||||
> svg {
|
||||
width: 30px !important;
|
||||
|
||||
@@ -39,8 +39,6 @@ html.transparencyEffects {
|
||||
[class*="LabelList__selected___"],
|
||||
.buttonChecklist,
|
||||
.pane,
|
||||
.legacy-root button,
|
||||
.legacy-root a,
|
||||
[class*="MessageList__MessageList___"] {
|
||||
backdrop-filter: blur(80px);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { fade, scale } from "svelte/transition";
|
||||
import { onMount, tick } from "svelte";
|
||||
import { onMount } from "svelte";
|
||||
import Switch from "./Switch.svelte";
|
||||
import {
|
||||
FEEDBACK_CATEGORIES,
|
||||
@@ -66,6 +66,11 @@
|
||||
const btnPrimary = $derived(
|
||||
`${btn} ${isDark ? "bg-zinc-200 text-zinc-900" : "bg-zinc-800 text-white"}`,
|
||||
);
|
||||
|
||||
function isStatusDetailKey(key: string): boolean {
|
||||
return key.startsWith("status-") && key !== "status-list";
|
||||
}
|
||||
|
||||
const panelKey = $derived(
|
||||
tab === "send"
|
||||
? successId
|
||||
@@ -76,54 +81,6 @@
|
||||
: "status-list",
|
||||
);
|
||||
|
||||
let panelBodyEl = $state<HTMLDivElement | null>(null);
|
||||
let panelHeightPx = $state<number | null>(null);
|
||||
|
||||
const panelHeightEase = "cubic-bezier(0.22, 1, 0.36, 1)";
|
||||
const panelHeightMotion = $derived(
|
||||
$settingsState.animations && panelHeightPx !== null
|
||||
? `height 280ms ${panelHeightEase}`
|
||||
: "none",
|
||||
);
|
||||
|
||||
function measurePanelHeight() {
|
||||
if (!panelBodyEl) return;
|
||||
panelHeightPx = panelBodyEl.scrollHeight;
|
||||
}
|
||||
|
||||
function panelMeasure(node: HTMLDivElement) {
|
||||
panelBodyEl = node;
|
||||
|
||||
const update = () => {
|
||||
panelHeightPx = node.scrollHeight;
|
||||
};
|
||||
|
||||
update();
|
||||
const ro = new ResizeObserver(() => update());
|
||||
ro.observe(node);
|
||||
|
||||
return {
|
||||
destroy() {
|
||||
ro.disconnect();
|
||||
if (panelBodyEl === node) panelBodyEl = null;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
panelKey;
|
||||
includeContact;
|
||||
errorMessage;
|
||||
statusLoading;
|
||||
statusItems.length;
|
||||
selectedItem;
|
||||
void tick().then(() => measurePanelHeight());
|
||||
});
|
||||
|
||||
function isStatusDetailKey(key: string): boolean {
|
||||
return key.startsWith("status-") && key !== "status-list";
|
||||
}
|
||||
|
||||
function errText(e: unknown): string {
|
||||
if (e instanceof FeedbackApiError) return e.message;
|
||||
return e instanceof Error ? e.message : "Something went wrong.";
|
||||
@@ -170,10 +127,24 @@
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
void tick().then(() => measurePanelHeight());
|
||||
const host = document.getElementById("ExtensionPopup");
|
||||
host?.classList.add("bsplus-feedback-open");
|
||||
// Remove leaked global styles from earlier builds that portaled to body.
|
||||
document.getElementById("betterseqta-feedback-modal-styles")?.remove();
|
||||
|
||||
const handleEscapeKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape" && !busy) onClose();
|
||||
};
|
||||
document.addEventListener("keydown", handleEscapeKey);
|
||||
|
||||
if (typeof initialFeedbackId === "string" && initialFeedbackId) {
|
||||
void openStatusItem(initialFeedbackId);
|
||||
}
|
||||
|
||||
return () => {
|
||||
host?.classList.remove("bsplus-feedback-open");
|
||||
document.removeEventListener("keydown", handleEscapeKey);
|
||||
};
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
@@ -200,236 +171,350 @@
|
||||
submitting = false;
|
||||
}
|
||||
}
|
||||
|
||||
function tabClass(active: boolean): string {
|
||||
if (active) {
|
||||
return isDark
|
||||
? "bg-zinc-700 text-white font-semibold shadow-sm"
|
||||
: "bg-white text-zinc-900 font-semibold shadow-sm";
|
||||
}
|
||||
return isDark
|
||||
? "bg-transparent text-zinc-400 hover:text-zinc-200"
|
||||
: "bg-transparent text-zinc-500 hover:text-zinc-800";
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Backdrop click target — separate from dialog so inner clicks never bubble to a "close" handler. -->
|
||||
<div
|
||||
class="flex fixed inset-0 z-[99999] justify-center items-center bg-black/50 backdrop-blur-sm {isDark
|
||||
class="feedback-overlay fixed inset-0 z-[99999] overflow-y-auto overscroll-contain {isDark
|
||||
? 'dark'
|
||||
: ''}"
|
||||
onclick={(e) => {
|
||||
if (e.target === e.currentTarget && !busy) onClose();
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === "Escape" && !busy) onClose();
|
||||
}}
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
transition:fade={{ duration: $settingsState.animations ? 200 : 0 }}
|
||||
>
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="feedback-dialog p-5 mx-4 w-full max-w-lg max-h-[90vh] overflow-y-auto rounded-2xl shadow-2xl border text-[18px] {isDark
|
||||
? 'bg-zinc-800 text-white border-zinc-700'
|
||||
: 'bg-white text-zinc-900 border-zinc-200'}"
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
onkeydown={(e) => e.stopPropagation()}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="feedback-modal-title"
|
||||
tabindex="-1"
|
||||
in:scale={{
|
||||
duration: $settingsState.animations ? 280 : 0,
|
||||
start: 0.92,
|
||||
opacity: 0,
|
||||
easing: (t) => 1 - Math.pow(1 - t, 3),
|
||||
<button
|
||||
type="button"
|
||||
class="feedback-overlay__backdrop fixed inset-0 bg-black/50 backdrop-blur-sm border-0 p-0 cursor-default"
|
||||
aria-label="Close feedback"
|
||||
disabled={busy}
|
||||
onclick={() => {
|
||||
if (!busy) onClose();
|
||||
}}
|
||||
></button>
|
||||
|
||||
<div
|
||||
class="feedback-overlay__center relative z-[1] flex min-h-full items-center justify-center p-4 sm:p-6 pointer-events-none"
|
||||
>
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="flex gap-1 p-1 mb-4 rounded-full {isDark ? 'bg-zinc-900' : 'bg-zinc-100'}"
|
||||
role="tablist"
|
||||
aria-label="Feedback views"
|
||||
class="feedback-dialog pointer-events-auto w-full max-w-lg max-h-[min(90dvh,100%)] rounded-2xl shadow-2xl border text-[18px] {isDark
|
||||
? 'bg-zinc-800 text-white border-zinc-700'
|
||||
: 'bg-white text-zinc-900 border-zinc-200'}"
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
onkeydown={(e) => e.stopPropagation()}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="feedback-modal-title"
|
||||
tabindex="-1"
|
||||
in:scale={{
|
||||
duration: $settingsState.animations ? 280 : 0,
|
||||
start: 0.92,
|
||||
opacity: 0,
|
||||
easing: (t) => 1 - Math.pow(1 - t, 3),
|
||||
}}
|
||||
>
|
||||
<button type="button" role="tab" aria-selected={tab === "send"} onclick={() => selectTab("send")} class="flex-1 px-3 py-2.5 rounded-full transition-all duration-200 {tabClass(tab === 'send')}">
|
||||
Send
|
||||
</button>
|
||||
<button type="button" role="tab" aria-selected={tab === "status"} onclick={() => selectTab("status")} class="flex-1 px-3 py-2.5 rounded-full transition-all duration-200 {tabClass(tab === 'status')}">
|
||||
My feedback
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="feedback-tabs shrink-0 flex gap-1 p-1 m-5 mb-0 rounded-full {isDark
|
||||
? 'bg-zinc-900'
|
||||
: 'bg-zinc-100'}"
|
||||
role="tablist"
|
||||
aria-label="Feedback views"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tab === "send"}
|
||||
onclick={() => selectTab("send")}
|
||||
class="feedback-tab flex-1 px-3 py-2.5 rounded-full text-[18px] font-medium transition-all duration-200 {tab ===
|
||||
'send'
|
||||
? isDark
|
||||
? 'bg-zinc-700 text-white font-semibold shadow-sm'
|
||||
: 'bg-white text-zinc-900 font-semibold shadow-sm'
|
||||
: isDark
|
||||
? 'bg-transparent text-zinc-400 hover:text-zinc-200'
|
||||
: 'bg-transparent text-zinc-500 hover:text-zinc-800'}"
|
||||
>
|
||||
Send
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tab === "status"}
|
||||
onclick={() => selectTab("status")}
|
||||
class="feedback-tab flex-1 px-3 py-2.5 rounded-full text-[18px] font-medium transition-all duration-200 {tab ===
|
||||
'status'
|
||||
? isDark
|
||||
? 'bg-zinc-700 text-white font-semibold shadow-sm'
|
||||
: 'bg-white text-zinc-900 font-semibold shadow-sm'
|
||||
: isDark
|
||||
? 'bg-transparent text-zinc-400 hover:text-zinc-200'
|
||||
: 'bg-transparent text-zinc-500 hover:text-zinc-800'}"
|
||||
>
|
||||
My feedback
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="feedback-panel"
|
||||
style:height={panelHeightPx === null ? "auto" : `${panelHeightPx}px`}
|
||||
style:transition={panelHeightMotion}
|
||||
>
|
||||
<div class="feedback-panel__body" use:panelMeasure>
|
||||
{#if panelKey === "send-success" && successId}
|
||||
<h2 id="feedback-modal-title" class="mb-3 text-xl font-bold">Thanks for the feedback</h2>
|
||||
<p class="mb-2 text-zinc-600 dark:text-zinc-300">Reference ID:</p>
|
||||
<p class="mb-4 px-3 py-2 font-mono text-base rounded-lg {isDark ? 'bg-zinc-900' : 'bg-zinc-100'} break-all">{successId}</p>
|
||||
<div class="flex gap-3 justify-end">
|
||||
<button type="button" class={btnMuted} onclick={() => successId && openStatusItem(successId)}>Check status</button>
|
||||
<button type="button" class={btnPrimary} onclick={onClose}>Done</button>
|
||||
</div>
|
||||
{:else if panelKey === "send-form"}
|
||||
<h2 id="feedback-modal-title" class="mb-1 text-xl font-bold">Send feedback</h2>
|
||||
<p class="mb-4 text-zinc-600 dark:text-zinc-400">Anonymous by default. Contact and school details are optional.</p>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<label class="flex flex-col gap-1.5 font-medium">
|
||||
Category
|
||||
<select id="feedback-category" bind:value={category} class={field} style={fieldStyle}>
|
||||
{#each FEEDBACK_CATEGORIES as value (value)}
|
||||
<option {value} style={fieldStyle}>{categoryLabel(value)}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label class="flex flex-col gap-1.5 font-medium">
|
||||
Subject <span class="font-normal text-zinc-500">(optional)</span>
|
||||
<input type="text" maxlength={120} bind:value={subject} placeholder="Short summary" class={field} style={fieldStyle} />
|
||||
</label>
|
||||
|
||||
<label class="flex flex-col gap-1.5 font-medium">
|
||||
Message
|
||||
<textarea rows={5} maxlength={FEEDBACK_MESSAGE_MAX} bind:value={message} placeholder="What happened, or what would you like to see?" class="{field} resize-y min-h-[120px]" style={fieldStyle}></textarea>
|
||||
<span class="text-base font-normal text-zinc-500">{message.trim().length}/{FEEDBACK_MESSAGE_MAX} (min {FEEDBACK_MESSAGE_MIN})</span>
|
||||
</label>
|
||||
|
||||
<div class="flex justify-between items-center gap-3">
|
||||
<div>
|
||||
<p class="font-medium">Include contact details</p>
|
||||
<p class="text-base text-zinc-500">Name and email so we can reply</p>
|
||||
</div>
|
||||
<Switch state={includeContact} onChange={(v) => (includeContact = v)} />
|
||||
<div class="feedback-panel__body overflow-y-auto overscroll-contain px-5 pb-5 pt-4">
|
||||
{#if panelKey === "send-success" && successId}
|
||||
<h2 id="feedback-modal-title" class="mb-3 text-xl font-bold">Thanks for the feedback</h2>
|
||||
<p class="mb-2 text-zinc-600 dark:text-zinc-300">Reference ID:</p>
|
||||
<p
|
||||
class="mb-4 px-3 py-2 font-mono text-base rounded-lg {isDark
|
||||
? 'bg-zinc-900'
|
||||
: 'bg-zinc-100'} break-all"
|
||||
>
|
||||
{successId}
|
||||
</p>
|
||||
<div class="flex gap-3 justify-end">
|
||||
<button
|
||||
type="button"
|
||||
class={btnMuted}
|
||||
onclick={() => successId && openStatusItem(successId)}>Check status</button
|
||||
>
|
||||
<button type="button" class={btnPrimary} onclick={onClose}>Done</button>
|
||||
</div>
|
||||
{#if includeContact}
|
||||
<input type="text" maxlength={80} bind:value={contactName} placeholder="Name" class={field} style={fieldStyle} />
|
||||
<input type="email" maxlength={254} bind:value={contactEmail} placeholder="Email" class={field} style={fieldStyle} />
|
||||
{/if}
|
||||
|
||||
<div class="flex justify-between items-center gap-3">
|
||||
<div>
|
||||
<p class="font-medium">Include SEQTA instance</p>
|
||||
<p class="text-base text-zinc-500">
|
||||
{#if instanceHostname}
|
||||
Hostname only: <span class="font-mono">{instanceHostname}</span>
|
||||
{:else}
|
||||
Open SEQTA first to detect hostname
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
state={includeInstance && !!instanceHostname}
|
||||
onChange={(v) => {
|
||||
if (instanceHostname) includeInstance = v;
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{#if errorMessage}
|
||||
<p class="text-red-600 dark:text-red-400" role="alert">{errorMessage}</p>
|
||||
{/if}
|
||||
|
||||
<p class="text-base text-zinc-500">
|
||||
Sent to betterseqta.org.
|
||||
<a href="https://betterseqta.org/privacy" target="_blank" rel="noopener noreferrer" class="underline">Privacy</a>
|
||||
{:else if panelKey === "send-form"}
|
||||
<h2 id="feedback-modal-title" class="mb-1 text-xl font-bold">Send feedback</h2>
|
||||
<p class="mb-4 text-zinc-600 dark:text-zinc-400">
|
||||
Anonymous by default. Contact and school details are optional.
|
||||
</p>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<label class="flex flex-col gap-1.5 font-medium">
|
||||
Category
|
||||
<select id="feedback-category" bind:value={category} class={field} style={fieldStyle}>
|
||||
{#each FEEDBACK_CATEGORIES as value (value)}
|
||||
<option {value} style={fieldStyle}>{categoryLabel(value)}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label class="flex flex-col gap-1.5 font-medium">
|
||||
Subject <span class="font-normal text-zinc-500">(optional)</span>
|
||||
<input
|
||||
type="text"
|
||||
maxlength={120}
|
||||
bind:value={subject}
|
||||
placeholder="Short summary"
|
||||
class={field}
|
||||
style={fieldStyle}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="flex flex-col gap-1.5 font-medium">
|
||||
Message
|
||||
<textarea
|
||||
rows={5}
|
||||
maxlength={FEEDBACK_MESSAGE_MAX}
|
||||
bind:value={message}
|
||||
placeholder="What happened, or what would you like to see?"
|
||||
class="{field} resize-y min-h-[120px]"
|
||||
style={fieldStyle}
|
||||
></textarea>
|
||||
<span class="text-base font-normal text-zinc-500"
|
||||
>{message.trim().length}/{FEEDBACK_MESSAGE_MAX} (min {FEEDBACK_MESSAGE_MIN})</span
|
||||
>
|
||||
</label>
|
||||
|
||||
<div class="flex justify-between items-center gap-3">
|
||||
<div>
|
||||
<p class="font-medium">Include contact details</p>
|
||||
<p class="text-base text-zinc-500">Name and email so we can reply</p>
|
||||
</div>
|
||||
<Switch state={includeContact} onChange={(v) => (includeContact = v)} />
|
||||
</div>
|
||||
{#if includeContact}
|
||||
<input
|
||||
type="text"
|
||||
maxlength={80}
|
||||
bind:value={contactName}
|
||||
placeholder="Name"
|
||||
class={field}
|
||||
style={fieldStyle}
|
||||
/>
|
||||
<input
|
||||
type="email"
|
||||
maxlength={254}
|
||||
bind:value={contactEmail}
|
||||
placeholder="Email"
|
||||
class={field}
|
||||
style={fieldStyle}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<div class="flex justify-between items-center gap-3">
|
||||
<div>
|
||||
<p class="font-medium">Include SEQTA instance</p>
|
||||
<p class="text-base text-zinc-500">
|
||||
{#if instanceHostname}
|
||||
Hostname only: <span class="font-mono">{instanceHostname}</span>
|
||||
{:else}
|
||||
Open SEQTA first to detect hostname
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
state={includeInstance && !!instanceHostname}
|
||||
onChange={(v) => {
|
||||
if (instanceHostname) includeInstance = v;
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{#if errorMessage}
|
||||
<p class="text-red-600 dark:text-red-400" role="alert">{errorMessage}</p>
|
||||
{/if}
|
||||
|
||||
<p class="text-base text-zinc-500">
|
||||
Sent to betterseqta.org.
|
||||
<a
|
||||
href="https://betterseqta.org/privacy"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="underline">Privacy</a
|
||||
>
|
||||
</p>
|
||||
|
||||
<div class="flex gap-3 justify-end">
|
||||
<button type="button" class={btnMuted} onclick={onClose} disabled={submitting}
|
||||
>Cancel</button
|
||||
>
|
||||
<button type="button" class={btnPrimary} onclick={handleSubmit} disabled={submitting}>
|
||||
{submitting ? "Sending…" : "Send feedback"}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{:else if isStatusDetailKey(panelKey) && selectedItem}
|
||||
<div class="flex items-start justify-between gap-3 mb-3">
|
||||
<h2 id="feedback-modal-title" class="text-xl font-bold">Feedback status</h2>
|
||||
<button
|
||||
type="button"
|
||||
class="{btnMuted} !text-base !px-3 !py-1.5"
|
||||
onclick={() => {
|
||||
selectedItem = null;
|
||||
void loadStatusList();
|
||||
}}>Back</button
|
||||
>
|
||||
</div>
|
||||
<p class="mb-1 font-medium">
|
||||
{selectedItem.subject || "Untitled"} · {formatStatus(selectedItem.status)}
|
||||
</p>
|
||||
<p class="mb-4 font-mono text-base text-zinc-500 break-all">{selectedItem.id}</p>
|
||||
{#if hasReply(selectedItem)}
|
||||
<div
|
||||
class="p-3 mb-4 rounded-lg border {isDark
|
||||
? 'border-zinc-700 bg-zinc-900/50'
|
||||
: 'border-zinc-200 bg-zinc-50'}"
|
||||
>
|
||||
<p class="mb-1 text-base font-semibold uppercase tracking-wide text-zinc-500">
|
||||
Response
|
||||
</p>
|
||||
<p class="whitespace-pre-wrap">{selectedItem.response}</p>
|
||||
</div>
|
||||
{:else}
|
||||
<p class="mb-4 text-zinc-500">No response yet.</p>
|
||||
{/if}
|
||||
{#if statusError}<p class="mb-3 text-red-600 dark:text-red-400" role="alert">{statusError}</p
|
||||
>{/if}
|
||||
<div class="flex gap-3 justify-end">
|
||||
<button type="button" class={btnMuted} onclick={onClose} disabled={submitting}>Cancel</button>
|
||||
<button type="button" class={btnPrimary} onclick={handleSubmit} disabled={submitting}>
|
||||
{submitting ? "Sending…" : "Send feedback"}
|
||||
<button
|
||||
type="button"
|
||||
class={btnMuted}
|
||||
onclick={() => openStatusItem(selectedItem!.id)}
|
||||
disabled={statusLoading}
|
||||
>
|
||||
{statusLoading ? "Refreshing…" : "Refresh"}
|
||||
</button>
|
||||
<button type="button" class={btnPrimary} onclick={onClose}>Close</button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex items-start justify-between gap-3 mb-3">
|
||||
<h2 id="feedback-modal-title" class="text-xl font-bold">My feedback</h2>
|
||||
<button
|
||||
type="button"
|
||||
class="{btnMuted} !text-base !px-3 !py-1.5"
|
||||
onclick={() => void loadStatusList()}
|
||||
disabled={statusLoading}
|
||||
>
|
||||
{statusLoading ? "…" : "Refresh"}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{:else if isStatusDetailKey(panelKey) && selectedItem}
|
||||
<div class="flex items-start justify-between gap-3 mb-3">
|
||||
<h2 id="feedback-modal-title" class="text-xl font-bold">Feedback status</h2>
|
||||
<button type="button" class="{btnMuted} !text-base !px-3 !py-1.5" onclick={() => { selectedItem = null; void loadStatusList(); }}>Back</button>
|
||||
</div>
|
||||
<p class="mb-1 font-medium">{selectedItem.subject || "Untitled"} · {formatStatus(selectedItem.status)}</p>
|
||||
<p class="mb-4 font-mono text-base text-zinc-500 break-all">{selectedItem.id}</p>
|
||||
{#if hasReply(selectedItem)}
|
||||
<div class="p-3 mb-4 rounded-lg border {isDark ? 'border-zinc-700 bg-zinc-900/50' : 'border-zinc-200 bg-zinc-50'}">
|
||||
<p class="mb-1 text-base font-semibold uppercase tracking-wide text-zinc-500">Response</p>
|
||||
<p class="whitespace-pre-wrap">{selectedItem.response}</p>
|
||||
</div>
|
||||
{:else}
|
||||
<p class="mb-4 text-zinc-500">No response yet.</p>
|
||||
{/if}
|
||||
{#if statusError}<p class="mb-3 text-red-600 dark:text-red-400" role="alert">{statusError}</p>{/if}
|
||||
<div class="flex gap-3 justify-end">
|
||||
<button type="button" class={btnMuted} onclick={() => openStatusItem(selectedItem!.id)} disabled={statusLoading}>
|
||||
{statusLoading ? "Refreshing…" : "Refresh"}
|
||||
</button>
|
||||
<button type="button" class={btnPrimary} onclick={onClose}>Close</button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex items-start justify-between gap-3 mb-3">
|
||||
<h2 id="feedback-modal-title" class="text-xl font-bold">My feedback</h2>
|
||||
<button type="button" class="{btnMuted} !text-base !px-3 !py-1.5" onclick={() => void loadStatusList()} disabled={statusLoading}>
|
||||
{statusLoading ? "…" : "Refresh"}
|
||||
</button>
|
||||
</div>
|
||||
{#if statusError}<p class="mb-3 text-red-600 dark:text-red-400" role="alert">{statusError}</p>{/if}
|
||||
{#if statusLoading && !statusItems.length}
|
||||
<div class="feedback-loading" aria-busy="true" aria-live="polite">
|
||||
<Spinner size="md" />
|
||||
<p class="text-zinc-500">Checking your feedback…</p>
|
||||
<div class="feedback-loading__skeleton" aria-hidden="true">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
{#if statusError}<p class="mb-3 text-red-600 dark:text-red-400" role="alert">{statusError}</p
|
||||
>{/if}
|
||||
{#if statusLoading && !statusItems.length}
|
||||
<div class="feedback-loading" aria-busy="true" aria-live="polite">
|
||||
<Spinner size="md" />
|
||||
<p class="text-zinc-500">Checking your feedback…</p>
|
||||
<div class="feedback-loading__skeleton" aria-hidden="true">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
{:else if !statusItems.length}
|
||||
<p class="mb-4 text-zinc-500">No feedback yet.</p>
|
||||
<button type="button" class={btnPrimary} onclick={() => selectTab("send")}
|
||||
>Send feedback</button
|
||||
>
|
||||
{:else}
|
||||
<ul class="flex flex-col gap-2 mb-4">
|
||||
{#each statusItems as item (item.id)}
|
||||
<li>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => openStatusItem(item.id)}
|
||||
class="w-full p-3 text-left rounded-lg border transition-all duration-200 hover:scale-[1.01] focus:outline-none focus:ring-2 focus:ring-zinc-400 {isDark
|
||||
? 'border-zinc-700 bg-zinc-900/40'
|
||||
: 'border-zinc-200 bg-white'}"
|
||||
>
|
||||
<p class="text-base text-zinc-500 mb-0.5">
|
||||
{formatStatus(item.status)}{#if hasReply(item)} · Reply{/if} · {categoryLabel(
|
||||
item.category,
|
||||
)}
|
||||
</p>
|
||||
<p class="font-medium truncate">{item.subject || "Untitled"}</p>
|
||||
</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
<div class="flex justify-end">
|
||||
<button type="button" class={btnMuted} onclick={onClose}>Close</button>
|
||||
</div>
|
||||
</div>
|
||||
{:else if !statusItems.length}
|
||||
<p class="mb-4 text-zinc-500">No feedback yet.</p>
|
||||
<button type="button" class={btnPrimary} onclick={() => selectTab("send")}>Send feedback</button>
|
||||
{:else}
|
||||
<ul class="flex flex-col gap-2 mb-4">
|
||||
{#each statusItems as item (item.id)}
|
||||
<li>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => openStatusItem(item.id)}
|
||||
class="w-full p-3 text-left rounded-lg border transition-all duration-200 hover:scale-[1.01] focus:outline-none focus:ring-2 focus:ring-zinc-400 {isDark
|
||||
? 'border-zinc-700 bg-zinc-900/40'
|
||||
: 'border-zinc-200 bg-white'}"
|
||||
>
|
||||
<p class="text-base text-zinc-500 mb-0.5">
|
||||
{formatStatus(item.status)}{#if hasReply(item)} · Reply{/if} · {categoryLabel(item.category)}
|
||||
</p>
|
||||
<p class="font-medium truncate">{item.subject || "Untitled"}</p>
|
||||
</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
<div class="flex justify-end">
|
||||
<button type="button" class={btnMuted} onclick={onClose}>Close</button>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.feedback-overlay {
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.feedback-overlay__backdrop:disabled {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.feedback-dialog {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.feedback-panel {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.feedback-panel__body {
|
||||
width: 100%;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.feedback-tabs {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.feedback-tab {
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.feedback-loading {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<script lang="ts">
|
||||
import type { Component } from "svelte";
|
||||
|
||||
let {
|
||||
loader,
|
||||
props = {},
|
||||
remountKey = "default",
|
||||
}: {
|
||||
loader: () => Promise<{ default: Component }>;
|
||||
props?: Record<string, unknown>;
|
||||
/** Change to force a fresh import (e.g. different panel). Props-only updates reuse the component. */
|
||||
remountKey?: string;
|
||||
} = $props();
|
||||
|
||||
let Comp = $state<Component | null>(null);
|
||||
let loadedKey = $state("");
|
||||
|
||||
$effect(() => {
|
||||
const key = remountKey;
|
||||
if (key === loadedKey && Comp) return;
|
||||
|
||||
loadedKey = key;
|
||||
Comp = null;
|
||||
void loader().then((mod) => {
|
||||
if (loadedKey === key) Comp = mod.default;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if Comp}
|
||||
<Comp {...props} />
|
||||
{:else}
|
||||
<div class="px-2 py-8 text-sm text-zinc-400 animate-pulse">Loading…</div>
|
||||
{/if}
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import { animate as motionAnimate } from 'motion';
|
||||
import { fullMotionEffectsEnabled } from '@/seqta/utils/performanceMode';
|
||||
|
||||
let { initial, animate, exit, transition, children, class: className } = $props<{
|
||||
initial?: any,
|
||||
@@ -13,8 +14,27 @@
|
||||
|
||||
let divElement: HTMLElement;
|
||||
|
||||
const applyCssKeyframe = (keyframe: Record<string, unknown>) => {
|
||||
if (!divElement || !keyframe) return;
|
||||
if (keyframe.x != null) {
|
||||
divElement.style.transition =
|
||||
'transform var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1))';
|
||||
const x = keyframe.x;
|
||||
divElement.style.transform =
|
||||
typeof x === 'number' ? `translateX(${x}px)` : `translateX(${String(x)})`;
|
||||
}
|
||||
if (typeof keyframe.opacity === 'number') {
|
||||
divElement.style.opacity = String(keyframe.opacity);
|
||||
}
|
||||
};
|
||||
|
||||
const playAnimation = (keyframe: any) => {
|
||||
if (divElement && keyframe) {
|
||||
if (!fullMotionEffectsEnabled()) {
|
||||
applyCssKeyframe(keyframe);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
let finalKeyframe = { ...keyframe };
|
||||
|
||||
if (finalKeyframe.height === 'auto') {
|
||||
@@ -72,7 +92,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class={className} bind:this={divElement} style="will-change: transform, opacity;">
|
||||
<div class={className} bind:this={divElement} style={fullMotionEffectsEnabled() ? 'will-change: transform, opacity;' : undefined}>
|
||||
{#if children}
|
||||
{@render children()}
|
||||
{/if}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
normalizeSidebarRadius,
|
||||
normalizeSidebarStyleId,
|
||||
normalizeSidebarWidth,
|
||||
normalizeSidebarPosition,
|
||||
SIDEBAR_STYLES,
|
||||
type SidebarStyleId,
|
||||
} from "@/seqta/ui/sidebar/sidebarStyles";
|
||||
@@ -36,6 +37,9 @@
|
||||
normalizeSidebarIndicator($settingsState.sidebarActiveIndicator),
|
||||
);
|
||||
const width = $derived(normalizeSidebarWidth($settingsState.sidebarWidth));
|
||||
const position = $derived(
|
||||
normalizeSidebarPosition($settingsState.sidebarPosition),
|
||||
);
|
||||
const radius = $derived(
|
||||
normalizeSidebarRadius(
|
||||
$settingsState.sidebarCornerRadius ?? DEFAULT_SIDEBAR_RADIUS,
|
||||
@@ -170,6 +174,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="copy">
|
||||
<h3 class="row-title">Sidebar Position</h3>
|
||||
<p class="row-desc">Which edge of the screen the navigation sits on</p>
|
||||
</div>
|
||||
<div class="control">
|
||||
<Select
|
||||
value={position}
|
||||
onChange={(value) => (settingsState.sidebarPosition = value)}
|
||||
options={[
|
||||
{ value: "left", label: "Left" },
|
||||
{ value: "right", label: "Right" },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="copy">
|
||||
<h3 class="row-title">Sidebar Width</h3>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { animationsEnabled } from "@/seqta/utils/performanceMode";
|
||||
import { rafThrottle } from "@/seqta/utils/rafThrottle";
|
||||
import SidebarNavItem from "./SidebarNavItem.svelte";
|
||||
|
||||
type NavGroup = {
|
||||
@@ -39,11 +40,13 @@
|
||||
indicatorReady = true;
|
||||
};
|
||||
|
||||
const scheduleIndicator = rafThrottle(updateIndicator);
|
||||
|
||||
$effect(() => {
|
||||
selectedId;
|
||||
groups;
|
||||
trackEl;
|
||||
queueMicrotask(updateIndicator);
|
||||
scheduleIndicator();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -54,8 +57,8 @@
|
||||
{#if indicatorReady}
|
||||
<div
|
||||
class="pointer-events-none absolute left-0 top-0 z-0 rounded-lg bg-zinc-200/90 dark:bg-zinc-700/90"
|
||||
style="transform: translate({indicatorX}px, {indicatorY}px); width: {indicatorW}px; height: {indicatorH}px; transition: {$settingsState.animations
|
||||
? 'transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), width 0.28s cubic-bezier(0.22, 1, 0.36, 1), height 0.28s cubic-bezier(0.22, 1, 0.36, 1)'
|
||||
style="transform: translate({indicatorX}px, {indicatorY}px); width: {indicatorW}px; height: {indicatorH}px; transition: {animationsEnabled()
|
||||
? 'transform var(--bs-motion-duration, 0.28s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)), width var(--bs-motion-duration, 0.28s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)), height var(--bs-motion-duration, 0.28s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1))'
|
||||
: 'none'};"
|
||||
></div>
|
||||
{/if}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { animate } from 'motion';
|
||||
import { standalone } from '../utils/standalone.svelte'
|
||||
import { standalone } from '../utils/standalone.svelte';
|
||||
import { fullMotionEffectsEnabled } from '@/seqta/utils/performanceMode';
|
||||
|
||||
let { state, onChange } = $props<{ state: boolean, onChange: (newState: boolean) => void }>();
|
||||
let handle: HTMLElement | null = null;
|
||||
@@ -10,13 +11,18 @@
|
||||
damping: 30,
|
||||
};
|
||||
|
||||
const knobX = $derived(state ? (standalone.standalone ? 24 : 20) : 0);
|
||||
|
||||
const animateSwitch = (enabled: boolean) => {
|
||||
if (!handle) return;
|
||||
const x = enabled ? (standalone.standalone ? 24 : 20) : 0;
|
||||
if (!fullMotionEffectsEnabled()) {
|
||||
handle.style.transform = `translateX(${x}px)`;
|
||||
return;
|
||||
}
|
||||
animate(
|
||||
handle,
|
||||
{
|
||||
x: enabled ? (standalone.standalone ? 24 : 20) : 0,
|
||||
},
|
||||
{ x },
|
||||
{
|
||||
type: 'spring',
|
||||
stiffness: springParams.stiffness,
|
||||
@@ -25,7 +31,6 @@
|
||||
);
|
||||
};
|
||||
|
||||
// Trigger animation whenever state changes
|
||||
$effect(() => animateSwitch(state));
|
||||
</script>
|
||||
|
||||
@@ -39,6 +44,7 @@
|
||||
>
|
||||
<div
|
||||
bind:this={handle}
|
||||
class="w-6 h-6 bg-white dark:bg-[#FEFEFE] rounded-full drop-shadow-md"
|
||||
class="w-6 h-6 bg-white dark:bg-[#FEFEFE] rounded-full drop-shadow-md transition-transform duration-200"
|
||||
style={fullMotionEffectsEnabled() ? undefined : `transform: translateX(${knobX}px)`}
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,39 +1,60 @@
|
||||
<script lang="ts">
|
||||
import MotionDiv from './MotionDiv.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import MotionDiv from "./MotionDiv.svelte";
|
||||
import LazyPanel from "./LazyPanel.svelte";
|
||||
import type { Component } from "svelte";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
let { tabs, activeTab = $bindable(0) } = $props<{ tabs: { title: string, Content: any, props?: any }[]; activeTab?: number }>();
|
||||
let containerRef: HTMLElement | null = null;
|
||||
type TabDef = {
|
||||
title: string;
|
||||
Content?: Component;
|
||||
loader?: () => Promise<{ default: Component }>;
|
||||
props?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
let { tabs, activeTab = $bindable(0) } = $props<{
|
||||
tabs: TabDef[];
|
||||
activeTab?: number;
|
||||
}>();
|
||||
|
||||
let containerRef: HTMLElement | null = $state(null);
|
||||
let tabWidth = $state(0);
|
||||
let containerWidth = $state(0);
|
||||
|
||||
const springTransition = { type: 'spring', stiffness: 250, damping: 25 };
|
||||
const springTransition = { type: "spring", stiffness: 250, damping: 25 };
|
||||
|
||||
const updateTabWidth = () => {
|
||||
tabWidth = tabs.length > 0 ? 100 / tabs.length : 0;
|
||||
function measureTabs() {
|
||||
if (!containerRef || tabs.length === 0) return;
|
||||
tabWidth = 100 / tabs.length;
|
||||
containerRef.style.setProperty("--tab-width", `${tabWidth}%`);
|
||||
containerWidth = containerRef.getBoundingClientRect().width;
|
||||
}
|
||||
|
||||
const indicatorX = $derived((tabWidth * activeTab * containerWidth) / 100);
|
||||
|
||||
$effect(() => {
|
||||
tabs.length;
|
||||
if (!containerRef) return;
|
||||
containerRef.style.setProperty('--tab-width', `${tabWidth}%`);
|
||||
};
|
||||
|
||||
const calcXPos = (index: number | null) => {
|
||||
if (containerRef) {
|
||||
return tabWidth * (index !== null ? index : activeTab) * containerRef.getBoundingClientRect().width / 100;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
measureTabs();
|
||||
requestAnimationFrame(measureTabs);
|
||||
|
||||
const ro =
|
||||
typeof ResizeObserver !== "undefined"
|
||||
? new ResizeObserver(measureTabs)
|
||||
: null;
|
||||
ro?.observe(containerRef);
|
||||
|
||||
return () => ro?.disconnect();
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
updateTabWidth();
|
||||
|
||||
const handleMessage = (event: MessageEvent) => {
|
||||
if (event.data === "popupClosed") {
|
||||
activeTab = 0;
|
||||
}
|
||||
};
|
||||
window.addEventListener("message", handleMessage);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("message", handleMessage);
|
||||
};
|
||||
return () => window.removeEventListener("message", handleMessage);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -42,7 +63,7 @@
|
||||
<div bind:this={containerRef} class="flex relative">
|
||||
<MotionDiv
|
||||
class="absolute top-0 left-0 z-0 h-full bg-gradient-to-tr dark:from-[#38373D]/80 dark:to-[#38373D] from-[#DDDDDD]/80 to-[#DDDDDD] rounded-full opacity-40 tab-width"
|
||||
animate={{ x: calcXPos(activeTab) }}
|
||||
animate={{ x: indicatorX }}
|
||||
transition={springTransition}
|
||||
/>
|
||||
{#each tabs as { title }, index}
|
||||
@@ -50,7 +71,7 @@
|
||||
role="tab"
|
||||
aria-selected={activeTab === index}
|
||||
class="relative z-10 flex-1 px-4 py-2 focus-visible:outline-none"
|
||||
onclick={() => activeTab = index}
|
||||
onclick={() => (activeTab = index)}
|
||||
>
|
||||
{title}
|
||||
</button>
|
||||
@@ -58,7 +79,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-hidden px-4 flex-1 min-h-0">
|
||||
{#each tabs as { Content, props }, index (index)}
|
||||
{#each tabs as tab, index (index)}
|
||||
{#if activeTab === index}
|
||||
<div
|
||||
role="tabpanel"
|
||||
@@ -68,7 +89,11 @@
|
||||
class="sticky top-0 w-full h-3 -mb-3 bg-gradient-to-b from-white/80 dark:from-zinc-800/80 to-transparent pointer-events-none z-[1]"
|
||||
aria-hidden="true"
|
||||
></div>
|
||||
<Content {...props} />
|
||||
{#if tab.loader}
|
||||
<LazyPanel loader={tab.loader} props={tab.props} />
|
||||
{:else if tab.Content}
|
||||
<tab.Content {...tab.props} />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
@@ -8,25 +8,22 @@
|
||||
|
||||
let { isEditMode, selectNoBackground = $bindable(), selectedBackground = $bindable() } = $props<{ isEditMode: boolean, selectNoBackground: () => void, selectedBackground: string | null }>();
|
||||
let backgrounds = $state<{ id: string; type: string; blob: Blob | null; url?: string }[]>([]);
|
||||
let error = $state<string | null>(null);
|
||||
let feedback = $state<{ kind: 'error' | 'warn'; text: string } | null>(null);
|
||||
|
||||
let imageBackgrounds = $derived(backgrounds.filter(bg => bg.type === 'image'));
|
||||
let videoBackgrounds = $derived(backgrounds.filter(bg => bg.type === 'video'));
|
||||
|
||||
function setError(e: unknown) {
|
||||
error = e instanceof Error ? e.message : 'An unknown error occurred';
|
||||
}
|
||||
|
||||
async function getTheme() {
|
||||
return localStorage.getItem('selectedBackground');
|
||||
}
|
||||
|
||||
async function setTheme(theme: string) {
|
||||
localStorage.setItem('selectedBackground', theme);
|
||||
function inferBackgroundType(file: File): 'image' | 'video' {
|
||||
const mime = file.type.toLowerCase();
|
||||
if (mime.startsWith('video/')) return 'video';
|
||||
if (mime.startsWith('image/')) return 'image';
|
||||
const ext = file.name.split('.').pop()?.toLowerCase() ?? '';
|
||||
return ['mp4', 'mov', 'webm', 'm4v', 'mkv'].includes(ext) ? 'video' : 'image';
|
||||
}
|
||||
|
||||
async function handleFileChange(file: File): Promise<void> {
|
||||
if (!file) return;
|
||||
feedback = null;
|
||||
|
||||
try {
|
||||
if (!isIndexedDBSupported()) {
|
||||
@@ -38,34 +35,47 @@
|
||||
throw new Error("Not enough storage space to save this background.");
|
||||
}
|
||||
|
||||
const fileId = `${Date.now()}-${file.name}`;
|
||||
const fileType = file.type.split('/')[0];
|
||||
const blob = new Blob([file], { type: file.type });
|
||||
const fileId = `${Date.now()}-${file.name.replace(/[^\w.-]+/g, '_')}`;
|
||||
const fileType = inferBackgroundType(file);
|
||||
const blob = file.slice(0, file.size, file.type || (fileType === 'video' ? 'video/mp4' : 'image/jpeg'));
|
||||
|
||||
await writeData(fileId, fileType, blob);
|
||||
backgrounds = [...backgrounds, { id: fileId, type: fileType, blob, url: URL.createObjectURL(blob) }];
|
||||
backgrounds = [
|
||||
...backgrounds,
|
||||
{ id: fileId, type: fileType, blob, url: URL.createObjectURL(blob) },
|
||||
];
|
||||
backgroundUpdates.triggerUpdate();
|
||||
|
||||
const ext = file.name.split('.').pop()?.toLowerCase() ?? '';
|
||||
if (['heic', 'heif'].includes(ext) || file.type.toLowerCase().includes('hei')) {
|
||||
feedback = {
|
||||
kind: 'warn',
|
||||
text: 'HEIC saved, but Chrome and Edge often cannot preview it. Export as JPEG or PNG if the thumbnail stays blank.',
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
setError(e);
|
||||
feedback = {
|
||||
kind: 'error',
|
||||
text: e instanceof Error ? e.message : 'An unknown error occurred',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async function syncBackgrounds(): Promise<void> {
|
||||
try {
|
||||
error = null;
|
||||
feedback = null;
|
||||
|
||||
if (!isIndexedDBSupported()) {
|
||||
throw new Error("Your browser doesn't support IndexedDB. Unable to load backgrounds.");
|
||||
}
|
||||
|
||||
selectedBackground = await getTheme();
|
||||
selectedBackground = localStorage.getItem('selectedBackground');
|
||||
const dbData = await readAllData();
|
||||
|
||||
// Release existing object URLs to prevent memory leaks
|
||||
backgrounds.forEach(bg => {
|
||||
if (bg.url) URL.revokeObjectURL(bg.url);
|
||||
});
|
||||
|
||||
// Create fresh background objects with new object URLs
|
||||
backgrounds = dbData.map(bg => ({
|
||||
id: bg.id,
|
||||
type: bg.type,
|
||||
@@ -73,12 +83,14 @@
|
||||
url: URL.createObjectURL(bg.blob)
|
||||
}));
|
||||
|
||||
// Check if selected background still exists
|
||||
if (selectedBackground && !backgrounds.some(bg => bg.id === selectedBackground)) {
|
||||
selectNoBackground();
|
||||
}
|
||||
} catch (e) {
|
||||
setError(e);
|
||||
feedback = {
|
||||
kind: 'error',
|
||||
text: e instanceof Error ? e.message : 'An unknown error occurred',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +101,7 @@
|
||||
}
|
||||
|
||||
selectedBackground = fileId;
|
||||
setTheme(fileId);
|
||||
localStorage.setItem('selectedBackground', fileId);
|
||||
}
|
||||
|
||||
async function deleteBackground(fileId: string): Promise<void> {
|
||||
@@ -100,14 +112,18 @@
|
||||
if (selectedBackground === fileId) {
|
||||
selectNoBackground();
|
||||
}
|
||||
backgroundUpdates.triggerUpdate();
|
||||
} catch (e) {
|
||||
error = e instanceof Error ? `Failed to delete background: ${e.message}` : 'An unknown error occurred';
|
||||
feedback = {
|
||||
kind: 'error',
|
||||
text: e instanceof Error ? e.message : 'An unknown error occurred',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
selectNoBackground = () => {
|
||||
selectedBackground = null;
|
||||
setTheme('');
|
||||
localStorage.setItem('selectedBackground', '');
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
@@ -115,12 +131,6 @@
|
||||
selectedBackground
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
syncBackgrounds();
|
||||
backgroundUpdates.addListener(syncBackgrounds);
|
||||
@@ -138,11 +148,22 @@
|
||||
</script>
|
||||
|
||||
<div class="relative px-1 { !( isEditMode && imageBackgrounds.length === 0 && videoBackgrounds.length === 0 ) && 'pt-2' }">
|
||||
{#if feedback}
|
||||
<div
|
||||
class="mx-1 mb-3 rounded-lg border px-3 py-2 text-sm {feedback.kind === 'warn'
|
||||
? 'border-amber-300/60 bg-amber-50 text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100'
|
||||
: 'border-red-300/60 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200'}"
|
||||
role={feedback.kind === 'warn' ? 'status' : 'alert'}
|
||||
>
|
||||
{feedback.text}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !(imageBackgrounds.length === 0 && isEditMode)}
|
||||
<h2 class="pb-2 text-lg font-bold">Background Images</h2>
|
||||
<div class="flex flex-wrap gap-4 mb-4">
|
||||
{#if !isEditMode}
|
||||
<BackgroundUploader on:fileChange={e => handleFileChange(e.detail)} />
|
||||
<BackgroundUploader onFileChange={handleFileChange} />
|
||||
{/if}
|
||||
{#each imageBackgrounds as bg (bg.id)}
|
||||
{#if bg.url}
|
||||
@@ -163,7 +184,7 @@
|
||||
<h2 class="py-2 text-lg font-bold">Background Videos</h2>
|
||||
<div class="flex flex-wrap gap-4">
|
||||
{#if !isEditMode}
|
||||
<BackgroundUploader on:fileChange={e => handleFileChange(e.detail)} />
|
||||
<BackgroundUploader onFileChange={handleFileChange} />
|
||||
{/if}
|
||||
{#each videoBackgrounds as bg (bg.id)}
|
||||
{#if bg.url}
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let { onFileChange }: { onFileChange?: (file: File) => void } = $props();
|
||||
|
||||
function handleFileChange(event: Event) {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const input = event.currentTarget as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
if (file) {
|
||||
dispatch('fileChange', file);
|
||||
onFileChange?.(file);
|
||||
}
|
||||
// Allow re-selecting the same file.
|
||||
input.value = "";
|
||||
}
|
||||
</script>
|
||||
|
||||
<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 font-IconFamily hover:text-gray-500">
|
||||
<!-- Plus icon -->
|
||||
<div
|
||||
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"
|
||||
>
|
||||
<!-- Plus icon -->
|
||||
|
||||
</div>
|
||||
<input
|
||||
type="file"
|
||||
accept="image/*, video/mp4"
|
||||
on:change={handleFileChange}
|
||||
accept="image/*,video/*,.mp4,.mov,.webm,.m4v,.heic,.heif"
|
||||
onchange={handleFileChange}
|
||||
class="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
|
||||
aria-label="Upload background image or video"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,23 +1,48 @@
|
||||
import localforage from "localforage";
|
||||
|
||||
type BackgroundRecord = { id: string; type: string; blob: Blob };
|
||||
|
||||
const store = localforage.createInstance({
|
||||
name: "BackgroundDB",
|
||||
storeName: "backgrounds",
|
||||
});
|
||||
const DB_NAME = "BackgroundDB";
|
||||
const STORE = "backgrounds";
|
||||
|
||||
export async function openDatabase(): Promise<typeof store> {
|
||||
await store.ready();
|
||||
return store;
|
||||
let dbPromise: Promise<IDBDatabase> | null = null;
|
||||
|
||||
function req<T>(request: IDBRequest<T>): Promise<T> {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.onsuccess = () => resolve(request.result);
|
||||
request.onerror = () => reject(request.error);
|
||||
});
|
||||
}
|
||||
|
||||
function txDone(tx: IDBTransaction): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
tx.oncomplete = () => resolve();
|
||||
tx.onerror = () => reject(tx.error);
|
||||
});
|
||||
}
|
||||
|
||||
export function openDatabase(): Promise<IDBDatabase> {
|
||||
if (!dbPromise) {
|
||||
dbPromise = new Promise((resolve, reject) => {
|
||||
const open = indexedDB.open(DB_NAME, 1);
|
||||
open.onerror = () => {
|
||||
dbPromise = null;
|
||||
reject(open.error);
|
||||
};
|
||||
open.onupgradeneeded = () => {
|
||||
if (!open.result.objectStoreNames.contains(STORE)) {
|
||||
open.result.createObjectStore(STORE, { keyPath: "id" });
|
||||
}
|
||||
};
|
||||
open.onsuccess = () => resolve(open.result);
|
||||
});
|
||||
}
|
||||
return dbPromise;
|
||||
}
|
||||
|
||||
export async function readAllData(): Promise<BackgroundRecord[]> {
|
||||
await store.ready();
|
||||
const items: BackgroundRecord[] = [];
|
||||
await store.iterate<BackgroundRecord, void>((value) => {
|
||||
if (value?.id && value.blob) items.push(value);
|
||||
});
|
||||
const db = await openDatabase();
|
||||
const tx = db.transaction(STORE, "readonly");
|
||||
const items = await req(tx.objectStore(STORE).getAll());
|
||||
await txDone(tx);
|
||||
return items;
|
||||
}
|
||||
|
||||
@@ -26,25 +51,50 @@ export async function writeData(
|
||||
type: string,
|
||||
blob: Blob,
|
||||
): Promise<void> {
|
||||
await store.setItem(id, { id, type, blob });
|
||||
const record = { id, type, blob };
|
||||
const db = await openDatabase();
|
||||
const tx = db.transaction(STORE, "readwrite");
|
||||
const store = tx.objectStore(STORE);
|
||||
|
||||
try {
|
||||
await req(store.keyPath ? store.put(record) : store.put(record, id));
|
||||
await txDone(tx);
|
||||
} catch (e) {
|
||||
const detail = e instanceof Error ? e.message : String(e);
|
||||
throw new Error(`Failed to save background: ${detail}`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteData(id: string): Promise<void> {
|
||||
await store.removeItem(id);
|
||||
const db = await openDatabase();
|
||||
const tx = db.transaction(STORE, "readwrite");
|
||||
await req(tx.objectStore(STORE).delete(id));
|
||||
await txDone(tx);
|
||||
}
|
||||
|
||||
export async function clearAllData(): Promise<void> {
|
||||
await store.clear();
|
||||
const db = await openDatabase();
|
||||
const tx = db.transaction(STORE, "readwrite");
|
||||
await req(tx.objectStore(STORE).clear());
|
||||
await txDone(tx);
|
||||
}
|
||||
|
||||
export async function getDataById(
|
||||
id: string,
|
||||
): Promise<BackgroundRecord | undefined> {
|
||||
const item = await store.getItem<BackgroundRecord>(id);
|
||||
return item ?? undefined;
|
||||
const db = await openDatabase();
|
||||
const tx = db.transaction(STORE, "readonly");
|
||||
const item = await req(tx.objectStore(STORE).get(id));
|
||||
await txDone(tx);
|
||||
return item?.blob instanceof Blob ? item : undefined;
|
||||
}
|
||||
|
||||
export function closeDatabase(): void {}
|
||||
export function closeDatabase(): void {
|
||||
if (dbPromise) {
|
||||
void dbPromise.then((db) => db.close());
|
||||
dbPromise = null;
|
||||
}
|
||||
}
|
||||
|
||||
export function isIndexedDBSupported(): boolean {
|
||||
return "indexedDB" in window;
|
||||
@@ -53,11 +103,7 @@ export function isIndexedDBSupported(): boolean {
|
||||
export async function hasEnoughStorageSpace(
|
||||
requiredSpace: number,
|
||||
): Promise<boolean> {
|
||||
if ("storage" in navigator && "estimate" in navigator.storage) {
|
||||
const { quota, usage } = await navigator.storage.estimate();
|
||||
if (quota !== undefined && usage !== undefined) {
|
||||
return quota - usage > requiredSpace;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
if (!("storage" in navigator) || !navigator.storage.estimate) return true;
|
||||
const { quota, usage } = await navigator.storage.estimate();
|
||||
return quota == null || usage == null || quota - usage > requiredSpace;
|
||||
}
|
||||
@@ -39,6 +39,21 @@ input {
|
||||
scrollbar-width: none !important;
|
||||
}
|
||||
|
||||
[data-settings-panel] {
|
||||
transform: scale(0.94);
|
||||
opacity: 0;
|
||||
transform-origin: center center;
|
||||
transition:
|
||||
transform var(--bs-motion-duration, 0.22s) cubic-bezier(0.22, 1, 0.36, 1),
|
||||
opacity var(--bs-motion-duration, 0.22s) cubic-bezier(0.22, 1, 0.36, 1);
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
[data-settings-panel].bsplus-settings-panel--open {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.cm-editor {
|
||||
width: 100%;
|
||||
min-height: 100px;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Settings from "./settings/general.svelte";
|
||||
import Shortcuts from "./settings/shortcuts.svelte";
|
||||
import Theme from "./settings/theme.svelte";
|
||||
import Store from "./store.svelte";
|
||||
import CommunityThemes from "./communityThemes.svelte";
|
||||
import TabbedContainer from "../components/TabbedContainer.svelte";
|
||||
import LazyPanel from "../components/LazyPanel.svelte";
|
||||
import darkLogo from "@/resources/icons/betterseqta-dark-full.png";
|
||||
import lightLogo from "@/resources/icons/betterseqta-light-full.png";
|
||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||
@@ -12,16 +8,13 @@
|
||||
import { standalone as StandaloneStore } from "../utils/standalone.svelte";
|
||||
import { onMount, onDestroy } from "svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
import { closeExtensionPopup } from "@/seqta/utils/Closers/closeExtensionPopup";
|
||||
import { OpenAboutPage } from "@/seqta/utils/Openers/OpenAboutPage";
|
||||
import { OpenWhatsNewPopup } from "@/seqta/utils/Openers/OpenWhatsNewPopup";
|
||||
|
||||
import type { Component } from "svelte";
|
||||
import FontPickerModal from "../components/FontPickerModal.svelte";
|
||||
import CloudPanel from "../components/CloudPanel.svelte";
|
||||
import DisclaimerModal from "../components/DisclaimerModal.svelte";
|
||||
import FeedbackModal from "../components/FeedbackModal.svelte";
|
||||
import SidebarNav from "../components/SidebarNav.svelte";
|
||||
import StoreHeader from "../components/store/Header.svelte";
|
||||
import { settingsPopup } from "@/seqta/utils/settingsPopup";
|
||||
@@ -43,6 +36,12 @@
|
||||
type ThemeView = "theme-settings" | "theme-store" | "community-themes" | "create-theme";
|
||||
type BackgroundView = "background-settings" | "background-store";
|
||||
|
||||
const loadSettingsBody = () => import("./settings/SettingsBody.svelte");
|
||||
const loadShortcuts = () => import("./settings/shortcuts.svelte");
|
||||
const loadThemeSettings = () => import("./settings/theme.svelte");
|
||||
const loadStore = () => import("./store.svelte");
|
||||
const loadCommunityThemes = () => import("./communityThemes.svelte");
|
||||
|
||||
type NavItem = {
|
||||
id: string;
|
||||
label: string;
|
||||
@@ -62,6 +61,19 @@
|
||||
let selectedBackgroundCategory = $state("All");
|
||||
let backgroundCategories = $state<string[]>([]);
|
||||
let storeSearchTerm = $state("");
|
||||
let settingsSearch = $state("");
|
||||
let debouncedSettingsSearch = $state("");
|
||||
let settingsSearchTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
$effect(() => {
|
||||
const query = settingsSearch;
|
||||
if (settingsSearchTimer) clearTimeout(settingsSearchTimer);
|
||||
const delay = isPerformanceMode() ? 250 : 150;
|
||||
settingsSearchTimer = setTimeout(() => {
|
||||
debouncedSettingsSearch = query;
|
||||
settingsSearchTimer = null;
|
||||
}, delay);
|
||||
});
|
||||
|
||||
let showDisclaimerModal = $state(false);
|
||||
let disclaimerCallbacks = $state<{ onConfirm: () => void; onCancel: () => void } | null>(null);
|
||||
@@ -144,6 +156,7 @@
|
||||
);
|
||||
|
||||
const sectionTitle = $derived.by(() => {
|
||||
if (activePage === "settings" && debouncedSettingsSearch.trim()) return "Search results";
|
||||
if (activePage === "themes") {
|
||||
if (activeThemeView === "theme-settings") return "Downloaded themes";
|
||||
if (activeThemeView === "create-theme") return "Custom themes";
|
||||
@@ -199,6 +212,10 @@
|
||||
};
|
||||
|
||||
let ColourPickerComponent = $state<Component | null>(null);
|
||||
let FontPickerComponent = $state<Component | null>(null);
|
||||
let CloudPanelComponent = $state<Component | null>(null);
|
||||
let DisclaimerModalComponent = $state<Component | null>(null);
|
||||
let FeedbackModalComponent = $state<Component | null>(null);
|
||||
|
||||
const openColourPicker = async () => {
|
||||
if (!ColourPickerComponent) {
|
||||
@@ -207,7 +224,10 @@
|
||||
showColourPicker = true;
|
||||
};
|
||||
|
||||
const openFontPicker = () => {
|
||||
const openFontPicker = async () => {
|
||||
if (!FontPickerComponent) {
|
||||
FontPickerComponent = (await import("../components/FontPickerModal.svelte")).default;
|
||||
}
|
||||
showFontPicker = true;
|
||||
};
|
||||
|
||||
@@ -233,27 +253,43 @@
|
||||
let showFeedbackModal = $state<boolean>(false);
|
||||
let feedbackFocusId = $state<string | null>(null);
|
||||
|
||||
const openCloudPanel = () => {
|
||||
const openCloudPanel = async () => {
|
||||
if (!CloudPanelComponent) {
|
||||
CloudPanelComponent = (await import("../components/CloudPanel.svelte")).default;
|
||||
}
|
||||
showCloudPanel = true;
|
||||
};
|
||||
|
||||
const openFeedback = (feedbackId?: string | null) => {
|
||||
const openFeedback = async (feedbackId?: string | null) => {
|
||||
if (!FeedbackModalComponent) {
|
||||
FeedbackModalComponent = (await import("../components/FeedbackModal.svelte")).default;
|
||||
}
|
||||
feedbackFocusId = typeof feedbackId === "string" && feedbackId ? feedbackId : null;
|
||||
showFeedbackModal = true;
|
||||
};
|
||||
|
||||
const showDisclaimer = (
|
||||
const showDisclaimer = async (
|
||||
onConfirm: () => void,
|
||||
onCancel: () => void,
|
||||
title = "Confirm",
|
||||
message = "",
|
||||
) => {
|
||||
if (!DisclaimerModalComponent) {
|
||||
DisclaimerModalComponent = (await import("../components/DisclaimerModal.svelte")).default;
|
||||
}
|
||||
disclaimerCallbacks = { onConfirm, onCancel };
|
||||
disclaimerTitle = title;
|
||||
disclaimerMessage = message;
|
||||
showDisclaimerModal = true;
|
||||
};
|
||||
|
||||
const settingsSharedProps = {
|
||||
showColourPicker: openColourPicker,
|
||||
showFontPicker: openFontPicker,
|
||||
showDisclaimer,
|
||||
showCloudPanel: openCloudPanel,
|
||||
};
|
||||
|
||||
const closePopupsOnSettingsClose = () => {
|
||||
showColourPicker = false;
|
||||
showFontPicker = false;
|
||||
@@ -270,6 +306,7 @@
|
||||
|
||||
const selectNavItem = (id: string) => {
|
||||
if (activePage === "settings") {
|
||||
settingsSearch = "";
|
||||
activeSection = id;
|
||||
return;
|
||||
}
|
||||
@@ -289,8 +326,14 @@
|
||||
|
||||
const applyDestination = (destination: SettingsDestination) => {
|
||||
activePage = destination.page;
|
||||
if (destination.page === "settings" && destination.section) {
|
||||
activeSection = destination.section;
|
||||
if (destination.page === "settings") {
|
||||
if (destination.section) {
|
||||
settingsSearch = "";
|
||||
activeSection = destination.section;
|
||||
}
|
||||
if (destination.search) {
|
||||
settingsSearch = destination.search;
|
||||
}
|
||||
} else if (destination.page === "themes" && destination.view) {
|
||||
activeThemeView =
|
||||
destination.view === "store"
|
||||
@@ -319,9 +362,16 @@
|
||||
}
|
||||
|
||||
if (ghReleaseUpdateEnabled) {
|
||||
void checkGithubReleaseUpdate().then((info) => {
|
||||
ghReleaseUpdate = info;
|
||||
});
|
||||
const runCheck = () => {
|
||||
void checkGithubReleaseUpdate().then((info) => {
|
||||
ghReleaseUpdate = info;
|
||||
});
|
||||
};
|
||||
if (typeof requestIdleCallback === "function") {
|
||||
requestIdleCallback(runCheck, { timeout: 4000 });
|
||||
} else {
|
||||
setTimeout(runCheck, 500);
|
||||
}
|
||||
}
|
||||
|
||||
const pendingFeedbackId = consumeOpenFeedbackRequest();
|
||||
@@ -389,6 +439,32 @@
|
||||
: 'w-[260px] px-4 py-5'}"
|
||||
aria-label="Settings categories"
|
||||
>
|
||||
{#if activePage === "settings"}
|
||||
<label class="relative mb-4 block shrink-0">
|
||||
<span class="sr-only">Search settings</span>
|
||||
<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"
|
||||
bind:value={settingsSearch}
|
||||
class="h-10 w-full rounded-lg bg-zinc-200/70 pl-9 pr-3 text-sm text-zinc-900 placeholder:text-zinc-400 transition-colors duration-200 focus:bg-white focus:outline-none focus:ring-2 focus:ring-zinc-400 focus:ring-offset-2 dark:bg-zinc-800/80 dark:text-white dark:placeholder:text-zinc-500 dark:focus:bg-zinc-800 dark:focus:ring-offset-zinc-900"
|
||||
/>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<SidebarNav
|
||||
groups={navGroups}
|
||||
selectedId={selectedNavId}
|
||||
@@ -450,19 +526,31 @@
|
||||
{#if isStoreView}
|
||||
<div class="min-w-0 min-h-0 flex-1">
|
||||
{#if activePage === "themes" && activeThemeView === "community-themes"}
|
||||
<CommunityThemes searchTerm={storeSearchTerm} setSearchTerm={(term) => (storeSearchTerm = term)} />
|
||||
<LazyPanel
|
||||
loader={loadCommunityThemes}
|
||||
remountKey="community-themes"
|
||||
props={{
|
||||
searchTerm: storeSearchTerm,
|
||||
setSearchTerm: (term: string) => (storeSearchTerm = term),
|
||||
}}
|
||||
/>
|
||||
{:else}
|
||||
<Store
|
||||
activeTab={activePage as StoreTab}
|
||||
searchTerm={storeSearchTerm}
|
||||
{selectedBackgroundCategory}
|
||||
setActiveTab={(tab) => {
|
||||
activePage = tab;
|
||||
if (tab === "themes") activeThemeView = "theme-store";
|
||||
else activeBackgroundView = "background-store";
|
||||
<LazyPanel
|
||||
loader={loadStore}
|
||||
remountKey="store"
|
||||
props={{
|
||||
activeTab: activePage as StoreTab,
|
||||
searchTerm: storeSearchTerm,
|
||||
selectedBackgroundCategory,
|
||||
setActiveTab: (tab: StoreTab) => {
|
||||
activePage = tab;
|
||||
if (tab === "themes") activeThemeView = "theme-store";
|
||||
else activeBackgroundView = "background-store";
|
||||
},
|
||||
setSearchTerm: (term: string) => (storeSearchTerm = term),
|
||||
setBackgroundCategories: (categories: string[]) =>
|
||||
(backgroundCategories = categories),
|
||||
}}
|
||||
setSearchTerm={(term) => (storeSearchTerm = term)}
|
||||
setBackgroundCategories={(categories) => (backgroundCategories = categories)}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -475,21 +563,38 @@
|
||||
</div>
|
||||
<div class="flex-1 min-h-0 px-4 pb-8 overflow-y-auto no-scrollbar">
|
||||
{#if activePage === "settings"}
|
||||
{#if activeSection === "shortcuts"}
|
||||
<Shortcuts />
|
||||
{#if activeSection === "shortcuts" && !debouncedSettingsSearch.trim()}
|
||||
<LazyPanel loader={loadShortcuts} remountKey="shortcuts-page" />
|
||||
{:else}
|
||||
<Settings
|
||||
showColourPicker={openColourPicker}
|
||||
showFontPicker={openFontPicker}
|
||||
{showDisclaimer}
|
||||
showCloudPanel={openCloudPanel}
|
||||
{activeSection}
|
||||
<LazyPanel
|
||||
loader={loadSettingsBody}
|
||||
remountKey="settings-body"
|
||||
props={{
|
||||
...settingsSharedProps,
|
||||
activeSection: debouncedSettingsSearch.trim() ? "all" : activeSection,
|
||||
searchQuery: debouncedSettingsSearch,
|
||||
}}
|
||||
/>
|
||||
{#if debouncedSettingsSearch.trim()}
|
||||
<LazyPanel
|
||||
loader={loadShortcuts}
|
||||
remountKey="shortcuts-search"
|
||||
props={{ searchQuery: debouncedSettingsSearch }}
|
||||
/>
|
||||
{/if}
|
||||
{/if}
|
||||
{:else if activePage === "themes"}
|
||||
<Theme section="themes" listMode={activeThemeListMode} />
|
||||
<LazyPanel
|
||||
loader={loadThemeSettings}
|
||||
remountKey={`theme-settings-${activeThemeListMode}`}
|
||||
props={{ section: "themes", listMode: activeThemeListMode }}
|
||||
/>
|
||||
{:else}
|
||||
<Theme section="backgrounds" />
|
||||
<LazyPanel
|
||||
loader={loadThemeSettings}
|
||||
remountKey="background-settings"
|
||||
props={{ section: "backgrounds" }}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -529,17 +634,21 @@
|
||||
tabs={[
|
||||
{
|
||||
title: "Settings",
|
||||
Content: Settings,
|
||||
loader: loadSettingsBody,
|
||||
props: {
|
||||
showColourPicker: openColourPicker,
|
||||
showFontPicker: openFontPicker,
|
||||
showDisclaimer,
|
||||
showCloudPanel: openCloudPanel,
|
||||
...settingsSharedProps,
|
||||
activeSection: "all",
|
||||
},
|
||||
},
|
||||
{ title: "Shortcuts", Content: Shortcuts },
|
||||
{ title: "Themes", Content: Theme },
|
||||
{
|
||||
title: "Shortcuts",
|
||||
loader: loadShortcuts,
|
||||
},
|
||||
{
|
||||
title: "Themes",
|
||||
loader: loadThemeSettings,
|
||||
props: { section: "all" },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
@@ -565,7 +674,9 @@
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="absolute inset-0 bg-black/60 backdrop-blur-sm transition-colors duration-200"
|
||||
class="absolute inset-0 bg-black/60 {$settingsState.performanceMode
|
||||
? 'backdrop-blur-none'
|
||||
: 'backdrop-blur-sm'} transition-colors duration-200"
|
||||
aria-label="Close settings"
|
||||
onclick={handleClose}
|
||||
></button>
|
||||
@@ -587,24 +698,24 @@
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if showCloudPanel}
|
||||
<CloudPanel
|
||||
{#if showCloudPanel && CloudPanelComponent}
|
||||
<CloudPanelComponent
|
||||
hidePanel={() => {
|
||||
showCloudPanel = false;
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if showFontPicker}
|
||||
<FontPickerModal
|
||||
{#if showFontPicker && FontPickerComponent}
|
||||
<FontPickerComponent
|
||||
hidePicker={() => {
|
||||
showFontPicker = false;
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if showDisclaimerModal && disclaimerCallbacks}
|
||||
<DisclaimerModal
|
||||
{#if showDisclaimerModal && disclaimerCallbacks && DisclaimerModalComponent}
|
||||
<DisclaimerModalComponent
|
||||
title={disclaimerTitle}
|
||||
message={disclaimerMessage}
|
||||
onConfirm={() => {
|
||||
@@ -620,8 +731,8 @@
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if showFeedbackModal}
|
||||
<FeedbackModal
|
||||
{#if showFeedbackModal && FeedbackModalComponent}
|
||||
<FeedbackModalComponent
|
||||
initialFeedbackId={feedbackFocusId}
|
||||
onClose={() => {
|
||||
showFeedbackModal = false;
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
<script lang="ts">
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import Slider from "@/interface/components/Slider.svelte";
|
||||
import Select from "@/interface/components/Select.svelte";
|
||||
import HotkeyInput from "@/interface/components/HotkeyInput.svelte";
|
||||
import SettingRow from "./SettingRow.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||
import {
|
||||
setPerformanceModePluginOverride,
|
||||
} from "@/seqta/utils/performanceMode";
|
||||
import { PERFORMANCE_HEAVY_PLUGIN_IDS } from "@/seqta/utils/performanceModeConfig";
|
||||
import { onMount } from "svelte";
|
||||
import {
|
||||
matchesSearch,
|
||||
PLUGIN_SECTION_BY_ID,
|
||||
type SettingsSectionId,
|
||||
type SettingsSectionSharedProps,
|
||||
} from "./shared";
|
||||
import {
|
||||
pluginSettingsStore,
|
||||
type PluginSettingsEntry,
|
||||
} from "./pluginSettingsState.svelte";
|
||||
|
||||
let {
|
||||
section,
|
||||
showDisclaimer,
|
||||
searchQuery = "",
|
||||
}: SettingsSectionSharedProps & { section: SettingsSectionId } = $props();
|
||||
|
||||
let cloudState = $state(cloudAuth.state);
|
||||
$effect(() => {
|
||||
const unsub = cloudAuth.subscribe((s) => {
|
||||
cloudState = s;
|
||||
});
|
||||
return unsub;
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
void pluginSettingsStore.ensureLoaded();
|
||||
});
|
||||
|
||||
const pluginHit = (plugin: PluginSettingsEntry) =>
|
||||
matchesSearch(
|
||||
searchQuery,
|
||||
plugin.name,
|
||||
plugin.description,
|
||||
...Object.values(plugin.settings).flatMap((s) => [s.title, s.description]),
|
||||
);
|
||||
|
||||
const visiblePlugins = $derived(
|
||||
pluginSettingsStore.plugins.filter(
|
||||
(plugin) =>
|
||||
(PLUGIN_SECTION_BY_ID[plugin.pluginId] ?? "features") === section &&
|
||||
pluginHit(plugin),
|
||||
),
|
||||
);
|
||||
|
||||
const pluginPerfPaused = (pluginId: string) =>
|
||||
($settingsState.performanceMode ?? false) &&
|
||||
$settingsState.performanceModePluginOverrides?.[pluginId] !== true &&
|
||||
PERFORMANCE_HEAVY_PLUGIN_IDS.has(pluginId);
|
||||
</script>
|
||||
|
||||
{#if pluginSettingsStore.loading && visiblePlugins.length === 0}
|
||||
<div class="px-5 py-6 text-sm text-zinc-400">Loading plugin settings…</div>
|
||||
{/if}
|
||||
|
||||
{#each visiblePlugins as plugin (plugin.pluginId)}
|
||||
{@const perfPaused = pluginPerfPaused(plugin.pluginId)}
|
||||
<div class="border-none">
|
||||
<div
|
||||
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40 {!(plugin as PluginSettingsEntry & { disableToggle?: boolean }).disableToggle && Object.keys(plugin.settings).length === 0 ? 'hidden' : ''} {perfPaused ? 'opacity-60' : ''}"
|
||||
>
|
||||
{#if perfPaused}
|
||||
<div
|
||||
class="flex justify-between items-center px-5 py-3 border-b border-amber-200/60 dark:border-amber-900/40 bg-amber-50/80 dark:bg-amber-950/20"
|
||||
>
|
||||
<p class="text-sm text-amber-800 dark:text-amber-200">
|
||||
Paused by Performance Mode — enable anyway
|
||||
</p>
|
||||
<Switch
|
||||
state={$settingsState.performanceModePluginOverrides?.[plugin.pluginId] === true}
|
||||
onChange={(forceOn: boolean) =>
|
||||
setPerformanceModePluginOverride(plugin.pluginId, forceOn)}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if plugin.disableToggle}
|
||||
<div class="flex justify-between items-center px-5 py-4 {perfPaused ? 'pointer-events-none' : ''}">
|
||||
<div class="pr-4">
|
||||
<h2 class="flex gap-2 items-center text-xl font-bold">
|
||||
Enable {plugin.name}
|
||||
{#if plugin.beta}
|
||||
<span
|
||||
class="px-2 py-0.5 text-xs font-medium text-orange-800 bg-orange-100 rounded-full border border-orange-300/30 dark:bg-orange-900/30 dark:text-orange-300 dark:border-orange-900/30"
|
||||
>
|
||||
Beta
|
||||
</span>
|
||||
{/if}
|
||||
</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">{plugin.description}</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true}
|
||||
onChange={async (value) => {
|
||||
if (plugin.pluginId === "assessments-average" && value === true) {
|
||||
showDisclaimer(
|
||||
async () => {
|
||||
await pluginSettingsStore.update(plugin.pluginId, "enabled", true);
|
||||
},
|
||||
() => {},
|
||||
"Assessment Averages Disclaimer",
|
||||
"This feature calculates a simple average of your assessment grades. It does not take into account:\n• Assessment weightings\n• Different grading scales\n• Other factors used in official reports\n\nThe displayed average may be inaccurate compared to your actual marks found in reports.\n\nDo you want to enable this feature?",
|
||||
);
|
||||
return;
|
||||
}
|
||||
await pluginSettingsStore.update(plugin.pluginId, "enabled", value);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !perfPaused && (!plugin.disableToggle || ((pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true))}
|
||||
{#each Object.entries(plugin.settings) as [key, setting] (key)}
|
||||
{#if key !== "enabled" && !(key === "useCloudPfp" && !cloudState.isLoggedIn)}
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">{setting.title || key}</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">{setting.description || ""}</p>
|
||||
</div>
|
||||
<div>
|
||||
{#if setting.type === "boolean"}
|
||||
<Switch
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as boolean | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
/>
|
||||
{:else if setting.type === "number"}
|
||||
<div class="w-28 shrink-0">
|
||||
<Slider
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as number | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
min={setting.min}
|
||||
max={setting.max}
|
||||
step={setting.step}
|
||||
/>
|
||||
</div>
|
||||
{:else if setting.type === "string"}
|
||||
<input
|
||||
type="text"
|
||||
class="px-2 py-1 text-sm rounded-md dark:bg-[#38373D]/50 bg-[#DDDDDD] dark:text-white border-none"
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
oninput={(e) =>
|
||||
pluginSettingsStore.update(plugin.pluginId, key, e.currentTarget.value)}
|
||||
/>
|
||||
{:else if setting.type === "select"}
|
||||
<Select
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
options={(setting.options as string[]).map((opt) => ({
|
||||
value: opt,
|
||||
label: opt.charAt(0).toUpperCase() + opt.slice(1),
|
||||
}))}
|
||||
/>
|
||||
{:else if setting.type === "button"}
|
||||
<Button onClick={() => setting.trigger?.()} text={setting.title} />
|
||||
{:else if setting.type === "hotkey"}
|
||||
<HotkeyInput
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
/>
|
||||
{:else if setting.type === "component" && setting.component}
|
||||
{@const Component = setting.component as import("svelte").Component}
|
||||
<Component />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if plugin.pluginId === "global-search"}
|
||||
<SettingRow
|
||||
title="Theme of the Month"
|
||||
description="Show the monthly featured theme popup when a new entry is available"
|
||||
id={15}
|
||||
Component={Switch}
|
||||
{searchQuery}
|
||||
props={{
|
||||
state: !($settingsState.themeOfTheMonthDisabled ?? false),
|
||||
onChange: (isOn: boolean) => (settingsState.themeOfTheMonthDisabled = !isOn),
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
@@ -0,0 +1,26 @@
|
||||
<script lang="ts">
|
||||
import type { SettingsList } from "@/interface/types/SettingsProps";
|
||||
import { matchesSearch } from "./shared";
|
||||
|
||||
let {
|
||||
title,
|
||||
description,
|
||||
Component,
|
||||
props = {},
|
||||
searchQuery = "",
|
||||
}: SettingsList & { searchQuery?: string } = $props();
|
||||
|
||||
const visible = $derived(matchesSearch(searchQuery, title, description));
|
||||
</script>
|
||||
|
||||
{#if visible}
|
||||
<div class="flex justify-between items-center px-5 py-5">
|
||||
<div class="pr-5">
|
||||
<h2 class="text-xl font-bold">{title}</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">{description}</p>
|
||||
</div>
|
||||
<div class="shrink-0">
|
||||
<Component {...props} />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -0,0 +1,60 @@
|
||||
<script lang="ts">
|
||||
import LazyPanel from "../../components/LazyPanel.svelte";
|
||||
import {
|
||||
ALL_SETTINGS_SECTIONS,
|
||||
type SettingsSectionId,
|
||||
type SettingsSectionSharedProps,
|
||||
} from "./shared";
|
||||
import { SECTION_LOADERS } from "./sectionLoaders";
|
||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
let {
|
||||
activeSection = "general",
|
||||
...rest
|
||||
}: SettingsSectionSharedProps & { activeSection?: string } = $props();
|
||||
|
||||
let mountedSectionCount = $state(1);
|
||||
|
||||
function scheduleIdle(step: () => void) {
|
||||
const delay = isPerformanceMode() ? 64 : 32;
|
||||
const timeout = isPerformanceMode() ? 800 : 500;
|
||||
if (typeof requestIdleCallback === "function") {
|
||||
requestIdleCallback(step, { timeout });
|
||||
} else {
|
||||
setTimeout(step, delay);
|
||||
}
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
mountedSectionCount = 1;
|
||||
if (activeSection !== "all") return;
|
||||
|
||||
let idx = 1;
|
||||
const step = () => {
|
||||
if (idx >= ALL_SETTINGS_SECTIONS.length) return;
|
||||
mountedSectionCount = ++idx;
|
||||
scheduleIdle(step);
|
||||
};
|
||||
scheduleIdle(step);
|
||||
});
|
||||
|
||||
const sectionsToShow = $derived.by((): SettingsSectionId[] => {
|
||||
if (activeSection === "all") {
|
||||
return ALL_SETTINGS_SECTIONS.slice(0, mountedSectionCount);
|
||||
}
|
||||
if (ALL_SETTINGS_SECTIONS.includes(activeSection as SettingsSectionId)) {
|
||||
return [activeSection as SettingsSectionId];
|
||||
}
|
||||
return ["general"];
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col divide-y divide-zinc-100 dark:divide-zinc-700">
|
||||
{#each sectionsToShow as section (section)}
|
||||
<LazyPanel
|
||||
loader={SECTION_LOADERS[section]}
|
||||
remountKey={section}
|
||||
props={{ section, ...rest }}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -1,733 +1,8 @@
|
||||
<script lang="ts">
|
||||
import Switch from "../../components/Switch.svelte"
|
||||
import Button from "../../components/Button.svelte"
|
||||
import Slider from "../../components/Slider.svelte"
|
||||
import Select from "@/interface/components/Select.svelte"
|
||||
import HotkeyInput from "@/interface/components/HotkeyInput.svelte"
|
||||
import SettingsBody from "./SettingsBody.svelte";
|
||||
import type { SettingsSectionSharedProps } from "./shared";
|
||||
|
||||
import browser from "webextension-polyfill"
|
||||
|
||||
import type { SettingsList } from "@/interface/types/SettingsProps"
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState.ts"
|
||||
import PickerSwatch from "@/interface/components/PickerSwatch.svelte"
|
||||
import SidebarAppearance from "@/interface/components/SidebarAppearance.svelte"
|
||||
import ConnectMobileApp from "@/interface/components/ConnectMobileApp.svelte"
|
||||
import CloudSettingsSync from "@/interface/components/CloudSettingsSync.svelte"
|
||||
import CloudHeader from "@/interface/components/store/CloudHeader.svelte"
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth"
|
||||
import { showPrivacyNotification } from "@/seqta/utils/Openers/OpenPrivacyNotification"
|
||||
import { showThemeOfTheMonthPopupNow } from "@/seqta/utils/Openers/OpenThemeOfTheMonthPopup"
|
||||
import { closeExtensionPopup } from "@/seqta/utils/Closers/closeExtensionPopup"
|
||||
import { getSnapshotForUpload } from "@/seqta/utils/cloudSettingsSync"
|
||||
import { getStoredOverride, setApiBase } from "@/seqta/utils/DevApiBase"
|
||||
import { onMount } from "svelte"
|
||||
|
||||
let devApiBaseInput = $state<string>(getStoredOverride() ?? "")
|
||||
let devApiBaseActive = $state<string | null>(getStoredOverride())
|
||||
|
||||
function applyDevApiBase() {
|
||||
const trimmed = devApiBaseInput.trim()
|
||||
if (trimmed === "") {
|
||||
setApiBase(null)
|
||||
devApiBaseActive = null
|
||||
return
|
||||
}
|
||||
if (!/^https?:\/\//.test(trimmed)) {
|
||||
alert("Please enter a full URL starting with http:// or https://")
|
||||
return
|
||||
}
|
||||
setApiBase(trimmed)
|
||||
devApiBaseActive = trimmed.replace(/\/$/, "")
|
||||
}
|
||||
|
||||
function clearDevApiBase() {
|
||||
devApiBaseInput = ""
|
||||
setApiBase(null)
|
||||
devApiBaseActive = null
|
||||
}
|
||||
|
||||
import { getAllPluginSettings } from "@/plugins"
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage"
|
||||
|
||||
const isEngage = isSeqtaEngageExperience();
|
||||
import type { BooleanSetting, StringSetting, NumberSetting, SelectSetting, ButtonSetting, HotkeySetting, ComponentSetting } from "@/plugins/core/types"
|
||||
|
||||
// Union type representing all possible settings
|
||||
type SettingType =
|
||||
(Omit<BooleanSetting, 'type'> & { type: 'boolean', id: string }) |
|
||||
(Omit<StringSetting, 'type'> & { type: 'string', id: string }) |
|
||||
(Omit<NumberSetting, 'type'> & { type: 'number', id: string }) |
|
||||
(Omit<SelectSetting<string>, 'type'> & {
|
||||
type: 'select',
|
||||
id: string,
|
||||
options: string[]
|
||||
}) |
|
||||
(Omit<ButtonSetting, 'type'> & {
|
||||
type: 'button',
|
||||
id: string
|
||||
}) |
|
||||
(Omit<HotkeySetting, 'type'> & {
|
||||
type: 'hotkey',
|
||||
id: string
|
||||
}) |
|
||||
(Omit<ComponentSetting, 'type'> & {
|
||||
type: 'component',
|
||||
id: string,
|
||||
component: any
|
||||
});
|
||||
|
||||
interface Plugin {
|
||||
pluginId: string;
|
||||
name: string;
|
||||
description: string;
|
||||
beta?: boolean;
|
||||
settings: Record<string, SettingType>;
|
||||
}
|
||||
|
||||
const pluginSettings = getAllPluginSettings().filter(
|
||||
(plugin) => !(isSeqtaEngageExperience() && plugin.pluginId === "global-search"),
|
||||
) as Plugin[];
|
||||
const pluginSettingsValues = $state<Record<string, Record<string, any>>>({});
|
||||
|
||||
let cloudState = $state(cloudAuth.state);
|
||||
$effect(() => {
|
||||
const unsub = cloudAuth.subscribe((s) => { cloudState = s; });
|
||||
return unsub;
|
||||
});
|
||||
|
||||
async function loadPluginSettings() {
|
||||
for (const plugin of pluginSettings) {
|
||||
if (Object.keys(plugin.settings).length === 0) continue;
|
||||
|
||||
const storageKey = `plugin.${plugin.pluginId}.settings`;
|
||||
const stored = await browser.storage.local.get(storageKey);
|
||||
|
||||
pluginSettingsValues[plugin.pluginId] = stored[storageKey] || {};
|
||||
|
||||
for (const [key, setting] of Object.entries(plugin.settings)) {
|
||||
if (
|
||||
pluginSettingsValues[plugin.pluginId][key] === undefined &&
|
||||
setting.type !== 'button' &&
|
||||
setting.type !== 'component'
|
||||
) {
|
||||
pluginSettingsValues[plugin.pluginId][key] = setting.default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function updatePluginSetting(pluginId: string, key: string, value: any) {
|
||||
const storageKey = `plugin.${pluginId}.settings`;
|
||||
|
||||
if (!pluginSettingsValues[pluginId]) {
|
||||
pluginSettingsValues[pluginId] = {};
|
||||
}
|
||||
pluginSettingsValues[pluginId][key] = value;
|
||||
|
||||
const stored = await browser.storage.local.get(storageKey);
|
||||
const currentSettings = (stored[storageKey] || {}) as Record<string, any>;
|
||||
|
||||
currentSettings[key] = value;
|
||||
|
||||
await browser.storage.local.set({ [storageKey]: currentSettings });
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
void loadPluginSettings();
|
||||
});
|
||||
|
||||
const { showColourPicker, showFontPicker, showDisclaimer, showCloudPanel, activeSection = "general" } = $props<{
|
||||
showColourPicker: () => void;
|
||||
showFontPicker: () => void;
|
||||
showDisclaimer: (onConfirm: () => void, onCancel: () => void, title?: string, message?: string) => void;
|
||||
showCloudPanel: () => void;
|
||||
activeSection?: string;
|
||||
}>();
|
||||
|
||||
/** Map each plugin into the settings sidebar category that fits its purpose. */
|
||||
const pluginSectionById: Record<string, string> = {
|
||||
"profile-picture": "account",
|
||||
"animated-background": "appearance",
|
||||
"background-music": "appearance",
|
||||
timetable: "timetable",
|
||||
timetableEdit: "timetable",
|
||||
"assessments-overview": "assessments",
|
||||
"assessments-average": "assessments",
|
||||
"grade-analytics": "assessments",
|
||||
"global-search": "features",
|
||||
"enhanced-navigation": "features",
|
||||
messageFolders: "features",
|
||||
notificationCollector: "features",
|
||||
};
|
||||
|
||||
const showsSection = (section: string) =>
|
||||
activeSection === "all" || activeSection === section;
|
||||
|
||||
const pluginBelongsInSection = (pluginId: string) =>
|
||||
activeSection === "all" ||
|
||||
(pluginSectionById[pluginId] ?? "features") === activeSection;
|
||||
|
||||
|
||||
async function exportCloudSettingsJsonToFile() {
|
||||
const payload = await getSnapshotForUpload();
|
||||
const blob = new Blob([JSON.stringify(payload, null, 2)], {
|
||||
type: "application/json",
|
||||
});
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = `betterseqta-plus-settings-export-${new Date().toISOString().replace(/[:.]/g, "-")}.json`;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
let props: SettingsSectionSharedProps & { activeSection?: string } = $props();
|
||||
</script>
|
||||
|
||||
{#snippet Setting({ title, description, Component, props }: SettingsList) }
|
||||
<div class="flex justify-between items-center px-5 py-5">
|
||||
<div class="pr-5">
|
||||
<h2 class="text-xl font-bold">{title}</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">{description}</p>
|
||||
</div>
|
||||
<div class="shrink-0">
|
||||
<Component {...props} />
|
||||
</div>
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
<div class="flex flex-col divide-y divide-zinc-100 dark:divide-zinc-700">
|
||||
{#if showsSection("account")}
|
||||
{@render Setting({
|
||||
title: "Connect Mobile App",
|
||||
description: "Link your SEQTA session to DesQTA — the modern desktop and mobile app for SEQTA Learn",
|
||||
id: 0,
|
||||
Component: ConnectMobileApp,
|
||||
props: {}
|
||||
})}
|
||||
|
||||
<div class="border-none">
|
||||
<div class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40">
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">BetterSEQTA Cloud</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Account & sync</p>
|
||||
</div>
|
||||
<div>
|
||||
<CloudHeader alwaysShowUserName onClick={showCloudPanel} />
|
||||
</div>
|
||||
</div>
|
||||
{#if cloudState.isLoggedIn}
|
||||
<div class="px-3 pb-3">
|
||||
<CloudSettingsSync showDisclaimer={(onConfirm, onCancel) => showDisclaimer(onConfirm, onCancel, "Restore from cloud?", "This will replace your local settings with the cloud backup. Continue?")} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if showsSection("general")}
|
||||
{#each [
|
||||
...(!isEngage
|
||||
? [
|
||||
{
|
||||
title: "Edit Sidebar Layout",
|
||||
description: "Reorder pages on the sidebar",
|
||||
id: 5,
|
||||
Component: Button,
|
||||
props: {
|
||||
onClick: () => browser.runtime.sendMessage({ type: 'currentTab', info: 'EditSidebar' }),
|
||||
text: "Edit"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Icon Only Sidebar",
|
||||
description: "Show only icons in the sidebar for a compact layout",
|
||||
id: 14,
|
||||
Component: Switch,
|
||||
props: {
|
||||
state: $settingsState.iconOnlySidebar ?? false,
|
||||
onChange: (isOn: boolean) => settingsState.iconOnlySidebar = isOn
|
||||
}
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
title: "Animations",
|
||||
description: "Enable animations on certain pages",
|
||||
id: 6,
|
||||
Component: Switch,
|
||||
props: {
|
||||
state: $settingsState.animations,
|
||||
onChange: (isOn: boolean) => settingsState.animations = isOn
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "12 Hour Time",
|
||||
description: "Prefer 12 hour time format for SEQTA",
|
||||
id: 9,
|
||||
Component: Switch,
|
||||
props: {
|
||||
state: $settingsState.timeFormat === "12",
|
||||
onChange: (isOn: boolean) => settingsState.timeFormat = isOn ? "12" : "24"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Default Page",
|
||||
description: "Choose which page loads first when you open SEQTA",
|
||||
id: 10,
|
||||
Component: Select,
|
||||
props: {
|
||||
value: $settingsState.defaultPage ?? "home",
|
||||
onChange: (value: string) => (settingsState.defaultPage = value),
|
||||
options: isEngage
|
||||
? [
|
||||
{ value: "home", label: "Home" },
|
||||
{ value: "dashboard", label: "Dashboard" },
|
||||
{ value: "timetable", label: "Timetable" },
|
||||
{ value: "messages", label: "Messages" },
|
||||
{ value: "documents", label: "Documents" },
|
||||
{ value: "reports", label: "Reports" },
|
||||
]
|
||||
: [
|
||||
{ value: "home", label: "Home" },
|
||||
{ value: "dashboard", label: "Dashboard" },
|
||||
{ value: "timetable", label: "Timetable" },
|
||||
{ value: "welcome", label: "Welcome" },
|
||||
{ value: "messages", label: "Messages" },
|
||||
{ value: "documents", label: "Documents" },
|
||||
{ value: "reports", label: "Reports" },
|
||||
],
|
||||
},
|
||||
},
|
||||
...(!isEngage
|
||||
? [
|
||||
{
|
||||
title: "News Feed Source",
|
||||
description: "Choose the sources for your news feed",
|
||||
id: 11,
|
||||
Component: Select,
|
||||
props: {
|
||||
value: $settingsState.newsSource,
|
||||
onChange: (value: string) => settingsState.newsSource = value,
|
||||
options: [
|
||||
{ value: "australia", label: "Australia" },
|
||||
{ value: "usa", label: "USA" },
|
||||
{ value: "uk", label: "UK" },
|
||||
{ value: "taiwan", label: "Taiwan" },
|
||||
{ value: "hong_kong", label: "Hong Kong" },
|
||||
{ value: "panama", label: "Panama" },
|
||||
{ value: "canada", label: "Canada" },
|
||||
{ value: "singapore", label: "Singapore" },
|
||||
{ value: "japan", label: "Japan" },
|
||||
{ value: "netherlands", label: "Netherlands" },
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
] as option (option.id)}
|
||||
{@render Setting(option)}
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
{#if showsSection("appearance")}
|
||||
{#each [
|
||||
{
|
||||
title: "Custom Theme Colour",
|
||||
description: "Customise the overall theme colour of SEQTA Learn",
|
||||
id: 4,
|
||||
Component: PickerSwatch,
|
||||
props: {
|
||||
onClick: showColourPicker
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Interface Font",
|
||||
description: "Choose the typeface used across SEQTA Learn",
|
||||
id: 16,
|
||||
Component: Button,
|
||||
props: {
|
||||
onClick: showFontPicker,
|
||||
text: "Change"
|
||||
}
|
||||
},
|
||||
] as option (option.id)}
|
||||
{@render Setting(option)}
|
||||
{/each}
|
||||
|
||||
{#if !isEngage}
|
||||
<div class="border-none">
|
||||
<SidebarAppearance />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="border-none">
|
||||
<div class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40">
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Adaptive Theme Colour</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Change the theme colour based on the current class (e.g. when viewing a course or assessments page)</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeColour ?? false}
|
||||
onChange={(isOn: boolean) => settingsState.adaptiveThemeColour = isOn}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{#if $settingsState.adaptiveThemeColour}
|
||||
<div class="flex justify-between items-center px-5 py-4 pl-7 border-t border-zinc-100 dark:border-zinc-700/50">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Soft Gradient</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Use a soft gradient instead of a solid colour when viewing a class</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeGradient ?? false}
|
||||
onChange={(isOn: boolean) => settingsState.adaptiveThemeGradient = isOn}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4 pl-7 border-t border-zinc-100 dark:border-zinc-700/50">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Smooth colour transition</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Ease between class/subject colours when navigating instead of switching instantly</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeColourTransition ?? true}
|
||||
onChange={(isOn: boolean) => settingsState.adaptiveThemeColourTransition = isOn}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if showsSection("general")}
|
||||
<div class="border-none">
|
||||
<div class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40">
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Home Page Assessments</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Limit upcoming assessments shown on the home page by subject</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4 pl-7 border-t border-zinc-100 dark:border-zinc-700/50">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Include Past Assessments</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Show past-due assessments from the upcoming list, matching the Assessments page</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.homeUpcomingIncludePast ?? true}
|
||||
onChange={(isOn: boolean) => (settingsState.homeUpcomingIncludePast = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4 pl-7 border-t border-zinc-100 dark:border-zinc-700/50">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Maximum Subjects</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Number of subjects to include, ordered by soonest due date</p>
|
||||
</div>
|
||||
<Select
|
||||
value={String($settingsState.homeUpcomingSubjectsMax ?? 5)}
|
||||
onChange={(value: string) => (settingsState.homeUpcomingSubjectsMax = Number(value))}
|
||||
options={[
|
||||
{ value: "0", label: "All" },
|
||||
{ value: "3", label: "3" },
|
||||
{ value: "5", label: "5" },
|
||||
{ value: "7", label: "7" },
|
||||
{ value: "10", label: "10" },
|
||||
{ value: "15", label: "15" },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4 pl-7 border-t border-zinc-100 dark:border-zinc-700/50">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Maximum Assessments per Subject</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Assessments shown for each included subject</p>
|
||||
</div>
|
||||
<Select
|
||||
value={String($settingsState.homeUpcomingAssessmentsPerSubjectMax ?? 0)}
|
||||
onChange={(value: string) => (settingsState.homeUpcomingAssessmentsPerSubjectMax = Number(value))}
|
||||
options={[
|
||||
{ value: "0", label: "All" },
|
||||
{ value: "1", label: "1" },
|
||||
{ value: "2", label: "2" },
|
||||
{ value: "3", label: "3" },
|
||||
{ value: "5", label: "5" },
|
||||
{ value: "10", label: "10" },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#each pluginSettings as plugin (plugin.pluginId)}
|
||||
{#if pluginBelongsInSection(plugin.pluginId)}
|
||||
<div class="border-none">
|
||||
<div class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40 {!(plugin as any).disableToggle && Object.keys(plugin.settings).length === 0 ? 'hidden' : ''}">
|
||||
<!-- Always show enable toggle if disableToggle is true -->
|
||||
{#if (plugin as any).disableToggle}
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="flex gap-2 items-center text-xl font-bold">
|
||||
Enable {plugin.name}
|
||||
{#if plugin.beta}
|
||||
<span class="px-2 py-0.5 text-xs font-medium text-orange-800 bg-orange-100 rounded-full border border-orange-300/30 dark:bg-orange-900/30 dark:text-orange-300 dark:border-orange-900/30">
|
||||
Beta
|
||||
</span>
|
||||
{/if}
|
||||
</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">{plugin.description}</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={pluginSettingsValues[plugin.pluginId]?.enabled ?? true}
|
||||
onChange={async (value) => {
|
||||
if (plugin.pluginId === 'assessments-average' && value === true) {
|
||||
showDisclaimer(
|
||||
async () => {
|
||||
await updatePluginSetting(plugin.pluginId, 'enabled', true);
|
||||
},
|
||||
() => {},
|
||||
"Assessment Averages Disclaimer",
|
||||
"This feature calculates a simple average of your assessment grades. It does not take into account:\n• Assessment weightings\n• Different grading scales\n• Other factors used in official reports\n\nThe displayed average may be inaccurate compared to your actual marks found in reports.\n\nDo you want to enable this feature?"
|
||||
);
|
||||
return;
|
||||
}
|
||||
await updatePluginSetting(plugin.pluginId, 'enabled', value);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !((plugin as any).disableToggle) || (pluginSettingsValues[plugin.pluginId]?.enabled ?? true)}
|
||||
{#each Object.entries(plugin.settings) as [key, setting] (key)}
|
||||
<!-- Skip the 'enabled' setting and hide cloud-only settings when not signed in -->
|
||||
{#if key !== 'enabled' && !(key === 'useCloudPfp' && !cloudState.isLoggedIn)}
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">{setting.title || key}</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">{setting.description || ''}</p>
|
||||
</div>
|
||||
<div>
|
||||
{#if setting.type === 'boolean'}
|
||||
<Switch
|
||||
state={pluginSettingsValues[plugin.pluginId]?.[key] ?? setting.default}
|
||||
onChange={(value) => updatePluginSetting(plugin.pluginId, key, value)}
|
||||
/>
|
||||
{:else if setting.type === 'number'}
|
||||
<div class="w-28 shrink-0">
|
||||
<Slider
|
||||
state={pluginSettingsValues[plugin.pluginId]?.[key] ?? setting.default}
|
||||
onChange={(value) => updatePluginSetting(plugin.pluginId, key, value)}
|
||||
min={setting.min}
|
||||
max={setting.max}
|
||||
step={setting.step}
|
||||
/>
|
||||
</div>
|
||||
{:else if setting.type === 'string'}
|
||||
<input
|
||||
type="text"
|
||||
class="px-2 py-1 text-sm rounded-md dark:bg-[#38373D]/50 bg-[#DDDDDD] dark:text-white border-none"
|
||||
value={pluginSettingsValues[plugin.pluginId]?.[key] ?? setting.default}
|
||||
oninput={(e) => updatePluginSetting(plugin.pluginId, key, e.currentTarget.value)}
|
||||
/>
|
||||
{:else if setting.type === 'select'}
|
||||
<Select
|
||||
value={pluginSettingsValues[plugin.pluginId]?.[key] ?? setting.default}
|
||||
onChange={(value) => updatePluginSetting(plugin.pluginId, key, value)}
|
||||
options={(setting.options as string[]).map(opt => ({
|
||||
value: opt,
|
||||
label: opt.charAt(0).toUpperCase() + opt.slice(1)
|
||||
}))}
|
||||
/>
|
||||
{:else if setting.type === 'button'}
|
||||
<Button
|
||||
onClick={() => setting.trigger?.()}
|
||||
text={setting.title}
|
||||
/>
|
||||
{:else if setting.type === 'hotkey'}
|
||||
<HotkeyInput
|
||||
value={pluginSettingsValues[plugin.pluginId]?.[key] ?? setting.default}
|
||||
onChange={(value) => updatePluginSetting(plugin.pluginId, key, value)}
|
||||
/>
|
||||
{:else if setting.type === 'component'}
|
||||
{#if setting.component}
|
||||
{@const Component = setting.component}
|
||||
<Component />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
{#if plugin.pluginId === 'global-search'}
|
||||
{@render Setting({
|
||||
title: "Theme of the Month",
|
||||
description: "Show the monthly featured theme popup when a new entry is available",
|
||||
id: 15,
|
||||
Component: Switch,
|
||||
props: {
|
||||
state: !($settingsState.themeOfTheMonthDisabled ?? false),
|
||||
onChange: (isOn: boolean) => settingsState.themeOfTheMonthDisabled = !isOn
|
||||
}
|
||||
})}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
{#if showsSection("advanced")}
|
||||
{@render Setting({
|
||||
title: "BetterSEQTA+",
|
||||
description: "Enables BetterSEQTA+ features",
|
||||
id: 12,
|
||||
Component: Switch,
|
||||
props: {
|
||||
state: $settingsState.onoff,
|
||||
onChange: (isOn: boolean) => settingsState.onoff = isOn
|
||||
}
|
||||
})}
|
||||
|
||||
{#if $settingsState.devMode}
|
||||
<div class="flex-col p-1 my-1 bg-gradient-to-br from-white rounded-xl border shadow-sm to-zinc-100 border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40">
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Developer Mode</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Enables developer mode, allowing you to test new features and changes.</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch state={$settingsState.devMode} onChange={(isOn: boolean) => settingsState.devMode = isOn} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Verbose logging</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Show diagnostic console output (indexer, theme manager, timetable colour patch, etc.)</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.verboseLogging ?? false}
|
||||
onChange={(isOn: boolean) => settingsState.verboseLogging = isOn}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Sensitive Hider</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Replace sensitive content with mock data</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.hideSensitiveContent ?? false}
|
||||
onChange={(isOn: boolean) => settingsState.hideSensitiveContent = isOn}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Mock Notices</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Use fake notice data on homepage instead of real data</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.mockNotices ?? false}
|
||||
onChange={(isOn: boolean) => settingsState.mockNotices = isOn}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Show Privacy Notification</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Show the privacy notification popup on next page load</p>
|
||||
</div>
|
||||
<div>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
settingsState.privacyStatementShown = false;
|
||||
settingsState.privacyStatementLastUpdated = undefined;
|
||||
closeExtensionPopup();
|
||||
// Small delay to ensure popup is closed before showing notification
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
await showPrivacyNotification();
|
||||
}}
|
||||
text="Show Now"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Show Theme of the Month</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Fetch and show the current month's popup now (ignores dismissed state)</p>
|
||||
</div>
|
||||
<div>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
closeExtensionPopup();
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
await showThemeOfTheMonthPopupNow();
|
||||
}}
|
||||
text="Show Now"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Export cloud settings JSON</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Download the same payload as cloud sync (OAuth tokens stripped). For debugging and server testing.</p>
|
||||
</div>
|
||||
<div>
|
||||
<Button onClick={exportCloudSettingsJsonToFile} text="Export to file" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 px-4 py-3">
|
||||
<div class="flex justify-between items-start gap-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">API Base URL (session only)</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Override the content API host for this browser session. Cleared on restart. Affects themes, theme of the month, and other server-driven content.</p>
|
||||
{#if devApiBaseActive}
|
||||
<p class="text-xs mt-1 text-amber-600 dark:text-amber-400">
|
||||
Override active: <span class="font-mono">{devApiBaseActive}</span>
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2 items-center">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="https://betterseqta.org"
|
||||
bind:value={devApiBaseInput}
|
||||
class="flex-1 px-2 py-1 text-xs rounded border bg-white dark:bg-zinc-800 border-zinc-300 dark:border-zinc-700 text-zinc-900 dark:text-zinc-100"
|
||||
/>
|
||||
<Button onClick={applyDevApiBase} text="Apply" />
|
||||
{#if devApiBaseActive}
|
||||
<Button onClick={clearDevApiBase} text="Clear" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 px-4 py-3">
|
||||
<div>
|
||||
<h2 class="text-xl font-bold">GitHub latest version override</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Pretend a newer GitHub release exists to test the update badge. Only applies when dev mode is on.</p>
|
||||
</div>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="e.g. 9.9.9"
|
||||
value={$settingsState.devGhReleaseVersionOverride ?? ""}
|
||||
oninput={(e) => {
|
||||
settingsState.devGhReleaseVersionOverride = e.currentTarget.value;
|
||||
}}
|
||||
class="px-2 py-1 text-xs rounded border bg-white dark:bg-zinc-800 border-zinc-300 dark:border-zinc-700 text-zinc-900 dark:text-zinc-100"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<SettingsBody {...props} />
|
||||
@@ -0,0 +1,101 @@
|
||||
import browser from "webextension-polyfill";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import type {
|
||||
BooleanSetting,
|
||||
ButtonSetting,
|
||||
ComponentSetting,
|
||||
HotkeySetting,
|
||||
NumberSetting,
|
||||
SelectSetting,
|
||||
StringSetting,
|
||||
} from "@/plugins/core/types";
|
||||
|
||||
type SettingType =
|
||||
| (Omit<BooleanSetting, "type"> & { type: "boolean"; id: string })
|
||||
| (Omit<StringSetting, "type"> & { type: "string"; id: string })
|
||||
| (Omit<NumberSetting, "type"> & { type: "number"; id: string })
|
||||
| (Omit<SelectSetting<string>, "type"> & {
|
||||
type: "select";
|
||||
id: string;
|
||||
options: string[];
|
||||
})
|
||||
| (Omit<ButtonSetting, "type"> & { type: "button"; id: string })
|
||||
| (Omit<HotkeySetting, "type"> & { type: "hotkey"; id: string })
|
||||
| (Omit<ComponentSetting, "type"> & {
|
||||
type: "component";
|
||||
id: string;
|
||||
component: unknown;
|
||||
});
|
||||
|
||||
export type PluginSettingsEntry = {
|
||||
pluginId: string;
|
||||
name: string;
|
||||
description: string;
|
||||
beta?: boolean;
|
||||
settings: Record<string, SettingType>;
|
||||
disableToggle?: boolean;
|
||||
};
|
||||
|
||||
let loadPromise: Promise<void> | null = null;
|
||||
|
||||
class PluginSettingsStore {
|
||||
loaded = $state(false);
|
||||
loading = $state(false);
|
||||
plugins = $state<PluginSettingsEntry[]>([]);
|
||||
values = $state<Record<string, Record<string, unknown>>>({});
|
||||
|
||||
ensureLoaded(): Promise<void> {
|
||||
if (this.loaded) return Promise.resolve();
|
||||
if (loadPromise) return loadPromise;
|
||||
|
||||
this.loading = true;
|
||||
loadPromise = this.load().finally(() => {
|
||||
this.loading = false;
|
||||
this.loaded = true;
|
||||
});
|
||||
return loadPromise;
|
||||
}
|
||||
|
||||
private async load(): Promise<void> {
|
||||
const { getAllPluginSettings } = await import("@/plugins");
|
||||
this.plugins = getAllPluginSettings().filter(
|
||||
(plugin) =>
|
||||
!(isSeqtaEngageExperience() && plugin.pluginId === "global-search"),
|
||||
) as PluginSettingsEntry[];
|
||||
|
||||
for (const plugin of this.plugins) {
|
||||
if (Object.keys(plugin.settings).length === 0) continue;
|
||||
|
||||
const storageKey = `plugin.${plugin.pluginId}.settings`;
|
||||
const stored = await browser.storage.local.get(storageKey);
|
||||
this.values[plugin.pluginId] = (stored[storageKey] as Record<string, unknown>) || {};
|
||||
|
||||
for (const [key, setting] of Object.entries(plugin.settings)) {
|
||||
if (
|
||||
this.values[plugin.pluginId][key] === undefined &&
|
||||
setting.type !== "button" &&
|
||||
setting.type !== "component"
|
||||
) {
|
||||
this.values[plugin.pluginId][key] = setting.default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async update(pluginId: string, key: string, value: unknown): Promise<void> {
|
||||
await this.ensureLoaded();
|
||||
|
||||
if (!this.values[pluginId]) {
|
||||
this.values[pluginId] = {};
|
||||
}
|
||||
this.values[pluginId][key] = value;
|
||||
|
||||
const storageKey = `plugin.${pluginId}.settings`;
|
||||
const stored = await browser.storage.local.get(storageKey);
|
||||
const currentSettings = (stored[storageKey] || {}) as Record<string, unknown>;
|
||||
currentSettings[key] = value;
|
||||
await browser.storage.local.set({ [storageKey]: currentSettings });
|
||||
}
|
||||
}
|
||||
|
||||
export const pluginSettingsStore = new PluginSettingsStore();
|
||||
@@ -0,0 +1,15 @@
|
||||
import type { Component } from "svelte";
|
||||
import type { SettingsSectionId } from "./shared";
|
||||
|
||||
export const SECTION_LOADERS: Record<
|
||||
SettingsSectionId,
|
||||
() => Promise<{ default: Component }>
|
||||
> = {
|
||||
account: () => import("./sections/account.svelte"),
|
||||
general: () => import("./sections/generalOptions.svelte"),
|
||||
appearance: () => import("./sections/appearance.svelte"),
|
||||
timetable: () => import("./sections/plugins.svelte"),
|
||||
assessments: () => import("./sections/plugins.svelte"),
|
||||
features: () => import("./sections/plugins.svelte"),
|
||||
advanced: () => import("./sections/advanced.svelte"),
|
||||
};
|
||||
@@ -0,0 +1,110 @@
|
||||
<script lang="ts">
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import ConnectMobileApp from "@/interface/components/ConnectMobileApp.svelte";
|
||||
import CloudSettingsSync from "@/interface/components/CloudSettingsSync.svelte";
|
||||
import CloudHeader from "@/interface/components/store/CloudHeader.svelte";
|
||||
import SettingRow from "../SettingRow.svelte";
|
||||
import PluginSettingsBlocks from "../PluginSettingsBlocks.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||
import { matchesSearch, type SettingsSectionSharedProps } from "../shared";
|
||||
|
||||
let {
|
||||
showDisclaimer,
|
||||
showCloudPanel,
|
||||
searchQuery = "",
|
||||
}: SettingsSectionSharedProps = $props();
|
||||
|
||||
let cloudState = $state(cloudAuth.state);
|
||||
$effect(() => {
|
||||
const unsub = cloudAuth.subscribe((s) => {
|
||||
cloudState = s;
|
||||
});
|
||||
return unsub;
|
||||
});
|
||||
|
||||
const founderBadgeSetting = {
|
||||
title: "Titlebar founder badge",
|
||||
description: "Show your Cloud founder badge in the SEQTA titlebar",
|
||||
} as const;
|
||||
|
||||
const showCloudCardHeader = $derived(
|
||||
matchesSearch(searchQuery, "BetterSEQTA Cloud", "Account & sync"),
|
||||
);
|
||||
|
||||
const showFounderBadgeSetting = $derived(
|
||||
matchesSearch(
|
||||
searchQuery,
|
||||
founderBadgeSetting.title,
|
||||
founderBadgeSetting.description,
|
||||
"founder badge",
|
||||
"titlebar",
|
||||
"founder",
|
||||
),
|
||||
);
|
||||
|
||||
const showCloudAccountCard = $derived(showCloudCardHeader || showFounderBadgeSetting);
|
||||
</script>
|
||||
|
||||
<SettingRow
|
||||
title="Connect Mobile App"
|
||||
description="Link your SEQTA session to DesQTA — the modern desktop and mobile app for SEQTA Learn"
|
||||
id={0}
|
||||
Component={ConnectMobileApp}
|
||||
{searchQuery}
|
||||
props={{}}
|
||||
/>
|
||||
|
||||
{#if showCloudAccountCard}
|
||||
<div class="border-none">
|
||||
<div
|
||||
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
|
||||
>
|
||||
{#if showCloudCardHeader}
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">BetterSEQTA Cloud</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">Account & sync</p>
|
||||
</div>
|
||||
<div>
|
||||
<CloudHeader alwaysShowUserName onClick={showCloudPanel} />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{#if cloudState.isLoggedIn}
|
||||
<div class="px-3 pb-3" class:pt-3={!showCloudCardHeader}>
|
||||
{#if showCloudCardHeader}
|
||||
<CloudSettingsSync
|
||||
showDisclaimer={(onConfirm, onCancel) =>
|
||||
showDisclaimer(
|
||||
onConfirm,
|
||||
onCancel,
|
||||
"Restore from cloud?",
|
||||
"This will replace your local settings with the cloud backup. Continue?",
|
||||
)}
|
||||
/>
|
||||
{/if}
|
||||
{#if showFounderBadgeSetting}
|
||||
<SettingRow
|
||||
title={founderBadgeSetting.title}
|
||||
description={founderBadgeSetting.description}
|
||||
id={17}
|
||||
Component={Switch}
|
||||
{searchQuery}
|
||||
props={{
|
||||
state: $settingsState.showTitlebarFounderBadge !== false,
|
||||
onChange: (isOn: boolean) => (settingsState.showTitlebarFounderBadge = isOn),
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if showFounderBadgeSetting}
|
||||
<div class="px-5 pb-4 text-sm text-zinc-600 dark:text-zinc-400">
|
||||
Sign in to Cloud first.
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<PluginSettingsBlocks section="account" {showDisclaimer} {searchQuery} />
|
||||
@@ -0,0 +1,248 @@
|
||||
<script lang="ts">
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import SettingRow from "../SettingRow.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { showPrivacyNotification } from "@/seqta/utils/Openers/OpenPrivacyNotification";
|
||||
import { showThemeOfTheMonthPopupNow } from "@/seqta/utils/Openers/OpenThemeOfTheMonthPopup";
|
||||
import { closeExtensionPopup } from "@/seqta/utils/Closers/closeExtensionPopup";
|
||||
import { getSnapshotForUpload } from "@/seqta/utils/cloudSettingsSync";
|
||||
import { getStoredOverride, setApiBase } from "@/seqta/utils/DevApiBase";
|
||||
import { matchesSearch, type SettingsSectionSharedProps } from "../shared";
|
||||
|
||||
let { searchQuery = "" }: SettingsSectionSharedProps = $props();
|
||||
|
||||
let devApiBaseInput = $state<string>(getStoredOverride() ?? "");
|
||||
let devApiBaseActive = $state<string | null>(getStoredOverride());
|
||||
|
||||
function applyDevApiBase() {
|
||||
const trimmed = devApiBaseInput.trim();
|
||||
if (trimmed === "") {
|
||||
setApiBase(null);
|
||||
devApiBaseActive = null;
|
||||
return;
|
||||
}
|
||||
if (!/^https?:\/\//.test(trimmed)) {
|
||||
alert("Please enter a full URL starting with http:// or https://");
|
||||
return;
|
||||
}
|
||||
setApiBase(trimmed);
|
||||
devApiBaseActive = trimmed.replace(/\/$/, "");
|
||||
}
|
||||
|
||||
function clearDevApiBase() {
|
||||
devApiBaseInput = "";
|
||||
setApiBase(null);
|
||||
devApiBaseActive = null;
|
||||
}
|
||||
|
||||
async function exportCloudSettingsJsonToFile() {
|
||||
const payload = await getSnapshotForUpload();
|
||||
const blob = new Blob([JSON.stringify(payload, null, 2)], {
|
||||
type: "application/json",
|
||||
});
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = `betterseqta-plus-settings-export-${new Date().toISOString().replace(/[:.]/g, "-")}.json`;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
</script>
|
||||
|
||||
<SettingRow
|
||||
title="BetterSEQTA+"
|
||||
description="Enables BetterSEQTA+ features"
|
||||
id={12}
|
||||
Component={Switch}
|
||||
{searchQuery}
|
||||
props={{
|
||||
state: $settingsState.onoff,
|
||||
onChange: (isOn: boolean) => (settingsState.onoff = isOn),
|
||||
}}
|
||||
/>
|
||||
|
||||
{#if $settingsState.devMode && matchesSearch(
|
||||
searchQuery,
|
||||
"Developer Mode",
|
||||
"Verbose logging",
|
||||
"Delay loading screen",
|
||||
"Sensitive Hider",
|
||||
"Mock Notices",
|
||||
"Show Privacy Notification",
|
||||
"Show Theme of the Month",
|
||||
"Export cloud settings JSON",
|
||||
"API Base URL",
|
||||
"GitHub latest version override",
|
||||
)}
|
||||
<div
|
||||
class="flex-col p-1 my-1 bg-gradient-to-br from-white rounded-xl border shadow-sm to-zinc-100 border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
|
||||
>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Developer Mode</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Enables developer mode, allowing you to test new features and changes.
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.devMode}
|
||||
onChange={(isOn: boolean) => (settingsState.devMode = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Verbose logging</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Show diagnostic console output (indexer, theme manager, timetable colour patch, etc.)
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.verboseLogging ?? false}
|
||||
onChange={(isOn: boolean) => (settingsState.verboseLogging = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Delay loading screen</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Keep the loading overlay visible for 5 extra seconds so you can preview canvas variants.
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.devDelayLoadingScreen ?? false}
|
||||
onChange={(isOn: boolean) => (settingsState.devDelayLoadingScreen = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Sensitive Hider</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Replace sensitive content with mock data
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.hideSensitiveContent ?? false}
|
||||
onChange={(isOn: boolean) => (settingsState.hideSensitiveContent = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Mock Notices</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Use fake notice data on homepage instead of real data
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.mockNotices ?? false}
|
||||
onChange={(isOn: boolean) => (settingsState.mockNotices = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Show Privacy Notification</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Show the privacy notification popup on next page load
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
settingsState.privacyStatementShown = false;
|
||||
settingsState.privacyStatementLastUpdated = undefined;
|
||||
closeExtensionPopup();
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
await showPrivacyNotification();
|
||||
}}
|
||||
text="Show Now"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Show Theme of the Month</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Fetch and show the current month's popup now (ignores dismissed state)
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
closeExtensionPopup();
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
await showThemeOfTheMonthPopupNow();
|
||||
}}
|
||||
text="Show Now"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Export cloud settings JSON</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Download the same payload as cloud sync (OAuth tokens stripped). For debugging and server
|
||||
testing.
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Button onClick={exportCloudSettingsJsonToFile} text="Export to file" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 px-4 py-3">
|
||||
<div class="flex justify-between items-start gap-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">API Base URL (session only)</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Override the content API host for this browser session. Cleared on restart. Affects
|
||||
themes, theme of the month, and other server-driven content.
|
||||
</p>
|
||||
{#if devApiBaseActive}
|
||||
<p class="text-xs mt-1 text-amber-600 dark:text-amber-400">
|
||||
Override active: <span class="font-mono">{devApiBaseActive}</span>
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2 items-center">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="https://betterseqta.org"
|
||||
bind:value={devApiBaseInput}
|
||||
class="flex-1 px-2 py-1 text-xs rounded border bg-white dark:bg-zinc-800 border-zinc-300 dark:border-zinc-700 text-zinc-900 dark:text-zinc-100"
|
||||
/>
|
||||
<Button onClick={applyDevApiBase} text="Apply" />
|
||||
{#if devApiBaseActive}
|
||||
<Button onClick={clearDevApiBase} text="Clear" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 px-4 py-3">
|
||||
<div>
|
||||
<h2 class="text-xl font-bold">GitHub latest version override</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Pretend a newer GitHub release exists to test the update badge. Only applies when dev mode
|
||||
is on.
|
||||
</p>
|
||||
</div>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="e.g. 9.9.9"
|
||||
value={$settingsState.devGhReleaseVersionOverride ?? ""}
|
||||
oninput={(e) => {
|
||||
settingsState.devGhReleaseVersionOverride = e.currentTarget.value;
|
||||
}}
|
||||
class="px-2 py-1 text-xs rounded border bg-white dark:bg-zinc-800 border-zinc-300 dark:border-zinc-700 text-zinc-900 dark:text-zinc-100"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -0,0 +1,105 @@
|
||||
<script lang="ts">
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import PickerSwatch from "@/interface/components/PickerSwatch.svelte";
|
||||
import SidebarAppearance from "@/interface/components/SidebarAppearance.svelte";
|
||||
import SettingRow from "../SettingRow.svelte";
|
||||
import PluginSettingsBlocks from "../PluginSettingsBlocks.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import { matchesSearch, type SettingsSectionSharedProps } from "../shared";
|
||||
|
||||
let {
|
||||
showColourPicker,
|
||||
showFontPicker,
|
||||
showDisclaimer,
|
||||
searchQuery = "",
|
||||
}: SettingsSectionSharedProps = $props();
|
||||
|
||||
const isEngage = isSeqtaEngageExperience();
|
||||
</script>
|
||||
|
||||
{#each [
|
||||
{
|
||||
title: "Custom Theme Colour",
|
||||
description: "Customise the overall theme colour of SEQTA Learn",
|
||||
id: 4,
|
||||
Component: PickerSwatch,
|
||||
props: { onClick: showColourPicker },
|
||||
},
|
||||
{
|
||||
title: "Interface Font",
|
||||
description: "Choose the typeface used across SEQTA Learn",
|
||||
id: 16,
|
||||
Component: Button,
|
||||
props: { onClick: showFontPicker, text: "Change" },
|
||||
},
|
||||
] as option (option.id)}
|
||||
<SettingRow {...option} {searchQuery} />
|
||||
{/each}
|
||||
|
||||
{#if !isEngage && matchesSearch(searchQuery, "Sidebar Style", "Item Size", "Corner Radius", "Active Indicator", "Sidebar Position", "Sidebar Width", "Transparency Effects", "Blur Strength")}
|
||||
<div class="border-none">
|
||||
<SidebarAppearance />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if matchesSearch(searchQuery, "Adaptive Theme Colour", "Soft Gradient", "Smooth colour transition")}
|
||||
<div class="border-none">
|
||||
<div
|
||||
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
|
||||
>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Adaptive Theme Colour</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Change the theme colour based on the current class (e.g. when viewing a course or
|
||||
assessments page)
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeColour ?? false}
|
||||
onChange={(isOn: boolean) => (settingsState.adaptiveThemeColour = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{#if $settingsState.adaptiveThemeColour}
|
||||
<div
|
||||
class="flex justify-between items-center px-5 py-4 pl-7 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Soft Gradient</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Use a soft gradient instead of a solid colour when viewing a class
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeGradient ?? false}
|
||||
onChange={(isOn: boolean) => (settingsState.adaptiveThemeGradient = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-5 py-4 pl-7 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Smooth colour transition</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Ease between class/subject colours when navigating instead of switching instantly
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeColourTransition ?? true}
|
||||
onChange={(isOn: boolean) => (settingsState.adaptiveThemeColourTransition = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<PluginSettingsBlocks section="appearance" {showDisclaimer} {searchQuery} />
|
||||
@@ -0,0 +1,244 @@
|
||||
<script lang="ts">
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import Select from "@/interface/components/Select.svelte";
|
||||
import SettingRow from "../SettingRow.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import {
|
||||
PERFORMANCE_HEAVY_PLUGINS,
|
||||
setPerformanceModePluginOverride,
|
||||
} from "@/seqta/utils/performanceMode";
|
||||
import browser from "webextension-polyfill";
|
||||
import { matchesSearch, type SettingsSectionSharedProps } from "../shared";
|
||||
|
||||
let { searchQuery = "" }: SettingsSectionSharedProps = $props();
|
||||
|
||||
const isEngage = isSeqtaEngageExperience();
|
||||
|
||||
const generalOptions = $derived([
|
||||
{
|
||||
title: "Performance Mode",
|
||||
description:
|
||||
"Pauses heavy plugins, disables blur, and uses shorter smooth animations while SEQTA is open",
|
||||
id: 0,
|
||||
Component: Switch,
|
||||
props: {
|
||||
state: $settingsState.performanceMode ?? false,
|
||||
onChange: (isOn: boolean) => (settingsState.performanceMode = isOn),
|
||||
},
|
||||
},
|
||||
...(!isEngage
|
||||
? [
|
||||
{
|
||||
title: "Edit Sidebar Layout",
|
||||
description: "Reorder pages on the sidebar",
|
||||
id: 5,
|
||||
Component: Button,
|
||||
props: {
|
||||
onClick: () =>
|
||||
browser.runtime.sendMessage({ type: "currentTab", info: "EditSidebar" }),
|
||||
text: "Edit",
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Icon Only Sidebar",
|
||||
description: "Show only icons in the sidebar for a compact layout",
|
||||
id: 14,
|
||||
Component: Switch,
|
||||
props: {
|
||||
state: $settingsState.iconOnlySidebar ?? false,
|
||||
onChange: (isOn: boolean) => (settingsState.iconOnlySidebar = isOn),
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
title: "Animations",
|
||||
description: "Enable animations on certain pages",
|
||||
id: 6,
|
||||
Component: Switch,
|
||||
props: {
|
||||
state: $settingsState.animations,
|
||||
onChange: (isOn: boolean) => (settingsState.animations = isOn),
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "12 Hour Time",
|
||||
description: "Prefer 12 hour time format for SEQTA",
|
||||
id: 9,
|
||||
Component: Switch,
|
||||
props: {
|
||||
state: $settingsState.timeFormat === "12",
|
||||
onChange: (isOn: boolean) => (settingsState.timeFormat = isOn ? "12" : "24"),
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Default Page",
|
||||
description: "Choose which page loads first when you open SEQTA",
|
||||
id: 10,
|
||||
Component: Select,
|
||||
props: {
|
||||
value: $settingsState.defaultPage ?? "home",
|
||||
onChange: (value: string) => (settingsState.defaultPage = value),
|
||||
options: isEngage
|
||||
? [
|
||||
{ value: "home", label: "Home" },
|
||||
{ value: "dashboard", label: "Dashboard" },
|
||||
{ value: "timetable", label: "Timetable" },
|
||||
{ value: "messages", label: "Messages" },
|
||||
{ value: "documents", label: "Documents" },
|
||||
{ value: "reports", label: "Reports" },
|
||||
]
|
||||
: [
|
||||
{ value: "home", label: "Home" },
|
||||
{ value: "dashboard", label: "Dashboard" },
|
||||
{ value: "timetable", label: "Timetable" },
|
||||
{ value: "welcome", label: "Welcome" },
|
||||
{ value: "messages", label: "Messages" },
|
||||
{ value: "documents", label: "Documents" },
|
||||
{ value: "reports", label: "Reports" },
|
||||
],
|
||||
},
|
||||
},
|
||||
...(!isEngage
|
||||
? [
|
||||
{
|
||||
title: "News Feed Source",
|
||||
description: "Choose the sources for your news feed",
|
||||
id: 11,
|
||||
Component: Select,
|
||||
props: {
|
||||
value: $settingsState.newsSource,
|
||||
onChange: (value: string) => (settingsState.newsSource = value),
|
||||
options: [
|
||||
{ value: "australia", label: "Australia" },
|
||||
{ value: "usa", label: "USA" },
|
||||
{ value: "uk", label: "UK" },
|
||||
{ value: "taiwan", label: "Taiwan" },
|
||||
{ value: "hong_kong", label: "Hong Kong" },
|
||||
{ value: "panama", label: "Panama" },
|
||||
{ value: "canada", label: "Canada" },
|
||||
{ value: "singapore", label: "Singapore" },
|
||||
{ value: "japan", label: "Japan" },
|
||||
{ value: "netherlands", label: "Netherlands" },
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
]);
|
||||
</script>
|
||||
|
||||
{#each generalOptions as option (option.id)}
|
||||
<SettingRow {...option} {searchQuery} />
|
||||
{#if option.id === 0 && $settingsState.performanceMode && matchesSearch(searchQuery, "Performance Mode", "Global Search", "Assessment Averages", "enable anyway", "paused")}
|
||||
<div class="border-none -mt-px">
|
||||
<div
|
||||
class="mx-5 mb-4 rounded-xl border border-zinc-200/80 bg-zinc-50/80 px-4 py-3 dark:border-zinc-700/60 dark:bg-zinc-900/40"
|
||||
>
|
||||
<p class="mb-3 text-sm font-medium text-zinc-500 dark:text-zinc-400">
|
||||
Paused for performance — enable anyway:
|
||||
</p>
|
||||
<div class="space-y-3">
|
||||
{#each PERFORMANCE_HEAVY_PLUGINS as heavy (heavy.id)}
|
||||
<div class="flex justify-between items-center gap-4">
|
||||
<div class="min-w-0">
|
||||
<p class="text-sm font-semibold text-zinc-800 dark:text-zinc-100">{heavy.name}</p>
|
||||
<p class="text-xs text-zinc-500 dark:text-zinc-400">{heavy.description}</p>
|
||||
</div>
|
||||
<Switch
|
||||
state={$settingsState.performanceModePluginOverrides?.[heavy.id] === true}
|
||||
onChange={(forceOn: boolean) => setPerformanceModePluginOverride(heavy.id, forceOn)}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
{#if matchesSearch(
|
||||
searchQuery,
|
||||
"Home Page Assessments",
|
||||
"Include Past Assessments",
|
||||
"Maximum Subjects",
|
||||
"Maximum Assessments per Subject",
|
||||
)}
|
||||
<div class="border-none">
|
||||
<div
|
||||
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
|
||||
>
|
||||
<div class="flex justify-between items-center px-5 py-4">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Home Page Assessments</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Limit upcoming assessments shown on the home page by subject
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-5 py-4 pl-7 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Include Past Assessments</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Show past-due assessments from the upcoming list, matching the Assessments page
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.homeUpcomingIncludePast ?? true}
|
||||
onChange={(isOn: boolean) => (settingsState.homeUpcomingIncludePast = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-5 py-4 pl-7 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Maximum Subjects</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Number of subjects to include, ordered by soonest due date
|
||||
</p>
|
||||
</div>
|
||||
<Select
|
||||
value={String($settingsState.homeUpcomingSubjectsMax ?? 5)}
|
||||
onChange={(value: string) => (settingsState.homeUpcomingSubjectsMax = Number(value))}
|
||||
options={[
|
||||
{ value: "0", label: "All" },
|
||||
{ value: "3", label: "3" },
|
||||
{ value: "5", label: "5" },
|
||||
{ value: "7", label: "7" },
|
||||
{ value: "10", label: "10" },
|
||||
{ value: "15", label: "15" },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-5 py-4 pl-7 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-xl font-bold">Maximum Assessments per Subject</h2>
|
||||
<p class="text-base text-zinc-600 dark:text-zinc-300">
|
||||
Assessments shown for each included subject
|
||||
</p>
|
||||
</div>
|
||||
<Select
|
||||
value={String($settingsState.homeUpcomingAssessmentsPerSubjectMax ?? 0)}
|
||||
onChange={(value: string) =>
|
||||
(settingsState.homeUpcomingAssessmentsPerSubjectMax = Number(value))}
|
||||
options={[
|
||||
{ value: "0", label: "All" },
|
||||
{ value: "1", label: "1" },
|
||||
{ value: "2", label: "2" },
|
||||
{ value: "3", label: "3" },
|
||||
{ value: "5", label: "5" },
|
||||
{ value: "10", label: "10" },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -0,0 +1,12 @@
|
||||
<script lang="ts">
|
||||
import PluginSettingsBlocks from "../PluginSettingsBlocks.svelte";
|
||||
import type { SettingsSectionId, SettingsSectionSharedProps } from "../shared";
|
||||
|
||||
let {
|
||||
section,
|
||||
showDisclaimer,
|
||||
searchQuery = "",
|
||||
}: SettingsSectionSharedProps & { section: SettingsSectionId } = $props();
|
||||
</script>
|
||||
|
||||
<PluginSettingsBlocks {section} {showDisclaimer} {searchQuery} />
|
||||
@@ -0,0 +1,47 @@
|
||||
export const ALL_SETTINGS_SECTIONS = [
|
||||
"account",
|
||||
"general",
|
||||
"appearance",
|
||||
"timetable",
|
||||
"assessments",
|
||||
"features",
|
||||
"advanced",
|
||||
] as const;
|
||||
|
||||
export type SettingsSectionId = (typeof ALL_SETTINGS_SECTIONS)[number];
|
||||
|
||||
export type SettingsSectionSharedProps = {
|
||||
showColourPicker: () => void;
|
||||
showFontPicker: () => void;
|
||||
showDisclaimer: (
|
||||
onConfirm: () => void,
|
||||
onCancel: () => void,
|
||||
title?: string,
|
||||
message?: string,
|
||||
) => void;
|
||||
showCloudPanel: () => void;
|
||||
searchQuery?: string;
|
||||
};
|
||||
|
||||
export function matchesSearch(
|
||||
searchQuery: string,
|
||||
...parts: Array<string | undefined>
|
||||
): boolean {
|
||||
const q = searchQuery.trim().toLowerCase();
|
||||
return !q || parts.some((part) => part?.toLowerCase().includes(q));
|
||||
}
|
||||
|
||||
export const PLUGIN_SECTION_BY_ID: Record<string, SettingsSectionId> = {
|
||||
"profile-picture": "account",
|
||||
"animated-background": "appearance",
|
||||
"background-music": "appearance",
|
||||
timetable: "timetable",
|
||||
timetableEdit: "timetable",
|
||||
"assessments-overview": "assessments",
|
||||
"assessments-average": "assessments",
|
||||
"grade-analytics": "assessments",
|
||||
"global-search": "features",
|
||||
"enhanced-navigation": "features",
|
||||
messageFolders: "features",
|
||||
notificationCollector: "features",
|
||||
};
|
||||
@@ -5,6 +5,9 @@
|
||||
import { onMount } from 'svelte';
|
||||
import Shortcuts from "@/seqta/content/links.json"
|
||||
|
||||
let { searchQuery = "" } = $props<{ searchQuery?: string }>();
|
||||
const q = $derived(searchQuery.trim().toLowerCase());
|
||||
|
||||
let isLoaded = $state(false);
|
||||
let fileInput = $state<HTMLInputElement | null>(null);
|
||||
|
||||
@@ -106,6 +109,7 @@
|
||||
|
||||
<div class="flex flex-col pt-4 divide-y divide-zinc-100 dark:divide-zinc-700">
|
||||
{#if isLoaded}
|
||||
{#if !q}
|
||||
<div>
|
||||
<MotionDiv
|
||||
initial={{ opacity: 0, height: 0 }}
|
||||
@@ -207,9 +211,11 @@
|
||||
</button>
|
||||
</MotionDiv>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Custom Shortcuts Section -->
|
||||
{#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)}>
|
||||
@@ -218,9 +224,11 @@
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
{#each Object.entries(Shortcuts) as shortcut}
|
||||
{#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 -->
|
||||
@@ -228,6 +236,7 @@
|
||||
</div>
|
||||
<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">
|
||||
|
||||
@@ -184,11 +184,18 @@
|
||||
window.addEventListener('bsplus:highlight-theme', onHighlightThemeEvent);
|
||||
themeUpdates.addListener(fetchCurrentThemes);
|
||||
|
||||
await fetchThemes();
|
||||
await fetchCurrentThemes();
|
||||
|
||||
const pending = consumePendingHighlightThemeId();
|
||||
if (pending) focusThemeById(pending);
|
||||
const load = async () => {
|
||||
await fetchThemes();
|
||||
await fetchCurrentThemes();
|
||||
const pending = consumePendingHighlightThemeId();
|
||||
if (pending) focusThemeById(pending);
|
||||
};
|
||||
|
||||
if (typeof requestIdleCallback === "function") {
|
||||
requestIdleCallback(() => void load(), { timeout: 2500 });
|
||||
} else {
|
||||
void load();
|
||||
}
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('bsplus:highlight-theme', onHighlightThemeEvent);
|
||||
|
||||
@@ -5,8 +5,6 @@ import {
|
||||
getThemeApplyButtonStyles,
|
||||
getCommunityInstalledThemeIds,
|
||||
getStoreInstalledThemeIds,
|
||||
isDownloadedTheme,
|
||||
isLocalCustomTheme,
|
||||
isStoreThemeInstalled,
|
||||
resolveLocalThemeInstallId,
|
||||
resolveStoreVariantAccentColor,
|
||||
@@ -35,46 +33,16 @@ function makeStoreTheme(overrides: Partial<Theme> & Pick<Theme, 'id' | 'name'>):
|
||||
};
|
||||
}
|
||||
|
||||
describe('isLocalCustomTheme', () => {
|
||||
it('returns true for file imports and theme creator saves', () => {
|
||||
expect(isLocalCustomTheme(makeCustomTheme({ id: 'a', name: 'A' }))).toBe(true);
|
||||
expect(
|
||||
isLocalCustomTheme(
|
||||
makeCustomTheme({ id: 'b', name: 'B', installedFromStore: false }),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false for store and community installs', () => {
|
||||
expect(
|
||||
isLocalCustomTheme(
|
||||
makeCustomTheme({ id: 's', name: 'S', installedFromStore: true }),
|
||||
),
|
||||
).toBe(false);
|
||||
expect(
|
||||
isLocalCustomTheme(
|
||||
makeCustomTheme({ id: 'c', name: 'C', installedFromCommunity: true }),
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveLocalThemeInstallId', () => {
|
||||
it('keeps the id for store installs', () => {
|
||||
it('keeps store ids and forks local imports that collide with store copies', () => {
|
||||
expect(resolveLocalThemeInstallId('theme-1', null, true, false)).toBe('theme-1');
|
||||
});
|
||||
|
||||
it('generates a new id when a local import collides with a store copy', () => {
|
||||
const nextId = resolveLocalThemeInstallId(
|
||||
const forked = resolveLocalThemeInstallId(
|
||||
'theme-1',
|
||||
makeCustomTheme({ id: 'theme-1', name: 'Store', installedFromStore: true }),
|
||||
false,
|
||||
false,
|
||||
);
|
||||
expect(nextId).not.toBe('theme-1');
|
||||
});
|
||||
|
||||
it('keeps the id when replacing an existing local copy', () => {
|
||||
expect(forked).not.toBe('theme-1');
|
||||
expect(
|
||||
resolveLocalThemeInstallId(
|
||||
'theme-1',
|
||||
@@ -98,116 +66,58 @@ describe('filterThemesByMode', () => {
|
||||
installedFromCommunity: true,
|
||||
});
|
||||
const localTheme = makeCustomTheme({ id: 'local-1', name: 'Local Theme' });
|
||||
const fileImport = makeCustomTheme({
|
||||
id: 'file-1',
|
||||
name: 'Imported Theme',
|
||||
installedFromStore: false,
|
||||
isEditable: false,
|
||||
});
|
||||
|
||||
it('returns all themes in all mode', () => {
|
||||
expect(filterThemesByMode([storeTheme, localTheme], 'all')).toEqual([storeTheme, localTheme]);
|
||||
});
|
||||
|
||||
it('returns store and community themes in downloaded mode', () => {
|
||||
expect(
|
||||
filterThemesByMode([storeTheme, communityTheme, localTheme, fileImport], 'downloaded'),
|
||||
).toEqual([storeTheme, communityTheme]);
|
||||
});
|
||||
|
||||
it('returns local/file themes in custom mode', () => {
|
||||
expect(
|
||||
filterThemesByMode([storeTheme, communityTheme, localTheme, fileImport], 'custom'),
|
||||
).toEqual([localTheme, fileImport]);
|
||||
});
|
||||
|
||||
it('isDownloadedTheme is the inverse of isLocalCustomTheme for known sources', () => {
|
||||
expect(isDownloadedTheme(storeTheme)).toBe(true);
|
||||
expect(isLocalCustomTheme(storeTheme)).toBe(false);
|
||||
expect(isDownloadedTheme(localTheme)).toBe(false);
|
||||
expect(isLocalCustomTheme(localTheme)).toBe(true);
|
||||
it('splits store, community, and local themes by mode', () => {
|
||||
const all = [storeTheme, communityTheme, localTheme];
|
||||
expect(filterThemesByMode(all, 'all')).toEqual(all);
|
||||
expect(filterThemesByMode(all, 'downloaded')).toEqual([storeTheme, communityTheme]);
|
||||
expect(filterThemesByMode(all, 'custom')).toEqual([localTheme]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getStoreInstalledThemeIds', () => {
|
||||
it('returns only store-installed theme ids', () => {
|
||||
describe('installed theme id helpers', () => {
|
||||
it('returns store-only and community-only ids', () => {
|
||||
const themes = [
|
||||
makeCustomTheme({ id: 'store-1', name: 'Store', installedFromStore: true }),
|
||||
makeCustomTheme({ id: 'local-1', name: 'Local' }),
|
||||
makeCustomTheme({
|
||||
id: 'same-as-store',
|
||||
name: 'Imported copy',
|
||||
installedFromStore: false,
|
||||
}),
|
||||
];
|
||||
expect(getStoreInstalledThemeIds(themes)).toEqual(['store-1']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getCommunityInstalledThemeIds', () => {
|
||||
it('returns only community-installed theme ids', () => {
|
||||
const themes = [
|
||||
makeCustomTheme({ id: 'community-1', name: 'Community', installedFromCommunity: true }),
|
||||
makeCustomTheme({ id: 'local-1', name: 'Local' }),
|
||||
];
|
||||
expect(getStoreInstalledThemeIds(themes)).toEqual(['store-1']);
|
||||
expect(getCommunityInstalledThemeIds(themes)).toEqual(['community-1']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isStoreThemeInstalled', () => {
|
||||
it('returns true when master id is installed', () => {
|
||||
const theme = makeStoreTheme({ id: 'master-1', name: 'Master' });
|
||||
it('matches master or flavour ids', () => {
|
||||
const theme = makeStoreTheme({
|
||||
id: 'master-1',
|
||||
name: 'Master',
|
||||
flavours: [{ id: 'flavour-1', name: 'Dark', accent_color: '#000', cover_image: '' }],
|
||||
});
|
||||
expect(isStoreThemeInstalled(theme, ['master-1'])).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true when a flavour id is installed', () => {
|
||||
const theme = makeStoreTheme({
|
||||
id: 'master-1',
|
||||
name: 'Master',
|
||||
flavours: [{ id: 'flavour-1', name: 'Dark', accent_color: '#000', cover_image: '' }],
|
||||
});
|
||||
expect(isStoreThemeInstalled(theme, ['flavour-1'])).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false when neither master nor flavours are installed', () => {
|
||||
const theme = makeStoreTheme({
|
||||
id: 'master-1',
|
||||
name: 'Master',
|
||||
flavours: [{ id: 'flavour-1', name: 'Dark', accent_color: '#000', cover_image: '' }],
|
||||
});
|
||||
expect(isStoreThemeInstalled(theme, ['other-theme'])).toBe(false);
|
||||
expect(isStoreThemeInstalled(theme, ['other'])).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveStoreVariantAccentColor', () => {
|
||||
it('prefers installed theme colour for the variant id', () => {
|
||||
const theme = makeStoreTheme({
|
||||
id: 'master-1',
|
||||
name: 'Master',
|
||||
flavours: [{ id: 'flavour-1', name: 'Dark', accent_color: '#111111', cover_image: '' }],
|
||||
});
|
||||
expect(resolveStoreVariantAccentColor(theme, 'flavour-1', { 'flavour-1': '#ff0000' })).toBe('#ff0000');
|
||||
});
|
||||
|
||||
it('falls back to flavour accent when not installed locally', () => {
|
||||
it('prefers installed colours then flavour accents', () => {
|
||||
const theme = makeStoreTheme({
|
||||
id: 'master-1',
|
||||
name: 'Master',
|
||||
flavours: [{ id: 'flavour-1', name: 'Dark', accent_color: '#112233', cover_image: '' }],
|
||||
});
|
||||
expect(resolveStoreVariantAccentColor(theme, 'flavour-1', { 'flavour-1': '#ff0000' })).toBe(
|
||||
'#ff0000',
|
||||
);
|
||||
expect(resolveStoreVariantAccentColor(theme, 'flavour-1')).toBe('#112233');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getThemeApplyButtonStyles', () => {
|
||||
it('uses the theme accent as the apply button background', () => {
|
||||
it('derives apply and applied styles from the accent colour', () => {
|
||||
const styles = getThemeApplyButtonStyles('#ff0000');
|
||||
expect(styles.apply).toContain('background-color: #FF0000');
|
||||
});
|
||||
|
||||
it('uses a muted version of the accent for the applied state', () => {
|
||||
const styles = getThemeApplyButtonStyles('#ff0000');
|
||||
expect(styles.applied).toContain('background-color:');
|
||||
expect(styles.applied).toContain('color: #FF0000');
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as pdfjs from "pdfjs-dist";
|
||||
import browser from "webextension-polyfill";
|
||||
|
||||
/** Static copies in `src/public` (see `scripts/copy-pdfjs-assets.mjs`, manifest web_accessible_resources). */
|
||||
/** Static copies in `src/public` (see `scripts/copy-runtime-assets.mjs`, manifest web_accessible_resources). */
|
||||
const PDF_WORKER_RESOURCE = "resources/pdfjs/pdf.worker.min.mjs";
|
||||
const PDF_LEGACY_RESOURCE = "resources/pdfjs/pdf.legacy.min.mjs";
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"64": "resources/icons/icon-64.png"
|
||||
}
|
||||
},
|
||||
"permissions": ["tabs", "notifications", "storage", "identity", "alarms"],
|
||||
"permissions": ["tabs", "notifications", "storage", "alarms"],
|
||||
"host_permissions": [
|
||||
"https://newsapi.org/",
|
||||
"https://betterseqta.org/",
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
syncAnimatedBackground,
|
||||
updateAnimationSpeed,
|
||||
} from "./backgroundLayers";
|
||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
const settings = defineSettings({
|
||||
speed: numberSetting({
|
||||
@@ -40,6 +41,11 @@ const animatedBackgroundPlugin: Plugin<typeof settings> = {
|
||||
settings: instance.settings,
|
||||
|
||||
run: async (api) => {
|
||||
if (isPerformanceMode()) {
|
||||
removeAnimatedBackgroundLayers();
|
||||
return () => removeAnimatedBackgroundLayers();
|
||||
}
|
||||
|
||||
await syncAnimatedBackground(api);
|
||||
const resync = () => void syncAnimatedBackground(api);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
import styles from "./styles.css?inline";
|
||||
import BackgroundMusicSetting from "./BackgroundMusicSetting.svelte";
|
||||
import localforage from "localforage";
|
||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
const settings = defineSettings({
|
||||
uploader: componentSetting({
|
||||
@@ -187,6 +188,10 @@ const backgroundMusicPlugin: Plugin<typeof settings> = {
|
||||
defaultEnabled: false,
|
||||
|
||||
run: async (api) => {
|
||||
if (isPerformanceMode()) {
|
||||
return () => stopAudio();
|
||||
}
|
||||
|
||||
await api.storage.loaded;
|
||||
|
||||
type BgSettings = { volume?: number; pauseOnHidden?: boolean };
|
||||
|
||||
@@ -24,6 +24,8 @@ const REBRANDED_404_BODY = `
|
||||
<div class="message">
|
||||
<h1>Page not found</h1>
|
||||
<p>We can't find the page you're looking for.</p>
|
||||
<p>It may have been moved, deleted or the link might be out of date.</p>
|
||||
<p>Ref: 404</p>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -63,6 +65,23 @@ describe("errorPageKitten", () => {
|
||||
expect(isSeqta404Page()).toBe(false);
|
||||
});
|
||||
|
||||
it("does not detect generic 404 pages on other sites", () => {
|
||||
document.title = "404 - Not Found";
|
||||
document.body.innerHTML = `
|
||||
<div class="message">
|
||||
<h1>Page not found</h1>
|
||||
<p>Sorry, this page does not exist.</p>
|
||||
</div>
|
||||
`;
|
||||
expect(isSeqta404Page()).toBe(false);
|
||||
});
|
||||
|
||||
it("does not treat a 404 title alone as SEQTA", () => {
|
||||
document.title = "Error 404";
|
||||
document.body.innerHTML = "<p>Not found</p>";
|
||||
expect(isSeqta404Page()).toBe(false);
|
||||
});
|
||||
|
||||
it("plugin run is a no-op outside a 404 page", async () => {
|
||||
document.title = "SEQTA Learn";
|
||||
document.body.innerHTML = '<div id="container"></div>';
|
||||
|
||||
@@ -16,12 +16,36 @@ const CARD_HTML = `<h1>404 Not Found</h1>
|
||||
</div>
|
||||
<a href="http://www.seqta.com.au">SEQTA</a>`;
|
||||
|
||||
function normalizePageText(text: string): string {
|
||||
return text
|
||||
.replace(/[\u2018\u2019]/g, "'")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
/** Fingerprints SEQTA's rebranded standalone 404 — not generic site 404s. */
|
||||
function isSeqtaRebranded404Message(message: Element): boolean {
|
||||
const heading = message.querySelector("h1");
|
||||
if (normalizePageText(heading?.textContent ?? "").toLowerCase() !== "page not found") {
|
||||
return false;
|
||||
}
|
||||
|
||||
const body = normalizePageText(message.textContent ?? "");
|
||||
return (
|
||||
body.includes("We can't find the page you're looking for") &&
|
||||
body.includes(
|
||||
"It may have been moved, deleted or the link might be out of date.",
|
||||
) &&
|
||||
body.includes("Ref: 404")
|
||||
);
|
||||
}
|
||||
|
||||
/** Standalone SEQTA 404 document — not the SPA (#container). */
|
||||
export function isSeqta404Page(): boolean {
|
||||
if (document.getElementById("container")) return false;
|
||||
const heading = document.querySelector(".message > h1");
|
||||
const text = heading?.textContent ?? document.title;
|
||||
return /not found/i.test(text) || /404/.test(document.title);
|
||||
const message = document.querySelector(".message");
|
||||
if (!message) return false;
|
||||
return isSeqtaRebranded404Message(message);
|
||||
}
|
||||
|
||||
export function mountErrorPageKitten(): () => void {
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
isValidHotkey,
|
||||
} from "./src/utils/hotkeyUtils";
|
||||
import { titleBarState } from "@/seqta/ui/titlebar/titleBarState.svelte";
|
||||
import { isPluginAllowedInPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
const settings = defineSettings({
|
||||
searchHotkey: hotkeySetting({
|
||||
@@ -91,6 +92,7 @@ const runGlobalSearch = globalSearchPlugin.run!;
|
||||
|
||||
globalSearchPlugin.run = async (api) => {
|
||||
if (isSeqtaEngageExperience() || isSeqtaLoginPage()) return () => {};
|
||||
if (!isPluginAllowedInPerformanceMode("global-search")) return () => {};
|
||||
|
||||
// Eager chrome (like Analytics menu injection) — heavy chunk loads behind it.
|
||||
const hotkey = isValidHotkey(api.settings.searchHotkey ?? "")
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
getStoredPassiveItems,
|
||||
installPassiveObserver,
|
||||
} from "../indexing/passiveObserver";
|
||||
import { globalSearchIndexingEnabled } from "@/seqta/utils/performanceMode";
|
||||
|
||||
function scheduleIdleIndexing(run: () => void): void {
|
||||
if (typeof requestIdleCallback === "function") {
|
||||
@@ -83,7 +84,7 @@ const globalSearchPlugin: Plugin<{}> = {
|
||||
(await import("../indexing/selfTests")).runGlobalSearchSelfTests(),
|
||||
};
|
||||
|
||||
if (api.settings.passiveIndexing) {
|
||||
if (globalSearchIndexingEnabled(!!api.settings.passiveIndexing)) {
|
||||
try {
|
||||
installPassiveObserver();
|
||||
} catch (error) {
|
||||
@@ -91,7 +92,10 @@ const globalSearchPlugin: Plugin<{}> = {
|
||||
}
|
||||
}
|
||||
|
||||
if (api.settings.runIndexingOnLoad && !isIndexingPaused()) {
|
||||
if (
|
||||
globalSearchIndexingEnabled(!!api.settings.runIndexingOnLoad) &&
|
||||
!isIndexingPaused()
|
||||
) {
|
||||
scheduleIdleIndexing(() => {
|
||||
if (!isIndexingPaused()) void runIndexing();
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import { unmount } from "svelte";
|
||||
import { warmUpVectorSearchOnInteraction } from "../search/vector/vectorSearch";
|
||||
import { formatHotkeyForDisplay, isValidHotkey } from "../utils/hotkeyUtils";
|
||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||
import { transparencyEnabled } from "@/seqta/utils/performanceMode";
|
||||
import browser from "webextension-polyfill";
|
||||
|
||||
type AppRef = {
|
||||
@@ -295,7 +296,7 @@ export async function mountSearchBar(
|
||||
SearchBar,
|
||||
searchRoot.attachShadow({ mode: "open" }),
|
||||
{
|
||||
transparencyEffects: api.settings.transparencyEffects,
|
||||
transparencyEffects: transparencyEnabled(),
|
||||
showRecentFirst: api.settings.showRecentFirst,
|
||||
searchHotkey: currentHotkey,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@ const VERSION_KEY = "betterseqta-index-version";
|
||||
|
||||
let dbPromise: Promise<IDBDatabase> | null = null;
|
||||
let cachedDb: IDBDatabase | null = null;
|
||||
let upgradeChain: Promise<void> = Promise.resolve();
|
||||
|
||||
function getCurrentVersion(): number {
|
||||
const storedVersion = localStorage.getItem(VERSION_KEY);
|
||||
@@ -180,48 +181,161 @@ function idbRequest<T>(request: IDBRequest<T>): Promise<T> {
|
||||
});
|
||||
}
|
||||
|
||||
async function objectStore(
|
||||
function runStoreTransaction(
|
||||
db: IDBDatabase,
|
||||
store: string,
|
||||
mode: IDBTransactionMode = "readonly",
|
||||
): Promise<IDBObjectStore> {
|
||||
const db = await openDB();
|
||||
mode: IDBTransactionMode,
|
||||
run: (objectStore: IDBObjectStore) => void | Promise<void>,
|
||||
): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const tx = db.transaction(store, mode);
|
||||
const objectStoreRef = tx.objectStore(store);
|
||||
|
||||
if (!db.objectStoreNames.contains(store)) {
|
||||
await upgradeDB(store);
|
||||
const upgradedDb = await openDB();
|
||||
return upgradedDb.transaction(store, mode).objectStore(store);
|
||||
Promise.resolve(run(objectStoreRef)).catch(reject);
|
||||
|
||||
tx.oncomplete = () => resolve();
|
||||
tx.onerror = () => reject(tx.error ?? new Error(`IndexedDB transaction failed for ${store}`));
|
||||
tx.onabort = () => reject(tx.error ?? new Error(`IndexedDB transaction aborted for ${store}`));
|
||||
});
|
||||
}
|
||||
|
||||
async function withUpgradeLock<T>(fn: () => Promise<T>): Promise<T> {
|
||||
const previous = upgradeChain;
|
||||
let release!: () => void;
|
||||
upgradeChain = new Promise<void>((resolve) => {
|
||||
release = resolve;
|
||||
});
|
||||
await previous;
|
||||
try {
|
||||
return await fn();
|
||||
} finally {
|
||||
release();
|
||||
}
|
||||
}
|
||||
|
||||
return db.transaction(store, mode).objectStore(store);
|
||||
async function openDatabaseWithStores(
|
||||
version: number,
|
||||
storesToCreate: string[],
|
||||
): Promise<IDBDatabase> {
|
||||
return new Promise((resolve, reject) => {
|
||||
let request: IDBOpenDBRequest;
|
||||
try {
|
||||
request = indexedDB.open(DB_NAME, version);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
|
||||
request.onupgradeneeded = () => {
|
||||
const db = request.result;
|
||||
if (!db.objectStoreNames.contains(META_STORE)) {
|
||||
db.createObjectStore(META_STORE);
|
||||
}
|
||||
for (const store of storesToCreate) {
|
||||
if (!db.objectStoreNames.contains(store)) {
|
||||
db.createObjectStore(store);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
request.onsuccess = () => {
|
||||
attachConnection(request.result);
|
||||
resolve(request.result);
|
||||
};
|
||||
request.onerror = () => reject(request.error);
|
||||
});
|
||||
}
|
||||
|
||||
async function upgradeDB(newStore: string): Promise<void> {
|
||||
invalidateConnection();
|
||||
await withUpgradeLock(async () => {
|
||||
invalidateConnection();
|
||||
|
||||
let baseVersion = 0;
|
||||
let baseVersion = 0;
|
||||
|
||||
try {
|
||||
const db = await openDatabase();
|
||||
baseVersion = db.version;
|
||||
try {
|
||||
const db = await openDatabase();
|
||||
if (db.objectStoreNames.contains(newStore)) {
|
||||
attachConnection(db);
|
||||
return;
|
||||
}
|
||||
baseVersion = db.version;
|
||||
db.close();
|
||||
cachedDb = null;
|
||||
dbPromise = null;
|
||||
} catch (error) {
|
||||
console.warn("[DB] Could not probe database version before upgrade:", error);
|
||||
}
|
||||
|
||||
try {
|
||||
await openDatabaseWithStores(baseVersion + 1, [newStore]);
|
||||
} catch (error) {
|
||||
console.error("Error upgrading database:", error);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates any missing object stores in a single version bump so later job
|
||||
* writes do not race passive observer traffic on a mid-run upgrade.
|
||||
*/
|
||||
export async function ensureStoresExist(stores: string[]): Promise<void> {
|
||||
const uniqueStores = [...new Set(stores.filter(Boolean))];
|
||||
if (uniqueStores.length === 0) return;
|
||||
|
||||
await withUpgradeLock(async () => {
|
||||
let db: IDBDatabase;
|
||||
try {
|
||||
db = await openDB();
|
||||
} catch (error) {
|
||||
console.warn("[DB] ensureStoresExist: could not open database:", error);
|
||||
return;
|
||||
}
|
||||
|
||||
const missing = uniqueStores.filter(
|
||||
(store) => !db.objectStoreNames.contains(store),
|
||||
);
|
||||
if (missing.length === 0) return;
|
||||
|
||||
invalidateConnection();
|
||||
const baseVersion = db.version;
|
||||
db.close();
|
||||
cachedDb = null;
|
||||
dbPromise = null;
|
||||
} catch (error) {
|
||||
console.warn("[DB] Could not probe database version before upgrade:", error);
|
||||
|
||||
try {
|
||||
await openDatabaseWithStores(baseVersion + 1, missing);
|
||||
} catch (error) {
|
||||
console.error("[DB] ensureStoresExist failed:", error);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function withObjectStore<T>(
|
||||
store: string,
|
||||
mode: IDBTransactionMode,
|
||||
run: (objectStore: IDBObjectStore) => Promise<T>,
|
||||
): Promise<T> {
|
||||
let db = await openDB();
|
||||
|
||||
if (!db.objectStoreNames.contains(store)) {
|
||||
await upgradeDB(store);
|
||||
db = await openDB();
|
||||
}
|
||||
|
||||
try {
|
||||
await openDatabase(baseVersion + 1, newStore);
|
||||
} catch (error) {
|
||||
console.error("Error upgrading database:", error);
|
||||
throw error;
|
||||
}
|
||||
let result!: T;
|
||||
await runStoreTransaction(db, store, mode, async (objectStoreRef) => {
|
||||
result = await run(objectStoreRef);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function getAll(store: string): Promise<any[]> {
|
||||
try {
|
||||
const s = await objectStore(store);
|
||||
return await idbRequest(s.getAll());
|
||||
return await withObjectStore(store, "readonly", async (s) =>
|
||||
idbRequest(s.getAll()),
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(`Error in getAll for store ${store}:`, error);
|
||||
return [];
|
||||
@@ -230,8 +344,9 @@ export async function getAll(store: string): Promise<any[]> {
|
||||
|
||||
export async function get(store: string, key: string): Promise<any> {
|
||||
try {
|
||||
const s = await objectStore(store);
|
||||
return await idbRequest(s.get(key));
|
||||
return await withObjectStore(store, "readonly", async (s) =>
|
||||
idbRequest(s.get(key)),
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(`Error in get for store ${store}, key ${key}:`, error);
|
||||
return null;
|
||||
@@ -244,8 +359,9 @@ export async function put(
|
||||
key?: string,
|
||||
): Promise<void> {
|
||||
try {
|
||||
const s = await objectStore(store, "readwrite");
|
||||
await idbRequest(key ? s.put(value, key) : s.put(value));
|
||||
await withObjectStore(store, "readwrite", async (s) => {
|
||||
await idbRequest(key ? s.put(value, key) : s.put(value));
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`Error in put for store ${store}:`, error);
|
||||
throw error;
|
||||
@@ -297,8 +413,9 @@ function runStoreDiffTransaction(
|
||||
|
||||
export async function remove(store: string, key: string): Promise<void> {
|
||||
try {
|
||||
const s = await objectStore(store, "readwrite");
|
||||
await idbRequest(s.delete(key));
|
||||
await withObjectStore(store, "readwrite", async (s) => {
|
||||
await idbRequest(s.delete(key));
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`Error in remove for store ${store}, key ${key}:`, error);
|
||||
throw error;
|
||||
@@ -307,8 +424,9 @@ export async function remove(store: string, key: string): Promise<void> {
|
||||
|
||||
export async function clear(store: string): Promise<void> {
|
||||
try {
|
||||
const s = await objectStore(store, "readwrite");
|
||||
await idbRequest(s.clear());
|
||||
await withObjectStore(store, "readwrite", async (s) => {
|
||||
await idbRequest(s.clear());
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`Error in clear for store ${store}:`, error);
|
||||
throw error;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { applyStoreDiff, get, getAll, put, remove } from "./db";
|
||||
import { applyStoreDiff, ensureStoresExist, get, getAll, put, remove } from "./db";
|
||||
import { jobs } from "./jobs";
|
||||
import { decorateIndexItems } from "./renderComponents";
|
||||
import type { IndexItem, Job, JobContext } from "./types";
|
||||
@@ -8,6 +8,8 @@ import { getVectorizedItemIds, pruneOrphanVectorEmbeddings } from "./utils";
|
||||
import { INDEX_SCHEMA_VERSION, SCHEMA_VERSION_KEY } from "./schemaVersion";
|
||||
import { resetSearchIndexes } from "./resetIndexes";
|
||||
import { isIndexingPaused } from "./indexingPause";
|
||||
import { setIndexingActive } from "./indexingState";
|
||||
import { isPluginBlockedByPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
import { verboseDebug } from '@/utils/verboseLog';
|
||||
const META_STORE = "meta";
|
||||
@@ -285,6 +287,11 @@ function dispatchVectorProgress(
|
||||
}
|
||||
|
||||
export async function runIndexing(): Promise<void> {
|
||||
if (isPluginBlockedByPerformanceMode("global-search")) {
|
||||
verboseDebug("[Indexer] Skipping indexing — performance mode blocks Global Search.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isIndexingPaused()) {
|
||||
verboseDebug(
|
||||
"[Indexer] Skipping indexing — index was reset; reload the page to rebuild.",
|
||||
@@ -304,10 +311,13 @@ export async function runIndexing(): Promise<void> {
|
||||
}
|
||||
|
||||
startHeartbeat();
|
||||
setIndexingActive(true);
|
||||
verboseDebug("%c[Indexer] Starting indexing...", "color: green");
|
||||
|
||||
try {
|
||||
const jobIds = Object.keys(jobs);
|
||||
await ensureStoresExist([META_STORE, ...jobIds]);
|
||||
|
||||
let completedJobs = 0;
|
||||
const totalSteps = jobIds.length + 1;
|
||||
dispatchProgress(completedJobs, totalSteps, true, "Starting jobs");
|
||||
@@ -379,6 +389,15 @@ export async function runIndexing(): Promise<void> {
|
||||
removeItem,
|
||||
getProgress: () => loadProgress(jobId),
|
||||
setProgress: (p) => saveProgress(jobId, p),
|
||||
reportJobProgress: ({ processed, total, status }) => {
|
||||
const stepProgress = total > 0 ? processed / total : 0;
|
||||
dispatchProgress(
|
||||
completedJobs + stepProgress,
|
||||
totalSteps,
|
||||
true,
|
||||
status ?? `Running job: ${job.label}`,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
verboseDebug(`%c[Indexer] Running job "${jobId}"...`, "color: #4ea1ff");
|
||||
@@ -500,6 +519,7 @@ export async function runIndexing(): Promise<void> {
|
||||
}),
|
||||
);
|
||||
} finally {
|
||||
setIndexingActive(false);
|
||||
stopHeartbeat();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import {
|
||||
isIndexingActive,
|
||||
setIndexingActive,
|
||||
} from "./indexingState";
|
||||
|
||||
describe("indexingState", () => {
|
||||
afterEach(() => {
|
||||
setIndexingActive(false);
|
||||
});
|
||||
|
||||
it("tracks whether structured indexing is running", () => {
|
||||
expect(isIndexingActive()).toBe(false);
|
||||
setIndexingActive(true);
|
||||
expect(isIndexingActive()).toBe(true);
|
||||
setIndexingActive(false);
|
||||
expect(isIndexingActive()).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
/** True while `runIndexing()` holds the indexer lock in this tab. */
|
||||
let indexingActive = false;
|
||||
|
||||
export function setIndexingActive(active: boolean): void {
|
||||
indexingActive = active;
|
||||
}
|
||||
|
||||
export function isIndexingActive(): boolean {
|
||||
return indexingActive;
|
||||
}
|
||||
@@ -104,7 +104,7 @@ export const coursesJob: Job = {
|
||||
return score;
|
||||
},
|
||||
|
||||
run: async (_ctx) => {
|
||||
run: async (ctx) => {
|
||||
const subjects = await fetchActiveSubjects();
|
||||
if (subjects.length === 0) {
|
||||
verboseDebug("[Courses job] No active subjects discovered.");
|
||||
@@ -113,6 +113,8 @@ export const coursesJob: Job = {
|
||||
|
||||
const items: IndexItem[] = [];
|
||||
const seenIds = new Set<string>();
|
||||
const totalSubjects = subjects.length;
|
||||
let processedSubjects = 0;
|
||||
|
||||
// Sequential per-subject fetch keeps load on SEQTA bounded; the shared
|
||||
// API layer also limits concurrency per route as a defense in depth.
|
||||
@@ -121,6 +123,12 @@ export const coursesJob: Job = {
|
||||
if (seenIds.has(id)) continue;
|
||||
seenIds.add(id);
|
||||
|
||||
ctx.reportJobProgress?.({
|
||||
processed: processedSubjects,
|
||||
total: totalSubjects,
|
||||
status: `Running job: Courses (${processedSubjects + 1}/${totalSubjects})`,
|
||||
});
|
||||
|
||||
const payload = await seqtaFetchPayload<CoursePayload>(
|
||||
"/seqta/student/load/courses",
|
||||
{
|
||||
@@ -129,7 +137,10 @@ export const coursesJob: Job = {
|
||||
},
|
||||
);
|
||||
|
||||
if (!payload) continue;
|
||||
if (!payload) {
|
||||
processedSubjects++;
|
||||
continue;
|
||||
}
|
||||
|
||||
const title =
|
||||
(typeof payload.t === "string" && payload.t.trim()) ||
|
||||
@@ -168,8 +179,15 @@ export const coursesJob: Job = {
|
||||
renderComponentId: "course",
|
||||
}),
|
||||
);
|
||||
processedSubjects++;
|
||||
}
|
||||
|
||||
ctx.reportJobProgress?.({
|
||||
processed: totalSubjects,
|
||||
total: totalSubjects,
|
||||
status: "Running job: Courses (saving)",
|
||||
});
|
||||
|
||||
verboseDebug(
|
||||
`[Courses job] Indexed ${items.length} courses across ${subjects.length} subjects.`,
|
||||
);
|
||||
|
||||
@@ -11,7 +11,9 @@ import { isSensitiveSeqtaPath, normalizeSeqtaPath } from "./api";
|
||||
import { mergeDynamicItems } from "../utils/dynamicItems";
|
||||
import { decorateIndexItems } from "./renderComponents";
|
||||
import { isIndexingPaused } from "./indexingPause";
|
||||
import { isIndexingActive } from "./indexingState";
|
||||
import { isAssessmentListRoute } from "./routeFilters";
|
||||
import { isPluginBlockedByPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
/**
|
||||
* Passive network observer.
|
||||
@@ -384,7 +386,7 @@ function synthesizeItems(
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
async function persistItems(items: IndexItem[]): Promise<void> {
|
||||
if (items.length === 0 || isIndexingPaused()) return;
|
||||
if (items.length === 0 || isIndexingPaused() || isIndexingActive()) return;
|
||||
|
||||
// Dedupe against existing entries. We replace on collision so the latest
|
||||
// observation wins (e.g. if a message changes title).
|
||||
@@ -405,10 +407,10 @@ async function persistItems(items: IndexItem[]): Promise<void> {
|
||||
}
|
||||
|
||||
function scheduleFlush() {
|
||||
if (pendingFlush || isIndexingPaused()) return;
|
||||
if (pendingFlush || isIndexingPaused() || isIndexingActive()) return;
|
||||
pendingFlush = setTimeout(() => {
|
||||
pendingFlush = null;
|
||||
if (!pendingDirty || isIndexingPaused()) return;
|
||||
if (!pendingDirty || isIndexingPaused() || isIndexingActive()) return;
|
||||
pendingDirty = false;
|
||||
void flushDynamicItems();
|
||||
}, FLUSH_DEBOUNCE_MS);
|
||||
@@ -425,7 +427,7 @@ export function pausePassiveObserver(): void {
|
||||
}
|
||||
|
||||
async function flushDynamicItems(): Promise<void> {
|
||||
if (isIndexingPaused()) return;
|
||||
if (isIndexingPaused() || isIndexingActive()) return;
|
||||
if (pendingChangedItems.size === 0) return;
|
||||
|
||||
const rawChanged = Array.from(pendingChangedItems.values());
|
||||
@@ -480,6 +482,7 @@ async function consumeResponse(
|
||||
url: string,
|
||||
requestBody: unknown,
|
||||
): Promise<void> {
|
||||
if (isPluginBlockedByPerformanceMode("global-search")) return;
|
||||
if (!response.ok) return;
|
||||
|
||||
const route = normalizeSeqtaPath(url);
|
||||
|
||||
@@ -24,6 +24,12 @@ export interface JobContext {
|
||||
removeItem: (id: string, storeId?: string) => Promise<void>;
|
||||
getProgress: <T = any>() => Promise<T | undefined>;
|
||||
setProgress: <T = any>(progress: T) => Promise<void>;
|
||||
/** Optional live status/progress while a long-running job is in flight. */
|
||||
reportJobProgress?: (detail: {
|
||||
processed: number;
|
||||
total: number;
|
||||
status?: string;
|
||||
}) => void;
|
||||
}
|
||||
|
||||
export interface Job {
|
||||
|
||||
@@ -14,15 +14,23 @@
|
||||
} from "./timeRange";
|
||||
import { computeGradeForecast, aggregateToMonthlyPoints } from "./utils/gradePrediction";
|
||||
import PredictionMonthsSlider from "./PredictionMonthsSlider.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
|
||||
interface Props {
|
||||
data: Assessment[];
|
||||
timeRange: TimeRange;
|
||||
customTimeRange?: CustomTimeRange;
|
||||
showSubjectTrends?: boolean;
|
||||
combinedLabel?: string;
|
||||
}
|
||||
|
||||
let { data, timeRange, customTimeRange, showSubjectTrends = false }: Props = $props();
|
||||
let {
|
||||
data,
|
||||
timeRange,
|
||||
customTimeRange,
|
||||
showSubjectTrends = false,
|
||||
combinedLabel,
|
||||
}: Props = $props();
|
||||
|
||||
let showPrediction = $state(false);
|
||||
let predictionMonths = $state(3);
|
||||
@@ -33,6 +41,7 @@
|
||||
buildGradeTrendChart(data, timeRange, {
|
||||
showPerSubject: showSubjectTrends,
|
||||
custom: customTimeRange,
|
||||
combinedLabel,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -166,6 +175,8 @@
|
||||
return monthly.length >= 3;
|
||||
});
|
||||
|
||||
const animationsOn = $derived($settingsState.animations);
|
||||
|
||||
/** Historical + future forecast points so tooltips work across the dashed line. */
|
||||
const chartData = $derived.by((): TrendPoint[] => {
|
||||
if (!showPrediction || !forecast?.points.length) {
|
||||
@@ -211,6 +222,8 @@
|
||||
<p class="bsplus-analytics-card-desc">
|
||||
{#if showSubjectTrends}
|
||||
Overall and per-subject averages · {timeRangeText()}
|
||||
{:else if combinedLabel}
|
||||
{combinedLabel} · {timeRangeText()}
|
||||
{:else}
|
||||
Average grades over time · {timeRangeText()}
|
||||
{/if}
|
||||
@@ -243,7 +256,7 @@
|
||||
curve: curveMonotoneX,
|
||||
"fill-opacity": showSubjectTrends ? 0.12 : 0.35,
|
||||
line: { class: "stroke-2" },
|
||||
motion: "tween",
|
||||
motion: animationsOn ? "tween" : false,
|
||||
},
|
||||
xAxis: {
|
||||
ticks: timeRange === "7d" ? 7 : undefined,
|
||||
@@ -267,12 +280,12 @@
|
||||
</defs>
|
||||
|
||||
<ChartClipPath
|
||||
initialWidth={showPrediction ? undefined : 0}
|
||||
motion={showPrediction
|
||||
? undefined
|
||||
: {
|
||||
initialWidth={animationsOn && !showPrediction ? 0 : undefined}
|
||||
motion={animationsOn && !showPrediction
|
||||
? {
|
||||
width: { type: "tween", duration: 900, easing: cubicInOut },
|
||||
}}
|
||||
}
|
||||
: undefined}
|
||||
>
|
||||
{#each series as s, i (s.key)}
|
||||
{@const meta = chartSeries.find((c) => c.key === s.key)}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
} from "./gradeDistribution";
|
||||
|
||||
import { loadDistributionMode, saveDistributionMode } from "./storage";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
|
||||
|
||||
|
||||
@@ -312,7 +313,7 @@
|
||||
|
||||
motion: {
|
||||
|
||||
y: { type: "tween", duration: 600, easing: cubicInOut },
|
||||
y: { type: "tween", duration: $settingsState.animations ? 600 : 0, easing: cubicInOut },
|
||||
|
||||
},
|
||||
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
<script lang="ts">
|
||||
import { fade, scale } from "svelte/transition";
|
||||
import type { AnalyticsClassGroup, AnalyticsClassOption } from "./types";
|
||||
import { animationsEnabled } from "@/seqta/utils/performanceMode";
|
||||
|
||||
type Props = {
|
||||
classOptions: AnalyticsClassOption[];
|
||||
groups: AnalyticsClassGroup[];
|
||||
activeGroupId: string | null;
|
||||
onSelectGroup: (group: AnalyticsClassGroup | null) => void;
|
||||
onSaveGroups: (groups: AnalyticsClassGroup[]) => void;
|
||||
};
|
||||
|
||||
let { classOptions, groups, activeGroupId, onSelectGroup, onSaveGroups }: Props = $props();
|
||||
|
||||
let showEditor = $state(false);
|
||||
let groupName = $state("");
|
||||
let draftClassKeys = $state<string[]>([]);
|
||||
let editingId = $state<string | null>(null);
|
||||
|
||||
const fadeDuration = $derived(animationsEnabled() ? 180 : 0);
|
||||
const optionByKey = $derived(new Map(classOptions.map((option) => [option.key, option])));
|
||||
|
||||
function classLabel(key: string): string {
|
||||
const option = optionByKey.get(key);
|
||||
return option ? `${option.title} (${option.yearLabel})` : key;
|
||||
}
|
||||
|
||||
function defaultGroupName(keys: string[]): string {
|
||||
if (!keys.length) return "";
|
||||
const labels = keys.map(classLabel);
|
||||
if (labels.length === 1) return labels[0]!;
|
||||
return `${labels[0]} + ${labels.length - 1} more`;
|
||||
}
|
||||
|
||||
function openCreate() {
|
||||
editingId = null;
|
||||
const active = groups.find((g) => g.id === activeGroupId);
|
||||
draftClassKeys = active?.classKeys.length
|
||||
? [...active.classKeys]
|
||||
: classOptions.slice(0, Math.min(2, classOptions.length)).map((option) => option.key);
|
||||
groupName = defaultGroupName(draftClassKeys);
|
||||
showEditor = true;
|
||||
}
|
||||
|
||||
function openEdit(group: AnalyticsClassGroup) {
|
||||
editingId = group.id;
|
||||
groupName = group.name;
|
||||
draftClassKeys = [...group.classKeys];
|
||||
showEditor = true;
|
||||
}
|
||||
|
||||
function cancelEditor() {
|
||||
showEditor = false;
|
||||
editingId = null;
|
||||
groupName = "";
|
||||
draftClassKeys = [];
|
||||
}
|
||||
|
||||
function toggleDraftClass(key: string) {
|
||||
draftClassKeys = draftClassKeys.includes(key)
|
||||
? draftClassKeys.filter((entry) => entry !== key)
|
||||
: [...draftClassKeys, key];
|
||||
}
|
||||
|
||||
function saveGroup() {
|
||||
if (!draftClassKeys.length) return;
|
||||
|
||||
if (editingId) {
|
||||
onSaveGroups(
|
||||
groups.map((g) =>
|
||||
g.id === editingId
|
||||
? { ...g, name: groupName.trim() || g.name, classKeys: [...draftClassKeys] }
|
||||
: g,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
const created: AnalyticsClassGroup = {
|
||||
id: crypto.randomUUID(),
|
||||
name: groupName.trim() || defaultGroupName(draftClassKeys),
|
||||
classKeys: [...new Set(draftClassKeys)],
|
||||
};
|
||||
onSaveGroups([...groups, created]);
|
||||
onSelectGroup(created);
|
||||
}
|
||||
cancelEditor();
|
||||
}
|
||||
|
||||
function deleteGroup(id: string) {
|
||||
onSaveGroups(groups.filter((g) => g.id !== id));
|
||||
if (activeGroupId === id) onSelectGroup(null);
|
||||
}
|
||||
|
||||
function onModalKeydown(event: KeyboardEvent) {
|
||||
if (event.key === "Escape") {
|
||||
event.preventDefault();
|
||||
cancelEditor();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window onkeydown={showEditor ? onModalKeydown : undefined} />
|
||||
|
||||
<div class="bsplus-analytics-filter-group bsplus-analytics-class-groups">
|
||||
<div class="bsplus-analytics-class-groups-head">
|
||||
<span class="bsplus-analytics-field-label">Combined classes</span>
|
||||
<button
|
||||
type="button"
|
||||
class="bsplus-analytics-class-groups-add"
|
||||
onclick={openCreate}
|
||||
disabled={!classOptions.length}
|
||||
>
|
||||
Combine
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if groups.length}
|
||||
<ul class="bsplus-analytics-class-groups-list" role="list">
|
||||
{#each groups as group (group.id)}
|
||||
{@const active = activeGroupId === group.id}
|
||||
<li class="bsplus-analytics-class-group-row">
|
||||
<button
|
||||
type="button"
|
||||
class="bsplus-analytics-class-group-btn"
|
||||
class:is-active={active}
|
||||
onclick={() => onSelectGroup(active ? null : group)}
|
||||
title={group.classKeys.map(classLabel).join(", ")}
|
||||
>
|
||||
<span class="bsplus-analytics-class-group-name">{group.name}</span>
|
||||
<span class="bsplus-analytics-class-group-meta"
|
||||
>{group.classKeys.length} class{group.classKeys.length === 1 ? "" : "es"}</span
|
||||
>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="bsplus-analytics-class-group-icon"
|
||||
aria-label="Edit {group.name}"
|
||||
onclick={() => openEdit(group)}
|
||||
>
|
||||
✎
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="bsplus-analytics-class-group-icon bsplus-analytics-class-group-delete"
|
||||
aria-label="Delete {group.name}"
|
||||
onclick={() => deleteGroup(group.id)}
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{:else}
|
||||
<p class="bsplus-analytics-class-groups-empty">
|
||||
Save classes from any year to view their combined grades in one trend.
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if showEditor}
|
||||
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
||||
<div
|
||||
class="bsplus-analytics-class-groups-modal"
|
||||
role="presentation"
|
||||
transition:fade={{ duration: fadeDuration }}
|
||||
onclick={(e) => {
|
||||
if (e.target === e.currentTarget) cancelEditor();
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="bsplus-analytics-class-groups-dialog"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="bsplus-class-group-modal-title"
|
||||
transition:scale={{ duration: fadeDuration, start: 0.96 }}
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<header class="bsplus-analytics-class-groups-dialog-head">
|
||||
<div>
|
||||
<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">
|
||||
Every class from every programme year — same folders as Courses.
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="bsplus-analytics-class-groups-close"
|
||||
aria-label="Close"
|
||||
onclick={cancelEditor}
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="bsplus-analytics-class-groups-dialog-body">
|
||||
<label class="bsplus-analytics-class-groups-field">
|
||||
<span class="bsplus-analytics-field-label">Group name</span>
|
||||
<input
|
||||
type="text"
|
||||
class="bsplus-analytics-input"
|
||||
bind:value={groupName}
|
||||
placeholder="e.g. English block"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div class="bsplus-analytics-class-groups-field">
|
||||
<span class="bsplus-analytics-field-label">
|
||||
Classes ({draftClassKeys.length} selected)
|
||||
</span>
|
||||
<div
|
||||
class="bsplus-analytics-class-groups-picks"
|
||||
role="group"
|
||||
aria-label="Classes in this group"
|
||||
>
|
||||
{#each classOptions as option (option.key)}
|
||||
{@const picked = draftClassKeys.includes(option.key)}
|
||||
<label class="bsplus-analytics-class-groups-pick">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={picked}
|
||||
onchange={() => toggleDraftClass(option.key)}
|
||||
/>
|
||||
<span class="bsplus-analytics-class-groups-check" aria-hidden="true">
|
||||
{#if picked}✓{/if}
|
||||
</span>
|
||||
<span class="bsplus-analytics-class-groups-pick-text">
|
||||
<span class="bsplus-analytics-class-groups-pick-label">{option.title}</span>
|
||||
<span class="bsplus-analytics-class-groups-year">{option.yearLabel}</span>
|
||||
</span>
|
||||
</label>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</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 bsplus-analytics-btn-primary"
|
||||
disabled={!draftClassKeys.length}
|
||||
onclick={saveGroup}
|
||||
>
|
||||
{editingId ? "Save changes" : "Create group"}
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -6,6 +6,8 @@
|
||||
loadGradeAnalytics,
|
||||
syncGradeAnalytics,
|
||||
getCacheTtlMs,
|
||||
loadAnalyticsClassCatalog,
|
||||
getStudentId,
|
||||
} from "./api";
|
||||
import AnalyticsAreaChart from "./AnalyticsAreaChart.svelte";
|
||||
import AnalyticsBarChart from "./AnalyticsBarChart.svelte";
|
||||
@@ -20,6 +22,13 @@
|
||||
type TimeRange,
|
||||
} from "./timeRange";
|
||||
import { openAnalyticsPrivacyPopup } from "./openAnalyticsPrivacyPopup";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { animationsEnabled } from "@/seqta/utils/performanceMode";
|
||||
import ClassGroupsPanel from "./ClassGroupsPanel.svelte";
|
||||
import type { AnalyticsClassGroup, AnalyticsClassOption } from "./types";
|
||||
import { loadClassGroups, saveClassGroups } from "./storage";
|
||||
|
||||
let { simpleMode = false } = $props<{ simpleMode?: boolean }>();
|
||||
|
||||
let analyticsData: Assessment[] | null = $state(null);
|
||||
let loading = $state(true);
|
||||
@@ -36,9 +45,14 @@
|
||||
let timeRange: TimeRange = $state("all");
|
||||
let customTimeRange: CustomTimeRange = $state(defaultCustomTimeRange());
|
||||
let showSubjectTrends = $state(false);
|
||||
let classGroups: AnalyticsClassGroup[] = $state([]);
|
||||
let classCatalog: AnalyticsClassOption[] = $state([]);
|
||||
let activeClassGroupId: string | null = $state(null);
|
||||
let studentId: number | null = $state(null);
|
||||
|
||||
let timestampInterval: ReturnType<typeof setInterval> | null = null;
|
||||
let contentReady = $state(false);
|
||||
const fadeDuration = $derived(animationsEnabled() ? 200 : 0);
|
||||
|
||||
const formattedTimestamp = $derived(() => {
|
||||
if (!lastUpdated) return "";
|
||||
@@ -46,6 +60,16 @@
|
||||
return formatLastUpdated(lastUpdated);
|
||||
});
|
||||
|
||||
const activeClassGroup = $derived(
|
||||
classGroups.find((g) => g.id === activeClassGroupId) ?? null,
|
||||
);
|
||||
|
||||
const activeClassKeys = $derived(activeClassGroup?.classKeys ?? []);
|
||||
|
||||
const combinedChartLabel = $derived(
|
||||
activeClassGroup && !showSubjectTrends ? activeClassGroup.name : undefined,
|
||||
);
|
||||
|
||||
const uniqueSubjects = $derived(() => {
|
||||
if (!analyticsData) return [];
|
||||
return [...new Set(analyticsData.map((a) => a.subject))].sort();
|
||||
@@ -55,7 +79,12 @@
|
||||
if (!analyticsData) return [];
|
||||
const [minG, maxG] = gradeRange;
|
||||
return analyticsData.filter((a) => {
|
||||
if (filterSubjects.length && !filterSubjects.includes(a.subject)) return false;
|
||||
if (activeClassKeys.length) {
|
||||
const key = `${a.programmeID}-${a.metaclassID}`;
|
||||
if (!activeClassKeys.includes(key)) return false;
|
||||
} else if (filterSubjects.length && !filterSubjects.includes(a.subject)) {
|
||||
return false;
|
||||
}
|
||||
if (a.finalGrade !== undefined) {
|
||||
if (a.finalGrade < minG || a.finalGrade > maxG) return false;
|
||||
}
|
||||
@@ -109,6 +138,7 @@
|
||||
const result = await syncGradeAnalytics();
|
||||
analyticsData = result.assessments;
|
||||
lastUpdated = new Date(result.updatedAt);
|
||||
await loadClassCatalog(result.assessments);
|
||||
} catch (e) {
|
||||
console.error("[BetterSEQTA+] Analytics sync failed:", e);
|
||||
error =
|
||||
@@ -122,11 +152,13 @@
|
||||
filterSubjects = [];
|
||||
filterSearch = "";
|
||||
gradeRange = [0, 100];
|
||||
activeClassGroupId = null;
|
||||
}
|
||||
|
||||
function hasActiveFilters() {
|
||||
return !!(
|
||||
filterSubjects.length ||
|
||||
activeClassGroupId ||
|
||||
filterSearch ||
|
||||
gradeRange[0] !== 0 ||
|
||||
gradeRange[1] !== 100
|
||||
@@ -134,6 +166,7 @@
|
||||
}
|
||||
|
||||
function toggleSubject(subject: string) {
|
||||
activeClassGroupId = null;
|
||||
if (filterSubjects.includes(subject)) {
|
||||
filterSubjects = filterSubjects.filter((s) => s !== subject);
|
||||
} else {
|
||||
@@ -141,6 +174,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
function selectClassGroup(group: AnalyticsClassGroup | null) {
|
||||
activeClassGroupId = group?.id ?? null;
|
||||
if (group) {
|
||||
filterSubjects = [];
|
||||
showSubjectTrends = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function persistClassGroups(groups: AnalyticsClassGroup[]) {
|
||||
classGroups = groups;
|
||||
if (activeClassGroupId && !groups.some((g) => g.id === activeClassGroupId)) {
|
||||
activeClassGroupId = null;
|
||||
}
|
||||
if (studentId == null) return;
|
||||
await saveClassGroups(location.origin, studentId, groups);
|
||||
}
|
||||
|
||||
async function loadClassCatalog(assessments: Assessment[]) {
|
||||
classCatalog = await loadAnalyticsClassCatalog(assessments);
|
||||
}
|
||||
|
||||
const timeRangeLabel = $derived(() => getTimeRangeLabel(timeRange, customTimeRange));
|
||||
|
||||
function closeToolbarDropdowns() {
|
||||
@@ -171,6 +225,16 @@
|
||||
const result = await loadGradeAnalytics();
|
||||
analyticsData = result.assessments;
|
||||
lastUpdated = result.updatedAt ? new Date(result.updatedAt) : null;
|
||||
|
||||
try {
|
||||
const id = await getStudentId();
|
||||
studentId = id;
|
||||
classGroups = await loadClassGroups(location.origin, id);
|
||||
await loadClassCatalog(result.assessments);
|
||||
} catch {
|
||||
classGroups = [];
|
||||
classCatalog = await loadAnalyticsClassCatalog(result.assessments);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("[BetterSEQTA+] Failed to load analytics:", e);
|
||||
analyticsData = [];
|
||||
@@ -204,7 +268,7 @@
|
||||
|
||||
<div class="bsplus-analytics-root">
|
||||
{#if error}
|
||||
<p class="bsplus-analytics-alert bsplus-analytics-animate" role="alert" transition:fade={{ duration: 200 }}>
|
||||
<p class="bsplus-analytics-alert bsplus-analytics-animate" role="alert" transition:fade={{ duration: fadeDuration }}>
|
||||
{error}
|
||||
</p>
|
||||
{/if}
|
||||
@@ -346,8 +410,10 @@
|
||||
aria-expanded={showSubjectsDropdown}
|
||||
aria-haspopup="listbox"
|
||||
>
|
||||
{#if filterSubjects.length === 0}
|
||||
{#if !activeClassGroup && filterSubjects.length === 0}
|
||||
All subjects
|
||||
{:else if activeClassGroup}
|
||||
{activeClassGroup.name}
|
||||
{:else if filterSubjects.length === 1}
|
||||
{filterSubjects[0]}
|
||||
{:else}
|
||||
@@ -359,14 +425,15 @@
|
||||
<button
|
||||
type="button"
|
||||
class="bsplus-analytics-dropdown-item"
|
||||
class:is-selected={filterSubjects.length === 0}
|
||||
class:is-selected={!activeClassGroup && filterSubjects.length === 0}
|
||||
onclick={() => {
|
||||
filterSubjects = [];
|
||||
activeClassGroupId = null;
|
||||
showSubjectsDropdown = false;
|
||||
}}
|
||||
>
|
||||
<span class="bsplus-analytics-dropdown-check"
|
||||
>{filterSubjects.length === 0 ? "✓" : ""}</span
|
||||
>{!activeClassGroup && filterSubjects.length === 0 ? "✓" : ""}</span
|
||||
>
|
||||
All subjects
|
||||
</button>
|
||||
@@ -389,6 +456,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if !simpleMode}
|
||||
<ClassGroupsPanel
|
||||
classOptions={classCatalog}
|
||||
groups={classGroups}
|
||||
activeGroupId={activeClassGroupId}
|
||||
onSelectGroup={selectClassGroup}
|
||||
onSaveGroups={persistClassGroups}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<div class="bsplus-analytics-filter-group">
|
||||
<span class="bsplus-analytics-field-label">Search</span>
|
||||
<input
|
||||
@@ -399,6 +476,7 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
{#if !simpleMode}
|
||||
<div class="bsplus-analytics-filter-group">
|
||||
<span class="bsplus-analytics-field-label">Grade range</span>
|
||||
<GradeRangeSlider bind:value={gradeRange} />
|
||||
@@ -411,6 +489,7 @@
|
||||
<span>Per-subject trends</span>
|
||||
</label>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{@render sidebarActions()}
|
||||
</aside>
|
||||
@@ -434,6 +513,7 @@
|
||||
</div>
|
||||
|
||||
<div class="bsplus-analytics-results">
|
||||
{#if !simpleMode}
|
||||
<div class="bsplus-analytics-charts">
|
||||
<div class="bsplus-analytics-chart-cell">
|
||||
<AnalyticsAreaChart
|
||||
@@ -441,12 +521,14 @@
|
||||
{timeRange}
|
||||
{customTimeRange}
|
||||
showSubjectTrends={showSubjectTrends}
|
||||
combinedLabel={combinedChartLabel}
|
||||
/>
|
||||
</div>
|
||||
<div class="bsplus-analytics-chart-cell">
|
||||
<AnalyticsBarChart data={gradedFiltered()} {timeRange} {customTimeRange} />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<AssessmentTable data={timeScopedData()} />
|
||||
</div>
|
||||
@@ -462,7 +544,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="bsplus-analytics-layout bsplus-analytics-animate" transition:fade={{ duration: 300 }}>
|
||||
<div class="bsplus-analytics-layout bsplus-analytics-animate" transition:fade={{ duration: fadeDuration }}>
|
||||
<aside class="bsplus-analytics-filters" aria-label="Analytics">
|
||||
{@render sidebarTitle()}
|
||||
{@render sidebarActions()}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onDestroy } from "svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
|
||||
let {
|
||||
value = $bindable<[number, number]>([0, 100]),
|
||||
@@ -88,7 +89,7 @@
|
||||
|
||||
value = next;
|
||||
|
||||
if (animate) {
|
||||
if (animate && $settingsState.animations) {
|
||||
animateVisualTo(next);
|
||||
} else {
|
||||
visual = next;
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
resolveNumericGradeFromAssessmentPayload,
|
||||
} from "./letterGradeScale";
|
||||
import { loadAnalyticsCache, saveAnalyticsCache } from "./storage";
|
||||
import type { Assessment, AssessmentStatus } from "./types";
|
||||
import type { Assessment, AssessmentStatus, AnalyticsClassOption } from "./types";
|
||||
|
||||
const PAST_FETCH_CONCURRENCY = 8;
|
||||
const DEFAULT_CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
||||
@@ -152,65 +152,119 @@ function extractLetterGrade(
|
||||
);
|
||||
}
|
||||
|
||||
/** All programme years / folders from SEQTA (active and inactive), matching DesQTA analytics. */
|
||||
function flattenSubjectFolders(payload: unknown): Subject[] {
|
||||
if (!Array.isArray(payload)) return [];
|
||||
function classKey(programme: number, metaclass: number): string {
|
||||
return `${programme}-${metaclass}`;
|
||||
}
|
||||
|
||||
const subjects: Subject[] = [];
|
||||
function folderYearLabel(description: unknown): string {
|
||||
const text = String(description ?? "").trim();
|
||||
const match = text.match(/\b(20\d{2})\b/);
|
||||
return match?.[1] ?? (text || "?");
|
||||
}
|
||||
|
||||
function parseClassOption(raw: unknown, yearLabel: string): AnalyticsClassOption | null {
|
||||
if (!raw || typeof raw !== "object") return null;
|
||||
const row = raw as Record<string, unknown>;
|
||||
const programme = Number(row.programme ?? row.programmeID);
|
||||
const metaclass = Number(row.metaclass ?? row.metaclassID);
|
||||
if (!programme || !metaclass || Number.isNaN(programme) || Number.isNaN(metaclass)) {
|
||||
return null;
|
||||
}
|
||||
const title = String(row.title ?? row.description ?? row.code ?? row.subject ?? "").trim();
|
||||
if (!title) return null;
|
||||
return {
|
||||
key: classKey(programme, metaclass),
|
||||
title,
|
||||
yearLabel,
|
||||
programme,
|
||||
metaclass,
|
||||
};
|
||||
}
|
||||
|
||||
function parseClassOptionsFromPayload(payload: unknown): AnalyticsClassOption[] {
|
||||
if (!Array.isArray(payload)) return [];
|
||||
const map = new Map<string, AnalyticsClassOption>();
|
||||
for (const folder of payload) {
|
||||
if (!folder || typeof folder !== "object") continue;
|
||||
const list = (folder as { subjects?: Subject[] }).subjects;
|
||||
if (!Array.isArray(list)) continue;
|
||||
|
||||
for (const raw of list) {
|
||||
if (!raw || typeof raw !== "object") continue;
|
||||
const programme = Number(
|
||||
(raw as Subject).programme ?? (raw as { programmeID?: number }).programmeID,
|
||||
);
|
||||
const metaclass = Number(
|
||||
(raw as Subject).metaclass ?? (raw as { metaclassID?: number }).metaclassID,
|
||||
);
|
||||
if (!programme || !metaclass || isNaN(programme) || isNaN(metaclass)) continue;
|
||||
|
||||
subjects.push({
|
||||
code: String((raw as Subject).code ?? (raw as { subject?: string }).subject ?? ""),
|
||||
programme,
|
||||
metaclass,
|
||||
});
|
||||
const term = folder as { description?: unknown; code?: unknown; subjects?: unknown[] };
|
||||
const yearLabel = folderYearLabel(term.description ?? term.code);
|
||||
for (const raw of term.subjects ?? []) {
|
||||
const option = parseClassOption(raw, yearLabel);
|
||||
if (option) map.set(option.key, option);
|
||||
}
|
||||
}
|
||||
return subjects;
|
||||
return sortClassOptions([...map.values()]);
|
||||
}
|
||||
|
||||
/** Subjects implied by cached assessments (covers metaclasses no longer listed). */
|
||||
function subjectsFromAssessments(assessments: Assessment[]): Subject[] {
|
||||
const map = new Map<string, Subject>();
|
||||
function classOptionsFromAssessments(assessments: Assessment[]): AnalyticsClassOption[] {
|
||||
const map = new Map<string, AnalyticsClassOption>();
|
||||
for (const a of assessments) {
|
||||
if (!a.programmeID || !a.metaclassID) continue;
|
||||
const key = `${a.programmeID}-${a.metaclassID}`;
|
||||
if (!map.has(key)) {
|
||||
map.set(key, {
|
||||
code: a.code || a.subject,
|
||||
programme: a.programmeID,
|
||||
metaclass: a.metaclassID,
|
||||
});
|
||||
}
|
||||
const key = classKey(a.programmeID, a.metaclassID);
|
||||
if (map.has(key)) continue;
|
||||
map.set(key, {
|
||||
key,
|
||||
title: a.subject || a.code,
|
||||
yearLabel: a.due ? String(new Date(a.due).getFullYear()) : "?",
|
||||
programme: a.programmeID,
|
||||
metaclass: a.metaclassID,
|
||||
});
|
||||
}
|
||||
return Array.from(map.values());
|
||||
return [...map.values()];
|
||||
}
|
||||
|
||||
function dedupeSubjects(subjects: Subject[]): Subject[] {
|
||||
const map = new Map<string, Subject>();
|
||||
for (const s of subjects) {
|
||||
map.set(`${s.programme}-${s.metaclass}`, s);
|
||||
function sortClassOptions(options: AnalyticsClassOption[]): AnalyticsClassOption[] {
|
||||
return [...options].sort((a, b) => {
|
||||
const yearA = Number.parseInt(a.yearLabel, 10);
|
||||
const yearB = Number.parseInt(b.yearLabel, 10);
|
||||
if (!Number.isNaN(yearA) && !Number.isNaN(yearB) && yearA !== yearB) {
|
||||
return yearB - yearA;
|
||||
}
|
||||
if (a.yearLabel !== b.yearLabel) {
|
||||
return a.yearLabel.localeCompare(b.yearLabel, undefined, { sensitivity: "base" });
|
||||
}
|
||||
return a.title.localeCompare(b.title, undefined, { sensitivity: "base" });
|
||||
});
|
||||
}
|
||||
|
||||
function mergeClassCatalog(
|
||||
folderPayload: unknown,
|
||||
assessments: Assessment[],
|
||||
): AnalyticsClassOption[] {
|
||||
const map = new Map<string, AnalyticsClassOption>();
|
||||
for (const option of parseClassOptionsFromPayload(folderPayload)) {
|
||||
map.set(option.key, option);
|
||||
}
|
||||
return Array.from(map.values());
|
||||
for (const option of classOptionsFromAssessments(assessments)) {
|
||||
map.set(option.key, option);
|
||||
}
|
||||
return sortClassOptions([...map.values()]);
|
||||
}
|
||||
|
||||
function catalogToSubjects(catalog: AnalyticsClassOption[]): Subject[] {
|
||||
return catalog.map((c) => ({
|
||||
code: c.title,
|
||||
programme: c.programme,
|
||||
metaclass: c.metaclass,
|
||||
}));
|
||||
}
|
||||
|
||||
async function loadAllSubjects(existingAssessments: Assessment[] = []): Promise<Subject[]> {
|
||||
const res = await fetchJSON("/seqta/student/load/subjects?", {});
|
||||
const fromFolders = flattenSubjectFolders(res.payload);
|
||||
return dedupeSubjects([...fromFolders, ...subjectsFromAssessments(existingAssessments)]);
|
||||
const catalog = await loadAnalyticsClassCatalog(existingAssessments);
|
||||
return catalogToSubjects(catalog);
|
||||
}
|
||||
|
||||
/** All programme-year classes for combine-groups UI (active + inactive folders). */
|
||||
export async function loadAnalyticsClassCatalog(
|
||||
existingAssessments: Assessment[] = [],
|
||||
): Promise<AnalyticsClassOption[]> {
|
||||
try {
|
||||
const res = await fetchJSON("/seqta/student/load/subjects?", {});
|
||||
return mergeClassCatalog(res.payload, existingAssessments);
|
||||
} catch (error) {
|
||||
console.error("[BetterSEQTA+] Failed to load analytics class catalog:", error);
|
||||
return sortClassOptions(classOptionsFromAssessments(existingAssessments));
|
||||
}
|
||||
}
|
||||
|
||||
async function loadUpcoming(studentId: number): Promise<Record<string, unknown>[]> {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { isMenuOptionsOpen } from "@/seqta/utils/Openers/menuOptionsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { applyMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
|
||||
import { getNativeMenuList } from "@/seqta/ui/sidebar/parseNativeMenu";
|
||||
import { rafThrottle } from "@/seqta/utils/rafThrottle";
|
||||
|
||||
const ANALYTICS_MENU_ICON = MenuitemSVGKey.analytics;
|
||||
export const ANALYTICS_MENU_CLASS = "betterseqta-grade-analytics-item";
|
||||
@@ -34,26 +35,14 @@ export async function injectAnalyticsMenuItem(): Promise<() => void> {
|
||||
`#menu .${ANALYTICS_MENU_CLASS}, #menu [data-key="${ANALYTICS_MENU_KEY}"]`,
|
||||
)
|
||||
.forEach((node) => {
|
||||
// Only touch the native list copy — custom sidebar mirrors via sync.
|
||||
if (node.closest("#bsplus-sidebar-root")) return;
|
||||
node.remove();
|
||||
});
|
||||
|
||||
await waitForElm(
|
||||
"#menu > ul:not(#bsplus-sidebar-root), #menu > ul",
|
||||
true,
|
||||
50,
|
||||
120,
|
||||
);
|
||||
await waitForElm("#menu > ul", true, 50, 120);
|
||||
|
||||
let menuList = getNativeMenuList();
|
||||
if (!menuList) {
|
||||
menuList = (await waitForElm(
|
||||
"#menu > ul:not(#bsplus-sidebar-root), #menu ul",
|
||||
true,
|
||||
50,
|
||||
120,
|
||||
)) as HTMLElement;
|
||||
menuList = (await waitForElm("#menu > ul", true, 50, 120)) as HTMLElement;
|
||||
}
|
||||
|
||||
const analyticsItem = document.createElement("li");
|
||||
@@ -88,10 +77,11 @@ export async function injectAnalyticsMenuItem(): Promise<() => void> {
|
||||
|
||||
syncAnalyticsMenu();
|
||||
|
||||
const scheduleAnalyticsSync = rafThrottle(syncAnalyticsMenu);
|
||||
const menuObserver = new MutationObserver(() => {
|
||||
const list = getNativeMenuList() ?? menuList;
|
||||
if (!list || isMenuOptionsOpen() || list.contains(analyticsItem)) return;
|
||||
syncAnalyticsMenu();
|
||||
scheduleAnalyticsSync();
|
||||
});
|
||||
menuObserver.observe(menuList, { childList: true });
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { getNativeMenuList } from "@/seqta/ui/sidebar/parseNativeMenu";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||
import { renderAnalyticsPage } from "./ui";
|
||||
@@ -23,10 +24,11 @@ export async function loadAnalyticsPage(): Promise<void> {
|
||||
async function loadAnalyticsPageInner(): Promise<void> {
|
||||
document.title = "Analytics ― SEQTA Learn";
|
||||
|
||||
document.querySelectorAll("#menu .item").forEach((item) => {
|
||||
const menu = getNativeMenuList();
|
||||
menu?.querySelectorAll(".item").forEach((item) => {
|
||||
item.classList.remove("active");
|
||||
});
|
||||
document.querySelector('[data-key="analytics"]')?.classList.add("active");
|
||||
menu?.querySelector('[data-key="analytics"]')?.classList.add("active");
|
||||
|
||||
let main: HTMLElement;
|
||||
try {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import browser from "webextension-polyfill";
|
||||
import type { DistributionMode } from "./gradeDistribution";
|
||||
import type { AnalyticsCache } from "./types";
|
||||
import type { AnalyticsCache, AnalyticsClassGroup } from "./types";
|
||||
|
||||
const STORAGE_PREFIX = "bsplus.analytics.v2";
|
||||
const DISTRIBUTION_MODE_PREFIX = "bsplus.analytics.distMode.v1";
|
||||
const CLASS_GROUPS_PREFIX = "bsplus.analytics.groups.v1";
|
||||
|
||||
export function analyticsStorageKey(origin: string, studentId: number): string {
|
||||
return `${STORAGE_PREFIX}.${origin}.${studentId}`;
|
||||
@@ -66,3 +67,38 @@ export async function saveDistributionMode(
|
||||
const key = distributionModeStorageKey(origin, studentId);
|
||||
await browser.storage.local.set({ [key]: mode });
|
||||
}
|
||||
|
||||
export function classGroupsStorageKey(origin: string, studentId: number): string {
|
||||
return `${CLASS_GROUPS_PREFIX}.${origin}.${studentId}`;
|
||||
}
|
||||
|
||||
function isClassGroup(value: unknown): value is AnalyticsClassGroup {
|
||||
if (!value || typeof value !== "object") return false;
|
||||
const g = value as AnalyticsClassGroup;
|
||||
return (
|
||||
typeof g.id === "string" &&
|
||||
typeof g.name === "string" &&
|
||||
Array.isArray(g.classKeys) &&
|
||||
g.classKeys.every((key) => typeof key === "string")
|
||||
);
|
||||
}
|
||||
|
||||
export async function loadClassGroups(
|
||||
origin: string,
|
||||
studentId: number,
|
||||
): Promise<AnalyticsClassGroup[]> {
|
||||
const key = classGroupsStorageKey(origin, studentId);
|
||||
const result = await browser.storage.local.get(key);
|
||||
const raw = result[key];
|
||||
if (!Array.isArray(raw)) return [];
|
||||
return raw.filter(isClassGroup);
|
||||
}
|
||||
|
||||
export async function saveClassGroups(
|
||||
origin: string,
|
||||
studentId: number,
|
||||
groups: AnalyticsClassGroup[],
|
||||
): Promise<void> {
|
||||
const key = classGroupsStorageKey(origin, studentId);
|
||||
await browser.storage.local.set({ [key]: groups });
|
||||
}
|
||||
@@ -114,6 +114,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
.bsplus-analytics-mount:not(.bsplus-analytics-motion) .bsplus-analytics-animate {
|
||||
animation: none;
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.bsplus-analytics-delay-1 {
|
||||
animation-delay: 80ms;
|
||||
}
|
||||
@@ -923,6 +929,315 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Combined class groups */
|
||||
.bsplus-analytics-class-groups-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-add {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--bsplus-analytics-accent, var(--better-main, #007bff));
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
padding: 0.15rem 0.35rem;
|
||||
border-radius: 0.375rem;
|
||||
transition: background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-add:hover:not(:disabled) {
|
||||
background: color-mix(in srgb, var(--bsplus-analytics-accent, #007bff) 12%, transparent);
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-add:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-empty {
|
||||
margin: 0.35rem 0 0;
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1.45;
|
||||
color: var(--bsplus-analytics-muted, rgba(127, 127, 127, 0.95));
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-list {
|
||||
list-style: none;
|
||||
margin: 0.5rem 0 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-group-row {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-group-btn {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.1rem;
|
||||
padding: 0.55rem 0.65rem;
|
||||
border-radius: 0.625rem;
|
||||
border: 1px solid var(--bsplus-analytics-border, rgba(127, 127, 127, 0.25));
|
||||
background: var(--bsplus-analytics-surface, rgba(255, 255, 255, 0.04));
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
transition:
|
||||
border-color 0.15s ease,
|
||||
background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-group-btn:hover,
|
||||
.bsplus-analytics-class-group-btn.is-active {
|
||||
border-color: var(--bsplus-analytics-accent, #007bff);
|
||||
background: color-mix(in srgb, var(--bsplus-analytics-accent, #007bff) 10%, transparent);
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-group-name {
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-group-meta {
|
||||
font-size: 0.75rem;
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-group-icon {
|
||||
flex: 0 0 auto;
|
||||
width: 2rem;
|
||||
border: 1px solid var(--bsplus-analytics-border, rgba(127, 127, 127, 0.25));
|
||||
border-radius: 0.625rem;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-group-icon:hover {
|
||||
border-color: var(--bsplus-analytics-accent, #007bff);
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-group-delete:hover {
|
||||
color: #ef4444;
|
||||
border-color: color-mix(in srgb, #ef4444 45%, transparent);
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 10000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 1.25rem;
|
||||
background: rgba(0, 0, 0, 0.52);
|
||||
backdrop-filter: blur(4px);
|
||||
-webkit-backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-dialog {
|
||||
width: min(100%, 34rem);
|
||||
max-height: min(88vh, 42rem);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 1rem;
|
||||
border: 1px solid var(--bsplus-analytics-border, rgba(127, 127, 127, 0.28));
|
||||
background: var(--bsplus-analytics-panel, var(--background-primary, #1a1a1a));
|
||||
color: inherit;
|
||||
box-shadow:
|
||||
0 24px 48px rgba(0, 0, 0, 0.28),
|
||||
0 0 0 1px rgba(255, 255, 255, 0.04) inset;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-dialog-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
padding: 1rem 1.1rem 0.85rem;
|
||||
border-bottom: 1px solid var(--bsplus-analytics-border, rgba(127, 127, 127, 0.22));
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-dialog-title {
|
||||
margin: 0;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-dialog-desc {
|
||||
margin: 0.35rem 0 0;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.45;
|
||||
color: var(--bsplus-analytics-muted, rgba(127, 127, 127, 0.95));
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-close {
|
||||
flex: 0 0 auto;
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font-size: 1.35rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0.75;
|
||||
transition:
|
||||
opacity 0.15s ease,
|
||||
background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-close:hover {
|
||||
opacity: 1;
|
||||
background: rgba(127, 127, 127, 0.16);
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-dialog-body {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.85rem;
|
||||
padding: 0.95rem 1.1rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-dialog-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 0.5rem;
|
||||
padding: 0.85rem 1.1rem 1rem;
|
||||
border-top: 1px solid var(--bsplus-analytics-border, rgba(127, 127, 127, 0.22));
|
||||
background: color-mix(in srgb, var(--bsplus-analytics-panel, #111) 92%, transparent);
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-field:last-child {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-picks {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.45rem;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
max-height: min(52vh, 24rem);
|
||||
overflow-y: auto;
|
||||
padding: 0.15rem 0.1rem 0.15rem 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-pick {
|
||||
display: grid;
|
||||
grid-template-columns: 1.125rem minmax(0, 1fr);
|
||||
gap: 0.75rem;
|
||||
align-items: start;
|
||||
padding: 0.6rem 0.7rem;
|
||||
border-radius: 0.625rem;
|
||||
border: 1px solid transparent;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition:
|
||||
border-color 0.15s ease,
|
||||
background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-pick:hover {
|
||||
background: rgba(127, 127, 127, 0.08);
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-pick:has(input:checked) {
|
||||
border-color: color-mix(in srgb, var(--bsplus-analytics-accent, #007bff) 45%, transparent);
|
||||
background: color-mix(in srgb, var(--bsplus-analytics-accent, #007bff) 8%, transparent);
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-pick input[type="checkbox"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
margin: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-check {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 1.125rem;
|
||||
height: 1.125rem;
|
||||
margin-top: 0.1rem;
|
||||
border: 2px solid var(--bsplus-analytics-accent, var(--better-main, #007bff));
|
||||
border-radius: 0.3rem;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 800;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-pick:has(input:checked) .bsplus-analytics-class-groups-check {
|
||||
background: var(--bsplus-analytics-accent, var(--better-main, #007bff));
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-pick-text {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: 0.45rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-pick-label {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.4;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.bsplus-analytics-class-groups-year {
|
||||
flex: 0 0 auto;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
padding: 0.12rem 0.45rem;
|
||||
border-radius: 999px;
|
||||
background: rgba(127, 127, 127, 0.16);
|
||||
color: var(--bsplus-analytics-muted, rgba(220, 220, 220, 0.92));
|
||||
}
|
||||
|
||||
/* ─── Chart grid & cards ─── */
|
||||
.bsplus-analytics-charts {
|
||||
display: grid;
|
||||
|
||||
@@ -193,7 +193,11 @@ function slugSubjectKey(name: string, keyBySubject: Map<string, string>): string
|
||||
export function buildGradeTrendChart(
|
||||
data: Assessment[],
|
||||
timeRange: TimeRange,
|
||||
options: { showPerSubject?: boolean; custom?: CustomTimeRange } = {},
|
||||
options: {
|
||||
showPerSubject?: boolean;
|
||||
custom?: CustomTimeRange;
|
||||
combinedLabel?: string;
|
||||
} = {},
|
||||
): { points: TrendPoint[]; series: TrendSeries[]; accentColor: string } {
|
||||
const accentColor =
|
||||
"var(--bsplus-analytics-accent, var(--better-main, #007bff))";
|
||||
@@ -283,7 +287,7 @@ export function buildGradeTrendChart(
|
||||
const series: TrendSeries[] = [
|
||||
{
|
||||
key: "average",
|
||||
label: "Overall average",
|
||||
label: options.combinedLabel?.trim() || "Overall average",
|
||||
color: accentColor,
|
||||
isOverall: true,
|
||||
},
|
||||
|
||||
@@ -27,3 +27,17 @@ export interface AnalyticsCache {
|
||||
updatedAt: number;
|
||||
assessments: Assessment[];
|
||||
}
|
||||
|
||||
export interface AnalyticsClassOption {
|
||||
key: string;
|
||||
title: string;
|
||||
yearLabel: string;
|
||||
programme: number;
|
||||
metaclass: number;
|
||||
}
|
||||
|
||||
export interface AnalyticsClassGroup {
|
||||
id: string;
|
||||
name: string;
|
||||
classKeys: string[];
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import tailwindStyles from "./tailwind.css?inline";
|
||||
import pluginStyles from "./styles.css?inline";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { isSimpleAnalyticsUi } from "@/seqta/utils/performanceMode";
|
||||
import { mount, unmount } from "svelte";
|
||||
import GradeAnalyticsPage from "./GradeAnalyticsPage.svelte";
|
||||
import { buildContrastAccentPalette } from "./utils/accentColor";
|
||||
@@ -11,7 +12,8 @@ type ThemeSettingKey =
|
||||
| "DarkMode"
|
||||
| "adaptiveThemeColour"
|
||||
| "adaptiveThemeGradient"
|
||||
| "selectedTheme";
|
||||
| "selectedTheme"
|
||||
| "animations";
|
||||
|
||||
type ThemeListenerRegistration = {
|
||||
key: ThemeSettingKey;
|
||||
@@ -117,7 +119,11 @@ function syncThemeFromPage(target: HTMLElement) {
|
||||
|
||||
function syncThemeToAnalyticsUi() {
|
||||
if (shadowHost) syncThemeFromPage(shadowHost);
|
||||
if (analyticsRoot) syncThemeFromPage(analyticsRoot);
|
||||
if (analyticsRoot) {
|
||||
syncThemeFromPage(analyticsRoot);
|
||||
analyticsRoot.classList.toggle("bsplus-analytics-motion", !!settingsState.animations);
|
||||
analyticsRoot.classList.toggle("bsplus-analytics-simple", isSimpleAnalyticsUi());
|
||||
}
|
||||
}
|
||||
|
||||
function clearThemeListeners() {
|
||||
@@ -136,6 +142,7 @@ function watchThemeChanges() {
|
||||
"adaptiveThemeColour",
|
||||
"adaptiveThemeGradient",
|
||||
"selectedTheme",
|
||||
"animations",
|
||||
];
|
||||
|
||||
const listener = () => syncThemeToAnalyticsUi();
|
||||
@@ -199,7 +206,10 @@ export function renderAnalyticsPage(container: HTMLElement) {
|
||||
attributeFilter: ["class"],
|
||||
});
|
||||
|
||||
currentApp = mount(GradeAnalyticsPage, { target: analyticsRoot });
|
||||
currentApp = mount(GradeAnalyticsPage, {
|
||||
target: analyticsRoot,
|
||||
props: { simpleMode: isSimpleAnalyticsUi() },
|
||||
});
|
||||
}
|
||||
|
||||
export function unmountAnalyticsPage() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Plugin } from "../../core/types";
|
||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
import { booleanSetting } from "@/plugins/core/settingsHelpers";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import { verboseInfo } from "@/utils/verboseLog";
|
||||
@@ -60,7 +60,7 @@ const notificationCollectorPlugin: Plugin<
|
||||
let pollInterval: number | null = null;
|
||||
let isVisible = !document.hidden;
|
||||
let archiveSyncInFlight = false;
|
||||
const baseInterval = 30000;
|
||||
const baseInterval = isPerformanceMode() ? 60000 : 30000;
|
||||
const maxInterval = 300000;
|
||||
|
||||
api.storage.lastNotificationCount ||= 0;
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
} from "@/types/CustomThemes";
|
||||
import { BSPLUS_PENDING_THEME_ENSURE_AFTER_CLOUD_KEY } from "@/seqta/utils/cloudSettingsSync";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { fullMotionEffectsEnabled } from "@/seqta/utils/performanceMode";
|
||||
import debounce from "@/seqta/utils/debounce";
|
||||
import { themeUpdates } from "@/interface/hooks/ThemeUpdates";
|
||||
import { getApiBase } from "@/seqta/utils/DevApiBase";
|
||||
@@ -128,7 +129,7 @@ export class ThemeManager {
|
||||
private async applyViewTransition(callback: () => void): Promise<void> {
|
||||
if (
|
||||
!document.startViewTransition ||
|
||||
!settingsState.animations ||
|
||||
!fullMotionEffectsEnabled() ||
|
||||
window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
||||
) {
|
||||
// Just run the callback without animation if transitions not supported
|
||||
|
||||
@@ -52,7 +52,8 @@ function showEditModal(
|
||||
const modal = document.createElement("div");
|
||||
modal.className = "timetable-edit-modal";
|
||||
|
||||
const override = overrides?.[String(item.ci)] ?? overridesBySubject?.[item.description];
|
||||
const override =
|
||||
overrides?.[String(item.ci)] ?? overridesBySubject?.[item.description];
|
||||
|
||||
const roomValue = override?.room ?? item.room ?? "";
|
||||
const staffValue = override?.staff ?? item.staff ?? "";
|
||||
@@ -97,21 +98,31 @@ function showEditModal(
|
||||
modal.addEventListener("mousedown", (e) => e.stopPropagation());
|
||||
modal.addEventListener("mouseup", (e) => e.stopPropagation());
|
||||
|
||||
const roomInput = modal.querySelector("#timetable-edit-room") as HTMLInputElement;
|
||||
const staffInput = modal.querySelector("#timetable-edit-staff") as HTMLInputElement;
|
||||
const applyFutureCheckbox = modal.querySelector("#timetable-edit-apply-future") as HTMLInputElement;
|
||||
const roomInput = modal.querySelector(
|
||||
"#timetable-edit-room",
|
||||
) as HTMLInputElement;
|
||||
const staffInput = modal.querySelector(
|
||||
"#timetable-edit-staff",
|
||||
) as HTMLInputElement;
|
||||
const applyFutureCheckbox = modal.querySelector(
|
||||
"#timetable-edit-apply-future",
|
||||
) as HTMLInputElement;
|
||||
|
||||
modal.querySelector(".timetable-edit-btn-save")?.addEventListener("click", () => {
|
||||
onSave(
|
||||
item.ci,
|
||||
roomInput.value.trim(),
|
||||
staffInput.value.trim(),
|
||||
applyFutureCheckbox?.checked ?? false,
|
||||
);
|
||||
removeModal();
|
||||
});
|
||||
modal
|
||||
.querySelector(".timetable-edit-btn-save")
|
||||
?.addEventListener("click", () => {
|
||||
onSave(
|
||||
item.ci,
|
||||
roomInput.value.trim(),
|
||||
staffInput.value.trim(),
|
||||
applyFutureCheckbox?.checked ?? false,
|
||||
);
|
||||
removeModal();
|
||||
});
|
||||
|
||||
modal.querySelector(".timetable-edit-btn-cancel")?.addEventListener("click", removeModal);
|
||||
modal
|
||||
.querySelector(".timetable-edit-btn-cancel")
|
||||
?.addEventListener("click", removeModal);
|
||||
|
||||
const clearBtn = modal.querySelector(".timetable-edit-btn-clear");
|
||||
if (clearBtn) {
|
||||
@@ -163,7 +174,9 @@ const timetableEditPlugin = {
|
||||
if (byCalendar) return byCalendar as HTMLElement;
|
||||
}
|
||||
|
||||
for (const entry of document.querySelectorAll(".timetablepage .entry.class")) {
|
||||
for (const entry of document.querySelectorAll(
|
||||
".timetablepage .entry.class",
|
||||
)) {
|
||||
const entryTitle = entry.querySelector(".title")?.textContent?.trim();
|
||||
if (entryTitle === title) return entry as HTMLElement;
|
||||
}
|
||||
@@ -174,7 +187,8 @@ const timetableEditPlugin = {
|
||||
const title = quickbar.querySelector(".title")?.textContent?.trim() ?? "";
|
||||
if (!title) return;
|
||||
|
||||
const quickbarRoom = quickbar.querySelector(".meta .room")?.textContent?.trim() ?? "";
|
||||
const quickbarRoom =
|
||||
quickbar.querySelector(".meta .room")?.textContent?.trim() ?? "";
|
||||
const quickbarStaff =
|
||||
quickbar.querySelector(".meta .teacher")?.textContent?.trim() ?? "";
|
||||
|
||||
@@ -211,7 +225,10 @@ const timetableEditPlugin = {
|
||||
};
|
||||
|
||||
const processEntry = (entry: HTMLElement): void => {
|
||||
if (entry.classList.contains("assessment") || entry.hasAttribute("data-timetable-edit-processed")) return;
|
||||
// Mixed timetable entries can include both the `class` and `assessment`
|
||||
// classes, especially when an assessment is attached to a lesson. We still
|
||||
// need to apply the per-lesson override to that element.
|
||||
if (entry.hasAttribute("data-timetable-edit-processed")) return;
|
||||
|
||||
const ciStr = entry.getAttribute("data-instance");
|
||||
if (!ciStr) return;
|
||||
@@ -233,8 +250,10 @@ const timetableEditPlugin = {
|
||||
|
||||
const override = getEffectiveOverride(ci, description);
|
||||
if (override) {
|
||||
if (override.room !== undefined && roomEl) roomEl.textContent = override.room;
|
||||
if (override.staff !== undefined && teacherEl) teacherEl.textContent = override.staff;
|
||||
if (override.room !== undefined && roomEl)
|
||||
roomEl.textContent = override.room;
|
||||
if (override.staff !== undefined && teacherEl)
|
||||
teacherEl.textContent = override.staff;
|
||||
}
|
||||
|
||||
entry.addEventListener(
|
||||
@@ -250,14 +269,19 @@ const timetableEditPlugin = {
|
||||
};
|
||||
|
||||
const processAllEntries = () => {
|
||||
document.querySelectorAll(".timetablepage .entry.class").forEach((entry) => {
|
||||
processEntry(entry as HTMLElement);
|
||||
});
|
||||
document
|
||||
.querySelectorAll(".timetablepage .entry.class")
|
||||
.forEach((entry) => {
|
||||
processEntry(entry as HTMLElement);
|
||||
});
|
||||
};
|
||||
|
||||
const getVisibleClassQuickbar = (): HTMLElement | null => {
|
||||
const quickbar = document.querySelector(".timetablepage .quickbar.visible");
|
||||
if (!quickbar || quickbar.getAttribute("data-type") !== "class") return null;
|
||||
const quickbar = document.querySelector(
|
||||
".timetablepage .quickbar.visible",
|
||||
);
|
||||
if (!quickbar || quickbar.getAttribute("data-type") !== "class")
|
||||
return null;
|
||||
return quickbar as HTMLElement;
|
||||
};
|
||||
|
||||
@@ -284,10 +308,18 @@ const timetableEditPlugin = {
|
||||
if (override.room !== undefined && !roomEl) return;
|
||||
if (override.staff !== undefined && !teacherEl) return;
|
||||
|
||||
if (override.room !== undefined && roomEl && roomEl.textContent !== override.room) {
|
||||
if (
|
||||
override.room !== undefined &&
|
||||
roomEl &&
|
||||
roomEl.textContent !== override.room
|
||||
) {
|
||||
roomEl.textContent = override.room;
|
||||
}
|
||||
if (override.staff !== undefined && teacherEl && teacherEl.textContent !== override.staff) {
|
||||
if (
|
||||
override.staff !== undefined &&
|
||||
teacherEl &&
|
||||
teacherEl.textContent !== override.staff
|
||||
) {
|
||||
teacherEl.textContent = override.staff;
|
||||
}
|
||||
|
||||
@@ -300,7 +332,8 @@ const timetableEditPlugin = {
|
||||
const roomEl = quickbar.querySelector(".meta .room");
|
||||
const teacherEl = quickbar.querySelector(".meta .teacher");
|
||||
if (roomEl && roomEl.textContent !== room) roomEl.textContent = room;
|
||||
if (teacherEl && teacherEl.textContent !== staff) teacherEl.textContent = staff;
|
||||
if (teacherEl && teacherEl.textContent !== staff)
|
||||
teacherEl.textContent = staff;
|
||||
if (lastClickedCi !== null) lastSyncedQuickbarCi = lastClickedCi;
|
||||
};
|
||||
|
||||
@@ -325,7 +358,9 @@ const timetableEditPlugin = {
|
||||
|
||||
syncClassQuickbar(quickbar);
|
||||
|
||||
const hasButton = quickbar.querySelector(".timetable-edit-quickbar-btn");
|
||||
const hasButton = quickbar.querySelector(
|
||||
".timetable-edit-quickbar-btn",
|
||||
);
|
||||
const hasActions = quickbar.querySelector(".actions");
|
||||
if ((!hasButton || !hasActions) && ++attempts < maxAttempts) {
|
||||
quickbarSyncTimer = setTimeout(trySync, 50);
|
||||
@@ -364,9 +399,12 @@ const timetableEditPlugin = {
|
||||
const entryData = lastClickedEntry;
|
||||
if (!entryData) return;
|
||||
|
||||
const quickbarRoom = qb.querySelector(".meta .room")?.textContent?.trim() ?? "";
|
||||
const quickbarTeacher = qb.querySelector(".meta .teacher")?.textContent?.trim() ?? "";
|
||||
const quickbarTitle = qb.querySelector(".title")?.textContent?.trim() ?? "";
|
||||
const quickbarRoom =
|
||||
qb.querySelector(".meta .room")?.textContent?.trim() ?? "";
|
||||
const quickbarTeacher =
|
||||
qb.querySelector(".meta .teacher")?.textContent?.trim() ?? "";
|
||||
const quickbarTitle =
|
||||
qb.querySelector(".title")?.textContent?.trim() ?? "";
|
||||
const ci = lastClickedCi ?? entryData.item.ci;
|
||||
const item: TimetableEntryData = {
|
||||
ci,
|
||||
@@ -391,7 +429,10 @@ const timetableEditPlugin = {
|
||||
const current = getOverrides();
|
||||
api.storage.timetableOverrides = {
|
||||
...current,
|
||||
[String(saveCi)]: { room: room || undefined, staff: staff || undefined },
|
||||
[String(saveCi)]: {
|
||||
room: room || undefined,
|
||||
staff: staff || undefined,
|
||||
},
|
||||
};
|
||||
}
|
||||
if (entryData.roomEl) entryData.roomEl.textContent = room;
|
||||
@@ -409,17 +450,15 @@ const timetableEditPlugin = {
|
||||
delete bySubject[item.description];
|
||||
api.storage.timetableOverridesBySubject = bySubject;
|
||||
if (entryData.roomEl) entryData.roomEl.textContent = item.room;
|
||||
if (entryData.teacherEl) entryData.teacherEl.textContent = item.staff;
|
||||
if (entryData.teacherEl)
|
||||
entryData.teacherEl.textContent = item.staff;
|
||||
updateVisibleQuickbar(item.room, item.staff);
|
||||
processAllEntries();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
actions.insertBefore(
|
||||
btn,
|
||||
colourBtn ?? actions.firstChild,
|
||||
);
|
||||
actions.insertBefore(btn, colourBtn ?? actions.firstChild);
|
||||
};
|
||||
|
||||
const syncQuickbarFromDOM = () => {
|
||||
@@ -437,13 +476,19 @@ const timetableEditPlugin = {
|
||||
if (!quickbar) return;
|
||||
|
||||
const shouldSync = mutations.some((mutation) => {
|
||||
if (mutation.type === "attributes" && mutation.attributeName === "class") {
|
||||
if (
|
||||
mutation.type === "attributes" &&
|
||||
mutation.attributeName === "class"
|
||||
) {
|
||||
const target = mutation.target as HTMLElement;
|
||||
return target.classList.contains("quickbar");
|
||||
}
|
||||
if (mutation.type === "childList") {
|
||||
const target = mutation.target as HTMLElement;
|
||||
return target.classList?.contains("quickbar") || target.closest?.(".quickbar");
|
||||
return (
|
||||
target.classList?.contains("quickbar") ||
|
||||
target.closest?.(".quickbar")
|
||||
);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
@@ -483,11 +528,13 @@ const timetableEditPlugin = {
|
||||
const timetablePage = document.querySelector(".timetablepage");
|
||||
if (timetablePage && !observer) {
|
||||
observer = new MutationObserver(() => {
|
||||
document.querySelectorAll(".timetablepage .entry.class").forEach((entry) => {
|
||||
if (!entry.hasAttribute("data-timetable-edit-processed")) {
|
||||
processEntry(entry as HTMLElement);
|
||||
}
|
||||
});
|
||||
document
|
||||
.querySelectorAll(".timetablepage .entry.class")
|
||||
.forEach((entry) => {
|
||||
if (!entry.hasAttribute("data-timetable-edit-processed")) {
|
||||
processEntry(entry as HTMLElement);
|
||||
}
|
||||
});
|
||||
});
|
||||
observer.observe(timetablePage, { childList: true, subtree: true });
|
||||
}
|
||||
@@ -501,10 +548,14 @@ const timetableEditPlugin = {
|
||||
observer?.disconnect();
|
||||
quickbarObserver?.disconnect();
|
||||
if (quickbarSyncTimer !== null) clearTimeout(quickbarSyncTimer);
|
||||
document.querySelectorAll("[data-timetable-edit-processed]").forEach((el) => {
|
||||
el.removeAttribute("data-timetable-edit-processed");
|
||||
});
|
||||
document.querySelectorAll(".timetable-edit-quickbar-btn").forEach((el) => el.remove());
|
||||
document
|
||||
.querySelectorAll("[data-timetable-edit-processed]")
|
||||
.forEach((el) => {
|
||||
el.removeAttribute("data-timetable-edit-processed");
|
||||
});
|
||||
document
|
||||
.querySelectorAll(".timetable-edit-quickbar-btn")
|
||||
.forEach((el) => el.remove());
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@ import { createPluginAPI } from "./createAPI";
|
||||
import browser from "webextension-polyfill";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { verboseInfo } from "@/utils/verboseLog";
|
||||
import { isPluginAllowedInPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
interface PluginSettingsStorage {
|
||||
enabled?: boolean;
|
||||
@@ -191,6 +192,14 @@ export class PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (!isPluginAllowedInPerformanceMode(pluginId)) {
|
||||
this.disposePluginAPI(pluginId);
|
||||
verboseInfo(
|
||||
`Plugin "${pluginId}" paused by performance mode`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Inject plugin styles if provided
|
||||
if (plugin.styles) {
|
||||
const styleElement = document.createElement("style");
|
||||
|
||||
+68
-27
@@ -8,6 +8,8 @@ import { delay } from "@/seqta/utils/delay";
|
||||
import stringToHTML from "@/seqta/utils/stringToHTML";
|
||||
import { MessageHandler } from "@/seqta/utils/listeners/MessageListener";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { animationsEnabled, fullMotionEffectsEnabled, isPerformanceMode, syncPerformanceModeEffects } from "@/seqta/utils/performanceMode";
|
||||
import { animatePopupOpen } from "@/seqta/utils/popupAnimation";
|
||||
import { StorageChangeHandler } from "@/seqta/utils/listeners/StorageChanges";
|
||||
import { eventManager } from "@/seqta/utils/listeners/EventManager";
|
||||
import debounce from "@/seqta/utils/debounce";
|
||||
@@ -28,6 +30,7 @@ import {
|
||||
} from "@/seqta/utils/Loaders/LoadEngageHomePage";
|
||||
import { loadHomePage } from "@/seqta/utils/Loaders/LoadHomePage";
|
||||
import { runStartupPopupQueue } from "@/seqta/utils/Openers/StartupPopupQueue";
|
||||
import { OpenCoursesAssessmentsFixPopup } from "@/seqta/utils/Openers/OpenCoursesAssessmentsFixPopup";
|
||||
|
||||
import {
|
||||
syncTimetableUrlMonitoring,
|
||||
@@ -92,6 +95,10 @@ export async function finishLoad() {
|
||||
|
||||
document.querySelector(".legacy-root")?.classList.remove("hidden");
|
||||
|
||||
if (settingsState.devMode && settingsState.devDelayLoadingScreen) {
|
||||
await delay(5000);
|
||||
}
|
||||
|
||||
const loadingbk = document.getElementById("loading");
|
||||
loadingbk?.classList.add("closeLoading");
|
||||
stopLoadingAnimation();
|
||||
@@ -202,8 +209,8 @@ function SortMessagePageItems(messagesParentElement: any) {
|
||||
|
||||
async function LoadPageElements(): Promise<void> {
|
||||
await AddBetterSEQTAElements();
|
||||
void import("@/seqta/ui/sidebar/mountCustomSidebar").then((mod) => {
|
||||
void mod.mountCustomSidebar();
|
||||
void import("@/seqta/ui/sidebar/applyNativeSidebar").then((mod) => {
|
||||
void mod.applyNativeSidebar();
|
||||
});
|
||||
void import("@/seqta/ui/titlebar/mountCustomTitleBar").then((mod) => {
|
||||
void mod.mountCustomTitleBar();
|
||||
@@ -249,11 +256,21 @@ async function LoadPageElements(): Promise<void> {
|
||||
|
||||
async function handleNotices(node: Element): Promise<void> {
|
||||
if (!(node instanceof HTMLElement)) return;
|
||||
if (!settingsState.animations) return;
|
||||
if (!animationsEnabled()) return;
|
||||
|
||||
if (!fullMotionEffectsEnabled()) {
|
||||
node.style.opacity = "0";
|
||||
node.style.transform = "translateY(8px)";
|
||||
node.style.transition = "opacity 0.2s ease, transform 0.2s ease";
|
||||
requestAnimationFrame(() => {
|
||||
node.style.opacity = "1";
|
||||
node.style.transform = "none";
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
node.style.opacity = "0";
|
||||
|
||||
// get index of node in relation to parent
|
||||
const index = Array.from(node.parentElement!.children).indexOf(node);
|
||||
|
||||
const { animate } = await loadMotion();
|
||||
@@ -366,7 +383,7 @@ async function handleMessages(node: Element): Promise<void> {
|
||||
document.title = "Direct Messages ― SEQTA Learn";
|
||||
SortMessagePageItems(node);
|
||||
|
||||
if (!settingsState.animations) return;
|
||||
if (!animationsEnabled() || !fullMotionEffectsEnabled()) return;
|
||||
|
||||
// Hides messages on page load
|
||||
const style = document.createElement("style");
|
||||
@@ -394,7 +411,7 @@ async function handleMessages(node: Element): Promise<void> {
|
||||
|
||||
async function handleDashboard(node: Element): Promise<void> {
|
||||
if (!(node instanceof HTMLElement)) return;
|
||||
if (!settingsState.animations) return;
|
||||
if (!animationsEnabled() || !fullMotionEffectsEnabled()) return;
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.classList.add("dashboardHider");
|
||||
@@ -425,7 +442,7 @@ async function handleDashboard(node: Element): Promise<void> {
|
||||
|
||||
async function handleDocuments(node: Element): Promise<void> {
|
||||
if (!(node instanceof HTMLElement)) return;
|
||||
if (!settingsState.animations) return;
|
||||
if (!animationsEnabled() || !fullMotionEffectsEnabled()) return;
|
||||
|
||||
await waitForElm(".document", true, 10);
|
||||
try {
|
||||
@@ -449,7 +466,7 @@ async function handleDocuments(node: Element): Promise<void> {
|
||||
|
||||
async function handleReports(node: Element): Promise<void> {
|
||||
if (!(node instanceof HTMLElement)) return;
|
||||
if (!settingsState.animations) return;
|
||||
if (!animationsEnabled() || !fullMotionEffectsEnabled()) return;
|
||||
|
||||
await waitForElm(".report", true, 10);
|
||||
try {
|
||||
@@ -664,13 +681,17 @@ export function showConflictPopup() {
|
||||
document.getElementById("container")?.append(background);
|
||||
|
||||
// CSS fade — avoid Motion on conflict overlay (not critical-path shell, but keeps Motion off this import path).
|
||||
if (settingsState.animations) {
|
||||
const el = background as HTMLElement;
|
||||
el.style.opacity = "0";
|
||||
el.style.transition = "opacity 200ms ease-in-out";
|
||||
requestAnimationFrame(() => {
|
||||
el.style.opacity = "1";
|
||||
});
|
||||
if (animationsEnabled()) {
|
||||
if (fullMotionEffectsEnabled()) {
|
||||
const el = background as HTMLElement;
|
||||
el.style.opacity = "0";
|
||||
el.style.transition = "opacity 200ms ease-in-out";
|
||||
requestAnimationFrame(() => {
|
||||
el.style.opacity = "1";
|
||||
});
|
||||
} else {
|
||||
animatePopupOpen(background);
|
||||
}
|
||||
}
|
||||
|
||||
background.addEventListener("click", (event) => {
|
||||
@@ -699,6 +720,7 @@ export function init() {
|
||||
}
|
||||
|
||||
AppendElementsToDisabledPage();
|
||||
OpenCoursesAssessmentsFixPopup();
|
||||
};
|
||||
|
||||
const handleDisabled = () => {
|
||||
@@ -723,19 +745,16 @@ export function init() {
|
||||
document.querySelector(".legacy-root")?.classList.add("hidden");
|
||||
}
|
||||
|
||||
// Learn only: hide native sidebar + mount Svelte replacement during loading.
|
||||
// Engage keeps its native React menu — never apply the pending hide class there.
|
||||
// Learn only: apply sidebar CSS vars early; Engage keeps its native React menu.
|
||||
if (!onLogin && !isSeqtaEngageExperience()) {
|
||||
document.documentElement.classList.add("bsplus-custom-sidebar-pending");
|
||||
document.documentElement.classList.add("bsplus-custom-title-pending");
|
||||
void import("@/seqta/ui/sidebar/mountCustomSidebar").then((mod) => {
|
||||
mod.prepareCustomSidebarEarly();
|
||||
void import("@/seqta/ui/sidebar/applyNativeSidebar").then((mod) => {
|
||||
mod.prepareNativeSidebarEarly();
|
||||
});
|
||||
void import("@/seqta/ui/titlebar/mountCustomTitleBar").then((mod) => {
|
||||
mod.prepareCustomTitleBarEarly();
|
||||
});
|
||||
} else {
|
||||
document.documentElement.classList.remove("bsplus-custom-sidebar-pending");
|
||||
document.documentElement.classList.remove("bsplus-custom-title-pending");
|
||||
}
|
||||
|
||||
@@ -744,11 +763,28 @@ export function init() {
|
||||
new StorageChangeHandler();
|
||||
new MessageHandler();
|
||||
|
||||
void updateAllColors();
|
||||
applySelectedFont();
|
||||
syncPerformanceModeEffects();
|
||||
|
||||
const deferBootWork = (fn: () => void) => {
|
||||
if (typeof requestIdleCallback === "function") {
|
||||
requestIdleCallback(fn, { timeout: 3000 });
|
||||
} else {
|
||||
setTimeout(fn, 100);
|
||||
}
|
||||
};
|
||||
deferBootWork(() => {
|
||||
void updateAllColors();
|
||||
applySelectedFont();
|
||||
});
|
||||
|
||||
let hashColorTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
window.addEventListener("hashchange", () => {
|
||||
if (settingsState.adaptiveThemeColour) void updateAllColors();
|
||||
if (!settingsState.adaptiveThemeColour) return;
|
||||
if (hashColorTimer) clearTimeout(hashColorTimer);
|
||||
hashColorTimer = setTimeout(() => {
|
||||
hashColorTimer = null;
|
||||
void updateAllColors();
|
||||
}, isPerformanceMode() ? 200 : 80);
|
||||
});
|
||||
if (!onLogin) {
|
||||
loading();
|
||||
@@ -820,9 +856,14 @@ export function init() {
|
||||
);
|
||||
}
|
||||
|
||||
[1000, 1200, 1500].forEach((delay) =>
|
||||
setTimeout(focusEditor, delay),
|
||||
);
|
||||
let attempts = 0;
|
||||
const tryFocus = () => {
|
||||
focusEditor();
|
||||
if (attempts++ < 5) {
|
||||
requestAnimationFrame(tryFocus);
|
||||
}
|
||||
};
|
||||
requestAnimationFrame(tryFocus);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -16,6 +16,14 @@ import { updateAllColors } from "./colors/Manager";
|
||||
import { delay } from "@/seqta/utils/delay";
|
||||
import { LUCIDE_MOON_ICON_SVG } from "@/lib/icons/lucideMoon";
|
||||
import { LUCIDE_SUN_ICON_SVG } from "@/lib/icons/lucideSun";
|
||||
import { ensureTitlebarFounderBadgeMounted, refreshTitlebarFounderBadge } from "@/seqta/ui/founderBadge/mountTitlebarFounderBadge";
|
||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
import { rafThrottle } from "@/seqta/utils/rafThrottle";
|
||||
import {
|
||||
installSidebarDrillReturn,
|
||||
runSidebarDrillReturn,
|
||||
getSidebarDrillDepth,
|
||||
} from "@/seqta/ui/sidebar/sidebarDrillReturn";
|
||||
|
||||
let cachedUserInfo: any = null;
|
||||
let userInfoFetchPromise: Promise<any> | null = null;
|
||||
@@ -144,8 +152,7 @@ export async function AddBetterSEQTAElements() {
|
||||
setupEventListeners();
|
||||
await addDarkLightToggle();
|
||||
customizeMenuToggle();
|
||||
// Kept as fallback if the custom Svelte sidebar fails to mount.
|
||||
setupSidebarAccessibility();
|
||||
maybeSetupSidebarAccessibility();
|
||||
}
|
||||
|
||||
addExtensionSettings();
|
||||
@@ -181,6 +188,7 @@ async function handleUserInfoAndStudentData() {
|
||||
]);
|
||||
|
||||
updateUserInfo(userInfo);
|
||||
ensureTitlebarFounderBadgeMounted();
|
||||
await updateStudentInfo((await studentResponse.json()).payload, userInfo);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
@@ -227,11 +235,16 @@ function updateUserInfo(info: {
|
||||
stringToHTML(/* html */ `
|
||||
<div class="userInfo">
|
||||
<div class="userInfoText">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<p class="userInfohouse userInfoCode" style="display: none;"></p>
|
||||
${displayName ? `<p class="userInfoName">${displayName}</p>` : ""}
|
||||
<div class="userInfoNameRow">
|
||||
<div class="userInfoHouseWrap">
|
||||
<p class="userInfohouse userInfoCode" style="display: none;"></p>
|
||||
<span class="bsplus-founder-badge-slot" hidden></span>
|
||||
</div>
|
||||
<div class="userInfoDetails">
|
||||
${displayName ? `<p class="userInfoName">${displayName}</p>` : ""}
|
||||
${metadata ? `<p class="userInfoCode">${metadata}</p>` : ""}
|
||||
</div>
|
||||
</div>
|
||||
${metadata ? `<p class="userInfoCode">${metadata}</p>` : ""}
|
||||
</div>
|
||||
</div>
|
||||
`).firstChild!,
|
||||
@@ -277,6 +290,7 @@ async function updateStudentInfo(students: any, info: Awaited<ReturnType<typeof
|
||||
|
||||
houseelement.innerText = text;
|
||||
houseelement.style.display = text ? "block" : "none";
|
||||
refreshTitlebarFounderBadge();
|
||||
}
|
||||
|
||||
function createNewsButton(fragment: DocumentFragment, menu: HTMLElement) {
|
||||
@@ -413,13 +427,20 @@ async function addEngageUserInfo() {
|
||||
stringToHTML(/* html */ `
|
||||
<div class="userInfo">
|
||||
<div class="userInfoText">
|
||||
${displayName ? `<p class="userInfoName">${displayName}</p>` : ""}
|
||||
${subText ? `<p class="userInfoCode">${subText}</p>` : ""}
|
||||
<div class="userInfoNameRow">
|
||||
<span class="bsplus-founder-badge-slot" hidden></span>
|
||||
<div class="userInfoDetails">
|
||||
${displayName ? `<p class="userInfoName">${displayName}</p>` : ""}
|
||||
${subText ? `<p class="userInfoCode">${subText}</p>` : ""}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`).firstChild!,
|
||||
);
|
||||
|
||||
ensureTitlebarFounderBadgeMounted();
|
||||
|
||||
const iconNode = stringToHTML(/* html */ `
|
||||
<div class="userInfosvgdiv tooltip" id="engage-logouttooltip-wrap">
|
||||
<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>
|
||||
@@ -485,11 +506,18 @@ async function setupEngageSettingsButton() {
|
||||
}
|
||||
(content as HTMLElement).dataset.bsplusEngageSettingsWatch = "1";
|
||||
|
||||
const observer = new MutationObserver(() => {
|
||||
if (document.getElementById("AddedSettings")) return;
|
||||
void tryMount();
|
||||
});
|
||||
observer.observe(content, { childList: true, subtree: true });
|
||||
let engageRemountTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
const debouncedTryMount = () => {
|
||||
if (engageRemountTimer) clearTimeout(engageRemountTimer);
|
||||
engageRemountTimer = setTimeout(() => {
|
||||
engageRemountTimer = null;
|
||||
if (document.getElementById("AddedSettings")) return;
|
||||
void tryMount();
|
||||
}, isPerformanceMode() ? 300 : 80);
|
||||
};
|
||||
|
||||
const observer = new MutationObserver(debouncedTryMount);
|
||||
observer.observe(content, { childList: true, subtree: !isPerformanceMode() });
|
||||
}
|
||||
|
||||
function GetLightDarkModeString() {
|
||||
@@ -557,6 +585,10 @@ function customizeMenuToggle() {
|
||||
}
|
||||
}
|
||||
|
||||
function maybeSetupSidebarAccessibility() {
|
||||
setupSidebarAccessibility();
|
||||
}
|
||||
|
||||
function setupSidebarAccessibility() {
|
||||
updateSidebarAccessibility();
|
||||
|
||||
@@ -564,31 +596,9 @@ function setupSidebarAccessibility() {
|
||||
if (!menu) return;
|
||||
|
||||
sidebarAccessibilityObserver?.disconnect();
|
||||
sidebarAccessibilityObserver = new MutationObserver((mutations) => {
|
||||
// Custom Svelte sidebar owns drill a11y — ignore its DOM (opening Goals/Folios
|
||||
// mutates a lot; re-running here used to help freeze the tab).
|
||||
if (menu.classList.contains("bsplus-custom-sidebar")) {
|
||||
const root = document.getElementById("bsplus-sidebar-root");
|
||||
if (
|
||||
root &&
|
||||
mutations.every(
|
||||
(m) => root === m.target || root.contains(m.target as Node),
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
// Still ignore class/style-only native noise while custom sidebar is on.
|
||||
if (
|
||||
mutations.every(
|
||||
(m) =>
|
||||
m.type === "attributes" &&
|
||||
(m.attributeName === "class" || m.attributeName === "style"),
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
scheduleSidebarAccessibilityUpdate();
|
||||
const throttledA11yUpdate = rafThrottle(scheduleSidebarAccessibilityUpdate);
|
||||
sidebarAccessibilityObserver = new MutationObserver(() => {
|
||||
throttledA11yUpdate();
|
||||
});
|
||||
sidebarAccessibilityObserver.observe(menu, {
|
||||
subtree: true,
|
||||
@@ -601,6 +611,8 @@ function setupSidebarAccessibility() {
|
||||
document.addEventListener("keydown", handleSidebarKeyboardActivation);
|
||||
sidebarAccessibilityListenersAttached = true;
|
||||
}
|
||||
|
||||
installSidebarDrillReturn(menu);
|
||||
}
|
||||
|
||||
function scheduleSidebarAccessibilityUpdate() {
|
||||
@@ -647,6 +659,10 @@ function handleSidebarKeyboardActivation(event: KeyboardEvent) {
|
||||
if (!parentEntry) return;
|
||||
|
||||
event.preventDefault();
|
||||
const depthBefore = getSidebarDrillDepth(menu);
|
||||
if (depthBefore > 0) {
|
||||
runSidebarDrillReturn(menu, depthBefore - 1);
|
||||
}
|
||||
parentEntry.classList.remove("active");
|
||||
scheduleSidebarAccessibilityUpdate();
|
||||
requestAnimationFrame(() => {
|
||||
@@ -730,20 +746,6 @@ function updateSidebarAccessibility() {
|
||||
const menu = document.getElementById("menu");
|
||||
if (!menu) return;
|
||||
|
||||
// Custom Svelte sidebar owns its own a11y / drill UI — do not mark its
|
||||
// `#bsplus-sidebar-root` items offscreen based on the hidden native list.
|
||||
if (menu.classList.contains("bsplus-custom-sidebar")) {
|
||||
const root = document.getElementById("bsplus-sidebar-root");
|
||||
if (root) {
|
||||
for (const entry of root.querySelectorAll(`.${BSPLUS_SIDEBAR_OFFSCREEN}`)) {
|
||||
if (entry instanceof HTMLElement) {
|
||||
entry.classList.remove(BSPLUS_SIDEBAR_OFFSCREEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const visibleList = getVisibleSidebarList(menu);
|
||||
const visibleEntries = new Set(
|
||||
visibleList ? getDirectSidebarEntries(visibleList) : [],
|
||||
@@ -761,7 +763,10 @@ function updateSidebarAccessibility() {
|
||||
visibleEntries.has(entry) || drillFolders.has(entry);
|
||||
|
||||
if (!interactive) {
|
||||
entry.classList.add(BSPLUS_SIDEBAR_OFFSCREEN);
|
||||
// Keep rows in normal layout — offscreen position/opacity snaps cause a
|
||||
// pop-in when drilling back to the root list. Visual hide uses translateX
|
||||
// in sidebar-animation.scss; keyboard uses tabindex only.
|
||||
entry.classList.remove(BSPLUS_SIDEBAR_OFFSCREEN);
|
||||
entry.tabIndex = -1;
|
||||
label.tabIndex = -1;
|
||||
continue;
|
||||
@@ -789,9 +794,7 @@ function getDirectSidebarEntries(list: HTMLElement) {
|
||||
}
|
||||
|
||||
function getVisibleSidebarList(menu: HTMLElement) {
|
||||
let currentList = menu.querySelector(
|
||||
":scope > ul:not(#bsplus-sidebar-root)",
|
||||
) as HTMLElement | null;
|
||||
let currentList = menu.querySelector(":scope > ul") as HTMLElement | null;
|
||||
|
||||
while (currentList) {
|
||||
const activeSubmenuParent = currentList.querySelector(
|
||||
|
||||
+22
-9
@@ -6,8 +6,10 @@ import loadingOverlay from "./loading-overlay.html?raw";
|
||||
import { startLoadingCanvas } from "./loadingCanvas";
|
||||
import {
|
||||
pickLoadingVariant,
|
||||
resolveLoadingTheme,
|
||||
type LoadingVariant,
|
||||
} from "./loadingVariants";
|
||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
let stopCanvas: (() => void) | null = null;
|
||||
let unbindThemeGuard: (() => void) | null = null;
|
||||
@@ -44,11 +46,23 @@ const loadingStyles = /* css */ `
|
||||
--bk-spin-small: 3s;
|
||||
--bk-stage-name: bkloading-stage-in;
|
||||
--bk-stage-duration: 0.85s;
|
||||
--bk-version-color: rgba(255, 255, 255, 0.35);
|
||||
--bk-vignette-fill: radial-gradient(ellipse at center, transparent 32%, rgba(0, 0, 0, 0.75) 100%);
|
||||
color: ${LOADING_PALETTE.text};
|
||||
opacity: 1;
|
||||
transition: opacity 0.85s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
:host([data-scheme="light"]) {
|
||||
--bk-line-color: rgba(24, 24, 27, 0.1);
|
||||
--bk-line-accent: rgba(24, 24, 27, 0.18);
|
||||
--bk-line-blue: rgba(37, 99, 235, 0.5);
|
||||
--bk-grid-color: rgba(24, 24, 27, 0.055);
|
||||
--bk-version-color: rgba(24, 24, 27, 0.42);
|
||||
--bk-vignette-fill: radial-gradient(ellipse at center, transparent 32%, rgba(250, 250, 250, 0.88) 100%);
|
||||
color: #18181b;
|
||||
}
|
||||
|
||||
:host(.closeLoading) {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
@@ -66,7 +80,7 @@ const loadingStyles = /* css */ `
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background: radial-gradient(ellipse at center, transparent 32%, rgba(0, 0, 0, 0.75) 100%);
|
||||
background: var(--bk-vignette-fill);
|
||||
opacity: 0.88;
|
||||
}
|
||||
|
||||
@@ -153,7 +167,7 @@ const loadingStyles = /* css */ `
|
||||
bottom: 10px;
|
||||
font-size: 0.95rem;
|
||||
letter-spacing: 0.02em;
|
||||
color: rgba(255, 255, 255, 0.35);
|
||||
color: var(--bk-version-color);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@@ -209,11 +223,6 @@ function applyHostShell(host: HTMLElement) {
|
||||
["contain", "strict"],
|
||||
["visibility", "visible"],
|
||||
["pointer-events", "auto"],
|
||||
["color", LOADING_PALETTE.text],
|
||||
["--bk-line-color", LOADING_PALETTE.line],
|
||||
["--bk-line-accent", LOADING_PALETTE.lineAccent],
|
||||
["--bk-line-blue", LOADING_PALETTE.lineBlue],
|
||||
["--bk-grid-color", LOADING_PALETTE.grid],
|
||||
] as const;
|
||||
|
||||
for (const [prop, value] of shell) {
|
||||
@@ -226,8 +235,10 @@ function applyVariantTheme(
|
||||
shadow: ShadowRoot,
|
||||
variant: LoadingVariant,
|
||||
) {
|
||||
const { theme } = variant;
|
||||
const darkMode = !!settingsState.DarkMode;
|
||||
const theme = resolveLoadingTheme(variant, darkMode);
|
||||
host.dataset.variant = variant.id;
|
||||
host.dataset.scheme = darkMode ? "dark" : "light";
|
||||
applyHostShell(host);
|
||||
host.style.setProperty("background", theme.background, "important");
|
||||
host.style.setProperty("--bk-spin-outer", theme.spinOuter, "important");
|
||||
@@ -310,7 +321,9 @@ export default function loading() {
|
||||
document.documentElement.append(host);
|
||||
|
||||
applyVariantTheme(host, shadow, variant);
|
||||
startCanvasForRoot(host, shadow, variant);
|
||||
if (!isPerformanceMode()) {
|
||||
startCanvasForRoot(host, shadow, variant);
|
||||
}
|
||||
|
||||
activeLoading = { host, shadow, variant };
|
||||
unbindThemeGuard = bindLoadingThemeGuard();
|
||||
|
||||
@@ -5,9 +5,8 @@ import { lightenAndPaleColor } from "./lightenAndPaleColor";
|
||||
import ColorLuminance from "./ColorLuminance";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { getAdaptiveColour } from "@/seqta/utils/adaptiveThemeColour";
|
||||
import { adaptiveThemeTransitionEnabled, transparencyEnabled } from "@/seqta/utils/performanceMode";
|
||||
import { getCustomThemeAdaptiveCssVariableBindings } from "@/seqta/ui/colors/customThemeAdaptiveBindings";
|
||||
import { syncTransparencyEffectsClass } from "@/seqta/ui/colors/syncTransparencyEffectsClass";
|
||||
|
||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||
import darkLogo from "@/resources/icons/betterseqta-light-full.png";
|
||||
import lightLogo from "@/resources/icons/betterseqta-dark-full.png";
|
||||
@@ -105,7 +104,7 @@ function applyBetterseqtaLogoBackground(isDark: boolean) {
|
||||
background-image: url("${fullUrl}") !important;
|
||||
}
|
||||
/* Icon-only sidebar: wordmark → compact mark (theme-aware). */
|
||||
body.student.icon-only-sidebar:not(:has(#menu li.hasChildren.active)) #menu > ul::before {
|
||||
body.student.icon-only-sidebar:not(:has(#menu li.hasChildren:is(.active, .bsplus-active))) #menu > ul::before {
|
||||
background-image: url("${iconUrl}") !important;
|
||||
}
|
||||
`;
|
||||
@@ -127,7 +126,11 @@ function getRepresentativeRgbChannels(s: string): { r: number; g: number; b: num
|
||||
}
|
||||
|
||||
function applyColorsWith(selectedColor: string) {
|
||||
syncTransparencyEffectsClass(settingsState.transparencyEffects === true);
|
||||
if (transparencyEnabled()) {
|
||||
document.documentElement.classList.add("transparencyEffects");
|
||||
} else {
|
||||
document.documentElement.classList.remove("transparencyEffects");
|
||||
}
|
||||
|
||||
// Common properties, always applied
|
||||
const commonProps = {
|
||||
@@ -252,7 +255,7 @@ export async function updateAllColors() {
|
||||
|
||||
const shouldAnimate =
|
||||
settingsState.adaptiveThemeColour &&
|
||||
(settingsState.adaptiveThemeColourTransition ?? true) &&
|
||||
adaptiveThemeTransitionEnabled() &&
|
||||
!!toHex;
|
||||
|
||||
const applyImmediate = () => {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/** @jest-environment jsdom */
|
||||
|
||||
import { syncTransparencyEffectsClass } from "./syncTransparencyEffectsClass";
|
||||
|
||||
describe("syncTransparencyEffectsClass", () => {
|
||||
beforeEach(() => {
|
||||
document.documentElement.classList.remove("transparencyEffects");
|
||||
});
|
||||
|
||||
it("adds the transparency class when enabled", () => {
|
||||
syncTransparencyEffectsClass(true);
|
||||
expect(document.documentElement.classList.contains("transparencyEffects")).toBe(true);
|
||||
});
|
||||
|
||||
it("removes the transparency class when disabled", () => {
|
||||
document.documentElement.classList.add("transparencyEffects");
|
||||
syncTransparencyEffectsClass(false);
|
||||
expect(document.documentElement.classList.contains("transparencyEffects")).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -1,10 +0,0 @@
|
||||
export function syncTransparencyEffectsClass(
|
||||
enabled: boolean,
|
||||
root: HTMLElement = document.documentElement,
|
||||
): void {
|
||||
if (enabled) {
|
||||
root.classList.add("transparencyEffects");
|
||||
} else {
|
||||
root.classList.remove("transparencyEffects");
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ const contentConfig: ContentConfig = {
|
||||
},
|
||||
},
|
||||
userCode: {
|
||||
selector: ".userInfoText > .userInfoCode",
|
||||
selector: ".userInfoText .userInfoCode",
|
||||
action: (element) => {
|
||||
element.textContent = generateMockUserCode();
|
||||
},
|
||||
|
||||
@@ -87,11 +87,11 @@ const SEQTA_FONT_SCOPE = `
|
||||
.legacy-root,
|
||||
.legacy-root input,
|
||||
.legacy-root textarea,
|
||||
.legacy-root button,
|
||||
.legacy-root button:not(.iconFamily),
|
||||
.legacy-root select,
|
||||
.legacy-root option,
|
||||
.legacy-root .input,
|
||||
.legacy-root *,
|
||||
.legacy-root *:not(.iconFamily),
|
||||
#container,
|
||||
#container *
|
||||
`;
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||
import { refreshCloudUserFromServer } from "@/seqta/utils/cloudPfpSync";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import {
|
||||
founderBadgeChipHtml,
|
||||
pickPrimaryFounderBadge,
|
||||
type FounderBadgeItem,
|
||||
} from "@/seqta/utils/founderBadges";
|
||||
import { openFounderBadgeModal } from "@/seqta/ui/founderBadge/openFounderBadgeModal";
|
||||
|
||||
let subscribed = false;
|
||||
let refreshPending = false;
|
||||
|
||||
function renderBadgeChip(
|
||||
slot: HTMLElement,
|
||||
badge: FounderBadgeItem,
|
||||
signupNumber?: number | null,
|
||||
): void {
|
||||
const house = slot
|
||||
.closest(".userInfoHouseWrap")
|
||||
?.querySelector<HTMLElement>(".userInfohouse");
|
||||
if (house?.style.display === "none") {
|
||||
slot.replaceChildren();
|
||||
slot.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
slot.hidden = false;
|
||||
slot.innerHTML = founderBadgeChipHtml(badge, { titlebar: true });
|
||||
|
||||
const chip = slot.querySelector<HTMLButtonElement>(".bsplus-founder-badge");
|
||||
if (!chip) return;
|
||||
|
||||
chip.setAttribute("aria-label", `${badge.label}, click for details`);
|
||||
chip.addEventListener("click", () => openFounderBadgeModal(badge, signupNumber));
|
||||
}
|
||||
|
||||
async function syncTitlebarFounderBadge(): Promise<void> {
|
||||
const slots = document.querySelectorAll<HTMLElement>(".titlebar .bsplus-founder-badge-slot");
|
||||
for (const slot of slots) {
|
||||
slot.replaceChildren();
|
||||
slot.hidden = true;
|
||||
}
|
||||
|
||||
if (settingsState.showTitlebarFounderBadge === false || !cloudAuth.state.isLoggedIn) return;
|
||||
|
||||
let user = cloudAuth.state.user;
|
||||
if (user && user.signup_number == null && !user.badges?.length) {
|
||||
if (!refreshPending) {
|
||||
refreshPending = true;
|
||||
try {
|
||||
await refreshCloudUserFromServer();
|
||||
user = cloudAuth.state.user;
|
||||
} finally {
|
||||
refreshPending = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const badge = pickPrimaryFounderBadge(user?.badges ?? [], user?.signup_number);
|
||||
if (!badge) return;
|
||||
|
||||
for (const slot of slots) {
|
||||
renderBadgeChip(slot, badge, user?.signup_number);
|
||||
}
|
||||
}
|
||||
|
||||
export function refreshTitlebarFounderBadge(): void {
|
||||
void syncTitlebarFounderBadge();
|
||||
}
|
||||
|
||||
export function ensureTitlebarFounderBadgeMounted(): void {
|
||||
if (!subscribed) {
|
||||
subscribed = true;
|
||||
cloudAuth.subscribe(() => void syncTitlebarFounderBadge());
|
||||
settingsState.register("showTitlebarFounderBadge", () => void syncTitlebarFounderBadge());
|
||||
}
|
||||
void syncTitlebarFounderBadge();
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import stringToHTML from "@/seqta/utils/stringToHTML";
|
||||
import { closePopup, openPopup } from "@/seqta/utils/Openers/PopupManager";
|
||||
import { openFounderBadgeSettings } from "@/seqta/ui/founderBadge/openFounderBadgeSettings";
|
||||
import {
|
||||
founderBadgeChipHtml,
|
||||
tierBlobStyle,
|
||||
tierForBadgeKey,
|
||||
type FounderBadgeItem,
|
||||
} from "@/seqta/utils/founderBadges";
|
||||
|
||||
const ACCOUNTS_URL = "https://accounts.betterseqta.org";
|
||||
|
||||
function esc(value: string): string {
|
||||
return value
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """);
|
||||
}
|
||||
|
||||
export function openFounderBadgeModal(
|
||||
badge: FounderBadgeItem,
|
||||
signupNumber?: number | null,
|
||||
): void {
|
||||
const tier = tierForBadgeKey(badge.key);
|
||||
if (!tier) return;
|
||||
|
||||
const header = stringToHTML(/* html */ `
|
||||
<div class="whatsnewHeader bsplus-founder-badge-header">
|
||||
<h1>${esc(badge.label)}</h1>
|
||||
<p>${esc(tier.rankLabel)}</p>
|
||||
</div>
|
||||
`).firstChild as HTMLElement;
|
||||
|
||||
const signupLine =
|
||||
signupNumber != null
|
||||
? `<p class="bsplus-founder-badge-signup">Cloud user #${signupNumber.toLocaleString()}</p>`
|
||||
: "";
|
||||
|
||||
const hero = stringToHTML(/* html */ `
|
||||
<div class="whatsnewImgContainer">
|
||||
<div class="bsplus-founder-badge-hero whatsnewImg" data-tier="${badge.key}" style="${tierBlobStyle(tier)}">
|
||||
<div class="bsplus-founder-badge-hero__blobs" aria-hidden="true"></div>
|
||||
<div class="bsplus-founder-badge-hero__vignette" aria-hidden="true"></div>
|
||||
<div class="bsplus-founder-badge-hero__stage">
|
||||
${founderBadgeChipHtml(badge, { hero: true })}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`).firstChild as HTMLElement;
|
||||
|
||||
const text = stringToHTML(/* html */ `
|
||||
<div class="whatsnewTextContainer bsplus-founder-badge-body" style="overflow-y: auto;">
|
||||
<p>${esc(tier.description)}</p>
|
||||
<p>
|
||||
Linked to your BetterSEQTA Cloud account at
|
||||
<a href="${ACCOUNTS_URL}" target="_blank" rel="noopener noreferrer">accounts.betterseqta.org</a>.
|
||||
</p>
|
||||
${signupLine}
|
||||
<div class="bsplus-founder-badge-actions">
|
||||
<button type="button" id="bsplus-founder-badge-settings-link" class="bsplus-cal-btn bsplus-cal-btn--ghost">
|
||||
Hide in settings
|
||||
</button>
|
||||
<button type="button" id="bsplus-founder-badge-dismiss" class="bsplus-cal-btn bsplus-cal-btn--primary">
|
||||
Got it
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`).firstChild as HTMLElement;
|
||||
|
||||
openPopup({
|
||||
header,
|
||||
content: [hero, text],
|
||||
animateSelector: ".whatsnewImgContainer, .whatsnewTextContainer *",
|
||||
actions: [
|
||||
{ id: "bsplus-founder-badge-dismiss", onClick: () => closePopup() },
|
||||
{
|
||||
id: "bsplus-founder-badge-settings-link",
|
||||
onClick: () => void closePopup().then(() => openFounderBadgeSettings()),
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { requestSettingsDestination } from "@/seqta/utils/settingsNavigation";
|
||||
import { openSettingsPopup } from "@/seqta/utils/setupSettingsButton";
|
||||
|
||||
const FOUNDER_BADGE_SETTING_SEARCH = "Titlebar founder badge";
|
||||
|
||||
/** Open BetterSEQTA+ settings on the titlebar founder badge toggle. */
|
||||
export async function openFounderBadgeSettings(): Promise<void> {
|
||||
requestSettingsDestination({
|
||||
page: "settings",
|
||||
section: "account",
|
||||
search: FOUNDER_BADGE_SETTING_SEARCH,
|
||||
});
|
||||
await openSettingsPopup();
|
||||
}
|
||||
|
||||
export { FOUNDER_BADGE_SETTING_SEARCH };
|
||||
@@ -78,8 +78,12 @@ function cycle(
|
||||
return { t: fadeT, fade: true, ambient: smooth((len - tick) / revealMs) };
|
||||
}
|
||||
|
||||
function cssVar(_root: HTMLElement, _name: string, fallback: string): string {
|
||||
return fallback;
|
||||
function cssVar(root: HTMLElement, name: string, fallback: string): string {
|
||||
return getComputedStyle(root).getPropertyValue(name).trim() || fallback;
|
||||
}
|
||||
|
||||
function isLightScheme(root: HTMLElement): boolean {
|
||||
return root.dataset.scheme === "light";
|
||||
}
|
||||
|
||||
function drawGrid(
|
||||
@@ -187,6 +191,7 @@ function drawDotGlobe(
|
||||
phaseElapsed: number,
|
||||
fade: boolean,
|
||||
ambient: number,
|
||||
light: boolean,
|
||||
) {
|
||||
const time = reduced ? 0 : elapsed * 0.001;
|
||||
const cx = w * 0.5;
|
||||
@@ -206,8 +211,8 @@ function drawDotGlobe(
|
||||
ctx.save();
|
||||
ctx.globalAlpha = ambient;
|
||||
const glow = ctx.createRadialGradient(cx, cy, 0, cx, cy, radius * 1.15);
|
||||
glow.addColorStop(0, "rgba(37, 99, 235, 0.1)");
|
||||
glow.addColorStop(0.55, "rgba(37, 99, 235, 0.03)");
|
||||
glow.addColorStop(0, light ? "rgba(37, 99, 235, 0.16)" : "rgba(37, 99, 235, 0.1)");
|
||||
glow.addColorStop(0.55, light ? "rgba(37, 99, 235, 0.05)" : "rgba(37, 99, 235, 0.03)");
|
||||
glow.addColorStop(1, "rgba(37, 99, 235, 0)");
|
||||
ctx.fillStyle = glow;
|
||||
ctx.fillRect(cx - radius * 1.2, cy - radius * 1.2, radius * 2.4, radius * 2.4);
|
||||
@@ -258,8 +263,8 @@ function drawDotGlobe(
|
||||
|
||||
ctx.fillStyle =
|
||||
brightness > 0.52
|
||||
? `rgba(96, 165, 250, ${alpha})`
|
||||
: `rgba(255, 255, 255, ${0.08 + brightness * 0.22 * dot.p})`;
|
||||
? `rgba(${light ? "29, 78, 216" : "96, 165, 250"}, ${alpha})`
|
||||
: `rgba(${light ? "24, 24, 27" : "255, 255, 255"}, ${0.08 + brightness * 0.22 * dot.p})`;
|
||||
ctx.beginPath();
|
||||
ctx.arc(dot.px, dot.py, size, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
@@ -306,7 +311,17 @@ export function startLoadingCanvas(
|
||||
|
||||
if (visual === "globe") {
|
||||
const { t, fade, ambient } = cycle(elapsed, revealMs, holdMs);
|
||||
drawDotGlobe(ctx, w, h, elapsed, reduced, t, fade, reduced ? 1 : ambient);
|
||||
drawDotGlobe(
|
||||
ctx,
|
||||
w,
|
||||
h,
|
||||
elapsed,
|
||||
reduced,
|
||||
t,
|
||||
fade,
|
||||
reduced ? 1 : ambient,
|
||||
isLightScheme(root),
|
||||
);
|
||||
} else if (visual === "blobs") {
|
||||
const tide = variant.blobStyle === "tide";
|
||||
drawSoftBlobs(
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
listLoadingVariants,
|
||||
resolveLoadingTheme,
|
||||
} from "./loadingVariants";
|
||||
|
||||
describe("resolveLoadingTheme", () => {
|
||||
it("keeps the dark background in dark mode and swaps it for light mode", () => {
|
||||
for (const variant of listLoadingVariants()) {
|
||||
const dark = resolveLoadingTheme(variant, true);
|
||||
const light = resolveLoadingTheme(variant, false);
|
||||
expect(dark).toEqual(variant.theme);
|
||||
expect(light.background).not.toBe(dark.background);
|
||||
expect(light.background).toContain("#fafafa");
|
||||
expect(light.background).not.toContain("#010101");
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -60,6 +60,8 @@ const segment = (x1: number, y1: number, x2: number, y2: number): Line["stroke"]
|
||||
};
|
||||
|
||||
const BASE = "linear-gradient(180deg, #010101 0%, #040404 50%, #080808 100%)";
|
||||
const BASE_LIGHT =
|
||||
"linear-gradient(180deg, #fafafa 0%, #f4f4f5 50%, #ececef 100%)";
|
||||
const STAGE = "bkloading-stage-in";
|
||||
|
||||
function theme(
|
||||
@@ -99,6 +101,17 @@ function canvasVariant(
|
||||
};
|
||||
}
|
||||
|
||||
export function resolveLoadingTheme(
|
||||
variant: LoadingVariant,
|
||||
darkMode: boolean,
|
||||
): LoadingVariant["theme"] {
|
||||
if (darkMode) return variant.theme;
|
||||
return {
|
||||
...variant.theme,
|
||||
background: variant.theme.background.replaceAll(BASE, BASE_LIGHT),
|
||||
};
|
||||
}
|
||||
|
||||
const VARIANTS: LoadingVariant[] = [
|
||||
{
|
||||
id: "sweep",
|
||||
|
||||
@@ -1,467 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onDestroy } from "svelte";
|
||||
import Sortable from "sortablejs";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import {
|
||||
restoreCustomMenuActive,
|
||||
sidebarState,
|
||||
} from "./sidebarState.svelte";
|
||||
import SidebarItem from "./SidebarItem.svelte";
|
||||
import type {
|
||||
SidebarDrillFrame,
|
||||
SidebarItem as SidebarItemModel,
|
||||
} from "./types";
|
||||
|
||||
type Props = {
|
||||
menuEl: HTMLElement;
|
||||
};
|
||||
|
||||
let { menuEl }: Props = $props();
|
||||
|
||||
let listEl = $state<HTMLElement | null>(null);
|
||||
let coverEl: HTMLElement | null = null;
|
||||
let sortable: Sortable | null = null;
|
||||
let dragging = $state(false);
|
||||
|
||||
const BACK_SVG = `<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><g style="fill: currentcolor;"><path d="M15.422 16.078l-1.406 1.406-6-6 6-6 1.406 1.406-4.594 4.594z"></path></g></svg>`;
|
||||
|
||||
function itemVisible(key: string): boolean {
|
||||
return (
|
||||
(settingsState.menuitems as Record<string, { toggle?: boolean }>)[key]
|
||||
?.toggle !== false
|
||||
);
|
||||
}
|
||||
|
||||
function onActivate(item: SidebarItemModel) {
|
||||
sidebarState.activateItem(item, menuEl);
|
||||
}
|
||||
|
||||
function closeEdit() {
|
||||
sidebarState.setEditMode(false);
|
||||
void import("@/seqta/utils/Openers/menuOptionsState").then((mod) => {
|
||||
mod.setMenuOptionsOpen(false);
|
||||
});
|
||||
}
|
||||
|
||||
const drillFolders = $derived(
|
||||
sidebarState.drillStack.map((frame) => ({
|
||||
frame,
|
||||
folder: sidebarState.findByKey(frame.key),
|
||||
})),
|
||||
);
|
||||
|
||||
function onToggleVisible(key: string, visible: boolean) {
|
||||
sidebarState.setItemVisibility(key, visible);
|
||||
}
|
||||
|
||||
function destroySortable() {
|
||||
sortable?.destroy();
|
||||
sortable = null;
|
||||
dragging = false;
|
||||
document.documentElement.style.removeProperty("--bsplus-drag-width");
|
||||
}
|
||||
|
||||
function syncSortableFromState() {
|
||||
if (!sortable || dragging) return;
|
||||
const order = sidebarState.editRootItems.map((item) => item.key);
|
||||
sortable.sort(order, true);
|
||||
}
|
||||
|
||||
function restoreDefault() {
|
||||
sidebarState.restoreDefaultOrder();
|
||||
queueMicrotask(syncSortableFromState);
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
const editing = sidebarState.editMode;
|
||||
const list = listEl;
|
||||
|
||||
destroySortable();
|
||||
if (!editing || !list) return;
|
||||
|
||||
sortable = Sortable.create(list, {
|
||||
animation: 220,
|
||||
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
|
||||
draggable: ".bsplus-sidebar-item.draggable",
|
||||
filter: ".toggle, .toggle input, .bsplus-sidebar-edit-header, .bsplus-sidebar-edit-actions",
|
||||
preventOnFilter: false,
|
||||
dataIdAttr: "data-key",
|
||||
ghostClass: "bsplus-sortable-ghost",
|
||||
chosenClass: "bsplus-sortable-chosen",
|
||||
dragClass: "bsplus-sortable-drag",
|
||||
forceFallback: true,
|
||||
fallbackOnBody: true,
|
||||
fallbackTolerance: 3,
|
||||
swapThreshold: 0.65,
|
||||
direction: "vertical",
|
||||
onStart: (evt) => {
|
||||
dragging = true;
|
||||
const width = evt.item.getBoundingClientRect().width;
|
||||
document.documentElement.style.setProperty(
|
||||
"--bsplus-drag-width",
|
||||
`${Math.round(width)}px`,
|
||||
);
|
||||
// Fallback clone is created just after onStart; pin size + drop
|
||||
// `.active` so theme/active rules don't expand it to full width.
|
||||
requestAnimationFrame(() => {
|
||||
const dragEl = document.querySelector(
|
||||
".bsplus-sortable-drag",
|
||||
) as HTMLElement | null;
|
||||
if (!dragEl) return;
|
||||
dragEl.style.width = `${Math.round(width)}px`;
|
||||
dragEl.style.maxWidth = `${Math.round(width)}px`;
|
||||
dragEl.classList.remove("active");
|
||||
});
|
||||
},
|
||||
onEnd: (evt) => {
|
||||
dragging = false;
|
||||
document.documentElement.style.removeProperty("--bsplus-drag-width");
|
||||
if (evt.from !== evt.to) return;
|
||||
if (evt.oldIndex == null || evt.newIndex == null) return;
|
||||
if (evt.oldIndex === evt.newIndex) return;
|
||||
sidebarState.applyMenuOrder(sortable?.toArray() ?? []);
|
||||
},
|
||||
});
|
||||
|
||||
return () => {
|
||||
destroySortable();
|
||||
};
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
const editing = sidebarState.editMode;
|
||||
const container = document.getElementById("container");
|
||||
|
||||
if (editing && container && !coverEl) {
|
||||
const cover = document.createElement("div");
|
||||
cover.className = "notMenuCover bsplus-sidebar-edit-cover";
|
||||
cover.addEventListener("click", closeEdit);
|
||||
container.appendChild(cover);
|
||||
menuEl.style.zIndex = "20";
|
||||
menuEl.classList.add("bsplus-sidebar-edit-mode");
|
||||
coverEl = cover;
|
||||
}
|
||||
|
||||
if (!editing) {
|
||||
coverEl?.remove();
|
||||
coverEl = null;
|
||||
menuEl.style.removeProperty("z-index");
|
||||
menuEl.classList.remove("bsplus-sidebar-edit-mode");
|
||||
}
|
||||
|
||||
return () => {
|
||||
coverEl?.remove();
|
||||
coverEl = null;
|
||||
menuEl.style.removeProperty("z-index");
|
||||
};
|
||||
});
|
||||
|
||||
// SEQTA strips `.active` from `#menu li` after clicks — re-apply from state.
|
||||
// Do NOT MutationObserver class changes here: restore writes `.active`, SEQTA
|
||||
// strips it again, and the feedback loop freezes the tab.
|
||||
$effect(() => {
|
||||
void sidebarState.activeKey;
|
||||
void sidebarState.isDrilling;
|
||||
restoreCustomMenuActive();
|
||||
});
|
||||
|
||||
// Drill `.sub` is position:absolute inside this scrollport — if the list was
|
||||
// scrolled down (e.g. Folios/Goals near the bottom), the panel sits under the
|
||||
// logo until we reset. Also reset when going back up the stack.
|
||||
$effect(() => {
|
||||
void sidebarState.drillStack.length;
|
||||
void sidebarState.enterFrameKey;
|
||||
const root = document.getElementById("bsplus-sidebar-root");
|
||||
if (!root) return;
|
||||
root.scrollTop = 0;
|
||||
requestAnimationFrame(() => {
|
||||
root.scrollTop = 0;
|
||||
});
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
destroySortable();
|
||||
coverEl?.remove();
|
||||
coverEl = null;
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--
|
||||
Direct `#menu > ul.logo-link` child so theme selectors like
|
||||
`#menu > ul > li.item` / `#menu .sub` / `:has(> ul > li.hasChildren.active)` match.
|
||||
-->
|
||||
<ul
|
||||
id="bsplus-sidebar-root"
|
||||
class="logo-link bsplus-sidebar-list"
|
||||
class:noscroll={sidebarState.isDrilling}
|
||||
class:drilling={sidebarState.isDrilling}
|
||||
class:drill-entering={sidebarState.enterFrameKey != null}
|
||||
class:drill-returning={sidebarState.drillReturning}
|
||||
class:compact={sidebarState.compact}
|
||||
class:edit-mode={sidebarState.editMode}
|
||||
class:is-sorting={dragging}
|
||||
aria-label="Main"
|
||||
bind:this={listEl}
|
||||
>
|
||||
{#if sidebarState.editMode}
|
||||
<li class="item bsplus-sidebar-edit-header" aria-hidden="true">
|
||||
<!-- svelte-ignore a11y_label_has_associated_control -->
|
||||
<label><span class="label">Edit Sidebar</span></label>
|
||||
</li>
|
||||
{#each sidebarState.editRootItems as item (item.key)}
|
||||
<SidebarItem
|
||||
{item}
|
||||
active={sidebarState.activeKey === item.key}
|
||||
compact={false}
|
||||
editMode={true}
|
||||
visible={itemVisible(item.key)}
|
||||
{onActivate}
|
||||
{onToggleVisible}
|
||||
/>
|
||||
{/each}
|
||||
<li class="item bsplus-sidebar-edit-actions">
|
||||
<button type="button" class="edit-btn" onclick={restoreDefault}>
|
||||
Restore Default
|
||||
</button>
|
||||
<button type="button" class="edit-btn primary" onclick={closeEdit}>
|
||||
Save
|
||||
</button>
|
||||
</li>
|
||||
{:else if drillFolders.length}
|
||||
<!-- Keep root rows in the DOM so sidebar-animation.scss can slide siblings.
|
||||
Never mark root leaves active while drilling — theme decorations
|
||||
(Beach palm/sand) would show through the transparent .sub panel. -->
|
||||
{#each sidebarState.visibleRootItems as item (item.key)}
|
||||
{#if item.key === drillFolders[0].frame.key}
|
||||
{@render drillLevel(drillFolders, 0)}
|
||||
{:else}
|
||||
<SidebarItem
|
||||
{item}
|
||||
active={false}
|
||||
compact={false}
|
||||
editMode={false}
|
||||
visible={true}
|
||||
{onActivate}
|
||||
/>
|
||||
{/if}
|
||||
{/each}
|
||||
{:else}
|
||||
{#each sidebarState.visibleRootItems as item (item.key)}
|
||||
<SidebarItem
|
||||
{item}
|
||||
active={sidebarState.activeKey === item.key}
|
||||
compact={sidebarState.compact}
|
||||
editMode={false}
|
||||
visible={true}
|
||||
{onActivate}
|
||||
/>
|
||||
{/each}
|
||||
{/if}
|
||||
</ul>
|
||||
|
||||
{#snippet drillLevel(
|
||||
frames: Array<{ frame: SidebarDrillFrame; folder: SidebarItemModel | null }>,
|
||||
depth: number,
|
||||
)}
|
||||
{@const current = frames[depth]}
|
||||
{@const isLast = depth === frames.length - 1}
|
||||
{@const nextKey = isLast ? null : frames[depth + 1].frame.key}
|
||||
{@const folder = current.folder}
|
||||
<li
|
||||
class="item hasChildren bsplus-sidebar-item"
|
||||
class:active={true}
|
||||
data-key={current.frame.key}
|
||||
data-path={folder?.path ?? undefined}
|
||||
style:--item-colour={folder?.itemColour || undefined}
|
||||
>
|
||||
<!-- svelte-ignore a11y_label_has_associated_control -->
|
||||
<label>
|
||||
{#if folder?.iconHtml}
|
||||
{@html folder.iconHtml}
|
||||
{/if}
|
||||
<span class="label">{current.frame.label}</span>
|
||||
</label>
|
||||
<div
|
||||
class="sub"
|
||||
class:bsplus-sub-enter={sidebarState.enterFrameKey === current.frame.key}
|
||||
onanimationend={(e) => {
|
||||
if (e.target !== e.currentTarget) return;
|
||||
if (sidebarState.enterFrameKey === current.frame.key) {
|
||||
sidebarState.clearEnterFrame(current.frame.key);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="nav">
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="back"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label="Back"
|
||||
onclick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
sidebarState.goBack();
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
sidebarState.goBack();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{@html BACK_SVG}
|
||||
<div class="backLabel">{current.frame.label}</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul>
|
||||
{#if isLast}
|
||||
{#each current.frame.items as item (item.key)}
|
||||
<SidebarItem
|
||||
{item}
|
||||
active={sidebarState.activeKey === item.key}
|
||||
compact={false}
|
||||
editMode={false}
|
||||
visible={true}
|
||||
drillEnter={sidebarState.enterFrameKey === current.frame.key}
|
||||
{onActivate}
|
||||
/>
|
||||
{/each}
|
||||
{:else}
|
||||
{#each current.frame.items as item (item.key)}
|
||||
{#if item.key === nextKey}
|
||||
{@render drillLevel(frames, depth + 1)}
|
||||
{:else}
|
||||
<SidebarItem
|
||||
{item}
|
||||
active={sidebarState.activeKey === item.key}
|
||||
compact={false}
|
||||
editMode={false}
|
||||
visible={true}
|
||||
{onActivate}
|
||||
/>
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
{/snippet}
|
||||
|
||||
<style>
|
||||
.bsplus-sidebar-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 0 16px;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
color: var(--text-color, #fff);
|
||||
scrollbar-width: thin;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-list.noscroll,
|
||||
.bsplus-sidebar-list.drilling {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-list.compact {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-list.is-sorting {
|
||||
cursor: grabbing;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-edit-header {
|
||||
pointer-events: none;
|
||||
width: 85%;
|
||||
margin: 8px auto 4px;
|
||||
font-weight: 700;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-edit-header > label {
|
||||
display: block;
|
||||
padding: 12px 16px 4px;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-edit-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
width: calc(100% - 12px);
|
||||
margin: 12px 6px 16px;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
cursor: default;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
padding: 10px 8px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
color: inherit;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background-color 0.2s ease,
|
||||
transform 0.2s ease;
|
||||
}
|
||||
|
||||
.edit-btn:hover {
|
||||
background: rgba(0, 0, 0, 0.32);
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
.edit-btn:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.edit-btn.primary {
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
/* SortableJS classes (applied to our items; must be :global). */
|
||||
.bsplus-sidebar-list :global(.bsplus-sortable-ghost) {
|
||||
opacity: 0.35 !important;
|
||||
background: rgba(255, 255, 255, 0.08) !important;
|
||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
|
||||
}
|
||||
|
||||
.bsplus-sidebar-list :global(.bsplus-sortable-chosen) {
|
||||
background: rgba(0, 0, 0, 0.28) !important;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-list :global(.bsplus-sortable-drag),
|
||||
:global(.bsplus-sortable-drag) {
|
||||
opacity: 1 !important;
|
||||
cursor: grabbing !important;
|
||||
z-index: 10000 !important;
|
||||
width: var(--bsplus-drag-width, 240px) !important;
|
||||
max-width: var(--bsplus-drag-width, 240px) !important;
|
||||
box-sizing: border-box !important;
|
||||
box-shadow:
|
||||
0 14px 32px rgba(0, 0, 0, 0.35),
|
||||
0 0 0 1px rgba(255, 255, 255, 0.12) !important;
|
||||
transform: scale(1.03);
|
||||
background: rgba(0, 0, 0, 0.45) !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,267 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { fly } from "svelte/transition";
|
||||
import type { SidebarItem } from "./types";
|
||||
|
||||
type Props = {
|
||||
item: SidebarItem;
|
||||
active: boolean;
|
||||
compact: boolean;
|
||||
editMode: boolean;
|
||||
visible: boolean;
|
||||
/** Play intro fly only when the parent folder first opens. */
|
||||
drillEnter?: boolean;
|
||||
onActivate: (item: SidebarItem) => void;
|
||||
onToggleVisible?: (key: string, visible: boolean) => void;
|
||||
};
|
||||
|
||||
let {
|
||||
item,
|
||||
active,
|
||||
compact,
|
||||
editMode,
|
||||
visible,
|
||||
drillEnter = false,
|
||||
onActivate,
|
||||
onToggleVisible,
|
||||
}: Props = $props();
|
||||
|
||||
const CHEVRON_SVG = `<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><g style="fill: currentcolor;"><path d="M8.578 16.359l4.594-4.594-4.594-4.594 1.406-1.406 6 6-6 6z"></path></g></svg>`;
|
||||
const GRIP_SVG = `<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><circle cx="5" cy="3" r="1.35" fill="currentColor"/><circle cx="11" cy="3" r="1.35" fill="currentColor"/><circle cx="5" cy="8" r="1.35" fill="currentColor"/><circle cx="11" cy="8" r="1.35" fill="currentColor"/><circle cx="5" cy="13" r="1.35" fill="currentColor"/><circle cx="11" cy="13" r="1.35" fill="currentColor"/></svg>`;
|
||||
</script>
|
||||
|
||||
<!-- SEQTA class names (item / hasChildren / active) so theme CSS keeps matching. -->
|
||||
<!-- svelte-ignore a11y_no_noninteractive_element_to_interactive_role -->
|
||||
<li
|
||||
class="item bsplus-sidebar-item"
|
||||
class:active={active}
|
||||
class:hasChildren={item.hasChildren}
|
||||
class:edit-mode={editMode}
|
||||
class:hidden-item={editMode && !visible}
|
||||
class:compact={compact}
|
||||
class:draggable={editMode}
|
||||
style:--item-colour={item.itemColour || undefined}
|
||||
data-key={item.key}
|
||||
data-path={item.path ?? undefined}
|
||||
data-betterseqta={item.betterseqta ? "true" : undefined}
|
||||
id={item.id ?? undefined}
|
||||
role="button"
|
||||
tabindex={editMode ? -1 : 0}
|
||||
aria-label={item.label}
|
||||
aria-current={active ? "page" : undefined}
|
||||
in:fly={drillEnter ? { x: 24, duration: 180 } : undefined}
|
||||
onclick={(e) => {
|
||||
// Keep SEQTA's #menu handlers from seeing custom-list clicks — that fights
|
||||
// our drill UI and can freeze the tab (Goals / Folios / etc.).
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (!editMode) onActivate(item);
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
if (editMode) return;
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onActivate(item);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{#if editMode}
|
||||
<span class="drag-grip" aria-hidden="true">{@html GRIP_SVG}</span>
|
||||
{/if}
|
||||
<!-- svelte-ignore a11y_label_has_associated_control -->
|
||||
<label>
|
||||
{#if item.iconHtml}
|
||||
<!-- svelte-ignore a11y_distracting_elements -->
|
||||
{@html item.iconHtml}
|
||||
{/if}
|
||||
<span class="label">{item.label}</span>
|
||||
{#if item.hasChildren && !compact && !editMode}
|
||||
<span class="chevron" aria-hidden="true">{@html CHEVRON_SVG}</span>
|
||||
{/if}
|
||||
</label>
|
||||
{#if editMode}
|
||||
<label class="toggle">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={visible}
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
onchange={(e) =>
|
||||
onToggleVisible?.(
|
||||
item.key,
|
||||
(e.currentTarget as HTMLInputElement).checked,
|
||||
)}
|
||||
/>
|
||||
</label>
|
||||
{/if}
|
||||
{#if item.itemColour && !item.hasChildren}
|
||||
<span class="colour-bar" aria-hidden="true"></span>
|
||||
{/if}
|
||||
</li>
|
||||
|
||||
<style>
|
||||
/* Layout defaults — theme #menu rules (often !important) win for look. */
|
||||
.bsplus-sidebar-item {
|
||||
position: relative;
|
||||
list-style: none;
|
||||
width: auto;
|
||||
margin: 2px 6px;
|
||||
padding: 0;
|
||||
border-radius: 12px;
|
||||
color: var(--text-color, #fff);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
transition:
|
||||
background-color 0.2s ease,
|
||||
box-shadow 0.2s ease,
|
||||
opacity 0.2s ease;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item > label:not(.toggle) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1 1 auto;
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 12px;
|
||||
cursor: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item:hover:not(.active) {
|
||||
background: rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px var(--theme-primary, #fff);
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item.active:not(.hasChildren),
|
||||
.bsplus-sidebar-item.active:not(.hasChildren):hover {
|
||||
background: rgba(0, 0, 0, 0.35);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item.compact {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item.compact > label:not(.toggle) {
|
||||
padding: 8px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item.hidden-item {
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item.edit-mode {
|
||||
cursor: grab;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item.edit-mode:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* Keep the same label padding/size as normal items; only reserve toggle space. */
|
||||
.bsplus-sidebar-item.edit-mode > label:not(.toggle) {
|
||||
flex: 1 1 auto;
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
padding: 12px;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.drag-grip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 auto;
|
||||
width: 20px;
|
||||
margin-left: 10px;
|
||||
opacity: 0.45;
|
||||
color: inherit;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item.edit-mode:hover .drag-grip {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item :global(label > svg) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.compact :global(label > svg) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.label {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.compact .label,
|
||||
.compact .chevron {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.chevron {
|
||||
display: inline-flex;
|
||||
flex-shrink: 0;
|
||||
margin-left: auto;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.chevron :global(svg) {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.toggle {
|
||||
margin: 0 10px 0 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
flex: 0 0 auto;
|
||||
width: auto;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.toggle input {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin: 0;
|
||||
flex-shrink: 0;
|
||||
accent-color: var(--theme-primary, #fff);
|
||||
}
|
||||
|
||||
.colour-bar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 3px;
|
||||
border-radius: 8px 0 0 8px;
|
||||
background: var(--item-colour, transparent);
|
||||
transition: width 100ms ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.bsplus-sidebar-item:hover .colour-bar,
|
||||
.bsplus-sidebar-item.active .colour-bar {
|
||||
width: 6px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,109 @@
|
||||
import type { SettingsState } from "@/types/storage";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { isSeqtaEngageExperience, isSeqtaLoginPage } from "@/seqta/utils/isSeqtaEngage";
|
||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||
import {
|
||||
applySidebarLook,
|
||||
applySidebarStyleClass,
|
||||
clearSidebarAppearance,
|
||||
} from "./sidebarStyles";
|
||||
|
||||
const MENU_CLASS = "bsplus-styled-sidebar";
|
||||
|
||||
type ChangeListener = (newValue: unknown, oldValue: unknown) => void;
|
||||
|
||||
let menuEl: HTMLElement | null = null;
|
||||
let sidebarLookScheduled = false;
|
||||
let settingsListenersAttached = false;
|
||||
|
||||
const settingsListeners: Array<{
|
||||
key: keyof SettingsState;
|
||||
listener: ChangeListener;
|
||||
}> = [];
|
||||
|
||||
function scheduleSidebarLook() {
|
||||
if (!menuEl || sidebarLookScheduled) return;
|
||||
sidebarLookScheduled = true;
|
||||
requestAnimationFrame(() => {
|
||||
sidebarLookScheduled = false;
|
||||
if (menuEl) applySidebarLook(menuEl);
|
||||
});
|
||||
}
|
||||
|
||||
function registerSetting(key: keyof SettingsState, listener: ChangeListener) {
|
||||
settingsState.register(key, listener);
|
||||
settingsListeners.push({ key, listener });
|
||||
}
|
||||
|
||||
function clearSettingListeners() {
|
||||
for (const { key, listener } of settingsListeners) {
|
||||
settingsState.unregister(key, listener);
|
||||
}
|
||||
settingsListeners.length = 0;
|
||||
settingsListenersAttached = false;
|
||||
}
|
||||
|
||||
function attachSettingsListeners() {
|
||||
if (settingsListenersAttached || !menuEl) return;
|
||||
settingsListenersAttached = true;
|
||||
clearSettingListeners();
|
||||
|
||||
registerSetting("sidebarStyle", () =>
|
||||
applySidebarStyleClass(menuEl, settingsState.sidebarStyle),
|
||||
);
|
||||
for (const key of [
|
||||
"sidebarDensity",
|
||||
"sidebarCornerRadius",
|
||||
"sidebarActiveIndicator",
|
||||
"sidebarWidth",
|
||||
"sidebarBlur",
|
||||
"transparencyEffects",
|
||||
] as const) {
|
||||
registerSetting(key, () => scheduleSidebarLook());
|
||||
}
|
||||
}
|
||||
|
||||
function applyToMenu(menu: HTMLElement) {
|
||||
menuEl = menu;
|
||||
menu.classList.add(MENU_CLASS);
|
||||
applySidebarStyleClass(menu, settingsState.sidebarStyle);
|
||||
applySidebarLook(menu);
|
||||
attachSettingsListeners();
|
||||
}
|
||||
|
||||
/** Apply sidebar width/blur CSS vars as soon as `#menu` exists (before full load). */
|
||||
export function prepareNativeSidebarEarly() {
|
||||
if (isSeqtaEngageExperience() || isSeqtaLoginPage()) return;
|
||||
if (!settingsState.onoff) return;
|
||||
applySidebarLook(document.getElementById("menu"));
|
||||
}
|
||||
|
||||
export async function applyNativeSidebar(): Promise<boolean> {
|
||||
if (isSeqtaEngageExperience() || isSeqtaLoginPage()) return false;
|
||||
if (!settingsState.onoff) return false;
|
||||
|
||||
if (menuEl?.isConnected) {
|
||||
applyToMenu(menuEl);
|
||||
return true;
|
||||
}
|
||||
|
||||
let menu: HTMLElement | null = null;
|
||||
try {
|
||||
menu = (await waitForElm("#menu", true, 50, 200)) as HTMLElement;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
if (!menu) return false;
|
||||
|
||||
applyToMenu(menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
export function clearNativeSidebar() {
|
||||
clearSettingListeners();
|
||||
if (menuEl) {
|
||||
menuEl.classList.remove(MENU_CLASS);
|
||||
clearSidebarAppearance(menuEl);
|
||||
}
|
||||
menuEl = null;
|
||||
}
|
||||
Loaded 100 of 148 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user