From 881b351410814105946fb4ba57a0740fdb92506a Mon Sep 17 00:00:00 2001 From: Noah Spannbauer Date: Sun, 8 Mar 2026 14:51:07 -0500 Subject: [PATCH] adding not signed in alerts to flights and logs --- api/package.json | 2 +- client/package.json | 2 +- client/src/components/flights/Flights.tsx | 9 ++++++++- client/src/components/logbook/Logbook.tsx | 4 +++- package.json | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/api/package.json b/api/package.json index eea3ce4..596fe1b 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "api", - "version": "2.0.0-beta-4", + "version": "2.0.0", "description": "", "author": "", "private": true, diff --git a/client/package.json b/client/package.json index bb88e90..147868c 100644 --- a/client/package.json +++ b/client/package.json @@ -1,7 +1,7 @@ { "name": "client", "private": true, - "version": "2.0.0-beta-4", + "version": "2.0.0", "type": "module", "scripts": { "dev": "vite", diff --git a/client/src/components/flights/Flights.tsx b/client/src/components/flights/Flights.tsx index cf559e0..1727f25 100644 --- a/client/src/components/flights/Flights.tsx +++ b/client/src/components/flights/Flights.tsx @@ -3,11 +3,13 @@ import { useEffect, useReducer } from "react"; import { useLogs } from "../../hooks/logs/UseLogs"; import { LogbookEntry } from "../logbook/LogbookEntry.interface"; import { initialState, reducer } from "./reducer"; +import { useOidc } from "../../auth/oidcConfig"; import Alert from "../alert/Alert"; const Flights = () => { const [state, dispatch] = useReducer(reducer, initialState); const { logs, logsLoading } = useLogs(); + const { isUserLoggedIn } = useOidc(); useEffect(() => { @@ -19,7 +21,12 @@ const Flights = () => { if (flights && flights.length > 0) { dispatch({ type: 'SET_FLIGHTS', payload: flights}) - dispatch({ type: 'SET_ALERT', payload: undefined }) + + if (!isUserLoggedIn && flights.length >= 5) { + dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'A limited number of flights displayed. Sign in to view all flights.'}}) + } else { + dispatch({ type: 'SET_ALERT', payload: undefined }) + } } else { dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'No flights found' }}) } diff --git a/client/src/components/logbook/Logbook.tsx b/client/src/components/logbook/Logbook.tsx index c2957e4..79a9c85 100644 --- a/client/src/components/logbook/Logbook.tsx +++ b/client/src/components/logbook/Logbook.tsx @@ -377,7 +377,9 @@ const Logbook: React.FC = () => { setColumnVisibility(columnVisibility) dispatch({ type: 'SET_ENTRIES', payload: entries }); - if (state.alert) { + if (!isUserLoggedIn && response.data.length >= 5) { + dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'A limited number of log entries displayed. Sign in to view all log entries.'}}) + } else { dispatch({ type: 'SET_ALERT', payload: undefined}) } } else { diff --git a/package.json b/package.json index d0a0f29..de688dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@noahspan/flying", - "version": "2.0.0-beta-4", + "version": "2.0.0", "scripts": { "start": "node api/dist/main", "format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"",