mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-04 21:32:39 +02:00
feat: added announcements
This commit is contained in:
parent
0e96e4492b
commit
e9979dfa7d
11 changed files with 833 additions and 3 deletions
42
surfsense_web/contracts/types/announcement.types.ts
Normal file
42
surfsense_web/contracts/types/announcement.types.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* Announcement system types
|
||||
*
|
||||
* Frontend-only announcement system that supports:
|
||||
* - Multiple announcement categories (update, feature, maintenance, info)
|
||||
* - Important flag for toast notifications
|
||||
* - Read/dismissed state tracking via localStorage
|
||||
*/
|
||||
|
||||
/** Announcement category */
|
||||
export type AnnouncementCategory = "update" | "feature" | "maintenance" | "info";
|
||||
|
||||
/** Single announcement entry */
|
||||
export interface Announcement {
|
||||
/** Unique identifier */
|
||||
id: string;
|
||||
/** Short title */
|
||||
title: string;
|
||||
/** Full description (supports basic text) */
|
||||
description: string;
|
||||
/** Category for visual styling and filtering */
|
||||
category: AnnouncementCategory;
|
||||
/** ISO date string of when the announcement was published */
|
||||
date: string;
|
||||
/** If true, the user will see a toast notification for this announcement */
|
||||
isImportant: boolean;
|
||||
/** Optional CTA link */
|
||||
link?: {
|
||||
label: string;
|
||||
url: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** State stored in localStorage for tracking user interactions */
|
||||
export interface AnnouncementUserState {
|
||||
/** IDs of announcements the user has read (clicked/viewed) */
|
||||
readIds: string[];
|
||||
/** IDs of important announcements already shown as toasts */
|
||||
toastedIds: string[];
|
||||
/** IDs of announcements the user has explicitly dismissed */
|
||||
dismissedIds: string[];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue