Cosmetics

This commit is contained in:
Eric van der Vlist 2022-12-13 08:24:50 +01:00
parent a6b5be4f11
commit 102a2feddc
4 changed files with 29 additions and 33 deletions

View File

@ -6,10 +6,11 @@ import dispatch from '../../workers/dispatcher-main';
interface Props { interface Props {
gpxId: () => string; gpxId: () => string;
setGpxId: (id: string) => void; setGpxId: (id: string) => void;
disabled?: boolean;
} }
const GpxChooser: Component<Props> = (props: Props) => { const GpxChooser: Component<Props> = (props: Props) => {
const { gpxId, setGpxId } = props; const { gpxId, setGpxId, disabled } = props;
const [t] = useI18n(); const [t] = useI18n();
@ -36,7 +37,7 @@ const GpxChooser: Component<Props> = (props: Props) => {
}; };
return ( return (
<FormControl> <FormControl disabled={disabled}>
<InputLabel variant='normal' htmlFor='gpx-chooser'> <InputLabel variant='normal' htmlFor='gpx-chooser'>
{t('gpxChooser')} {t('gpxChooser')}
</InputLabel> </InputLabel>

View File

@ -2,16 +2,12 @@ import { useI18n } from '@solid-primitives/i18n';
import { import {
Box, Box,
Button, Button,
FormControl,
IconButton, IconButton,
Input,
InputLabel,
NativeSelect,
SvgIcon, SvgIcon,
TextField, TextField,
} from '@suid/material'; } from '@suid/material';
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import { Component, createSignal, For, Show } from 'solid-js'; import { Component, createSignal, Show } from 'solid-js';
import dispatch from '../../workers/dispatcher-main'; import dispatch from '../../workers/dispatcher-main';
import Dialog from '../dialog'; import Dialog from '../dialog';
import GpxChooser from '../gpx-chooser'; import GpxChooser from '../gpx-chooser';

View File

@ -1,17 +1,13 @@
import { Component, createSignal, For, Show } from 'solid-js'; import { Component, createSignal, For } from 'solid-js';
import CloudUploadIcon from '@suid/icons-material/CloudUpload'; import CloudUploadIcon from '@suid/icons-material/CloudUpload';
// @ts-ignore // @ts-ignore
import GPX from '../../lib/gpx-parser-builder/src/gpx';
import css from './GpxImport.module.css'; import css from './GpxImport.module.css';
import { findStartTime } from '../../lib/gpx';
import dispatch from '../../workers/dispatcher-main';
import { intToGpxId } from '../../lib/ids';
import Dialog from '../dialog'; import Dialog from '../dialog';
import { useI18n } from '@solid-primitives/i18n'; import { useI18n } from '@solid-primitives/i18n';
import { Box, Grid, Typography } from '@suid/material'; import { Box } from '@suid/material';
import GpxImportSingleFile from './GpxImportSingleFile'; import GpxImportSingleFile from './GpxImportSingleFile';
const GpxImport: Component = () => { const GpxImport: Component = () => {

View File

@ -1,24 +1,19 @@
import { useI18n } from '@solid-primitives/i18n'; import { useI18n } from '@solid-primitives/i18n';
import { import {
FormControlLabel,
Grid,
Typography, Typography,
Switch,
FormGroup,
RadioGroup,
Radio,
Divider,
FormControl,
FormLabel,
Card, Card,
CardContent, CardContent,
CardActions, CardActions,
CardHeader,
Button, Button,
Box,
LinearProgress,
CircularProgress,
} from '@suid/material'; } from '@suid/material';
import { Component, createEffect, createSignal, Show } from 'solid-js'; import { Component, createEffect, createSignal, Show } from 'solid-js';
import { findStartTime } from '../../lib/gpx'; import { findStartTime } from '../../lib/gpx';
import GPX from '../../lib/gpx-parser-builder/src/gpx'; import GPX from '../../lib/gpx-parser-builder/src/gpx';
import GpxChooser from '../gpx-chooser';
import { currentGpxId } from '../gpx-dialog';
interface Props { interface Props {
gpxFile: File; gpxFile: File;
@ -54,6 +49,10 @@ const GpxImportSingleFile: Component<Props> = ({ gpxFile }) => {
const [t] = useI18n(); const [t] = useI18n();
const [statsAndGpx, setStatsAndGpx] = createSignal<StatsAndGpx>(); const [statsAndGpx, setStatsAndGpx] = createSignal<StatsAndGpx>();
const [state, setState] = createSignal('init'); const [state, setState] = createSignal('init');
const [gpxId, setGpxId] = createSignal<string>('');
createEffect(() => {
setGpxId(currentGpxId());
});
const gpxReader = new FileReader(); const gpxReader = new FileReader();
gpxReader.readAsText(gpxFile); gpxReader.readAsText(gpxFile);
@ -78,7 +77,7 @@ const GpxImportSingleFile: Component<Props> = ({ gpxFile }) => {
); );
const doImport = () => { const doImport = () => {
setState('imported'); setState('importing');
}; };
const [selectedTrkTransform, setSelectedTrkTransform] = createSignal( const [selectedTrkTransform, setSelectedTrkTransform] = createSignal(
@ -136,8 +135,11 @@ const GpxImportSingleFile: Component<Props> = ({ gpxFile }) => {
</RadioGroup> </RadioGroup>
</FormControl> </FormControl>
</Show> */} </Show> */}
<Show when={state() === 'importing'}>
<LinearProgress />
</Show> </Show>
<CardActions> <CardActions>
<GpxChooser gpxId={gpxId} setGpxId={setGpxId} disabled={state() != 'init'} />
<Button <Button
variant='contained' variant='contained'
disabled={state() != 'init'} disabled={state() != 'init'}
@ -146,6 +148,7 @@ const GpxImportSingleFile: Component<Props> = ({ gpxFile }) => {
{t('import')} {t('import')}
</Button> </Button>
</CardActions> </CardActions>
</Show>
</CardContent> </CardContent>
</Card> </Card>
); );