Feature/73 add flights page #78

Merged
noahspannbauer merged 7 commits from feature/73-add-flights-page into main 2025-03-23 12:48:42 -04:00
5 changed files with 19 additions and 8 deletions
Showing only changes of commit f51c4f2e1a - Show all commits

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
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 { AxiosInstance, AxiosResponse } from "axios";
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>
</Grid>
<Grid display="flex" justifyContent="right" size={1}>
<IconButton onClick={onCancel}>
<IconButton disabled={state.isLoading ? true : false} onClick={onCancel}>
<Icon iconName={IconName.XMARK} />
</IconButton>
</Grid>
{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 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}>
<Button
disabled={state.isLoading ? true : false}
startIcon={<Icon iconName={IconName.XMARK} />}
variant="outlined"
onClick={onCancel}
@@ -165,7 +176,7 @@ const LogTracks = ({ isDrawerOpen, mode, onOpenClose, selectedRowKey }: LogTrack
{mode.toString() !== FormMode.VIEW && (
<Button
component='label'
loading={state.isLoading}
disabled={state.isLoading ? true : false}
startIcon={<Icon iconName={IconName.UPLOAD} />}
variant='contained'
>

View File

@@ -53,7 +53,7 @@ const Logbook: React.FC<unknown> = () => {
accessorKey: 'tracks',
header: 'Tracks',
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 (
<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",
"version": "1.2.0",
"version": "1.3.0",
"scripts": {
"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\"",