mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-18 11:51:41 +03:00
0cc917ea9e
Issue: https://github.com/StanGirard/quivr/issues/1884 - Add new sidebar (Menu) - Add Menu to App level (shared accross all pages) and display it only on chat bar - Remove chatlist from sidebar (they are now accessible through Actions bar (plus button on right of chat input) - Move notification banner to App.tsx - Update translations Demo: https://github.com/StanGirard/quivr/assets/63923024/53b1bf3b-db1a-49d7-ae84-80423d66ec03
34 lines
849 B
TypeScript
34 lines
849 B
TypeScript
const notificationsLocalStorageKey = "homepage-notifications";
|
|
|
|
type LocalStorageNotification = {
|
|
isDismissed: boolean;
|
|
id: string;
|
|
};
|
|
|
|
export const getNotificationFromLocalStorage = ():
|
|
| LocalStorageNotification
|
|
| undefined => {
|
|
const notifications = localStorage.getItem(notificationsLocalStorageKey);
|
|
|
|
if (notifications !== null) {
|
|
return JSON.parse(notifications) as LocalStorageNotification;
|
|
}
|
|
|
|
return undefined;
|
|
};
|
|
|
|
export const setNotificationAsDismissedInLocalStorage = (id: string): void => {
|
|
const notificationPayload: LocalStorageNotification = {
|
|
isDismissed: true,
|
|
id,
|
|
};
|
|
localStorage.setItem(
|
|
notificationsLocalStorageKey,
|
|
JSON.stringify(notificationPayload)
|
|
);
|
|
};
|
|
|
|
export const clearLocalStorageNotificationBanner = (): void => {
|
|
localStorage.removeItem(notificationsLocalStorageKey);
|
|
};
|