adding flights page

This commit is contained in:
2025-03-23 11:06:35 -05:00
parent eb1bfb53c5
commit f51c4f2e1a
5 changed files with 19 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "api", "name": "api",
"version": "1.2.0", "version": "1.3.0",
"description": "", "description": "",
"author": "", "author": "",
"private": true, "private": true,

View File

@@ -1,7 +1,7 @@
{ {
"name": "app", "name": "app",
"private": true, "private": true,
"version": "1.2.0", "version": "1.3.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -1,5 +1,5 @@
import { useEffect, useReducer } from "react"; import { useEffect, useReducer } from "react";
import { Button, Drawer, Grid, Icon, IconButton, IconName, TextField, theme, Typography, useMediaQuery } from "@noahspan/noahspan-components"; import { Button, Drawer, Grid, Icon, IconButton, IconName, Spinner, TextField, theme, Typography, useMediaQuery } from "@noahspan/noahspan-components";
import { useHttpClient } from "../../hooks/httpClient/UseHttpClient"; import { useHttpClient } from "../../hooks/httpClient/UseHttpClient";
import { AxiosInstance, AxiosResponse } from "axios"; import { AxiosInstance, AxiosResponse } from "axios";
import { useAccessToken } from "../../hooks/accessToken/UseAcessToken"; import { useAccessToken } from "../../hooks/accessToken/UseAcessToken";
@@ -132,13 +132,23 @@ const LogTracks = ({ isDrawerOpen, mode, onOpenClose, selectedRowKey }: LogTrack
<Typography variant="h4">{`${mode.toString().toLowerCase().charAt(0).toUpperCase() + mode.toString().slice(1).toLowerCase()} Tracks`}</Typography> <Typography variant="h4">{`${mode.toString().toLowerCase().charAt(0).toUpperCase() + mode.toString().slice(1).toLowerCase()} Tracks`}</Typography>
</Grid> </Grid>
<Grid display="flex" justifyContent="right" size={1}> <Grid display="flex" justifyContent="right" size={1}>
<IconButton onClick={onCancel}> <IconButton disabled={state.isLoading ? true : false} onClick={onCancel}>
<Icon iconName={IconName.XMARK} /> <Icon iconName={IconName.XMARK} />
</IconButton> </IconButton>
</Grid> </Grid>
{mode === FormMode.EDIT && {mode === FormMode.EDIT &&
<> <>
{state.tracks.length > 0 && state.tracks.map((track, index) => { {state.isLoading &&
<>
<Grid display="flex" justifyContent="center" size={12}>
<Spinner />
</Grid>
<Grid display="flex" justifyContent="center" size={12}>
Loading...
</Grid>
</>
}
{!state.isLoading && state.tracks.length > 0 && state.tracks.map((track, index) => {
const trackSplit = track.split('/') const trackSplit = track.split('/')
const filename = trackSplit[trackSplit.length - 1]; const filename = trackSplit[trackSplit.length - 1];
@@ -155,6 +165,7 @@ const LogTracks = ({ isDrawerOpen, mode, onOpenClose, selectedRowKey }: LogTrack
})} })}
<Grid display='flex' gap={2} justifyContent='right' size={12}> <Grid display='flex' gap={2} justifyContent='right' size={12}>
<Button <Button
disabled={state.isLoading ? true : false}
startIcon={<Icon iconName={IconName.XMARK} />} startIcon={<Icon iconName={IconName.XMARK} />}
variant="outlined" variant="outlined"
onClick={onCancel} onClick={onCancel}
@@ -165,7 +176,7 @@ const LogTracks = ({ isDrawerOpen, mode, onOpenClose, selectedRowKey }: LogTrack
{mode.toString() !== FormMode.VIEW && ( {mode.toString() !== FormMode.VIEW && (
<Button <Button
component='label' component='label'
loading={state.isLoading} disabled={state.isLoading ? true : false}
startIcon={<Icon iconName={IconName.UPLOAD} />} startIcon={<Icon iconName={IconName.UPLOAD} />}
variant='contained' variant='contained'
> >

View File

@@ -53,7 +53,7 @@ const Logbook: React.FC<unknown> = () => {
accessorKey: 'tracks', accessorKey: 'tracks',
header: 'Tracks', header: 'Tracks',
cell: (info: any) => { cell: (info: any) => {
if (info.row.original.tracks && info.row.original.tracks.length > 0) { if (info.row.original.tracks && JSON.parse(info.row.original.tracks).length > 0) {
return ( return (
<IconButton onClick={() => onOpenCloseTracks(FormMode.VIEW, info.row.original.rowKey)}><Icon iconName={IconName.MAP_LOCATION_DOT} /></IconButton> <IconButton onClick={() => onOpenCloseTracks(FormMode.VIEW, info.row.original.rowKey)}><Icon iconName={IconName.MAP_LOCATION_DOT} /></IconButton>
) )

View File

@@ -1,6 +1,6 @@
{ {
"name": "@noahspan/flying", "name": "@noahspan/flying",
"version": "1.2.0", "version": "1.3.0",
"scripts": { "scripts": {
"start": "concurrently 'npm run start:azure -w api' 'wait-on tcp:0.0.0.0:7071 && npm run dev -w app'", "start": "concurrently 'npm run start:azure -w api' 'wait-on tcp:0.0.0.0:7071 && npm run dev -w app'",
"format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"", "format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"",