diff --git a/.DS_Store b/.DS_Store index e390b1b..dc31f0f 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/api/src/main.ts b/api/src/main.ts index d3968c6..a83aba6 100644 --- a/api/src/main.ts +++ b/api/src/main.ts @@ -10,15 +10,15 @@ async function bootstrap() { const app = await NestFactory.create(AppModule); app.enableCors({ - origin: 'http://localhost:8080', // Allow requests from your frontend's origin + origin: 'http://localhost:8080', methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', - credentials: true, // If you need to send cookies or authorization headers + credentials: true, }); app.setGlobalPrefix('api'); app.useGlobalFilters(new HttpExceptionFilter()); app.use( session({ - secret: 'blah', + secret: process.env.SESSION_SECRET, resave: false, saveUninitialized: false }) diff --git a/api/src/pilot/pilot.interceptor.ts b/api/src/pilot/pilot.interceptor.ts index e742aad..8739095 100644 --- a/api/src/pilot/pilot.interceptor.ts +++ b/api/src/pilot/pilot.interceptor.ts @@ -31,7 +31,6 @@ export class PilotInterceptor implements NestInterceptor { const token = authHeader && authHeader.split(' ')[1]; const jwtPayload = jwtDecode(token); - console.log(jwtPayload) const rolesKeyName = Object.keys(jwtPayload).find((key) => key.includes('roles')); if (jwtPayload[rolesKeyName].includes('Flying.Read')) { diff --git a/client/src/components/alert/Alert.tsx b/client/src/components/alert/Alert.tsx new file mode 100644 index 0000000..3404447 --- /dev/null +++ b/client/src/components/alert/Alert.tsx @@ -0,0 +1,44 @@ +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { AlertProps } from "./AlertProps.interface"; +import { faCircleCheck, faCircleInfo, faCircleXmark, faTriangleExclamation, faXmark } from "@fortawesome/free-solid-svg-icons"; + +const Alert = ({ + children, + className, + closeIcon, + severity, + onClose, + ...rest +}: AlertProps) => { + const severityVariants = { + info: 'alert-info', + error: 'alert-error', + success: 'alert-success', + warning: 'alert-warning' + }; + + return ( + <> +
+ + {severity === 'info' && } + {severity === 'error' && } + {severity === 'success' && ( + + )} + {severity === 'warning' && ( + + )} + + {children} + {closeIcon && } +
+ + ); +}; + +export default Alert; \ No newline at end of file diff --git a/client/src/components/alert/AlertProps.interface.ts b/client/src/components/alert/AlertProps.interface.ts new file mode 100644 index 0000000..4ea37ae --- /dev/null +++ b/client/src/components/alert/AlertProps.interface.ts @@ -0,0 +1,7 @@ +export interface AlertProps { + children?: React.ReactNode; + className?: string; + closeIcon?: React.ReactNode; + onClose?: () => void; + severity: 'info' | 'error' | 'success' | 'warning'; +} \ No newline at end of file diff --git a/client/src/components/logForm/LogForm.tsx b/client/src/components/logForm/LogForm.tsx index 2cd3093..1ab9f18 100644 --- a/client/src/components/logForm/LogForm.tsx +++ b/client/src/components/logForm/LogForm.tsx @@ -1,5 +1,5 @@ -import React, { useEffect, useReducer } from 'react'; -import { useForm, Controller, FormProvider, useFormContext } from 'react-hook-form'; +import { useEffect, useReducer } from 'react'; +import { useForm, Controller, useFormContext } from 'react-hook-form'; import { LogFormProps } from './LogFormProps.interface'; import { initialState, reducer } from './reducer'; import { AxiosError, AxiosResponse } from 'axios'; @@ -71,15 +71,13 @@ const LogForm = () => { { + render={({ field: { onChange, value } }) => { return ( - - + {logbookContext.state.formMode === FormMode.ADD && +
+ +
+ } {state.isConfirmDialogOpen && ( { break; } - case width >= 640: { + case width >= 640 && width < 1024: { size = ScreenSize.MD; break; } - case width >= 1024: { + case width >= 1024 && width < 1280: { size = ScreenSize.LG break; } - case width >= 1280: { + case width >= 1280 && width < 1536: { size = ScreenSize.XL; break;