diff --git a/frontend/.env.development b/frontend/.env.development index 4083d677..7b6f3434 100644 --- a/frontend/.env.development +++ b/frontend/.env.development @@ -1,4 +1,6 @@ # Please put appropriate value VITE_BASE_URL=http://localhost:5173 VITE_API_HOST=http://127.0.0.1:7091 -VITE_API_STREAMING=true \ No newline at end of file +VITE_API_STREAMING=true +VITE_NOTIFICATION_TEXT="What's new in 0.14.0 — Changelog" +VITE_NOTIFICATION_LINK="#" \ No newline at end of file diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 0a8c22f1..0c3384d1 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -15,6 +15,7 @@ import useTokenAuth from './hooks/useTokenAuth'; import Navigation from './Navigation'; import PageNotFound from './PageNotFound'; import Setting from './settings'; +import Notification from './components/Notification'; function AuthWrapper({ children }: { children: React.ReactNode }) { const { isAuthLoading } = useTokenAuth(); @@ -52,11 +53,27 @@ function MainLayout() { } export default function App() { const [, , componentMounted] = useDarkTheme(); + const [showNotification, setShowNotification] = useState(() => { + const saved = localStorage.getItem('showNotification'); + return saved ? JSON.parse(saved) : true; + }); + const notificationText = import.meta.env.VITE_NOTIFICATION_TEXT; + const notificationLink = import.meta.env.VITE_NOTIFICATION_LINK; if (!componentMounted) { return
; } return (
+ {notificationLink && notificationText && showNotification && ( + { + setShowNotification(false); + localStorage.setItem('showNotification', 'false'); + }} + /> + )} + + diff --git a/frontend/src/assets/notification-bg.jpg b/frontend/src/assets/notification-bg.jpg new file mode 100644 index 00000000..6e0a5d0f Binary files /dev/null and b/frontend/src/assets/notification-bg.jpg differ diff --git a/frontend/src/components/Notification.tsx b/frontend/src/components/Notification.tsx new file mode 100644 index 00000000..7bd48158 --- /dev/null +++ b/frontend/src/components/Notification.tsx @@ -0,0 +1,45 @@ +import close from '../assets/cross.svg'; +import rightArrow from '../assets/arrow-full-right.svg'; +import bg from '../assets/notification-bg.jpg'; + +interface NotificationProps { + notificationText: string; + notificationLink: string; + handleCloseNotification: () => void; +} + +export default function Notification({ + notificationText, + notificationLink, + handleCloseNotification, +}: NotificationProps) { + return ( + +

+ {notificationText} +

+ + + + + +
+ ); +} diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index d7b59a4e..312b92c9 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -202,6 +202,7 @@ export default function Conversation() { queries[queries.length - 1].response && setLastQueryReturnedErr(false); } }, [queries[queries.length - 1]]); + return (