First commit
This commit is contained in:
14
client/src/components/logbook/Logbook.tsx
Normal file
14
client/src/components/logbook/Logbook.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import SiteNav from '../siteNav/SiteNav';
|
||||
|
||||
const Logbook: React.FC<unknown> = () => {
|
||||
return (
|
||||
<div>
|
||||
<SiteNav />
|
||||
<div>
|
||||
Logbook goes here
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Logbook;
|
||||
138
client/src/components/logbookEntryForm/LogbookEntryForm.tsx
Normal file
138
client/src/components/logbookEntryForm/LogbookEntryForm.tsx
Normal file
@@ -0,0 +1,138 @@
|
||||
import React from 'react';
|
||||
import { Accordion, AccordionItem, Button, DatePicker, Input } from '@nextui-org/react';
|
||||
import { useForm, Controller, SubmitHandler } from 'react-hook-form';
|
||||
|
||||
const LogbookEntryForm: React.FC<unknown> = () => {
|
||||
const { control, handleSubmit } = useForm();
|
||||
|
||||
const onSubmit = (data: unknown) => {
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
return (
|
||||
<form className='m-10' onSubmit={handleSubmit(onSubmit)}>
|
||||
<div className='grid grid-cols-2 gap-4'>
|
||||
<div className='self-center'>
|
||||
<label>Date</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='date'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<DatePicker
|
||||
labelPlacement='outside-left'
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className='self-center'>
|
||||
<label>Aircraft Type</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='aircraftType'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input
|
||||
fullWidth={true}
|
||||
labelPlacement='outside-left'
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className='self-center'>
|
||||
<label>Aircraft Identity</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='aircraftIdent'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input
|
||||
fullWidth={true}
|
||||
labelPlacement='outside-left'
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className='self-center'>
|
||||
<label>Route To</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='routeTo'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input />
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className='self-center'>
|
||||
<label>Route From</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='routeFrom'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input />
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className='self-center'>
|
||||
<label>Duration of Flight</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='flightDuration'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input />
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className='self-center'>
|
||||
<label>Single Engine Land</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='aircraftSEL'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input />
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className='col-span-2'>
|
||||
<Accordion>
|
||||
<AccordionItem title='Aircraft Category and Class'>
|
||||
<div className='self-center'>
|
||||
<label>Single Engine Land</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='aircraftSEL'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input />
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</div>
|
||||
<div className='col-span-2 justify-self-end'>
|
||||
<Button color='default'>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button className='ml-10' color='primary'>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
|
||||
export default LogbookEntryForm;
|
||||
83
client/src/components/pilotForm/PilotForm.tsx
Normal file
83
client/src/components/pilotForm/PilotForm.tsx
Normal file
@@ -0,0 +1,83 @@
|
||||
import { Accordion, AccordionItem, Button, DatePicker, Input, Select, SelectItem } from '@nextui-org/react';
|
||||
import { useForm, Controller, SubmitHandler } from 'react-hook-form';
|
||||
|
||||
const PilotForm: React.FC<unknown> = () => {
|
||||
const { control, handleSubmit } = useForm();
|
||||
|
||||
const onSubmit = (data: unknown) => {
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
return (
|
||||
<form className='m-10' onSubmit={handleSubmit(onSubmit)}>
|
||||
<div className='grid grid-cols-2 gap-4'>
|
||||
<div className='self-center'>
|
||||
<label>First Name</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='firstName'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input />
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className='self-center'>
|
||||
<label>Last Name</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='lastName'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input />
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<Accordion>
|
||||
<AccordionItem title='Medical Certificate'>
|
||||
<div className='grid grid-cols-2 gap-4'>
|
||||
<div className='self-center'>
|
||||
<label>Class</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='medicalClass'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Select>
|
||||
<SelectItem key='first' value='First'>
|
||||
First
|
||||
</SelectItem>
|
||||
<SelectItem key='second' value='Second'>
|
||||
Second
|
||||
</SelectItem>
|
||||
<SelectItem key='Third' value='Third'>
|
||||
Third
|
||||
</SelectItem>
|
||||
</Select>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className='self-center'>
|
||||
<label>Expires</label>
|
||||
</div>
|
||||
<div>
|
||||
<Controller
|
||||
name='medicalExpiration'
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<DatePicker />
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
|
||||
export default PilotForm;
|
||||
15
client/src/components/pilots/Pilots.tsx
Normal file
15
client/src/components/pilots/Pilots.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import SiteNav from '../siteNav/SiteNav';
|
||||
import PilotForm from '../pilotForm/PilotForm';
|
||||
|
||||
const Pilots: React.FC<unknown> = () => {
|
||||
return (
|
||||
<div>
|
||||
<SiteNav />
|
||||
<div>
|
||||
<PilotForm />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Pilots;
|
||||
53
client/src/components/siteNav/SiteNav.tsx
Normal file
53
client/src/components/siteNav/SiteNav.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
import { Avatar, Link, Navbar, NavbarBrand, NavbarContent, NavbarItem, Button } from '@nextui-org/react';
|
||||
import { Link as ReactRouterLink } from 'react-router-dom';
|
||||
import { useIsAuthenticated, useMsal } from '@azure/msal-react';
|
||||
|
||||
const SiteNav: React.FC<unknown> = () => {
|
||||
const isAuthenticated = useIsAuthenticated();
|
||||
const { accounts, instance } = useMsal();
|
||||
const initializeLogin = () => {
|
||||
instance.loginRedirect();
|
||||
}
|
||||
|
||||
console.log(accounts)
|
||||
|
||||
return (
|
||||
<Navbar isBordered>
|
||||
<NavbarBrand>
|
||||
Site Logo Goes Here
|
||||
</NavbarBrand>
|
||||
<NavbarContent justify='center'>
|
||||
<NavbarItem>
|
||||
<Link>
|
||||
<ReactRouterLink to='/'>Flights</ReactRouterLink>
|
||||
</Link>
|
||||
</NavbarItem>
|
||||
<NavbarItem>
|
||||
<Link>
|
||||
<ReactRouterLink to='/logbook'>Logbook</ReactRouterLink>
|
||||
</Link>
|
||||
</NavbarItem>
|
||||
<NavbarItem>
|
||||
<Link>
|
||||
<ReactRouterLink to='/checklists'>Checklists</ReactRouterLink>
|
||||
</Link>
|
||||
</NavbarItem>
|
||||
<NavbarItem>
|
||||
<Link>
|
||||
<ReactRouterLink to='/pilots'>Pilots</ReactRouterLink>
|
||||
</Link>
|
||||
</NavbarItem>
|
||||
</NavbarContent>
|
||||
<NavbarContent justify='end'>
|
||||
{!isAuthenticated &&
|
||||
<Button as={Link} color='primary' href='#' onClick={initializeLogin}>Login</Button>
|
||||
}
|
||||
{isAuthenticated &&
|
||||
<Avatar name={accounts[0]?.username} />
|
||||
}
|
||||
</NavbarContent>
|
||||
</Navbar>
|
||||
)
|
||||
}
|
||||
|
||||
export default SiteNav;
|
||||
Reference in New Issue
Block a user