mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2a37b3ed3 | ||
|
|
3224f64875 | ||
|
|
0090368707 | ||
|
|
767c3b9e98 | ||
|
|
b55415c93b | ||
|
|
38f934c01f | ||
|
|
0f9b8efc40 | ||
|
|
9bfc0989c1 | ||
|
|
a967e2c2fb | ||
|
|
74fdd079dd | ||
|
|
29c31a2a22 | ||
|
|
0e3297636d | ||
|
|
d3fc4b0afd | ||
|
|
4d8445d7da | ||
|
|
29bdb0064d | ||
|
|
efa4f8b85c | ||
|
|
fea017bbd7 | ||
|
|
95908baa8e | ||
|
|
6868964366 | ||
|
|
344458cc6f | ||
|
|
2135349038 | ||
|
|
06be15b0ef | ||
|
|
13f974d652 |
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "betterseqtaplus",
|
||||
"version": "3.7.3",
|
||||
"version": "3.7.4",
|
||||
"type": "module",
|
||||
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development and add heaps more features!",
|
||||
"browserslist": "> 0.5%, last 2 versions, not dead",
|
||||
|
||||
+272
-8
@@ -241,14 +241,15 @@ html:not(.dark) .legacy-root {
|
||||
.addedButton {
|
||||
position: absolute !important;
|
||||
right: 105px;
|
||||
padding: 6px !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
overflow: unset !important;
|
||||
border-radius: 10px !important;
|
||||
cursor: pointer;
|
||||
background: var(--text-primary) !important;
|
||||
color: var(--theme-primary) !important;
|
||||
height: 35px;
|
||||
justify-content: center;
|
||||
width: 35px !important;
|
||||
}
|
||||
|
||||
@@ -422,7 +423,9 @@ ul.magicDelete > li.deleting {
|
||||
background: unset;
|
||||
}
|
||||
.addedButton svg {
|
||||
margin: 6px;
|
||||
display: block;
|
||||
margin: 0;
|
||||
flex-shrink: 0;
|
||||
fill: var(--theme-primary);
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
@@ -719,6 +722,14 @@ body.icon-only-sidebar {
|
||||
}
|
||||
}
|
||||
|
||||
/* Rail tiles follow the user radius even for squared presets (strip/sharp):
|
||||
the compact rail's shape language is the rounded folder arc, so a
|
||||
square active/hover tile there reads as a glitch. Pill keeps its
|
||||
full capsule (it is the "rounder" shape, not the square one). */
|
||||
#menu#menu:not(.bsplus-sidebar-style-pill) > ul > :is(li, section) {
|
||||
border-radius: var(--bsplus-sidebar-radius, 12px) !important;
|
||||
}
|
||||
|
||||
#menu#menu > ul > .hasChildren {
|
||||
position: static !important;
|
||||
backdrop-filter: none !important;
|
||||
@@ -856,11 +867,6 @@ body.icon-only-sidebar {
|
||||
> :is(li.item, section.item) {
|
||||
margin-inline: auto !important;
|
||||
}
|
||||
#menu#menu.bsplus-sidebar-style-strip .sub :is(li.item, section.item) {
|
||||
width: 100% !important;
|
||||
margin-inline: 0 !important;
|
||||
}
|
||||
|
||||
#menu.bsplus-icon-rail-switching > ul > .hasChildren > .sub {
|
||||
transition: none !important;
|
||||
}
|
||||
@@ -890,6 +896,16 @@ body.icon-only-sidebar {
|
||||
}
|
||||
}
|
||||
|
||||
#menu#menu.bsplus-sidebar-style-strip .sub :is(li.item, section.item) {
|
||||
width: 100% !important;
|
||||
box-sizing: border-box !important;
|
||||
margin-inline: 0 !important;
|
||||
}
|
||||
body:not(.icon-only-sidebar) #menu#menu.bsplus-sidebar-style-strip > ul > :is(li.item, section.item) {
|
||||
width: calc(100% + 1px) !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
|
||||
body.icon-only-sidebar:has(
|
||||
#menu > ul > .hasChildren:is(.active, .bsplus-active)
|
||||
) {
|
||||
@@ -4315,6 +4331,181 @@ div.day-empty {
|
||||
-webkit-backdrop-filter: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Terms of service — compact whatsnew shell (theme vars, light + dark) */
|
||||
#whatsnewbk.bsplus-tos-overlay {
|
||||
.whatsnewContainer.bsplus-tos-container {
|
||||
position: relative !important;
|
||||
width: min(34em, calc(100vw - 1.75rem)) !important;
|
||||
height: auto !important;
|
||||
max-height: min(32rem, calc(100vh - 2rem)) !important;
|
||||
margin: auto !important;
|
||||
padding: 0 0 1rem !important;
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
overflow: hidden !important;
|
||||
background: var(--background-primary) !important;
|
||||
color: var(--text-primary) !important;
|
||||
border-radius: 20px !important;
|
||||
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28) !important;
|
||||
}
|
||||
|
||||
.bsplus-tos-header {
|
||||
margin: 20px 20px 0.5rem !important;
|
||||
width: calc(100% - 40px) !important;
|
||||
height: auto !important;
|
||||
min-height: unset !important;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.bsplus-tos-header h1 {
|
||||
margin: 0 !important;
|
||||
font-size: 1.75rem !important;
|
||||
font-weight: 700 !important;
|
||||
line-height: 1.15 !important;
|
||||
color: var(--text-primary) !important;
|
||||
}
|
||||
|
||||
.bsplus-tos-header p {
|
||||
margin: 0.35rem 0 0 !important;
|
||||
font-size: 1rem !important;
|
||||
font-weight: 400 !important;
|
||||
line-height: 1.4 !important;
|
||||
color: var(--text-primary) !important;
|
||||
opacity: 0.88;
|
||||
}
|
||||
|
||||
.bsplus-tos-body {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
gap: 0.75rem !important;
|
||||
width: 90% !important;
|
||||
margin: 0 auto !important;
|
||||
min-height: 0 !important;
|
||||
flex: 1 1 auto !important;
|
||||
overflow: hidden !important;
|
||||
font-size: 1.05rem !important;
|
||||
line-height: 1.6 !important;
|
||||
}
|
||||
|
||||
.bsplus-tos-intro {
|
||||
margin: 0 !important;
|
||||
flex-shrink: 0;
|
||||
text-align: center;
|
||||
font-size: 1rem !important;
|
||||
line-height: 1.5 !important;
|
||||
color: var(--text-primary) !important;
|
||||
}
|
||||
|
||||
.bsplus-tos-scroll {
|
||||
flex: 1 1 auto;
|
||||
min-height: 7rem;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
padding: 0.65rem 0.75rem;
|
||||
text-align: left;
|
||||
font-size: 1.05rem !important;
|
||||
line-height: 1.6 !important;
|
||||
color: var(--text-primary) !important;
|
||||
border-radius: 12px;
|
||||
border: 1px solid color-mix(in srgb, var(--text-primary) 14%, transparent);
|
||||
background: color-mix(in srgb, var(--text-primary) 5%, var(--background-primary));
|
||||
}
|
||||
|
||||
.bsplus-tos-scroll h3,
|
||||
.bsplus-tos-scroll h4 {
|
||||
margin: 1rem 0 0.4rem;
|
||||
font-size: 1.15em !important;
|
||||
font-weight: 600 !important;
|
||||
line-height: 1.35 !important;
|
||||
color: var(--text-primary) !important;
|
||||
}
|
||||
|
||||
.bsplus-tos-scroll h3:first-child,
|
||||
.bsplus-tos-scroll h4:first-child,
|
||||
.bsplus-tos-scroll p:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.bsplus-tos-scroll p {
|
||||
margin: 0 0 1ex;
|
||||
font-size: inherit !important;
|
||||
color: var(--text-primary) !important;
|
||||
}
|
||||
|
||||
.bsplus-tos-scroll ul,
|
||||
.bsplus-tos-scroll ol {
|
||||
margin: 0 0 1ex;
|
||||
padding-left: 1.25rem;
|
||||
}
|
||||
|
||||
.bsplus-tos-scroll li {
|
||||
margin: 0.15rem 0;
|
||||
}
|
||||
|
||||
.bsplus-tos-scroll a {
|
||||
color: inherit;
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
}
|
||||
|
||||
.bsplus-tos-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.55rem;
|
||||
flex-shrink: 0;
|
||||
padding-top: 0.1rem;
|
||||
padding-bottom: 0.15rem;
|
||||
}
|
||||
|
||||
.bsplus-tos-btn {
|
||||
width: 100%;
|
||||
min-height: 2.65rem;
|
||||
padding: 0.65rem 1rem;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.bsplus-tos-btn:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.bsplus-tos-btn:focus-visible {
|
||||
box-shadow:
|
||||
0 0 0 2px var(--background-primary),
|
||||
0 0 0 4px color-mix(in srgb, var(--text-primary) 45%, transparent);
|
||||
}
|
||||
|
||||
.bsplus-tos-btn--primary {
|
||||
background: var(--text-primary);
|
||||
color: var(--background-primary);
|
||||
}
|
||||
|
||||
.bsplus-tos-btn--primary:hover:not(:disabled) {
|
||||
filter: brightness(1.08);
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
.bsplus-tos-btn--secondary {
|
||||
background: color-mix(in srgb, var(--text-primary) 10%, var(--background-primary));
|
||||
color: var(--text-primary);
|
||||
border: 1px solid color-mix(in srgb, var(--text-primary) 16%, transparent);
|
||||
}
|
||||
|
||||
.bsplus-tos-btn--secondary:hover:not(:disabled) {
|
||||
background: color-mix(in srgb, var(--text-primary) 14%, var(--background-primary));
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
.bsplus-tos-btn:active:not(:disabled) {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
}
|
||||
.whatsnewImgContainer {
|
||||
width: 96%;
|
||||
display: flex;
|
||||
@@ -5666,3 +5857,76 @@ h2.home-subtitle {
|
||||
font-size: 20px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.bsplus-ld-surprise-root {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 50;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.bsplus-ld-surprise-popout {
|
||||
pointer-events: auto;
|
||||
position: fixed;
|
||||
right: 24px;
|
||||
bottom: 24px;
|
||||
width: min(640px, calc(100vw - 48px));
|
||||
aspect-ratio: 16 / 9;
|
||||
border-radius: 16px;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
|
||||
border: 1px solid color-mix(in srgb, var(--text-primary) 12%, transparent);
|
||||
transform-origin: bottom right;
|
||||
animation: bsplusLdSurprisePopoutIn 0.28s ease-out;
|
||||
}
|
||||
|
||||
.bsplus-ld-surprise-player {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #000;
|
||||
|
||||
iframe {
|
||||
display: block;
|
||||
width: 640px;
|
||||
max-width: 100%;
|
||||
height: 360px;
|
||||
max-height: 100%;
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.bsplus-ld-surprise-close {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 1;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
cursor: pointer;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.bsplus-ld-surprise-close::before {
|
||||
content: "\ed8a";
|
||||
font-family: "IconFamily";
|
||||
font-size: 20px;
|
||||
line-height: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@keyframes bsplusLdSurprisePopoutIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: scale(0.92) translateY(12px);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: scale(1) translateY(0);
|
||||
}
|
||||
}
|
||||
@@ -90,17 +90,24 @@ $sidebar-motion: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
&.bsplus-sidebar-style-glass {
|
||||
/* Never put backdrop-filter on an open folder — it becomes a clip
|
||||
containing-block and hides `.sub` labels on Chromium/Edge. */
|
||||
/* Never put backdrop-filter on a folder — it becomes a clip
|
||||
containing-block and hides `.sub` labels on Chromium/Edge. Lean rows
|
||||
blur; closed folders keep the translated glass surface without blur;
|
||||
open folders drop the fill entirely so `.sub` stays clip-safe. */
|
||||
#{$item} {
|
||||
&:not(:has(> .sub)) {
|
||||
margin: 0 8px 8px !important;
|
||||
margin: 4px 8px 4px !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);
|
||||
}
|
||||
&:has(> .sub) {
|
||||
&:is(li, section).hasChildren:not(:is(.active, .bsplus-active)) {
|
||||
margin: 4px 8px 4px !important;
|
||||
background: rgba(255, 255, 255, 0.1) !important;
|
||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
|
||||
}
|
||||
&:has(> .sub):is(.active, .bsplus-active) {
|
||||
background: transparent !important;
|
||||
backdrop-filter: none !important;
|
||||
-webkit-backdrop-filter: none !important;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"last_updated": "2026-10-29T00:00:00.000Z",
|
||||
"whatsnew_html": "<div class=\"whatsnewTextContainer\"><h3>1. Agreement</h3><p>By installing or using BetterSEQTA+, you agree to these Terms of Service. If you do not agree, do not use the extension.</p><h3>2. The extension</h3><p>BetterSEQTA+ is a browser extension that enhances SEQTA Learn and SEQTA Engage on your device. Features may change over time.</p><h3>3. Your school account</h3><p>You must comply with your school’s policies when using SEQTA. BetterSEQTA+ does not replace your school’s terms.</p><h3>4. Acceptable use</h3><p>Do not use the extension to harm others, bypass security, or violate applicable law.</p><h3>5. Privacy</h3><p>Our Privacy Policy explains what data we process. See <a href=\"https://betterseqta.org/privacy\" target=\"_blank\" rel=\"noopener noreferrer\">betterseqta.org/privacy</a>.</p><h3>6. Changes</h3><p>We may update these terms. Material changes may require you to accept again in the extension.</p></div>"
|
||||
}
|
||||
@@ -3,18 +3,31 @@
|
||||
onClick,
|
||||
text,
|
||||
disabled = false,
|
||||
variant = "secondary",
|
||||
icon,
|
||||
class: className = "",
|
||||
} = $props<{
|
||||
onClick: () => void;
|
||||
text: string;
|
||||
disabled?: boolean;
|
||||
variant?: "primary" | "secondary" | "ghost";
|
||||
icon?: string;
|
||||
class?: string;
|
||||
}>();
|
||||
|
||||
const variants = {
|
||||
primary: "bg-zinc-100 text-zinc-900 border-transparent enabled:hover:bg-white",
|
||||
secondary: "dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 dark:text-white enabled:hover:brightness-125",
|
||||
ghost: "bg-transparent border-transparent dark:text-white enabled:hover:bg-zinc-200/60 dark:enabled:hover:bg-zinc-700/50",
|
||||
};
|
||||
</script>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onclick={onClick}
|
||||
disabled={disabled}
|
||||
class="px-5 py-1.5 text-[0.75rem] shadow-2xl border dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 dark:text-white rounded-lg disabled:cursor-not-allowed disabled:opacity-50"
|
||||
class="inline-flex items-center justify-center gap-1.5 px-5 py-1.5 text-[0.75rem] shadow-2xl border rounded-lg transition enabled:active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 disabled:cursor-not-allowed disabled:opacity-50 {variants[variant]} {className}"
|
||||
>
|
||||
{#if icon}<span class="font-IconFamily text-base" aria-hidden="true">{icon}</span>{/if}
|
||||
{text}
|
||||
</button>
|
||||
</button>
|
||||
@@ -5,6 +5,7 @@
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
|
||||
import Button from "./Button.svelte";
|
||||
|
||||
const { hidePanel } = $props<{
|
||||
hidePanel: () => void;
|
||||
@@ -139,13 +140,7 @@
|
||||
<p class="text-sm text-zinc-600 dark:text-zinc-400">
|
||||
Sign in to sync settings across devices, use your cloud profile picture, and more.
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
onclick={handleSignIn}
|
||||
class="w-full px-4 py-2.5 text-sm font-medium rounded-lg bg-zinc-800 dark:bg-zinc-200 text-white dark:text-zinc-900 hover:bg-zinc-700 dark:hover:bg-zinc-300 transition-colors duration-200"
|
||||
>
|
||||
Sign in with BetterSEQTA Cloud
|
||||
</button>
|
||||
<Button class="w-full" icon={""} text="Sign in with BetterSEQTA Cloud" onClick={handleSignIn} />
|
||||
{#if loginError}
|
||||
<p class="text-xs text-red-600 dark:text-red-400">{loginError}</p>
|
||||
{/if}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { fade } from "svelte/transition";
|
||||
import browser from "webextension-polyfill";
|
||||
import QRCode from "qrcode";
|
||||
import Button from "./Button.svelte";
|
||||
import { portal } from "../utils/portal";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
|
||||
@@ -106,13 +107,7 @@
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-1 items-end">
|
||||
<button
|
||||
type="button"
|
||||
onclick={generateQrCode}
|
||||
disabled={isLoading}
|
||||
class="px-5 py-1.5 text-[0.75rem] text-nowrap shadow-2xl border dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 dark:text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-opacity">
|
||||
{isLoading ? "Generating..." : "Generate QR"}
|
||||
</button>
|
||||
<Button onClick={generateQrCode} disabled={isLoading} text={isLoading ? "Generating..." : "Generate QR"} />
|
||||
{#if errorMessage}
|
||||
<p class="text-xs text-right text-amber-600 dark:text-amber-400">{errorMessage}</p>
|
||||
{/if}
|
||||
|
||||
@@ -280,14 +280,14 @@
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 1.25rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin-top: 0.15rem;
|
||||
font-size: 1rem;
|
||||
font-size: 0.75rem;
|
||||
color: rgb(82 82 91);
|
||||
}
|
||||
|
||||
@@ -305,12 +305,12 @@
|
||||
}
|
||||
|
||||
.selected-label {
|
||||
font-size: 0.95rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.selected-desc {
|
||||
font-size: 0.8rem;
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.35;
|
||||
color: rgb(113 113 122);
|
||||
}
|
||||
@@ -583,14 +583,14 @@
|
||||
}
|
||||
|
||||
.row-title {
|
||||
font-size: 1.125rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.row-desc {
|
||||
margin-top: 0.1rem;
|
||||
font-size: 0.95rem;
|
||||
font-size: 0.75rem;
|
||||
color: rgb(82 82 91);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import SkeletonLoader from "@/interface/components/SkeletonLoader.svelte";
|
||||
import SignInToFavoriteModal from "@/interface/components/SignInToFavoriteModal.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import type { CommunityThemesState } from "@/interface/hooks/communityThemesState.svelte";
|
||||
import {
|
||||
formatCustomThemeStatus,
|
||||
@@ -13,7 +14,7 @@
|
||||
import type { CustomTheme } from "@/types/CustomThemes";
|
||||
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
|
||||
import { themeUpdates } from "@/interface/hooks/ThemeUpdates";
|
||||
import { filterThemesByMode } from "@/interface/utils/themeListFilters";
|
||||
import { isLocalCustomTheme } from "@/interface/utils/themeListFilters";
|
||||
import { formatCustomThemeApiError } from "@/seqta/utils/customThemes/apiErrors";
|
||||
|
||||
let { communityState }: { communityState: CommunityThemesState } = $props();
|
||||
@@ -30,7 +31,7 @@
|
||||
localThemesLoading = true;
|
||||
try {
|
||||
const all = await themeManager.getAvailableThemes();
|
||||
localThemes = filterThemesByMode(all, "custom");
|
||||
localThemes = all.filter(isLocalCustomTheme);
|
||||
} finally {
|
||||
localThemesLoading = false;
|
||||
}
|
||||
@@ -76,13 +77,11 @@
|
||||
<p class="mt-3 text-zinc-600 dark:text-zinc-300">
|
||||
Submit themes for review and track pending, approved, or rejected submissions.
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-6 rounded-lg bg-zinc-900 px-5 py-2.5 font-medium text-white dark:bg-zinc-100 dark:text-zinc-900"
|
||||
onclick={() => (communityState.showSignInOverlay = true)}
|
||||
>
|
||||
Sign in with BetterSEQTA Cloud
|
||||
</button>
|
||||
<Button
|
||||
class="mt-6"
|
||||
text="Sign in with BetterSEQTA Cloud"
|
||||
onClick={() => (communityState.showSignInOverlay = true)}
|
||||
/>
|
||||
</div>
|
||||
{:else}
|
||||
<section class="mb-8">
|
||||
@@ -101,7 +100,7 @@
|
||||
</div>
|
||||
{:else if localThemes.length === 0}
|
||||
<p class="mt-3 text-sm text-zinc-500 dark:text-zinc-400">
|
||||
No local custom themes yet. Use Create & submit above or build one in Custom themes settings.
|
||||
No local custom themes yet. Use Create & submit above or build one in My themes.
|
||||
</p>
|
||||
{:else}
|
||||
<ul class="mt-3 space-y-3">
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
|
||||
{#if !(videoBackgrounds.length === 0 && isEditMode)}
|
||||
<h2 class="py-2 text-lg font-bold">Background Videos</h2>
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<div class="flex flex-wrap gap-4 mb-4">
|
||||
{#if !isEditMode}
|
||||
<BackgroundUploader onFileChange={handleFileChange} />
|
||||
{/if}
|
||||
|
||||
@@ -8,17 +8,16 @@
|
||||
import SignInToFavoriteModal from '@/interface/components/SignInToFavoriteModal.svelte'
|
||||
import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
|
||||
import ThemePlaceholderCover from '@/interface/components/themes/ThemePlaceholderCover.svelte'
|
||||
import { filterThemesByMode, isLocalCustomTheme, type ThemeListMode } from '@/interface/utils/themeListFilters'
|
||||
import { isLocalCustomTheme } from '@/interface/utils/themeListFilters'
|
||||
import { closeExtensionPopup } from '@/seqta/utils/Closers/closeExtensionPopup'
|
||||
import { formatCustomThemeApiError } from '@/seqta/utils/customThemes/apiErrors'
|
||||
|
||||
const themeManager = ThemeManager.getInstance();
|
||||
|
||||
let themes = $state<ThemeList | null>(null);
|
||||
let { isEditMode, showNavigation = true, listMode = 'all' } = $props<{
|
||||
let { isEditMode, showNavigation = true } = $props<{
|
||||
isEditMode: boolean;
|
||||
showNavigation?: boolean;
|
||||
listMode?: ThemeListMode;
|
||||
}>();
|
||||
let favoriteStatus = $state<Record<string, boolean>>({});
|
||||
let cloudLoggedIn = $state(cloudAuth.state.isLoggedIn);
|
||||
@@ -112,11 +111,6 @@
|
||||
await launchPageThemeBuilder(themeId)
|
||||
}
|
||||
|
||||
const openCommunitySubmit = async () => {
|
||||
const { openCommunityThemeSubmit } = await import('@/seqta/utils/openCommunityThemeSubmit')
|
||||
await openCommunityThemeSubmit()
|
||||
}
|
||||
|
||||
const submitCustomTheme = async (theme: CustomTheme, e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
submitError = null;
|
||||
@@ -135,11 +129,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
const customThemeActionClass =
|
||||
'flex h-12 items-center justify-center gap-2 w-full rounded-xl transition bg-zinc-100 text-xl dark:bg-zinc-900 dark:text-white hover:bg-zinc-200 dark:hover:bg-zinc-800'
|
||||
|
||||
const customThemeActionCompactClass = customThemeActionClass
|
||||
|
||||
const handleToggleFavorite = async (theme: CustomTheme, e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
if (!cloudLoggedIn) {
|
||||
@@ -166,11 +155,7 @@
|
||||
themeUpdates.removeListener(fetchThemes);
|
||||
})
|
||||
|
||||
const visibleThemes = $derived(
|
||||
themes ? filterThemesByMode(themes.themes, listMode) : [],
|
||||
);
|
||||
|
||||
const useTwoColumnLayout = $derived(listMode === 'downloaded' || listMode === 'custom');
|
||||
const useTwoColumnLayout = $derived(!showNavigation);
|
||||
</script>
|
||||
|
||||
<div
|
||||
@@ -180,7 +165,7 @@
|
||||
>
|
||||
<div class="{useTwoColumnLayout ? 'grid grid-cols-2 gap-3' : 'flex flex-col gap-2 px-2'}">
|
||||
{#if themes}
|
||||
{#each visibleThemes as theme (theme.id)}
|
||||
{#each themes.themes as theme (theme.id)}
|
||||
<button
|
||||
class="relative group w-full aspect-theme flex justify-center items-center rounded-xl transition ring dark:ring-white ring-zinc-300 {theme.id === themes.selectedTheme ? 'dark:ring-2 ring-4' : 'ring-0'}"
|
||||
onclick={(e) => handleThemeClick(theme, e)}
|
||||
@@ -236,18 +221,16 @@
|
||||
>
|
||||
<span class="text-lg font-IconFamily"></span>
|
||||
</div>
|
||||
{#if listMode === 'custom'}
|
||||
<div
|
||||
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white {submittingThemeId === theme.id ? 'opacity-60' : ''}"
|
||||
onclick={(event) => void submitCustomTheme(theme, event)}
|
||||
onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') void submitCustomTheme(theme, event as unknown as MouseEvent) }}
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
title="Submit to community"
|
||||
>
|
||||
<span class="text-lg font-IconFamily"></span>
|
||||
</div>
|
||||
{/if}
|
||||
<div
|
||||
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white {submittingThemeId === theme.id ? 'opacity-60' : ''}"
|
||||
onclick={(event) => void submitCustomTheme(theme, event)}
|
||||
onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') void submitCustomTheme(theme, event as unknown as MouseEvent) }}
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
title="Submit to community"
|
||||
>
|
||||
<span class="text-lg font-IconFamily"></span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -273,142 +256,39 @@
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
{#if themes && visibleThemes.length === 0}
|
||||
{#if themes && themes.themes.length === 0}
|
||||
<div class="flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center {useTwoColumnLayout ? 'col-span-2' : ''}">
|
||||
{#if listMode === 'custom'}
|
||||
<h3 class="text-xl font-semibold text-zinc-900 dark:text-white" style="text-wrap: balance">
|
||||
No custom themes yet
|
||||
</h3>
|
||||
<p class="mt-2 max-w-md text-base text-zinc-500 dark:text-zinc-400" style="text-wrap: pretty">
|
||||
Create a theme with the builder, or follow our guide to get started.
|
||||
</p>
|
||||
<div class="mt-6 grid w-full max-w-md grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => void openThemeCreator()}
|
||||
class="flex h-11 items-center justify-center gap-2 rounded-lg bg-zinc-200 px-4 font-medium text-zinc-900 transition-[background-color,color,transform] duration-150 hover:bg-zinc-300 active:scale-[0.96] focus:outline-none focus:ring-2 focus:ring-zinc-400 dark:bg-zinc-700 dark:text-white dark:hover:bg-zinc-600"
|
||||
>
|
||||
<span class="font-IconFamily text-lg" aria-hidden="true"></span>
|
||||
Create a theme
|
||||
</button>
|
||||
<a
|
||||
href="https://docs.betterseqta.org/theme-creation/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="flex h-11 items-center justify-center gap-2 rounded-lg bg-zinc-200 px-4 font-medium text-zinc-900 transition-[background-color,color,transform] duration-150 hover:bg-zinc-300 active:scale-[0.96] focus:outline-none focus:ring-2 focus:ring-zinc-400 dark:bg-zinc-700 dark:text-white dark:hover:bg-zinc-600"
|
||||
>
|
||||
<span class="font-IconFamily text-lg" aria-hidden="true">{'\uecb3'}</span>
|
||||
View docs
|
||||
</a>
|
||||
</div>
|
||||
{:else if listMode === 'downloaded'}
|
||||
<h3 class="text-xl font-semibold text-zinc-900 dark:text-white" style="text-wrap: balance">
|
||||
No downloaded themes
|
||||
</h3>
|
||||
<p class="mt-2 max-w-md text-base text-zinc-500 dark:text-zinc-400" style="text-wrap: pretty">
|
||||
Browse the theme store to find and install themes.
|
||||
</p>
|
||||
<div class="mt-6 grid w-full max-w-md grid-cols-1 gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => void openStorePage()}
|
||||
class="flex h-11 items-center justify-center gap-2 rounded-lg bg-zinc-200 px-4 font-medium text-zinc-900 transition-[background-color,color,transform] duration-150 hover:bg-zinc-300 active:scale-[0.96] focus:outline-none focus:ring-2 focus:ring-zinc-400 dark:bg-zinc-700 dark:text-white dark:hover:bg-zinc-600"
|
||||
>
|
||||
<span class="font-IconFamily text-lg" aria-hidden="true"></span>
|
||||
Browse the store
|
||||
</button>
|
||||
</div>
|
||||
{:else}
|
||||
<h3 class="text-xl font-semibold text-zinc-900 dark:text-white" style="text-wrap: balance">
|
||||
No themes installed
|
||||
</h3>
|
||||
<p class="mt-2 max-w-md text-base text-zinc-500 dark:text-zinc-400" style="text-wrap: pretty">
|
||||
Install a theme from the store or create one of your own.
|
||||
</p>
|
||||
<div class="mt-6 grid w-full max-w-md grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => void openStorePage()}
|
||||
class="flex h-11 items-center justify-center gap-2 rounded-lg bg-zinc-200 px-4 font-medium text-zinc-900 transition-[background-color,color,transform] duration-150 hover:bg-zinc-300 active:scale-[0.96] focus:outline-none focus:ring-2 focus:ring-zinc-400 dark:bg-zinc-700 dark:text-white dark:hover:bg-zinc-600"
|
||||
>
|
||||
<span class="font-IconFamily text-lg" aria-hidden="true"></span>
|
||||
Install a theme
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => void openThemeCreator()}
|
||||
class="flex h-11 items-center justify-center gap-2 rounded-lg bg-zinc-200 px-4 font-medium text-zinc-900 transition-[background-color,color,transform] duration-150 hover:bg-zinc-300 active:scale-[0.96] focus:outline-none focus:ring-2 focus:ring-zinc-400 dark:bg-zinc-700 dark:text-white dark:hover:bg-zinc-600"
|
||||
>
|
||||
<span class="font-IconFamily text-lg" aria-hidden="true"></span>
|
||||
Create a theme
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
<h3 class="text-xl font-semibold text-zinc-900 dark:text-white" style="text-wrap: balance">
|
||||
No themes installed
|
||||
</h3>
|
||||
<p class="mt-2 max-w-md text-base text-zinc-500 dark:text-zinc-400" style="text-wrap: pretty">
|
||||
Install a theme from the store or create one of your own.
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if themes && (listMode === 'custom' || (showNavigation && visibleThemes.length > 0) || (listMode === 'downloaded' && visibleThemes.length > 0))}
|
||||
<div id="divider" class="w-full h-[1px] my-2 bg-zinc-100 dark:bg-zinc-600 {useTwoColumnLayout ? 'col-span-2' : ''}"></div>
|
||||
{#if submitError}
|
||||
<p class="whitespace-pre-line text-sm text-red-600 dark:text-red-400 {useTwoColumnLayout ? 'col-span-2' : ''}">{submitError}</p>
|
||||
{/if}
|
||||
|
||||
{#if listMode === 'custom' && submitError}
|
||||
<p class="col-span-2 whitespace-pre-line text-sm text-red-600 dark:text-red-400">{submitError}</p>
|
||||
{/if}
|
||||
{#if themes && showNavigation}
|
||||
<div id="divider" class="w-full h-[1px] my-2 bg-zinc-100 dark:bg-zinc-600"></div>
|
||||
|
||||
{#if listMode === 'custom'}
|
||||
<div class="grid grid-cols-2 gap-2 {useTwoColumnLayout ? 'col-span-2' : ''}">
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => void openThemeCreator()}
|
||||
class={customThemeActionCompactClass}
|
||||
>
|
||||
<span class="text-2xl font-IconFamily" aria-hidden="true"></span>
|
||||
<span>Create theme</span>
|
||||
</button>
|
||||
<button
|
||||
onclick={() => void openStorePage()}
|
||||
class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white"
|
||||
>
|
||||
<span class="text-xl font-IconFamily"></span>
|
||||
<span class="ml-2">Theme Store</span>
|
||||
</button>
|
||||
|
||||
<a
|
||||
href="https://docs.betterseqta.org/theme-creation/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class={customThemeActionCompactClass}
|
||||
>
|
||||
<span class="text-2xl font-IconFamily" aria-hidden="true">{'\uecb3'}</span>
|
||||
<span>View docs</span>
|
||||
</a>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => void openCommunitySubmit()}
|
||||
class="{customThemeActionClass} col-span-2"
|
||||
>
|
||||
<span class="text-2xl font-IconFamily" aria-hidden="true"></span>
|
||||
<span>Create & submit</span>
|
||||
</button>
|
||||
</div>
|
||||
{:else if listMode === 'downloaded'}
|
||||
<button
|
||||
onclick={() => void openStorePage()}
|
||||
class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white {useTwoColumnLayout ? 'col-span-2' : ''}"
|
||||
>
|
||||
<span class="text-xl font-IconFamily"></span>
|
||||
<span class="ml-2">Theme Store</span>
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
onclick={() => void openStorePage()}
|
||||
class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white"
|
||||
>
|
||||
<span class="text-xl font-IconFamily"></span>
|
||||
<span class="ml-2">Theme Store</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
onclick={() => void openThemeCreator()}
|
||||
class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white"
|
||||
>
|
||||
<span class="text-xl font-IconFamily"></span>
|
||||
<span class="ml-2">Create your own</span>
|
||||
</button>
|
||||
{/if}
|
||||
<button
|
||||
onclick={() => void openThemeCreator()}
|
||||
class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white"
|
||||
>
|
||||
<span class="text-xl font-IconFamily"></span>
|
||||
<span class="ml-2">Create your own</span>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import BrowsePanel from "@/interface/components/communityThemes/BrowsePanel.svelte";
|
||||
import MyThemesPanel from "@/interface/components/communityThemes/MyThemesPanel.svelte";
|
||||
import OwnerThemeDetailModal from "@/interface/components/communityThemes/OwnerThemeDetailModal.svelte";
|
||||
@@ -36,16 +37,14 @@
|
||||
My themes
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg bg-zinc-900 px-4 py-2 text-sm font-medium text-white transition hover:bg-zinc-700 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white"
|
||||
onclick={() =>
|
||||
<Button
|
||||
variant="primary"
|
||||
text="Create & submit"
|
||||
onClick={() =>
|
||||
void import("@/seqta/utils/launchPageThemeBuilder").then(({ launchPageThemeBuilder }) =>
|
||||
launchPageThemeBuilder(),
|
||||
)}
|
||||
>
|
||||
Create & submit
|
||||
</button>
|
||||
/>
|
||||
</div>
|
||||
<p class="mt-2 text-sm text-zinc-500 dark:text-zinc-400">
|
||||
Community themes are user-submitted and moderated separately from the official theme store.
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
} from "@/utils/githubReleaseUpdate";
|
||||
type PageId = "settings" | "themes" | "backgrounds";
|
||||
type StoreTab = "themes" | "backgrounds";
|
||||
type ThemeView = "theme-settings" | "theme-store" | "community-themes" | "create-theme";
|
||||
type ThemeView = "theme-settings" | "theme-store" | "community-themes";
|
||||
type BackgroundView = "background-settings" | "background-store";
|
||||
|
||||
const loadSettingsBody = () => import("./settings/SettingsBody.svelte");
|
||||
@@ -115,8 +115,7 @@
|
||||
items: [
|
||||
{ id: "theme-store", label: "Theme store" },
|
||||
{ id: "community-themes", label: "Community themes" },
|
||||
{ id: "theme-settings", label: "Downloaded themes" },
|
||||
{ id: "create-theme", label: "Custom themes" },
|
||||
{ id: "theme-settings", label: "My themes" },
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -165,8 +164,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";
|
||||
if (activeThemeView === "theme-settings") return "My themes";
|
||||
if (activeThemeView === "community-themes") return "Community themes";
|
||||
if (activeThemeView === "theme-store") return "Theme store";
|
||||
return "Themes";
|
||||
@@ -175,12 +173,6 @@
|
||||
return [...userNav, ...appNav].find((item) => item.id === activeSection)?.label ?? "Settings";
|
||||
});
|
||||
|
||||
const activeThemeListMode = $derived.by(() => {
|
||||
if (activeThemeView === "create-theme") return "custom" as const;
|
||||
if (activeThemeView === "theme-settings") return "downloaded" as const;
|
||||
return "all" as const;
|
||||
});
|
||||
|
||||
const isStoreView = $derived(
|
||||
(activePage === "themes" &&
|
||||
(activeThemeView === "theme-store" || activeThemeView === "community-themes")) ||
|
||||
@@ -464,9 +456,7 @@
|
||||
? "theme-store"
|
||||
: destination.view === "community"
|
||||
? "community-themes"
|
||||
: destination.view === "custom"
|
||||
? "create-theme"
|
||||
: "theme-settings";
|
||||
: "theme-settings";
|
||||
} else if (destination.page === "backgrounds" && destination.view) {
|
||||
activeBackgroundView = destination.view === "store" ? "background-store" : "background-settings";
|
||||
}
|
||||
@@ -717,8 +707,8 @@
|
||||
{:else if activePage === "themes"}
|
||||
<LazyPanel
|
||||
loader={loadThemeSettings}
|
||||
remountKey={`theme-settings-${activeThemeListMode}`}
|
||||
props={{ section: "themes", listMode: activeThemeListMode }}
|
||||
remountKey="theme-settings"
|
||||
props={{ section: "themes" }}
|
||||
/>
|
||||
{:else}
|
||||
<LazyPanel
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import SettingsCard from "./SettingsCard.svelte";
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import Slider from "@/interface/components/Slider.svelte";
|
||||
@@ -69,121 +70,116 @@
|
||||
|
||||
{#each visiblePlugins as plugin (plugin.pluginId)}
|
||||
{@const perfPaused = pluginPerfPaused(plugin.pluginId)}
|
||||
<div class="border-none">
|
||||
<div
|
||||
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40 {!(plugin as PluginSettingsEntry & { disableToggle?: boolean }).disableToggle && Object.keys(plugin.settings).length === 0 ? 'hidden' : ''} {perfPaused ? 'opacity-60' : ''}"
|
||||
>
|
||||
{#if perfPaused}
|
||||
<div
|
||||
class="flex justify-between items-center px-5 py-3 border-b border-amber-200/60 dark:border-amber-900/40 bg-amber-50/80 dark:bg-amber-950/20"
|
||||
>
|
||||
<p class="text-sm text-amber-800 dark:text-amber-200">
|
||||
Paused by Performance Mode — enable anyway
|
||||
</p>
|
||||
<SettingsCard class="{!(plugin as PluginSettingsEntry & { disableToggle?: boolean }).disableToggle && Object.keys(plugin.settings).length === 0 ? 'hidden' : ''} {perfPaused ? 'opacity-60' : ''}">
|
||||
{#if perfPaused}
|
||||
<div
|
||||
class="flex justify-between items-center px-5 py-3 border-b border-amber-200/60 dark:border-amber-900/40 bg-amber-50/80 dark:bg-amber-950/20"
|
||||
>
|
||||
<p class="text-sm text-amber-800 dark:text-amber-200">
|
||||
Paused by Performance Mode — enable anyway
|
||||
</p>
|
||||
<Switch
|
||||
state={$settingsState.performanceModePluginOverrides?.[plugin.pluginId] === true}
|
||||
onChange={(forceOn: boolean) =>
|
||||
setPerformanceModePluginOverride(plugin.pluginId, forceOn)}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if plugin.disableToggle}
|
||||
<div class="flex justify-between items-center px-4 py-3 {perfPaused ? 'pointer-events-none' : ''}">
|
||||
<div class="pr-4">
|
||||
<h2 class="flex gap-2 items-center text-sm font-bold">
|
||||
Enable {plugin.name}
|
||||
{#if plugin.beta}
|
||||
<span
|
||||
class="px-2 py-0.5 text-xs font-medium text-orange-800 bg-orange-100 rounded-full border border-orange-300/30 dark:bg-orange-900/30 dark:text-orange-300 dark:border-orange-900/30"
|
||||
>
|
||||
Beta
|
||||
</span>
|
||||
{/if}
|
||||
</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">{plugin.description}</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.performanceModePluginOverrides?.[plugin.pluginId] === true}
|
||||
onChange={(forceOn: boolean) =>
|
||||
setPerformanceModePluginOverride(plugin.pluginId, forceOn)}
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true}
|
||||
onChange={async (value) => {
|
||||
if (plugin.pluginId === "assessments-average" && value === true) {
|
||||
showDisclaimer(
|
||||
async () => {
|
||||
await pluginSettingsStore.update(plugin.pluginId, "enabled", true);
|
||||
},
|
||||
() => {},
|
||||
"Assessment Averages Disclaimer",
|
||||
"This feature calculates a simple average of your assessment grades. It does not take into account:\n• Assessment weightings\n• Different grading scales\n• Other factors used in official reports\n\nThe displayed average may be inaccurate compared to your actual marks found in reports.\n\nDo you want to enable this feature?",
|
||||
);
|
||||
return;
|
||||
}
|
||||
await pluginSettingsStore.update(plugin.pluginId, "enabled", value);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if plugin.disableToggle}
|
||||
<div class="flex justify-between items-center px-4 py-3 {perfPaused ? 'pointer-events-none' : ''}">
|
||||
<div class="pr-4">
|
||||
<h2 class="flex gap-2 items-center text-sm font-bold">
|
||||
Enable {plugin.name}
|
||||
{#if plugin.beta}
|
||||
<span
|
||||
class="px-2 py-0.5 text-xs font-medium text-orange-800 bg-orange-100 rounded-full border border-orange-300/30 dark:bg-orange-900/30 dark:text-orange-300 dark:border-orange-900/30"
|
||||
>
|
||||
Beta
|
||||
</span>
|
||||
{/if}
|
||||
</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">{plugin.description}</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true}
|
||||
onChange={async (value) => {
|
||||
if (plugin.pluginId === "assessments-average" && value === true) {
|
||||
showDisclaimer(
|
||||
async () => {
|
||||
await pluginSettingsStore.update(plugin.pluginId, "enabled", true);
|
||||
},
|
||||
() => {},
|
||||
"Assessment Averages Disclaimer",
|
||||
"This feature calculates a simple average of your assessment grades. It does not take into account:\n• Assessment weightings\n• Different grading scales\n• Other factors used in official reports\n\nThe displayed average may be inaccurate compared to your actual marks found in reports.\n\nDo you want to enable this feature?",
|
||||
);
|
||||
return;
|
||||
}
|
||||
await pluginSettingsStore.update(plugin.pluginId, "enabled", value);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !perfPaused && (!plugin.disableToggle || ((pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true))}
|
||||
{#each Object.entries(plugin.settings) as [key, setting] (key)}
|
||||
{#if key !== "enabled" && !(key === "useCloudPfp" && !cloudState.isLoggedIn)}
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">{setting.title || key}</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">{setting.description || ""}</p>
|
||||
</div>
|
||||
<div>
|
||||
{#if setting.type === "boolean"}
|
||||
<Switch
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as boolean | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
/>
|
||||
{:else if setting.type === "number"}
|
||||
<div class="w-28 shrink-0">
|
||||
<Slider
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as number | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
min={setting.min}
|
||||
max={setting.max}
|
||||
step={setting.step}
|
||||
/>
|
||||
</div>
|
||||
{:else if setting.type === "string"}
|
||||
<input
|
||||
type="text"
|
||||
class="px-2 py-1 text-sm rounded-md dark:bg-[#38373D]/50 bg-[#DDDDDD] dark:text-white border-none"
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
oninput={(e) =>
|
||||
pluginSettingsStore.update(plugin.pluginId, key, e.currentTarget.value)}
|
||||
/>
|
||||
{:else if setting.type === "select"}
|
||||
<Select
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
options={(setting.options as string[]).map((opt) => ({
|
||||
value: opt,
|
||||
label: opt.charAt(0).toUpperCase() + opt.slice(1),
|
||||
}))}
|
||||
/>
|
||||
{:else if setting.type === "button"}
|
||||
<Button onClick={() => setting.trigger?.()} text={setting.title} />
|
||||
{:else if setting.type === "hotkey"}
|
||||
<HotkeyInput
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
/>
|
||||
{:else if setting.type === "component" && setting.component}
|
||||
{@const Component = setting.component as import("svelte").Component}
|
||||
<Component />
|
||||
{/if}
|
||||
</div>
|
||||
{#if !perfPaused && (!plugin.disableToggle || ((pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true))}
|
||||
{#each Object.entries(plugin.settings) as [key, setting] (key)}
|
||||
{#if key !== "enabled" && !(key === "useCloudPfp" && !cloudState.isLoggedIn)}
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">{setting.title || key}</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">{setting.description || ""}</p>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{#if setting.type === "boolean"}
|
||||
<Switch
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as boolean | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
/>
|
||||
{:else if setting.type === "number"}
|
||||
<div class="w-28 shrink-0">
|
||||
<Slider
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as number | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
min={setting.min}
|
||||
max={setting.max}
|
||||
step={setting.step}
|
||||
/>
|
||||
</div>
|
||||
{:else if setting.type === "string"}
|
||||
<input
|
||||
type="text"
|
||||
class="px-2 py-1 text-sm rounded-md dark:bg-[#38373D]/50 bg-[#DDDDDD] dark:text-white border-none"
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
oninput={(e) =>
|
||||
pluginSettingsStore.update(plugin.pluginId, key, e.currentTarget.value)}
|
||||
/>
|
||||
{:else if setting.type === "select"}
|
||||
<Select
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
options={(setting.options as string[]).map((opt) => ({
|
||||
value: opt,
|
||||
label: opt.charAt(0).toUpperCase() + opt.slice(1),
|
||||
}))}
|
||||
/>
|
||||
{:else if setting.type === "button"}
|
||||
<Button onClick={() => setting.trigger?.()} text={setting.title} />
|
||||
{:else if setting.type === "hotkey"}
|
||||
<HotkeyInput
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
/>
|
||||
{:else if setting.type === "component" && setting.component}
|
||||
{@const Component = setting.component as import("svelte").Component}
|
||||
<Component />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
{#if plugin.pluginId === "global-search"}
|
||||
<SettingRow
|
||||
title="Theme of the Month"
|
||||
@@ -197,5 +193,5 @@
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</SettingsCard>
|
||||
{/each}
|
||||
@@ -0,0 +1,13 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from "svelte";
|
||||
|
||||
let { class: className = "", children }: { class?: string; children: Snippet } = $props();
|
||||
</script>
|
||||
|
||||
<div class="border-none">
|
||||
<div
|
||||
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40 {className}"
|
||||
>
|
||||
{@render children()}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import SettingsCard from "../SettingsCard.svelte";
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import ConnectMobileApp from "@/interface/components/ConnectMobileApp.svelte";
|
||||
import CloudSettingsSync from "@/interface/components/CloudSettingsSync.svelte";
|
||||
@@ -46,65 +47,65 @@
|
||||
const showCloudAccountCard = $derived(showCloudCardHeader || showFounderBadgeSetting);
|
||||
</script>
|
||||
|
||||
<SettingRow
|
||||
title="Connect Mobile App"
|
||||
description="Link your SEQTA session to DesQTA — the modern desktop and mobile app for SEQTA Learn"
|
||||
id={0}
|
||||
Component={ConnectMobileApp}
|
||||
{searchQuery}
|
||||
props={{}}
|
||||
/>
|
||||
{#if matchesSearch(searchQuery, "Connect Mobile App", "Link your SEQTA session to DesQTA — the modern desktop and mobile app for SEQTA Learn")}
|
||||
<SettingsCard>
|
||||
<SettingRow
|
||||
title="Connect Mobile App"
|
||||
description="Link your SEQTA session to DesQTA — the modern desktop and mobile app for SEQTA Learn"
|
||||
id={0}
|
||||
Component={ConnectMobileApp}
|
||||
{searchQuery}
|
||||
props={{}}
|
||||
/>
|
||||
</SettingsCard>
|
||||
{/if}
|
||||
|
||||
{#if showCloudAccountCard}
|
||||
<div class="border-none">
|
||||
<div
|
||||
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
|
||||
>
|
||||
{#if showCloudCardHeader}
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">BetterSEQTA Cloud</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">Account & sync</p>
|
||||
</div>
|
||||
<div>
|
||||
<CloudHeader compact alwaysShowUserName onClick={showCloudPanel} />
|
||||
</div>
|
||||
<SettingsCard>
|
||||
{#if showCloudCardHeader}
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">BetterSEQTA Cloud</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">Account & sync</p>
|
||||
</div>
|
||||
{/if}
|
||||
{#if cloudState.isLoggedIn}
|
||||
<div class="px-3 pb-3" class:pt-3={!showCloudCardHeader}>
|
||||
{#if showCloudCardHeader}
|
||||
<CloudSettingsSync
|
||||
showDisclaimer={(onConfirm, onCancel) =>
|
||||
showDisclaimer(
|
||||
onConfirm,
|
||||
onCancel,
|
||||
"Restore from cloud?",
|
||||
"This will replace your local settings with the cloud backup. Continue?",
|
||||
)}
|
||||
/>
|
||||
{/if}
|
||||
{#if showFounderBadgeSetting}
|
||||
<SettingRow
|
||||
title={founderBadgeSetting.title}
|
||||
description={founderBadgeSetting.description}
|
||||
id={17}
|
||||
Component={Switch}
|
||||
{searchQuery}
|
||||
props={{
|
||||
state: $settingsState.showTitlebarFounderBadge !== false,
|
||||
onChange: (isOn: boolean) => (settingsState.showTitlebarFounderBadge = isOn),
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
<div>
|
||||
<CloudHeader compact alwaysShowUserName onClick={showCloudPanel} />
|
||||
</div>
|
||||
{:else if showFounderBadgeSetting}
|
||||
<div class="px-5 pb-4 text-sm text-zinc-600 dark:text-zinc-400">
|
||||
Sign in to Cloud first.
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{#if cloudState.isLoggedIn}
|
||||
<div class="px-3 pb-3" class:pt-3={!showCloudCardHeader}>
|
||||
{#if showCloudCardHeader}
|
||||
<CloudSettingsSync
|
||||
showDisclaimer={(onConfirm, onCancel) =>
|
||||
showDisclaimer(
|
||||
onConfirm,
|
||||
onCancel,
|
||||
"Restore from cloud?",
|
||||
"This will replace your local settings with the cloud backup. Continue?",
|
||||
)}
|
||||
/>
|
||||
{/if}
|
||||
{#if showFounderBadgeSetting}
|
||||
<SettingRow
|
||||
title={founderBadgeSetting.title}
|
||||
description={founderBadgeSetting.description}
|
||||
id={17}
|
||||
Component={Switch}
|
||||
{searchQuery}
|
||||
props={{
|
||||
state: $settingsState.showTitlebarFounderBadge !== false,
|
||||
onChange: (isOn: boolean) => (settingsState.showTitlebarFounderBadge = isOn),
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if showFounderBadgeSetting}
|
||||
<div class="px-5 pb-4 text-sm text-zinc-600 dark:text-zinc-400">
|
||||
Sign in to Cloud first.
|
||||
</div>
|
||||
{/if}
|
||||
</SettingsCard>
|
||||
{/if}
|
||||
|
||||
<PluginSettingsBlocks section="account" {showDisclaimer} {searchQuery} />
|
||||
@@ -2,7 +2,7 @@
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { showPrivacyNotification } from "@/seqta/utils/Openers/OpenPrivacyNotification";
|
||||
import { openTermsOfServicePopup } from "@/seqta/utils/Openers/OpenTermsOfServicePopup";
|
||||
import { showThemeOfTheMonthPopupNow } from "@/seqta/utils/Openers/OpenThemeOfTheMonthPopup";
|
||||
import { closeExtensionPopup } from "@/seqta/utils/Closers/closeExtensionPopup";
|
||||
import { getSnapshotForUpload } from "@/seqta/utils/cloudSettingsSync";
|
||||
@@ -139,19 +139,20 @@
|
||||
</div>
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Show Privacy Notification</h2>
|
||||
<h2 class="text-sm font-bold">Show Terms of Service</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Show the privacy notification popup on next page load
|
||||
Show the terms of service acceptance popup (same as startup queue)
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
settingsState.termsOfServiceLastAccepted = undefined;
|
||||
settingsState.privacyStatementShown = false;
|
||||
settingsState.privacyStatementLastUpdated = undefined;
|
||||
closeExtensionPopup();
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
await showPrivacyNotification();
|
||||
await openTermsOfServicePopup(undefined, { force: true });
|
||||
}}
|
||||
text="Show Now"
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import SettingsCard from "../SettingsCard.svelte";
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import PickerSwatch from "@/interface/components/PickerSwatch.svelte";
|
||||
@@ -19,24 +20,28 @@
|
||||
const isEngage = isSeqtaEngageExperience();
|
||||
</script>
|
||||
|
||||
{#each [
|
||||
{
|
||||
title: "Custom Theme Colour",
|
||||
description: "Customise the overall theme colour of SEQTA Learn",
|
||||
id: 4,
|
||||
Component: PickerSwatch,
|
||||
props: { onClick: showColourPicker },
|
||||
},
|
||||
{
|
||||
title: "Interface Font",
|
||||
description: "Choose the typeface used across SEQTA Learn",
|
||||
id: 16,
|
||||
Component: Button,
|
||||
props: { onClick: showFontPicker, text: "Change" },
|
||||
},
|
||||
] as option (option.id)}
|
||||
<SettingRow {...option} {searchQuery} />
|
||||
{/each}
|
||||
{#if matchesSearch(searchQuery, "Custom Theme Colour", "Interface Font", "Customise the overall theme colour of SEQTA Learn", "Choose the typeface used across SEQTA Learn")}
|
||||
<SettingsCard class="divide-y divide-zinc-200/60 dark:divide-zinc-700/40">
|
||||
{#each [
|
||||
{
|
||||
title: "Custom Theme Colour",
|
||||
description: "Customise the overall theme colour of SEQTA Learn",
|
||||
id: 4,
|
||||
Component: PickerSwatch,
|
||||
props: { onClick: showColourPicker },
|
||||
},
|
||||
{
|
||||
title: "Interface Font",
|
||||
description: "Choose the typeface used across SEQTA Learn",
|
||||
id: 16,
|
||||
Component: Button,
|
||||
props: { onClick: showFontPicker, text: "Change" },
|
||||
},
|
||||
] as option (option.id)}
|
||||
<SettingRow {...option} {searchQuery} />
|
||||
{/each}
|
||||
</SettingsCard>
|
||||
{/if}
|
||||
|
||||
{#if !isEngage && matchesSearch(searchQuery, "Sidebar Style", "Item Size", "Corner Radius", "Active Indicator", "Sidebar Position", "Sidebar Width", "Transparency Effects", "Blur Strength")}
|
||||
<div class="border-none">
|
||||
@@ -45,61 +50,57 @@
|
||||
{/if}
|
||||
|
||||
{#if matchesSearch(searchQuery, "Adaptive Theme Colour", "Soft Gradient", "Smooth colour transition")}
|
||||
<div class="border-none">
|
||||
<div
|
||||
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
|
||||
>
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<SettingsCard>
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Adaptive Theme Colour</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Change the theme colour based on the current class (e.g. when viewing a course or
|
||||
assessments page)
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeColour ?? false}
|
||||
onChange={(isOn: boolean) => (settingsState.adaptiveThemeColour = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{#if $settingsState.adaptiveThemeColour}
|
||||
<div
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Adaptive Theme Colour</h2>
|
||||
<h2 class="text-sm font-bold">Soft Gradient</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Change the theme colour based on the current class (e.g. when viewing a course or
|
||||
assessments page)
|
||||
Use a soft gradient instead of a solid colour when viewing a class
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeColour ?? false}
|
||||
onChange={(isOn: boolean) => (settingsState.adaptiveThemeColour = isOn)}
|
||||
state={$settingsState.adaptiveThemeGradient ?? false}
|
||||
onChange={(isOn: boolean) => (settingsState.adaptiveThemeGradient = isOn)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{#if $settingsState.adaptiveThemeColour}
|
||||
<div
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Soft Gradient</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Use a soft gradient instead of a solid colour when viewing a class
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeGradient ?? false}
|
||||
onChange={(isOn: boolean) => (settingsState.adaptiveThemeGradient = isOn)}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Smooth colour transition</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Ease between class/subject colours when navigating instead of switching instantly
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Smooth colour transition</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Ease between class/subject colours when navigating instead of switching instantly
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeColourTransition ?? true}
|
||||
onChange={(isOn: boolean) => (settingsState.adaptiveThemeColourTransition = isOn)}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.adaptiveThemeColourTransition ?? true}
|
||||
onChange={(isOn: boolean) => (settingsState.adaptiveThemeColourTransition = isOn)}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</SettingsCard>
|
||||
{/if}
|
||||
|
||||
<PluginSettingsBlocks section="appearance" {showDisclaimer} {searchQuery} />
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import SettingsCard from "../SettingsCard.svelte";
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import Select from "@/interface/components/Select.svelte";
|
||||
@@ -140,34 +141,38 @@
|
||||
]);
|
||||
</script>
|
||||
|
||||
{#each generalOptions as option (option.id)}
|
||||
<SettingRow {...option} {searchQuery} />
|
||||
{#if option.id === 0 && $settingsState.performanceMode && matchesSearch(searchQuery, "Performance Mode", "Global Search", "Assessment Averages", "enable anyway", "paused")}
|
||||
<div class="border-none -mt-px">
|
||||
<div
|
||||
class="mx-5 mb-4 rounded-xl border border-zinc-200/80 bg-zinc-50/80 px-4 py-3 dark:border-zinc-700/60 dark:bg-zinc-900/40"
|
||||
>
|
||||
<p class="mb-3 text-sm font-medium text-zinc-500 dark:text-zinc-400">
|
||||
Paused for performance — enable anyway:
|
||||
</p>
|
||||
<div class="space-y-3">
|
||||
{#each PERFORMANCE_HEAVY_PLUGINS as heavy (heavy.id)}
|
||||
<div class="flex justify-between items-center gap-4">
|
||||
<div class="min-w-0">
|
||||
<p class="text-sm font-semibold text-zinc-800 dark:text-zinc-100">{heavy.name}</p>
|
||||
<p class="text-xs text-zinc-500 dark:text-zinc-400">{heavy.description}</p>
|
||||
</div>
|
||||
<Switch
|
||||
state={$settingsState.performanceModePluginOverrides?.[heavy.id] === true}
|
||||
onChange={(forceOn: boolean) => setPerformanceModePluginOverride(heavy.id, forceOn)}
|
||||
/>
|
||||
{#if generalOptions.some((option) => matchesSearch(searchQuery, option.title, option.description))}
|
||||
<SettingsCard class="divide-y divide-zinc-200/60 dark:divide-zinc-700/40">
|
||||
{#each generalOptions as option (option.id)}
|
||||
<SettingRow {...option} {searchQuery} />
|
||||
{#if option.id === 0 && $settingsState.performanceMode && matchesSearch(searchQuery, "Performance Mode", "Global Search", "Assessment Averages", "enable anyway", "paused")}
|
||||
<div class="border-none -mt-px">
|
||||
<div
|
||||
class="mx-5 mb-4 rounded-xl border border-zinc-200/80 bg-zinc-50/80 px-4 py-3 dark:border-zinc-700/60 dark:bg-zinc-900/40"
|
||||
>
|
||||
<p class="mb-3 text-sm font-medium text-zinc-500 dark:text-zinc-400">
|
||||
Paused for performance — enable anyway:
|
||||
</p>
|
||||
<div class="space-y-3">
|
||||
{#each PERFORMANCE_HEAVY_PLUGINS as heavy (heavy.id)}
|
||||
<div class="flex justify-between items-center gap-4">
|
||||
<div class="min-w-0">
|
||||
<p class="text-sm font-semibold text-zinc-800 dark:text-zinc-100">{heavy.name}</p>
|
||||
<p class="text-xs text-zinc-500 dark:text-zinc-400">{heavy.description}</p>
|
||||
</div>
|
||||
<Switch
|
||||
state={$settingsState.performanceModePluginOverrides?.[heavy.id] === true}
|
||||
onChange={(forceOn: boolean) => setPerformanceModePluginOverride(heavy.id, forceOn)}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
{/each}
|
||||
</SettingsCard>
|
||||
{/if}
|
||||
|
||||
{#if matchesSearch(
|
||||
searchQuery,
|
||||
@@ -176,43 +181,41 @@
|
||||
"Maximum Subjects",
|
||||
"Maximum Assessments per Subject",
|
||||
)}
|
||||
<div class="border-none">
|
||||
<SettingsCard>
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Home Page Assessments</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Limit upcoming assessments shown on the home page by subject
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="p-1 my-1 from-white to-zinc-100 bg-gradient-to-br rounded-xl border shadow-sm border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Home Page Assessments</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Limit upcoming assessments shown on the home page by subject
|
||||
</p>
|
||||
</div>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Include Past Assessments</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Show past-due assessments from the upcoming list, matching the Assessments page
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Include Past Assessments</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Show past-due assessments from the upcoming list, matching the Assessments page
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.homeUpcomingIncludePast ?? true}
|
||||
onChange={(isOn: boolean) => (settingsState.homeUpcomingIncludePast = isOn)}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={$settingsState.homeUpcomingIncludePast ?? true}
|
||||
onChange={(isOn: boolean) => (settingsState.homeUpcomingIncludePast = isOn)}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Maximum Subjects</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Number of subjects to include, ordered by soonest due date
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Maximum Subjects</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Number of subjects to include, ordered by soonest due date
|
||||
</p>
|
||||
</div>
|
||||
<div class="shrink-0">
|
||||
<Select
|
||||
value={String($settingsState.homeUpcomingSubjectsMax ?? 5)}
|
||||
onChange={(value: string) => (settingsState.homeUpcomingSubjectsMax = Number(value))}
|
||||
@@ -226,15 +229,17 @@
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Maximum Assessments per Subject</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Assessments shown for each included subject
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Maximum Assessments per Subject</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Assessments shown for each included subject
|
||||
</p>
|
||||
</div>
|
||||
<div class="shrink-0">
|
||||
<Select
|
||||
value={String($settingsState.homeUpcomingAssessmentsPerSubjectMax ?? 0)}
|
||||
onChange={(value: string) =>
|
||||
@@ -250,5 +255,5 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SettingsCard>
|
||||
{/if}
|
||||
@@ -2,6 +2,7 @@
|
||||
import MotionDiv from '@/interface/components/MotionDiv.svelte';
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState.ts"
|
||||
import Switch from "@/interface/components/Switch.svelte"
|
||||
import Button from "@/interface/components/Button.svelte"
|
||||
import { onMount } from 'svelte';
|
||||
import Shortcuts from "@/seqta/content/links.json"
|
||||
|
||||
@@ -199,16 +200,11 @@
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.3 }}
|
||||
>
|
||||
<button
|
||||
class="w-full px-4 py-3 mb-4 text-base dark:text-white transition rounded-xl bg-zinc-200 dark:bg-zinc-700/50"
|
||||
onclick={isFormVisible ? addNewCustomShortcut : toggleForm}
|
||||
>
|
||||
{#if isFormVisible}
|
||||
Add
|
||||
{:else}
|
||||
Add Custom Shortcut
|
||||
{/if}
|
||||
</button>
|
||||
<Button
|
||||
class="w-full mb-4"
|
||||
text={isFormVisible ? "Add" : "Add Custom Shortcut"}
|
||||
onClick={isFormVisible ? addNewCustomShortcut : toggleForm}
|
||||
/>
|
||||
</MotionDiv>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<script lang="ts">
|
||||
import BackgroundSelector from "@/interface/components/themes/BackgroundSelector.svelte"
|
||||
import ThemeSelector from "@/interface/components/themes/ThemeSelector.svelte"
|
||||
import Button from "@/interface/components/Button.svelte"
|
||||
import { standalone } from "@/interface/utils/standalone.svelte"
|
||||
import type { ThemeListMode } from "@/interface/utils/themeListFilters"
|
||||
|
||||
let { section = "all", listMode = "all" } = $props<{
|
||||
let { section = "all" } = $props<{
|
||||
section?: "all" | "themes" | "backgrounds";
|
||||
listMode?: ThemeListMode;
|
||||
}>();
|
||||
|
||||
// backgrounds
|
||||
@@ -22,24 +21,23 @@
|
||||
<div class="py-4">
|
||||
{#if !standalone.standalone}
|
||||
{#if showBackgrounds}
|
||||
<button
|
||||
onclick={() => selectNoBackground()}
|
||||
<Button
|
||||
onClick={() => selectNoBackground()}
|
||||
disabled={section === "backgrounds" && !clearTheme}
|
||||
class="w-full px-4 py-3 mb-4 text-base dark:text-white transition rounded-xl bg-zinc-200 dark:bg-zinc-700/50 disabled:opacity-50">
|
||||
{section === "all"
|
||||
text={section === "all"
|
||||
? clearTheme ? 'Clear Theme' : 'Select a Theme'
|
||||
: clearTheme ? 'Clear Background' : 'No Background Selected'}
|
||||
</button>
|
||||
class="w-full mb-4"
|
||||
/>
|
||||
{/if}
|
||||
<div class="w-full">
|
||||
{#if showThemes || showBackgrounds}
|
||||
<div class="mb-3 flex justify-end">
|
||||
<button
|
||||
onclick={() => editMode = !editMode}
|
||||
class="inline-flex h-8 items-center rounded-xl bg-zinc-100 px-3 text-lg dark:bg-zinc-700">
|
||||
<span class="mr-2">{editMode ? 'Done' : 'Remove'}</span>
|
||||
<span class="font-IconFamily">{editMode ? '\ue9e4' : '\uec38'}</span>
|
||||
</button>
|
||||
<Button
|
||||
onClick={() => editMode = !editMode}
|
||||
text={editMode ? 'Done' : 'Remove'}
|
||||
icon={editMode ? '\ue9e4' : '\uec38'}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -47,20 +45,19 @@
|
||||
<BackgroundSelector isEditMode={editMode} bind:selectedBackground={selectedBackground} bind:selectNoBackground={selectNoBackground} />
|
||||
{/if}
|
||||
{#if showThemes}
|
||||
{#if listMode === "custom"}
|
||||
<button
|
||||
type="button"
|
||||
class="mb-4 flex h-11 w-full items-center justify-center gap-2 rounded-xl bg-zinc-900 text-sm font-medium text-white dark:bg-zinc-100 dark:text-zinc-900"
|
||||
onclick={() =>
|
||||
{#if section === "themes"}
|
||||
<Button
|
||||
variant="primary"
|
||||
class="w-full mb-4"
|
||||
icon={""}
|
||||
text="Open theme builder"
|
||||
onClick={() =>
|
||||
void import("@/seqta/utils/launchPageThemeBuilder").then(({ launchPageThemeBuilder }) =>
|
||||
launchPageThemeBuilder(),
|
||||
)}
|
||||
>
|
||||
<span class="font-IconFamily text-lg" aria-hidden="true"></span>
|
||||
Open theme builder
|
||||
</button>
|
||||
/>
|
||||
{/if}
|
||||
<ThemeSelector isEditMode={editMode} showNavigation={section === "all"} {listMode} />
|
||||
<ThemeSelector isEditMode={editMode} showNavigation={section === "all"} />
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
|
||||
@@ -694,7 +694,7 @@
|
||||
{/each}
|
||||
|
||||
<div
|
||||
class="sticky bottom-0 z-10 -mx-2 mt-4 space-y-2 border-t border-zinc-200/80 bg-zinc-100 p-3 pb-4 dark:border-zinc-700/60 dark:bg-zinc-800"
|
||||
class="sticky bottom-0 z-[1500] -mx-2 mt-4 space-y-2 border-t border-zinc-200/80 bg-zinc-100 p-3 pb-4 dark:border-zinc-700/60 dark:bg-zinc-800"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { CustomTheme } from '@/types/CustomThemes';
|
||||
import type { Theme } from '@/interface/types/Theme';
|
||||
import {
|
||||
filterThemesByMode,
|
||||
getThemeApplyButtonStyles,
|
||||
getCommunityInstalledThemeIds,
|
||||
getStoreInstalledThemeIds,
|
||||
@@ -54,27 +53,6 @@ describe('resolveLocalThemeInstallId', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('filterThemesByMode', () => {
|
||||
const storeTheme = makeCustomTheme({
|
||||
id: 'store-1',
|
||||
name: 'Store Theme',
|
||||
installedFromStore: true,
|
||||
});
|
||||
const communityTheme = makeCustomTheme({
|
||||
id: 'community-1',
|
||||
name: 'Community Theme',
|
||||
installedFromCommunity: true,
|
||||
});
|
||||
const localTheme = makeCustomTheme({ id: 'local-1', name: 'Local Theme' });
|
||||
|
||||
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('installed theme id helpers', () => {
|
||||
it('returns store-only and community-only ids', () => {
|
||||
const themes = [
|
||||
|
||||
@@ -2,8 +2,6 @@ import type { CustomTheme } from '@/types/CustomThemes';
|
||||
import type { Theme } from '@/interface/types/Theme';
|
||||
import { parseCssColor } from '@/seqta/ui/colors/parseCssColor';
|
||||
|
||||
export type ThemeListMode = 'downloaded' | 'custom' | 'all';
|
||||
|
||||
const DEFAULT_THEME_ACCENT = 'rgba(0, 123, 255, 1)';
|
||||
|
||||
/** Local themes: created in the editor or imported from a file (not store/community). */
|
||||
@@ -11,11 +9,6 @@ export function isLocalCustomTheme(theme: CustomTheme): boolean {
|
||||
return theme.installedFromStore !== true && theme.installedFromCommunity !== true;
|
||||
}
|
||||
|
||||
/** Themes installed from the official store or community API. */
|
||||
export function isDownloadedTheme(theme: CustomTheme): boolean {
|
||||
return theme.installedFromStore === true || theme.installedFromCommunity === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* When importing a local copy of a theme whose id already belongs to a store/community
|
||||
* install, use a new id so both copies can coexist.
|
||||
@@ -36,12 +29,6 @@ export function resolveLocalThemeInstallId(
|
||||
return themeId;
|
||||
}
|
||||
|
||||
export function filterThemesByMode(themes: CustomTheme[], mode: ThemeListMode): CustomTheme[] {
|
||||
if (mode === 'all') return themes;
|
||||
if (mode === 'custom') return themes.filter(isLocalCustomTheme);
|
||||
return themes.filter(isDownloadedTheme);
|
||||
}
|
||||
|
||||
/** Installed theme ids from the official store only (excludes file imports / custom copies). */
|
||||
export function getStoreInstalledThemeIds(themes: CustomTheme[]): string[] {
|
||||
return themes.filter((theme) => theme.installedFromStore === true).map((theme) => theme.id);
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
"resources/update-image.webp",
|
||||
"resources/pdfjs/pdf.worker.min.mjs",
|
||||
"resources/pdfjs/pdf.legacy.min.mjs",
|
||||
"resources/themeToggleSurprisePage.js",
|
||||
"resources/ort/*",
|
||||
"assets/*.css",
|
||||
"assets/*"
|
||||
|
||||
@@ -35,7 +35,7 @@ const FOLDER_HEROICONS = [
|
||||
folderHeroicon('<path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/>'),
|
||||
];
|
||||
|
||||
const FOLDER_ICON_SVG = `<svg style="width:24px;height:24px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/></svg>`;
|
||||
const FOLDER_ICON_SVG = `<svg style="width:24px;height:24px;flex-shrink:0" viewBox="0 0 24 24"><path fill="currentColor" d="M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/></svg>`;
|
||||
const PLUS_SVG = `<svg style="width:14px;height:14px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>`;
|
||||
const CHECK_SVG_WHITE = `<svg style="width:14px;height:14px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#fff" d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>`;
|
||||
const CLOSE_SVG = `<svg style="width:14px;height:14px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>`;
|
||||
|
||||
@@ -375,6 +375,7 @@
|
||||
/* ── "Add to folder" button in message actions bar ── */
|
||||
.bsplus-folder-btn {
|
||||
position: relative;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.bsplus-folder-btn svg {
|
||||
|
||||
@@ -78,34 +78,27 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col items-end gap-2 shrink-0 max-w-[14rem]">
|
||||
<p class="text-xs text-right text-zinc-500 dark:text-zinc-400">{scopeLabel}</p>
|
||||
|
||||
<div class="flex flex-col items-end gap-2 shrink-0 max-w-[14rem]" title={scopeLabel}>
|
||||
{#if syncOptIn}
|
||||
<p class="text-xs font-medium text-green-600 dark:text-green-400">Opted in on this site</p>
|
||||
<div class="flex flex-wrap gap-2 justify-end">
|
||||
<Button text="Sync now" onClick={() => void syncNow()} disabled={busy} />
|
||||
<button
|
||||
type="button"
|
||||
class="px-3 py-1.5 text-[0.75rem] rounded-lg text-red-600 dark:text-red-400 hover:bg-zinc-200/80 dark:hover:bg-zinc-700/50 disabled:opacity-50 transition-colors duration-200"
|
||||
disabled={busy}
|
||||
onclick={startOptOut}
|
||||
>
|
||||
Opt out…
|
||||
</button>
|
||||
</div>
|
||||
{:else}
|
||||
<p class="text-xs text-right text-zinc-500 dark:text-zinc-400">
|
||||
{cloudAuth.state.isLoggedIn
|
||||
? "Not sharing yet"
|
||||
: "Sign in to Cloud in the opt-in guide"}
|
||||
{cloudAuth.state.isLoggedIn ? "Not sharing yet" : "Sign in to Cloud first"}
|
||||
</p>
|
||||
<Button text="Opt in…" onClick={startOptIn} disabled={busy} />
|
||||
{/if}
|
||||
|
||||
{#if status}
|
||||
<p class="text-xs text-right text-zinc-500 dark:text-zinc-400">{status}</p>
|
||||
{/if}
|
||||
|
||||
{#if syncOptIn}
|
||||
<div class="flex flex-wrap gap-2 justify-end">
|
||||
<Button text="Sync now" onClick={() => void syncNow()} disabled={busy} />
|
||||
<Button variant="ghost" class="text-red-600 dark:text-red-400" text="Opt out…" onClick={startOptOut} disabled={busy} />
|
||||
</div>
|
||||
{:else}
|
||||
<Button text="Opt in…" onClick={startOptIn} disabled={busy} />
|
||||
{/if}
|
||||
|
||||
{#if error}
|
||||
<p class="text-xs text-right text-red-500">{error}</p>
|
||||
{/if}
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
|
||||
const STYLE_ID = "bsplus-timetable-classmates-popup-styles";
|
||||
const CLASSMATES_VIDEO_URL =
|
||||
"https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Plus/main/src/resources/timetable-classmates-video.webm";
|
||||
"https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Plus/refs/heads/main/src/resources/timetable-classmates.webm";
|
||||
|
||||
function ensurePopupStyles(): void {
|
||||
if (document.getElementById(STYLE_ID)) return;
|
||||
@@ -26,6 +26,8 @@ function ensurePopupStyles(): void {
|
||||
|
||||
type ConsentPopupOptions = {
|
||||
onDismiss?: () => void;
|
||||
/** Fires once the popup shell is ready (Svelte mounted). */
|
||||
onOpened?: () => void;
|
||||
heroVideo?: boolean;
|
||||
};
|
||||
|
||||
@@ -76,6 +78,7 @@ function openConsentPopup(
|
||||
},
|
||||
},
|
||||
});
|
||||
options?.onOpened?.();
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -83,22 +86,17 @@ function openConsentPopup(
|
||||
export function openTimetableClassmatesOptInPopup(options: {
|
||||
onAccepted: () => void | Promise<void>;
|
||||
onDismiss?: () => void;
|
||||
/** Clears post–cloud-login resume flag as soon as the modal is shown (one-shot reopen). */
|
||||
onOpened?: () => void;
|
||||
}): void {
|
||||
openConsentPopup(
|
||||
"Timetable classmates",
|
||||
"Share class lists with opted-in students at your school",
|
||||
TimetableClassmatesOptInPopup,
|
||||
{ onAccepted: options.onAccepted },
|
||||
{
|
||||
onAccepted: async () => {
|
||||
clearResumeOptInAfterCloudLogin();
|
||||
await options.onAccepted();
|
||||
},
|
||||
},
|
||||
{
|
||||
onDismiss: () => {
|
||||
clearResumeOptInAfterCloudLogin();
|
||||
options.onDismiss?.();
|
||||
},
|
||||
onDismiss: options.onDismiss,
|
||||
onOpened: options.onOpened,
|
||||
heroVideo: true,
|
||||
},
|
||||
);
|
||||
@@ -117,7 +115,10 @@ async function openResumeOptInIfNeeded(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
openTimetableClassmatesOptInPopup({ onAccepted: () => {} });
|
||||
openTimetableClassmatesOptInPopup({
|
||||
onAccepted: () => {},
|
||||
onOpened: () => clearResumeOptInAfterCloudLogin(),
|
||||
});
|
||||
}
|
||||
|
||||
/** After cloud OAuth refreshes the page, reopen opt-in if the user started sign-in from this flow. */
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/* Maintainer note: page-context YouTube IFrame API for theme toggle easter egg. */
|
||||
(function () {
|
||||
if (window.__bsplusThemeSurprisePage) return;
|
||||
window.__bsplusThemeSurprisePage = true;
|
||||
|
||||
var MESSAGE_SOURCE = "betterseqta-theme-surprise";
|
||||
var ytPlayer = null;
|
||||
var apiReady = false;
|
||||
var pendingMountId = null;
|
||||
|
||||
window.onYouTubeIframeAPIReady = function () {
|
||||
apiReady = true;
|
||||
if (pendingMountId) {
|
||||
var mountId = pendingMountId;
|
||||
pendingMountId = null;
|
||||
openPlayer(mountId);
|
||||
}
|
||||
};
|
||||
|
||||
if (
|
||||
!document.querySelector('script[src="https://www.youtube.com/iframe_api"]')
|
||||
) {
|
||||
var apiScript = document.createElement("script");
|
||||
apiScript.src = "https://www.youtube.com/iframe_api";
|
||||
(document.head || document.documentElement).appendChild(apiScript);
|
||||
}
|
||||
|
||||
function openPlayer(mountId) {
|
||||
if (!apiReady) {
|
||||
pendingMountId = mountId;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ytPlayer) {
|
||||
ytPlayer.playVideo();
|
||||
ytPlayer.unMute();
|
||||
return;
|
||||
}
|
||||
|
||||
ytPlayer = new YT.Player(mountId, {
|
||||
height: "360",
|
||||
width: "640",
|
||||
videoId: "dQw4w9WgXcQ",
|
||||
playerVars: {
|
||||
autoplay: 1,
|
||||
rel: 0,
|
||||
origin: window.location.origin,
|
||||
},
|
||||
events: {
|
||||
onReady: function (event) {
|
||||
event.target.unMute();
|
||||
event.target.playVideo();
|
||||
},
|
||||
onError: function (event) {
|
||||
console.warn(
|
||||
"[BetterSEQTA+] Theme toggle surprise YouTube error:",
|
||||
event.data,
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener("message", function (event) {
|
||||
if (event.source !== window || !event.data) return;
|
||||
if (event.data.source !== MESSAGE_SOURCE) return;
|
||||
|
||||
if (event.data.type === "open" && event.data.mountId) {
|
||||
openPlayer(event.data.mountId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.data.type === "close") {
|
||||
try {
|
||||
if (ytPlayer && ytPlayer.destroy) {
|
||||
ytPlayer.destroy();
|
||||
}
|
||||
} catch (error) {}
|
||||
ytPlayer = null;
|
||||
pendingMountId = null;
|
||||
}
|
||||
});
|
||||
})();
|
||||
Binary file not shown.
@@ -14,6 +14,11 @@ import stringToHTML from "@/seqta/utils/stringToHTML";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { updateAllColors } from "./colors/Manager";
|
||||
import { delay } from "@/seqta/utils/delay";
|
||||
import {
|
||||
ensureThemeToggleSurprisePageScript,
|
||||
openThemeToggleSurprise,
|
||||
THEME_TOGGLE_SURPRISE_TRIGGER_AT,
|
||||
} from "@/seqta/utils/Openers/openThemeToggleSurprise";
|
||||
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";
|
||||
@@ -47,7 +52,7 @@ function attachUserInfoCacheInvalidation(): void {
|
||||
|
||||
attachUserInfoCacheInvalidation();
|
||||
|
||||
let LightDarkModeSnakeEggButton = 0;
|
||||
let lightDarkToggleStreak = 0;
|
||||
let sidebarAccessibilityObserver: MutationObserver | null = null;
|
||||
let sidebarTabOrderAnimationFrame: number | null = null;
|
||||
let sidebarAccessibilityListenersAttached = false;
|
||||
@@ -543,14 +548,17 @@ async function addDarkLightToggle(parent?: Element) {
|
||||
"LightDarkModeButton",
|
||||
)!;
|
||||
|
||||
ensureThemeToggleSurprisePageScript();
|
||||
|
||||
lightDarkModeButtonElement.addEventListener("click", async () => {
|
||||
const darklightText = document.getElementById("darklighttooliptext");
|
||||
|
||||
LightDarkModeSnakeEggButton += 1;
|
||||
lightDarkToggleStreak += 1;
|
||||
|
||||
if (LightDarkModeSnakeEggButton >= 10) {
|
||||
window.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "_blank");
|
||||
LightDarkModeSnakeEggButton = 0;
|
||||
if (lightDarkToggleStreak >= THEME_TOGGLE_SURPRISE_TRIGGER_AT) {
|
||||
lightDarkToggleStreak = 0;
|
||||
openThemeToggleSurprise();
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
jest.mock("../DevApiBase", () => ({
|
||||
getApiBase: () => "https://betterseqta.org",
|
||||
}));
|
||||
|
||||
import {
|
||||
getFallbackTermsOfService,
|
||||
markTermsOfServiceAccepted,
|
||||
shouldShowTermsOfServicePopup,
|
||||
} from "./OpenTermsOfServicePopup";
|
||||
|
||||
const SAMPLE_TERMS = {
|
||||
last_updated: "2024-06-15T12:00:00Z",
|
||||
whatsnew_html: "<div class=\"whatsnewTextContainer\"><p>Terms body</p></div>",
|
||||
};
|
||||
|
||||
describe("shouldShowTermsOfServicePopup", () => {
|
||||
it("shows when the user has never accepted", () => {
|
||||
expect(
|
||||
shouldShowTermsOfServicePopup({ termsOfServiceLastAccepted: undefined }, SAMPLE_TERMS),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("shows when the remote policy was updated after acceptance", () => {
|
||||
expect(
|
||||
shouldShowTermsOfServicePopup(
|
||||
{ termsOfServiceLastAccepted: "2024-01-01T00:00:00Z" },
|
||||
SAMPLE_TERMS,
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("does not show when the user accepted the current version", () => {
|
||||
expect(
|
||||
shouldShowTermsOfServicePopup(
|
||||
{ termsOfServiceLastAccepted: SAMPLE_TERMS.last_updated },
|
||||
SAMPLE_TERMS,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("treats legacy privacy acceptance as terms acceptance", () => {
|
||||
expect(
|
||||
shouldShowTermsOfServicePopup(
|
||||
{
|
||||
privacyStatementShown: true,
|
||||
privacyStatementLastUpdated: SAMPLE_TERMS.last_updated,
|
||||
},
|
||||
SAMPLE_TERMS,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("markTermsOfServiceAccepted", () => {
|
||||
it("stores the accepted terms version from GET /api/terms", () => {
|
||||
const state = {
|
||||
termsOfServiceLastAccepted: undefined as string | undefined,
|
||||
};
|
||||
|
||||
markTermsOfServiceAccepted(state, SAMPLE_TERMS.last_updated);
|
||||
|
||||
expect(state.termsOfServiceLastAccepted).toBe(SAMPLE_TERMS.last_updated);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getFallbackTermsOfService", () => {
|
||||
it("returns bundled fallback content when the API is unavailable", () => {
|
||||
const fallback = getFallbackTermsOfService();
|
||||
expect(fallback.last_updated).toBeTruthy();
|
||||
expect(fallback.whatsnew_html).toContain("whatsnewTextContainer");
|
||||
expect(fallback.whatsnew_html).toContain("Agreement");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,202 @@
|
||||
import stringToHTML from "../stringToHTML";
|
||||
import { settingsState } from "../listeners/SettingsState";
|
||||
import { getApiBase } from "../DevApiBase";
|
||||
import { closePopup, openPopup } from "./PopupManager";
|
||||
import fallbackTerms from "@/exampletermsresponse.json";
|
||||
import type { SettingsState } from "@/types/storage";
|
||||
|
||||
export const TERMS_OF_SERVICE_URL = "https://betterseqta.org/terms";
|
||||
export const PRIVACY_POLICY_URL = "https://betterseqta.org/privacy";
|
||||
|
||||
const TERMS_FETCH_TIMEOUT_MS = 8_000;
|
||||
|
||||
/** Shared shape for `GET /api/terms` and `GET /api/privacy`. */
|
||||
export interface LegalDocumentPayload {
|
||||
last_updated: string;
|
||||
whatsnew_html: string;
|
||||
}
|
||||
|
||||
function isLegalDocumentPayload(data: unknown): data is LegalDocumentPayload {
|
||||
return (
|
||||
!!data &&
|
||||
typeof data === "object" &&
|
||||
typeof (data as LegalDocumentPayload).last_updated === "string" &&
|
||||
typeof (data as LegalDocumentPayload).whatsnew_html === "string" &&
|
||||
!!(data as LegalDocumentPayload).whatsnew_html.trim()
|
||||
);
|
||||
}
|
||||
|
||||
export function getFallbackTermsOfService(): LegalDocumentPayload {
|
||||
return fallbackTerms as LegalDocumentPayload;
|
||||
}
|
||||
|
||||
/** Loads Terms of Service body from `GET /api/terms`. */
|
||||
export async function fetchTermsOfService(): Promise<LegalDocumentPayload> {
|
||||
try {
|
||||
const res = await fetch(`${getApiBase()}/api/terms`, {
|
||||
cache: "no-store",
|
||||
signal: AbortSignal.timeout(TERMS_FETCH_TIMEOUT_MS),
|
||||
});
|
||||
if (!res.ok) return getFallbackTermsOfService();
|
||||
const data: unknown = await res.json();
|
||||
if (!isLegalDocumentPayload(data)) return getFallbackTermsOfService();
|
||||
return data;
|
||||
} catch (err) {
|
||||
console.warn("[TermsOfService] Failed to fetch terms:", err);
|
||||
return getFallbackTermsOfService();
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link fetchTermsOfService}. */
|
||||
export const fetchPrivacyTerms = fetchTermsOfService;
|
||||
|
||||
function termsVersionIsNewer(
|
||||
remoteLastUpdated: string,
|
||||
acceptedLastUpdated?: string,
|
||||
): boolean {
|
||||
if (!acceptedLastUpdated) return true;
|
||||
const remote = Date.parse(remoteLastUpdated);
|
||||
const accepted = Date.parse(acceptedLastUpdated);
|
||||
if (Number.isNaN(remote) || Number.isNaN(accepted)) {
|
||||
return remoteLastUpdated !== acceptedLastUpdated;
|
||||
}
|
||||
return remote > accepted;
|
||||
}
|
||||
|
||||
function resolvedTermsAcceptance(
|
||||
state: Pick<
|
||||
SettingsState,
|
||||
| "termsOfServiceLastAccepted"
|
||||
| "privacyStatementShown"
|
||||
| "privacyStatementLastUpdated"
|
||||
>,
|
||||
): string | undefined {
|
||||
if (state.termsOfServiceLastAccepted) return state.termsOfServiceLastAccepted;
|
||||
if (state.privacyStatementShown && state.privacyStatementLastUpdated) {
|
||||
return state.privacyStatementLastUpdated;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function shouldShowTermsOfServicePopup(
|
||||
state: Pick<
|
||||
SettingsState,
|
||||
| "termsOfServiceLastAccepted"
|
||||
| "privacyStatementShown"
|
||||
| "privacyStatementLastUpdated"
|
||||
>,
|
||||
terms: LegalDocumentPayload,
|
||||
): boolean {
|
||||
return termsVersionIsNewer(terms.last_updated, resolvedTermsAcceptance(state));
|
||||
}
|
||||
|
||||
export function markTermsOfServiceAccepted(
|
||||
state: Pick<SettingsState, "termsOfServiceLastAccepted">,
|
||||
lastUpdated: string,
|
||||
): void {
|
||||
state.termsOfServiceLastAccepted = lastUpdated;
|
||||
}
|
||||
|
||||
function buildTermsScrollContent(html: string): HTMLElement {
|
||||
const parsed = stringToHTML(html);
|
||||
const root = parsed.firstElementChild as HTMLElement | null;
|
||||
const scroll = document.createElement("div");
|
||||
scroll.className = "bsplus-tos-scroll privacyStatement";
|
||||
scroll.setAttribute("tabindex", "0");
|
||||
scroll.setAttribute("aria-label", "Terms of service");
|
||||
|
||||
if (root?.classList.contains("whatsnewTextContainer")) {
|
||||
scroll.innerHTML = root.innerHTML;
|
||||
} else if (root) {
|
||||
scroll.append(root);
|
||||
} else {
|
||||
scroll.innerHTML = parsed.innerHTML;
|
||||
}
|
||||
|
||||
return scroll;
|
||||
}
|
||||
|
||||
export async function openTermsOfServicePopup(
|
||||
onDismissed?: () => void,
|
||||
options?: { terms?: LegalDocumentPayload; force?: boolean },
|
||||
) {
|
||||
if (document.getElementById("whatsnewbk")) {
|
||||
onDismissed?.();
|
||||
return;
|
||||
}
|
||||
|
||||
const terms = options?.terms ?? (await fetchTermsOfService());
|
||||
if (!options?.force && !shouldShowTermsOfServicePopup(settingsState, terms)) {
|
||||
onDismissed?.();
|
||||
return;
|
||||
}
|
||||
|
||||
const header = stringToHTML(
|
||||
/* html */
|
||||
`<div class="whatsnewHeader bsplus-tos-header">
|
||||
<h1>Terms of Service</h1>
|
||||
<p>Scroll to read the full terms, then accept or dismiss for now</p>
|
||||
</div>`,
|
||||
).firstChild as HTMLElement;
|
||||
|
||||
const scrollContent = buildTermsScrollContent(terms.whatsnew_html);
|
||||
|
||||
const body = document.createElement("div");
|
||||
body.className = "whatsnewTextContainer bsplus-tos-body";
|
||||
|
||||
const intro = stringToHTML(/* html */ `
|
||||
<p class="bsplus-tos-intro privacyStatement">
|
||||
Do you accept the terms of service?
|
||||
<a href="${TERMS_OF_SERVICE_URL}" target="_blank" rel="noopener noreferrer">Terms</a>
|
||||
·
|
||||
<a href="${PRIVACY_POLICY_URL}" target="_blank" rel="noopener noreferrer">Privacy</a>
|
||||
</p>
|
||||
`).firstChild as HTMLElement;
|
||||
|
||||
const actions = stringToHTML(/* html */ `
|
||||
<div class="bsplus-tos-actions">
|
||||
<button type="button" id="bsplus-tos-decline" class="bsplus-tos-btn bsplus-tos-btn--secondary">
|
||||
Not now
|
||||
</button>
|
||||
<button type="button" id="bsplus-tos-accept" class="bsplus-tos-btn bsplus-tos-btn--primary">
|
||||
I accept the terms of service
|
||||
</button>
|
||||
</div>
|
||||
`).firstChild as HTMLElement;
|
||||
|
||||
body.append(intro, scrollContent, actions);
|
||||
|
||||
openPopup({
|
||||
header,
|
||||
content: [body],
|
||||
containerClass: "bsplus-tos-container",
|
||||
backgroundClass: "bsplus-tos-overlay",
|
||||
hideCloseButton: true,
|
||||
closeOnBackdrop: false,
|
||||
closeOnEscape: false,
|
||||
animateSelector: ".bsplus-tos-header *, .bsplus-tos-body > *",
|
||||
afterClose: onDismissed,
|
||||
actions: [
|
||||
{
|
||||
id: "bsplus-tos-accept",
|
||||
onClick: () => {
|
||||
markTermsOfServiceAccepted(settingsState, terms.last_updated);
|
||||
void closePopup();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "bsplus-tos-decline",
|
||||
onClick: () => {
|
||||
void closePopup();
|
||||
},
|
||||
},
|
||||
],
|
||||
onReady: ({ container }) => {
|
||||
container.setAttribute("role", "dialog");
|
||||
container.setAttribute("aria-modal", "true");
|
||||
container.setAttribute("aria-labelledby", "bsplus-tos-title");
|
||||
const title = container.querySelector(".whatsnewHeader h1");
|
||||
if (title) title.id = "bsplus-tos-title";
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -11,6 +11,12 @@ import {
|
||||
shouldShowCoursesAssessmentsFixPopup,
|
||||
} from "./OpenCoursesAssessmentsFixPopup";
|
||||
import { syncApiBaseToBackground } from "../DevApiBase";
|
||||
import { cloudAuth } from "../CloudAuth";
|
||||
import {
|
||||
fetchTermsOfService,
|
||||
openTermsOfServicePopup,
|
||||
shouldShowTermsOfServicePopup,
|
||||
} from "./OpenTermsOfServicePopup";
|
||||
|
||||
type QueueStep = (goNext: () => void) => void;
|
||||
|
||||
@@ -18,7 +24,8 @@ type QueueStep = (goNext: () => void) => void;
|
||||
* Runs startup modals in order: What's New (if the extension just updated),
|
||||
* Courses/Assessments fix notice (only if features are off),
|
||||
* Theme of the Month (when the user hasn't dismissed this calendar month),
|
||||
* then feedback reply notifications for pending submissions.
|
||||
* feedback reply notifications for pending submissions, then terms of service
|
||||
* acceptance (always last, and only once signed in to Cloud).
|
||||
*/
|
||||
export async function runStartupPopupQueue() {
|
||||
// Make sure the background script knows about any dev-mode API override
|
||||
@@ -50,6 +57,22 @@ export async function runStartupPopupQueue() {
|
||||
steps.push(feedbackReplyStep);
|
||||
}
|
||||
|
||||
steps.push((goNext) => {
|
||||
void (async () => {
|
||||
// Nothing is sent to BetterSEQTA servers until the user signs in to Cloud.
|
||||
if (!(await cloudAuth.getStoredToken())) {
|
||||
goNext();
|
||||
return;
|
||||
}
|
||||
const termsDocument = await fetchTermsOfService();
|
||||
if (!shouldShowTermsOfServicePopup(settingsState, termsDocument)) {
|
||||
goNext();
|
||||
return;
|
||||
}
|
||||
await openTermsOfServicePopup(goNext, { terms: termsDocument });
|
||||
})();
|
||||
});
|
||||
|
||||
function runNext() {
|
||||
const step = steps.shift();
|
||||
if (step) step(runNext);
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
import browser from "webextension-polyfill";
|
||||
|
||||
/** Maintainer note: the light/dark toggle easter egg (10 clicks) plays a Rick Roll video. */
|
||||
const PAGE_SCRIPT_RESOURCE = "resources/themeToggleSurprisePage.js";
|
||||
const POPOUT_ROOT_ID = "bsplus-ld-surprise-root";
|
||||
const PLAYER_MOUNT_ID = "bsplus-ld-surprise-player";
|
||||
const PAGE_SCRIPT_ID = "bsplus-theme-surprise-page-script";
|
||||
const MESSAGE_SOURCE = "betterseqta-theme-surprise";
|
||||
|
||||
export const THEME_TOGGLE_SURPRISE_TRIGGER_AT = 10;
|
||||
|
||||
let playerRoot: HTMLElement | null = null;
|
||||
let pageScriptInjected = false;
|
||||
|
||||
function hostElement(): HTMLElement {
|
||||
return document.getElementById("container") ?? document.body;
|
||||
}
|
||||
|
||||
function postToPageContext(type: "open" | "close", mountId?: string): void {
|
||||
window.postMessage(
|
||||
{
|
||||
source: MESSAGE_SOURCE,
|
||||
type,
|
||||
mountId,
|
||||
},
|
||||
"*",
|
||||
);
|
||||
}
|
||||
|
||||
/** Loads YouTube IFrame API in the page context (mirrors the test HTML setup). */
|
||||
export function ensureThemeToggleSurprisePageScript(): void {
|
||||
if (pageScriptInjected || document.getElementById(PAGE_SCRIPT_ID)) {
|
||||
pageScriptInjected = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const script = document.createElement("script");
|
||||
script.id = PAGE_SCRIPT_ID;
|
||||
script.src = browser.runtime.getURL(PAGE_SCRIPT_RESOURCE);
|
||||
(document.head || document.documentElement).appendChild(script);
|
||||
pageScriptInjected = true;
|
||||
}
|
||||
|
||||
function ensurePlayerShell(): void {
|
||||
if (playerRoot) return;
|
||||
|
||||
const root = document.createElement("div");
|
||||
root.id = POPOUT_ROOT_ID;
|
||||
root.className = "bsplus-ld-surprise-root";
|
||||
|
||||
const aside = document.createElement("aside");
|
||||
aside.className = "bsplus-ld-surprise-popout";
|
||||
aside.setAttribute("role", "dialog");
|
||||
aside.setAttribute("aria-label", "Video player");
|
||||
|
||||
const closeBtn = document.createElement("button");
|
||||
closeBtn.type = "button";
|
||||
closeBtn.className = "bsplus-ld-surprise-close";
|
||||
closeBtn.setAttribute("aria-label", "Close");
|
||||
closeBtn.addEventListener("click", closeThemeToggleSurprise);
|
||||
|
||||
const mount = document.createElement("div");
|
||||
mount.id = PLAYER_MOUNT_ID;
|
||||
mount.className = "bsplus-ld-surprise-player";
|
||||
|
||||
aside.append(closeBtn, mount);
|
||||
root.append(aside);
|
||||
hostElement().append(root);
|
||||
|
||||
playerRoot = root;
|
||||
}
|
||||
|
||||
export function closeThemeToggleSurprise(): void {
|
||||
postToPageContext("close");
|
||||
playerRoot?.remove();
|
||||
playerRoot = null;
|
||||
}
|
||||
|
||||
export function openThemeToggleSurprise(): void {
|
||||
ensureThemeToggleSurprisePageScript();
|
||||
ensurePlayerShell();
|
||||
postToPageContext("open", PLAYER_MOUNT_ID);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ export type WhatsNewRelease = {
|
||||
|
||||
export const WHATS_NEW_CHANGELOG: WhatsNewRelease[] = [
|
||||
{
|
||||
"title": "3.7.3 – Performance Mode, Timetable syncing with Friends and Calendars, Sidebar Customisation, new loading animations & Bugfix Bundle",
|
||||
"title": "3.7.4 - Performance Mode, Timetable syncing with Friends and Calendars, Sidebar Customisation, new loading animations & Bugfix Bundle",
|
||||
"items": [
|
||||
"Added Performance Mode in General settings dramatically improving performance with little sacrifice to looks.",
|
||||
"Added the ability to sync your timetable with your friends and calendars.",
|
||||
@@ -47,11 +47,12 @@ export const WHATS_NEW_CHANGELOG: WhatsNewRelease[] = [
|
||||
"Improved background music autoplay with a tap-to-start hint when blocked.",
|
||||
"Added verbose logging toggle under Developer settings.",
|
||||
"Restored theme settings Edit/Done label and improved custom Select keyboard accessibility.",
|
||||
"Cloud sign-in now sends a device name for account management."
|
||||
"Cloud sign-in now sends a device name for account management.",
|
||||
"Added TOS popup"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "3.7.2 – Analytics Fixes",
|
||||
"title": "3.7.2 - Analytics Fixes",
|
||||
"items": [
|
||||
"Fixed analytics page breaking on certain configurations.",
|
||||
"Added safer DOM handling for analytics to prevent crashes.",
|
||||
@@ -61,7 +62,7 @@ export const WHATS_NEW_CHANGELOG: WhatsNewRelease[] = [
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "3.7.0 – Grade Analytics, Enhanced Navigation, fonts, Global Search & SEQTA Engage Improvements",
|
||||
"title": "3.7.0 - Grade Analytics, Enhanced Navigation, fonts, Global Search & SEQTA Engage Improvements",
|
||||
"items": [
|
||||
"Added Enhanced Navigation for courses: the navigator now auto-scrolls to the selected lesson (e.g. inside the \"Go to…\" popup) and prev/next arrows for jumping between lessons.",
|
||||
"Added Grade Analytics, new sidebar page with grade trend charts synced from SEQTA.",
|
||||
@@ -530,6 +531,6 @@ export const WHATS_NEW_CHANGELOG: WhatsNewRelease[] = [
|
||||
export function renderWhatsNewChangelogHtml(): string {
|
||||
return WHATS_NEW_CHANGELOG.map(
|
||||
(release) =>
|
||||
`<h1>${release.title}</h1>\n${release.items.map((item) => `<li>${item}</li>`).join("\n")}`,
|
||||
).join("\n\n ");
|
||||
`<section class="whatsnewRelease">\n<h1>${release.title}</h1>\n${release.items.map((item) => `<li>${item}</li>`).join("\n")}\n</section>`,
|
||||
).join("\n");
|
||||
}
|
||||
@@ -24,6 +24,7 @@ const OPTIONAL_UNSET_MEANS_DEFAULT_KEYS = [
|
||||
"selectedFont",
|
||||
"privacyStatementShown",
|
||||
"privacyStatementLastUpdated",
|
||||
"termsOfServiceLastAccepted",
|
||||
"bsCloudAutoSyncAnnouncementShown",
|
||||
"coursesAssessmentsFixPopupShown",
|
||||
"themeOfTheMonthDismissedMonth",
|
||||
|
||||
@@ -35,6 +35,7 @@ const SETTINGS_STORAGE_KEYS = [
|
||||
"mockNotices",
|
||||
"hideSensitiveContent",
|
||||
"privacyStatementLastUpdated",
|
||||
"termsOfServiceLastAccepted",
|
||||
"themeOfTheMonthDismissedMonth",
|
||||
"themeOfTheMonthLastSeenId",
|
||||
...PLUGIN_SETTINGS_KEYS,
|
||||
|
||||
@@ -36,6 +36,8 @@ export interface SettingsState {
|
||||
justupdated?: boolean;
|
||||
privacyStatementShown?: boolean;
|
||||
privacyStatementLastUpdated?: string;
|
||||
/** ISO timestamp from `GET /api/terms` `last_updated` when the user accepted ToS. */
|
||||
termsOfServiceLastAccepted?: string;
|
||||
/** One-time announcement: BS Cloud automatic settings sync (last in startup popup queue). */
|
||||
bsCloudAutoSyncAnnouncementShown?: boolean;
|
||||
/** One-time notice when BetterSEQTA features are off after the Courses/Assessments fix. */
|
||||
|
||||
Reference in new issue
Block a user