adding not signed in alerts to flights and logs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "api",
|
||||
"version": "2.0.0-beta-4",
|
||||
"version": "2.0.0",
|
||||
"description": "",
|
||||
"author": "",
|
||||
"private": true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "client",
|
||||
"private": true,
|
||||
"version": "2.0.0-beta-4",
|
||||
"version": "2.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -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})
|
||||
|
||||
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' }})
|
||||
}
|
||||
|
||||
@@ -377,7 +377,9 @@ const Logbook: React.FC<unknown> = () => {
|
||||
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 {
|
||||
|
||||
@@ -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\"",
|
||||
|
||||
Reference in New Issue
Block a user