feat: update job title

This commit is contained in:
SethBurkart123
2025-05-07 20:28:39 +10:00
parent 79ed998edf
commit 87bf526dc6
3 changed files with 11 additions and 12 deletions
+1 -1
View File
@@ -50,6 +50,6 @@
}
.dark .switch[data-ison="true"] {
@apply from-[#30D259]/50 to-[#30D259];
@apply from-[#30D259]/40 to-[#30D259];
}
</style>
@@ -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<string, Job> = {
messages: messagesJob,
assessments: assessmentsJob,
notifications: notificationsJob,
forums: forumsJob,
};
@@ -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<AssessmentsProgress>()) ?? {
const progress = (await ctx.getProgress<NotificationsProgress>()) ?? {
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<boolean> => {
const [inAssessments, inMessages] = await Promise.all([
ctx
.getStoredItems("assessments")
.getStoredItems("notifications")
.then((items) => items.some((i) => i.id === id)),
ctx
.getStoredItems("messages")