mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-03 21:02:40 +02:00
feat(chat): add userId to premium alert handling and improve alert visibility in UI
This commit is contained in:
parent
901de33684
commit
e6db050dfd
4 changed files with 21 additions and 6 deletions
|
|
@ -14,13 +14,25 @@ export const setPremiumAlertForThreadAtom = atom(
|
|||
payload: {
|
||||
threadId: number;
|
||||
message: string;
|
||||
userId?: string | null;
|
||||
}
|
||||
) => {
|
||||
const storageKey = `surfsense-premium-alert-seen-v1:${payload.userId ?? "anonymous"}`;
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
const hasSeen = localStorage.getItem(storageKey) === "true";
|
||||
if (hasSeen) return;
|
||||
}
|
||||
|
||||
const current = get(premiumAlertByThreadAtom);
|
||||
set(premiumAlertByThreadAtom, {
|
||||
...current,
|
||||
[payload.threadId]: { message: payload.message },
|
||||
});
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
localStorage.setItem(storageKey, "true");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue