diff --git a/src/background.ts b/src/background.ts
index 7821e531..2bc7f515 100644
--- a/src/background.ts
+++ b/src/background.ts
@@ -100,10 +100,6 @@ const DefaultValues: SettingsState = {
assessmentsAverage: true,
defaultPage: "home",
shortcuts: [
- {
- name: "YouTube",
- enabled: false,
- },
{
name: "Outlook",
enabled: true,
@@ -112,42 +108,10 @@ const DefaultValues: SettingsState = {
name: "Office",
enabled: true,
},
- {
- name: "Spotify",
- enabled: false,
- },
{
name: "Google",
enabled: true,
},
- {
- name: "DuckDuckGo",
- enabled: false,
- },
- {
- name: "Cool Math Games",
- enabled: false,
- },
- {
- name: "SACE",
- enabled: false,
- },
- {
- name: "Google Scholar",
- enabled: false,
- },
- {
- name: "Gmail",
- enabled: false,
- },
- {
- name: "Netflix",
- enabled: false,
- },
- {
- name: "Education Perfect",
- enabled: false,
- },
],
customshortcuts: [],
lettergrade: false,
diff --git a/src/interface/components/Switch.svelte b/src/interface/components/Switch.svelte
index 6fe91cbf..a56a287c 100644
--- a/src/interface/components/Switch.svelte
+++ b/src/interface/components/Switch.svelte
@@ -50,6 +50,6 @@
}
.dark .switch[data-ison="true"] {
- @apply from-[#30D259]/50 to-[#30D259];
+ @apply from-[#30D259]/40 to-[#30D259];
}
diff --git a/src/interface/pages/settings/shortcuts.svelte b/src/interface/pages/settings/shortcuts.svelte
index 1d155857..b9b4f637 100644
--- a/src/interface/pages/settings/shortcuts.svelte
+++ b/src/interface/pages/settings/shortcuts.svelte
@@ -3,6 +3,7 @@
import { settingsState } from "@/seqta/utils/listeners/SettingsState.ts"
import Switch from "@/interface/components/Switch.svelte"
import { onMount } from 'svelte';
+ import Shortcuts from "@/seqta/content/links.json"
let isLoaded = $state(false);
@@ -21,10 +22,14 @@
});
});
- const switchChange = (index: number) => {
- const updatedShortcuts = [...settingsState.shortcuts];
- updatedShortcuts[index].enabled = !updatedShortcuts[index].enabled;
- settingsState.shortcuts = updatedShortcuts;
+ const switchChange = (shortcut: any) => {
+ const value = $settingsState.shortcuts.find(s => s.name === shortcut);
+ if (value) {
+ value.enabled = !value.enabled;
+ settingsState.shortcuts = settingsState.shortcuts;
+ } else {
+ settingsState.shortcuts = [...settingsState.shortcuts, { name: shortcut, enabled: true }];
+ }
}
let isFormVisible = $state(false);
@@ -65,15 +70,6 @@
};
-{#snippet Shortcuts([index, Shortcut]: [string, { name: string, enabled: boolean }]) }
-
-
-
{Shortcut.name}
-
-
switchChange(parseInt(index))} />
-
-{/snippet}
-
{#if isLoaded}
@@ -136,8 +132,13 @@
- {#each Object.entries($settingsState.shortcuts) as shortcut}
- {@render Shortcuts(shortcut)}
+ {#each Object.entries(Shortcuts) as shortcut}
+
+
+
{shortcut[0]}
+
+
s.name === shortcut[0])?.enabled ?? false} onChange={() => switchChange(shortcut[0])} />
+
{/each}
diff --git a/src/plugins/built-in/globalSearch/src/indexing/jobs.ts b/src/plugins/built-in/globalSearch/src/indexing/jobs.ts
index 7d2c5506..6a819a9a 100644
--- a/src/plugins/built-in/globalSearch/src/indexing/jobs.ts
+++ b/src/plugins/built-in/globalSearch/src/indexing/jobs.ts
@@ -1,10 +1,10 @@
import type { Job } from "./types";
import { messagesJob } from "./jobs/messages";
-import { assessmentsJob } from "./jobs/assessments";
+import { notificationsJob } from "./jobs/notifications";
import { forumsJob } from "./jobs/forums";
export const jobs: Record
= {
messages: messagesJob,
- assessments: assessmentsJob,
+ notifications: notificationsJob,
forums: forumsJob,
};
diff --git a/src/plugins/built-in/globalSearch/src/indexing/jobs/assessments.ts b/src/plugins/built-in/globalSearch/src/indexing/jobs/notifications.ts
similarity index 93%
rename from src/plugins/built-in/globalSearch/src/indexing/jobs/assessments.ts
rename to src/plugins/built-in/globalSearch/src/indexing/jobs/notifications.ts
index 654d1f3c..62492a96 100644
--- a/src/plugins/built-in/globalSearch/src/indexing/jobs/assessments.ts
+++ b/src/plugins/built-in/globalSearch/src/indexing/jobs/notifications.ts
@@ -27,8 +27,7 @@ interface AssessmentNotification {
type Notification = MessageNotification | AssessmentNotification;
-/* ------------- Progress model ------------- */
-interface AssessmentsProgress {
+interface NotificationsProgress {
lastTs: number; // ms since epoch of last processed notification
}
@@ -108,14 +107,14 @@ const fetchAssessmentName = async (
};
/* ------------- Job ------------- */
-export const assessmentsJob: Job = {
- id: "assessments",
- label: "Assessments",
- renderComponentId: "assessment",
+export const notificationsJob: Job = {
+ id: "notifications",
+ label: "Notifications",
+ renderComponentId: "notifications",
frequency: { type: "expiry", afterMs: 15 * 60 * 1000 },
run: async (ctx) => {
- const progress = (await ctx.getProgress()) ?? {
+ const progress = (await ctx.getProgress()) ?? {
lastTs: 0,
};
@@ -123,14 +122,14 @@ export const assessmentsJob: Job = {
try {
notifications = await fetchNotifications();
} catch (e) {
- console.error("[Assessments job] fetch failed:", e);
+ console.error("[Notifications job] fetch failed:", e);
return [];
}
const notificationIsIndexed = async (id: string): Promise => {
const [inAssessments, inMessages] = await Promise.all([
ctx
- .getStoredItems("assessments")
+ .getStoredItems("notifications")
.then((items) => items.some((i) => i.id === id)),
ctx
.getStoredItems("messages")
diff --git a/src/seqta/utils/listeners/StorageChanges.ts b/src/seqta/utils/listeners/StorageChanges.ts
index a7bd8f76..cf363b42 100644
--- a/src/seqta/utils/listeners/StorageChanges.ts
+++ b/src/seqta/utils/listeners/StorageChanges.ts
@@ -70,14 +70,13 @@ export class StorageChangeHandler {
oldValue: { enabled: boolean; name: string }[],
) {
const addedShortcuts = newValue.filter((newItem: any) => {
- const isAdded = oldValue.some((oldItem: any) => {
- const match = oldItem.name === newItem.name;
- const wasDisabled = !oldItem.enabled;
- const isEnabled = newItem.enabled;
- return match && wasDisabled && isEnabled;
+ const wasDisabledAndNowEnabled = oldValue.some((oldItem: any) => {
+ return oldItem.name === newItem.name && !oldItem.enabled && newItem.enabled;
});
- return isAdded;
+ const isNewShortcut = !oldValue.some((oldItem: any) => oldItem.name === newItem.name);
+
+ return (wasDisabledAndNowEnabled || isNewShortcut) && newItem.enabled;
});
const removedShortcuts = newValue.filter((newItem: any) => {