mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-17 18:35:19 +02:00
refactor: made announcements time-bound and added audiences
- Added startTime and endTime properties to announcements for time-bound visibility. - Introduced audience targeting to control who sees announcements (all, users, web_visitors). - Updated related components and hooks to support new announcement features. - Removed unused state tracking for dismissed announcements to streamline functionality.
This commit is contained in:
parent
2c68e4ad69
commit
f777142017
7 changed files with 211 additions and 263 deletions
|
|
@ -4,12 +4,17 @@
|
|||
* Frontend-only announcement system that supports:
|
||||
* - Multiple announcement categories (update, feature, maintenance, info)
|
||||
* - Important flag for toast notifications
|
||||
* - Read/dismissed state tracking via localStorage
|
||||
* - Time-bound visibility (start/end times)
|
||||
* - Audience targeting (all, users, web_visitors)
|
||||
* - Read state tracking via localStorage
|
||||
*/
|
||||
|
||||
/** Announcement category */
|
||||
export type AnnouncementCategory = "update" | "feature" | "maintenance" | "info";
|
||||
|
||||
/** Who should see the announcement */
|
||||
export type AnnouncementAudience = "all" | "users" | "web_visitors";
|
||||
|
||||
/** Single announcement entry */
|
||||
export interface Announcement {
|
||||
/** Unique identifier */
|
||||
|
|
@ -22,6 +27,12 @@ export interface Announcement {
|
|||
category: AnnouncementCategory;
|
||||
/** ISO date string of when the announcement was published */
|
||||
date: string;
|
||||
/** ISO datetime — announcement becomes visible at this time */
|
||||
startTime: string;
|
||||
/** ISO datetime — announcement expires and is hidden after this time */
|
||||
endTime: string;
|
||||
/** Who should see this announcement */
|
||||
audience: AnnouncementAudience;
|
||||
/** If true, the user will see a toast notification for this announcement */
|
||||
isImportant: boolean;
|
||||
/** Optional CTA link */
|
||||
|
|
@ -37,6 +48,4 @@ export interface AnnouncementUserState {
|
|||
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