making logbook responsive
This commit is contained in:
@@ -15,6 +15,7 @@ export class LogInterceptor implements NestInterceptor {
|
|||||||
return {
|
return {
|
||||||
partitionKey: log.partitionKey,
|
partitionKey: log.partitionKey,
|
||||||
rowKey: log.rowKey,
|
rowKey: log.rowKey,
|
||||||
|
id: log.id,
|
||||||
pilotId: log.pilotId,
|
pilotId: log.pilotId,
|
||||||
pilotName: log.pilotName,
|
pilotName: log.pilotName,
|
||||||
date: log.date,
|
date: log.date,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/msal-browser": "^4.0.1",
|
"@azure/msal-browser": "^4.0.1",
|
||||||
"@azure/msal-react": "^3.0.1",
|
"@azure/msal-react": "^3.0.1",
|
||||||
"@noahspan/noahspan-components": "^1.4.0",
|
"@noahspan/noahspan-components": "^1.5.1",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ export interface ILogbookEntry {
|
|||||||
rowKey: string;
|
rowKey: string;
|
||||||
id: string;
|
id: string;
|
||||||
pilotId: string;
|
pilotId: string;
|
||||||
|
pilotName: string;
|
||||||
date: string;
|
date: string;
|
||||||
aircraftMakeModel: string;
|
aircraftMakeModel: string;
|
||||||
aircraftIdentity: string;
|
aircraftIdentity: string;
|
||||||
@@ -24,4 +25,5 @@ export interface ILogbookEntry {
|
|||||||
night: number | null;
|
night: number | null;
|
||||||
solo: number | null;
|
solo: number | null;
|
||||||
pilotInCommand: number | null;
|
pilotInCommand: number | null;
|
||||||
|
notes: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ import {
|
|||||||
IconName,
|
IconName,
|
||||||
Spinner,
|
Spinner,
|
||||||
Table,
|
Table,
|
||||||
Typography
|
theme,
|
||||||
|
Typography,
|
||||||
|
useMediaQuery
|
||||||
} from '@noahspan/noahspan-components';
|
} from '@noahspan/noahspan-components';
|
||||||
import { initialState, reducer } from './reducer';
|
import { initialState, reducer } from './reducer';
|
||||||
import { useHttpClient } from '../../hooks/httpClient/UseHttpClient';
|
import { useHttpClient } from '../../hooks/httpClient/UseHttpClient';
|
||||||
@@ -21,12 +23,14 @@ import { FormMode } from '../../enums/formMode';
|
|||||||
import ActionMenu from '../actionMenu/ActionMenu';
|
import ActionMenu from '../actionMenu/ActionMenu';
|
||||||
import ConfirmationDialog from '../confirmationDialog/ConfirmationDialog';
|
import ConfirmationDialog from '../confirmationDialog/ConfirmationDialog';
|
||||||
import { ILogbookEntry } from './ILogbookEntry';
|
import { ILogbookEntry } from './ILogbookEntry';
|
||||||
|
import LogbookCard from '../logbookCard/LogbookCard';
|
||||||
|
|
||||||
const Logbook: React.FC<unknown> = () => {
|
const Logbook: React.FC<unknown> = () => {
|
||||||
const [state, dispatch] = useReducer(reducer, initialState);
|
const [state, dispatch] = useReducer(reducer, initialState);
|
||||||
const httpClient: AxiosInstance = useHttpClient();
|
const httpClient: AxiosInstance = useHttpClient();
|
||||||
const isAuthenticated = useIsAuthenticated();
|
const isAuthenticated = useIsAuthenticated();
|
||||||
const { getAccessToken } = useAccessToken();
|
const { getAccessToken } = useAccessToken();
|
||||||
|
const isMedium = useMediaQuery(theme.breakpoints.up('md'));
|
||||||
|
|
||||||
const getLogbookEntries = async () => {
|
const getLogbookEntries = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -405,10 +409,10 @@ const Logbook: React.FC<unknown> = () => {
|
|||||||
return (
|
return (
|
||||||
<Box sx={{ margin: '20px' }}>
|
<Box sx={{ margin: '20px' }}>
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
<Grid size={11}>
|
<Grid size={isMedium ? 11 : 6}>
|
||||||
<Typography variant="h4">Logbook</Typography>
|
<Typography variant="h4">Logbook</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid display="flex" justifyContent="right" size={1}>
|
<Grid display="flex" justifyContent="right" size={isMedium ? 1 : 6}>
|
||||||
{isAuthenticated &&
|
{isAuthenticated &&
|
||||||
<Button
|
<Button
|
||||||
onClick={() => onOpenCloseEntryForm(FormMode.ADD)}
|
onClick={() => onOpenCloseEntryForm(FormMode.ADD)}
|
||||||
@@ -435,9 +439,12 @@ const Logbook: React.FC<unknown> = () => {
|
|||||||
)}
|
)}
|
||||||
{!state.isLoading && (
|
{!state.isLoading && (
|
||||||
<Grid size={12}>
|
<Grid size={12}>
|
||||||
{state.entries.length > 0 && (
|
{isMedium && state.entries.length > 0 && (
|
||||||
<Table columns={isAuthenticated ? authColumns : unauthColumns} data={state.entries} />
|
<Table columns={isAuthenticated ? authColumns : unauthColumns} data={state.entries} />
|
||||||
)}
|
)}
|
||||||
|
{!isMedium && state.entries.length > 0 &&
|
||||||
|
<LogbookCard logs={state.entries} onDelete={onDeleteEntry} onOpenCloseForm={onOpenCloseEntryForm} />
|
||||||
|
}
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
{state.isLoading && !state.alert && (
|
{state.isLoading && !state.alert && (
|
||||||
|
|||||||
74
app/src/components/logbookCard/LogbookCard.tsx
Normal file
74
app/src/components/logbookCard/LogbookCard.tsx
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
import { Card, CardContent, CardHeader, Grid, Typography } from "@noahspan/noahspan-components";
|
||||||
|
import { LogbookCardProps } from "./LogbookCardProps.interface";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import ActionMenu from "../actionMenu/ActionMenu";
|
||||||
|
|
||||||
|
|
||||||
|
const LogbookCard = ({ logs, onDelete, onOpenCloseForm }: LogbookCardProps) => {
|
||||||
|
return (
|
||||||
|
<Grid container spacing={2}>
|
||||||
|
{logs.map((log) => {
|
||||||
|
return (
|
||||||
|
<Grid size={12}>
|
||||||
|
<Card key={log.rowKey}>
|
||||||
|
<CardHeader
|
||||||
|
action={<ActionMenu id={log.rowKey} onDelete={onDelete} onOpenCloseForm={onOpenCloseForm} />}
|
||||||
|
subheader={log.pilotName}
|
||||||
|
title={log.date}
|
||||||
|
slotProps={{
|
||||||
|
subheader: {
|
||||||
|
fontSize: '16px'
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
fontSize: '24px',
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<CardContent>
|
||||||
|
<Grid container spacing={1}>
|
||||||
|
<Grid size={12}>
|
||||||
|
<Typography variant="subtitle2">Aircraft Make and Model</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid size={12}>
|
||||||
|
<Typography variant="body1">{log.aircraftMakeModel}</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid size={12}>
|
||||||
|
<Typography variant="subtitle2">Route From</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid size={12}>
|
||||||
|
<Typography variant="body1">{log.routeFrom}</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid size={12}>
|
||||||
|
<Typography variant="subtitle2">Route To</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid size={12}>
|
||||||
|
<Typography variant="body1">{log.routeTo}</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid size={12}>
|
||||||
|
<Typography variant="subtitle2">Duration Of Flight</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid size={12}>
|
||||||
|
<Typography variant="body1">{log.durationOfFlight}</Typography>
|
||||||
|
</Grid>
|
||||||
|
{log.notes &&
|
||||||
|
<>
|
||||||
|
<Grid size={12}>
|
||||||
|
<Typography variant="subtitle2">Notes</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid size={12}>
|
||||||
|
<Typography variant="body1">{log.notes}</Typography>
|
||||||
|
</Grid>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Grid>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LogbookCard;
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { FormMode } from "../../enums/formMode";
|
||||||
|
import { ILogbookEntry } from "../logbook/ILogbookEntry";
|
||||||
|
|
||||||
|
export interface LogbookCardProps {
|
||||||
|
logs: ILogbookEntry[];
|
||||||
|
onDelete: (entryId: string) => void;
|
||||||
|
onOpenCloseForm: (formMode: FormMode, id: string) => void;
|
||||||
|
}
|
||||||
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
@@ -149,8 +149,8 @@ importers:
|
|||||||
specifier: ^3.0.1
|
specifier: ^3.0.1
|
||||||
version: 3.0.1(@azure/msal-browser@4.0.1)(react@18.3.1)
|
version: 3.0.1(@azure/msal-browser@4.0.1)(react@18.3.1)
|
||||||
'@noahspan/noahspan-components':
|
'@noahspan/noahspan-components':
|
||||||
specifier: ^1.4.0
|
specifier: ^1.5.1
|
||||||
version: 1.4.0(@mui/system@6.4.6(@emotion/react@11.14.0(@types/react@18.3.18)(react@18.3.1))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1))(@types/react-dom@18.3.5(@types/react@18.3.18))(@types/react@18.3.18)(less@4.2.2)(moment@2.30.1)(postcss@8.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.3(prettier@3.2.5))(typescript@5.7.3)(webpack@5.97.1(esbuild@0.18.20))
|
version: 1.5.1(@mui/system@6.4.6(@emotion/react@11.14.0(@types/react@18.3.18)(react@18.3.1))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1))(@types/react-dom@18.3.5(@types/react@18.3.18))(@types/react@18.3.18)(less@4.2.2)(moment@2.30.1)(postcss@8.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.3(prettier@3.2.5))(typescript@5.7.3)(webpack@5.97.1(esbuild@0.18.20))
|
||||||
axios:
|
axios:
|
||||||
specifier: ^1.7.2
|
specifier: ^1.7.2
|
||||||
version: 1.7.9
|
version: 1.7.9
|
||||||
@@ -1564,8 +1564,8 @@ packages:
|
|||||||
'@nestjs/common': ^9.0.0 || ^10.0.0
|
'@nestjs/common': ^9.0.0 || ^10.0.0
|
||||||
'@nestjs/core': ^9.0.0 || ^10.0.0
|
'@nestjs/core': ^9.0.0 || ^10.0.0
|
||||||
|
|
||||||
'@noahspan/noahspan-components@1.4.0':
|
'@noahspan/noahspan-components@1.5.1':
|
||||||
resolution: {integrity: sha512-Urq/hHr3KCbmnKO6NhruZQhJnFjiycQ8yReV/JFoxNdlN7WTWGIGEca9MnqNH11WmRK+RtecU4ByehrHqqqK3Q==}
|
resolution: {integrity: sha512-GDowrEyxP/uZ1esrJVXWNKCzmG8s/OHra7JVudBKfQhDzxWE9o+RDqIHhX78YwbMsE1cu4BEvNAM8oa6jTaAuQ==}
|
||||||
engines: {node: '>=18.0.0'}
|
engines: {node: '>=18.0.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: ^18.2.0
|
react: ^18.2.0
|
||||||
@@ -7289,7 +7289,7 @@ snapshots:
|
|||||||
- stream-browserify
|
- stream-browserify
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@noahspan/noahspan-components@1.4.0(@mui/system@6.4.6(@emotion/react@11.14.0(@types/react@18.3.18)(react@18.3.1))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1))(@types/react-dom@18.3.5(@types/react@18.3.18))(@types/react@18.3.18)(less@4.2.2)(moment@2.30.1)(postcss@8.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.3(prettier@3.2.5))(typescript@5.7.3)(webpack@5.97.1(esbuild@0.18.20))':
|
'@noahspan/noahspan-components@1.5.1(@mui/system@6.4.6(@emotion/react@11.14.0(@types/react@18.3.18)(react@18.3.1))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1))(@types/react-dom@18.3.5(@types/react@18.3.18))(@types/react@18.3.18)(less@4.2.2)(moment@2.30.1)(postcss@8.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.3(prettier@3.2.5))(typescript@5.7.3)(webpack@5.97.1(esbuild@0.18.20))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@emotion/react': 11.14.0(@types/react@18.3.18)(react@18.3.1)
|
'@emotion/react': 11.14.0(@types/react@18.3.18)(react@18.3.1)
|
||||||
'@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1)
|
'@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1)
|
||||||
|
|||||||
Reference in New Issue
Block a user