adding not signed in alerts to flights and logs

This commit is contained in:
2026-03-08 14:51:07 -05:00
parent 6700c83692
commit 881b351410
5 changed files with 14 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "api", "name": "api",
"version": "2.0.0-beta-4", "version": "2.0.0",
"description": "", "description": "",
"author": "", "author": "",
"private": true, "private": true,

View File

@@ -1,7 +1,7 @@
{ {
"name": "client", "name": "client",
"private": true, "private": true,
"version": "2.0.0-beta-4", "version": "2.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -3,11 +3,13 @@ import { useEffect, useReducer } from "react";
import { useLogs } from "../../hooks/logs/UseLogs"; import { useLogs } from "../../hooks/logs/UseLogs";
import { LogbookEntry } from "../logbook/LogbookEntry.interface"; import { LogbookEntry } from "../logbook/LogbookEntry.interface";
import { initialState, reducer } from "./reducer"; import { initialState, reducer } from "./reducer";
import { useOidc } from "../../auth/oidcConfig";
import Alert from "../alert/Alert"; import Alert from "../alert/Alert";
const Flights = () => { const Flights = () => {
const [state, dispatch] = useReducer(reducer, initialState); const [state, dispatch] = useReducer(reducer, initialState);
const { logs, logsLoading } = useLogs(); const { logs, logsLoading } = useLogs();
const { isUserLoggedIn } = useOidc();
useEffect(() => { useEffect(() => {
@@ -19,7 +21,12 @@ const Flights = () => {
if (flights && flights.length > 0) { if (flights && flights.length > 0) {
dispatch({ type: 'SET_FLIGHTS', payload: flights}) 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 { } else {
dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'No flights found' }}) dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'No flights found' }})
} }

View File

@@ -377,7 +377,9 @@ const Logbook: React.FC<unknown> = () => {
setColumnVisibility(columnVisibility) setColumnVisibility(columnVisibility)
dispatch({ type: 'SET_ENTRIES', payload: entries }); 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}) dispatch({ type: 'SET_ALERT', payload: undefined})
} }
} else { } else {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@noahspan/flying", "name": "@noahspan/flying",
"version": "2.0.0-beta-4", "version": "2.0.0",
"scripts": { "scripts": {
"start": "node api/dist/main", "start": "node api/dist/main",
"format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"", "format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"",