From adb8e51adfd2eec74b44894401ac49dfced436a3 Mon Sep 17 00:00:00 2001 From: noahspannbauer Date: Tue, 18 Mar 2025 09:56:24 -0500 Subject: [PATCH] limiting pilot data for unauthenticated users (#68) * limiting pilot data for unauthenticated users * limiting pilot data for unauthenticated users --- api/package.json | 2 +- .../pilot/interceptors/pilot.interceptor.ts | 4 +- app/package.json | 2 +- app/src/App.tsx | 6 +- app/src/components/pilotCard/PilotCard.tsx | 29 ++ .../pilotCard/PilotCardProps.interface.ts | 8 + app/src/components/pilotForm/PilotForm.tsx | 336 +++++++++--------- .../PilotFormCertificates.tsx | 14 +- .../PilotFormCertificatesProps.interface.ts | 3 + .../PilotFormEndorsements.tsx | 10 +- .../PilotFormEndorsementsProps.interface.ts | 3 + .../pilotFormMedical/PilotFormMedical.tsx | 13 +- app/src/components/pilots/Pilots.tsx | 27 +- app/src/components/siteNav/SiteNav.tsx | 11 +- package.json | 2 +- 15 files changed, 264 insertions(+), 206 deletions(-) create mode 100644 app/src/components/pilotCard/PilotCard.tsx create mode 100644 app/src/components/pilotCard/PilotCardProps.interface.ts diff --git a/api/package.json b/api/package.json index 8e7c6b4..4c40a6a 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "api", - "version": "1.1.0", + "version": "1.2.0", "description": "", "author": "", "private": true, diff --git a/api/src/pilot/interceptors/pilot.interceptor.ts b/api/src/pilot/interceptors/pilot.interceptor.ts index 1167182..6089ccb 100644 --- a/api/src/pilot/interceptors/pilot.interceptor.ts +++ b/api/src/pilot/interceptors/pilot.interceptor.ts @@ -16,7 +16,9 @@ export class PilotInterceptor implements NestInterceptor { partitionKey: pilot.partitionKey, rowKey: pilot.rowKey, id: pilot.id, - name: pilot.name + name: pilot.name, + certificates: pilot.certificates, + endorsements: pilot.endorsements }; }); diff --git a/app/package.json b/app/package.json index 4a56710..c1306b6 100644 --- a/app/package.json +++ b/app/package.json @@ -1,7 +1,7 @@ { "name": "app", "private": true, - "version": "1.1.0", + "version": "1.2.0", "type": "module", "scripts": { "dev": "vite", diff --git a/app/src/App.tsx b/app/src/App.tsx index bfb41c6..d9607ea 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -19,11 +19,7 @@ const App = () => { <> - - - - } /> + } /> } /> diff --git a/app/src/components/pilotCard/PilotCard.tsx b/app/src/components/pilotCard/PilotCard.tsx new file mode 100644 index 0000000..afa4b84 --- /dev/null +++ b/app/src/components/pilotCard/PilotCard.tsx @@ -0,0 +1,29 @@ +import { Card, CardContent, CardHeader, Grid, Typography } from "@noahspan/noahspan-components" +import { PilotCardProps } from "./PilotCardProps.interface" +import ActionMenu from "../actionMenu/ActionMenu" + +const PilotCard = ({ pilots, onDelete, onOpenCloseForm }: PilotCardProps) => { + return ( + + {pilots.map((pilot) => { + return ( + + + } + title={pilot.name} + slotProps={{ + title: { + fontSize: '24px', + } + }} + /> + + + ) + })} + + ) +} + +export default PilotCard; \ No newline at end of file diff --git a/app/src/components/pilotCard/PilotCardProps.interface.ts b/app/src/components/pilotCard/PilotCardProps.interface.ts new file mode 100644 index 0000000..3023b17 --- /dev/null +++ b/app/src/components/pilotCard/PilotCardProps.interface.ts @@ -0,0 +1,8 @@ +import { FormMode } from "../../enums/formMode"; +import { Pilot } from "../pilots/Pilot.interface"; + +export interface PilotCardProps { + pilots: Pilot[]; + onDelete: (entryId: string) => void; + onOpenCloseForm: (formMode: FormMode, id: string) => void; +} \ No newline at end of file diff --git a/app/src/components/pilotForm/PilotForm.tsx b/app/src/components/pilotForm/PilotForm.tsx index fb19cef..3b40466 100644 --- a/app/src/components/pilotForm/PilotForm.tsx +++ b/app/src/components/pilotForm/PilotForm.tsx @@ -1,19 +1,18 @@ import { useEffect, useState } from 'react'; import { useForm, Controller, FormProvider } from 'react-hook-form'; import { - Accordion, Button, - DatePicker, Drawer, Grid, Icon, IconButton, IconName, PeoplePicker, - Select, StateSelect, TextField, - Typography + theme, + Typography, + useMediaQuery } from '@noahspan/noahspan-components'; import { IPilotFormProps } from './IPilotFormProps'; import { AxiosError, AxiosInstance, AxiosResponse } from 'axios'; @@ -64,6 +63,7 @@ const PilotForm: React.FC = ({ }); const [isDisabled, setIsDisabled] = useState(false); const [isError, setIsError] = useState(false); + const isMedium = useMediaQuery(theme.breakpoints.up('md')); const onPeoplePickerSearch = async ( _event: React.SyntheticEvent, @@ -193,7 +193,7 @@ const PilotForm: React.FC = ({ PaperProps={{ sx: { padding: '30px', - width: '33%' + width: isMedium ? '33%' : '75%' } }} > @@ -208,10 +208,10 @@ const PilotForm: React.FC = ({ - + Name * - + = ({ value={selectedPerson} /> - - Address * - - - ( - + + Address * + + + ( + + )} /> - )} - /> - - - City * - - - ( - + + City * + + + ( + + )} /> - )} - /> - - - State * - - - ( - + + State * + + + ( + + )} /> - )} - /> - - - Postal Code * - - - ( - + + Postal Code * + + + ( + + )} /> - )} - /> - - - Email - - - ( - + + Email + + + ( + + )} /> - )} - /> - - - Phone Number - - - ( - + + Phone Number + + + ( + + )} /> - )} - /> + + + } + {isAuthenticated && + + + + } + + - - - - - - - +