Making sure gpx id is 'new' when importing a GPX as a new journey
This commit is contained in:
parent
b38fdf49ad
commit
856cd7637e
|
@ -37,8 +37,8 @@ const GpxDialog: Component<{}> = (props) => {
|
||||||
dispatch({ action: 'getCurrentAccount' }).then((currentAccount: any) => {
|
dispatch({ action: 'getCurrentAccount' }).then((currentAccount: any) => {
|
||||||
console.log({ caller: 'GpxDialog / currentAccount', currentAccount });
|
console.log({ caller: 'GpxDialog / currentAccount', currentAccount });
|
||||||
setCurrentAccount(currentAccount);
|
setCurrentAccount(currentAccount);
|
||||||
setCurrentGpxId(currentAccount.currentGpxId);
|
setCurrentGpxId(currentAccount.currentGpxId || 'new');
|
||||||
setSelectedGpxId(currentAccount.currentGpxId);
|
setSelectedGpxId(currentAccount.currentGpxId || 'new');
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleClickOpen = async () => {
|
const handleClickOpen = async () => {
|
||||||
|
|
|
@ -63,14 +63,19 @@ const ImportSingleFile: Component<Props> = ({ file: file }) => {
|
||||||
const [statsAndGpx, setStatsAndGpx] = createSignal<StatsAndGpx>();
|
const [statsAndGpx, setStatsAndGpx] = createSignal<StatsAndGpx>();
|
||||||
const [picture, setPicture] = createSignal<Picture>();
|
const [picture, setPicture] = createSignal<Picture>();
|
||||||
const [state, setState] = createSignal('init');
|
const [state, setState] = createSignal('init');
|
||||||
const [gpxId, setGpxId] = createSignal<string>('');
|
const [gpxId, setGpxId] = createSignal<string>('new');
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
setGpxId(currentGpxId());
|
setGpxId(currentGpxId());
|
||||||
});
|
});
|
||||||
|
|
||||||
const parseGpx = (content: string) => {
|
const parseGpx = (content: string) => {
|
||||||
const gpx = GPX.parse(content);
|
const gpx = GPX.parse(content);
|
||||||
console.log({ caller: 'ImportSingleFile / JSON', gpxFile: file, gpx });
|
console.log({
|
||||||
|
caller: 'ImportSingleFile / JSON',
|
||||||
|
gpxFile: file,
|
||||||
|
gpx,
|
||||||
|
gpxId: gpxId(),
|
||||||
|
});
|
||||||
setStatsAndGpx({ gpx, stats: analyzeGpx(gpx) });
|
setStatsAndGpx({ gpx, stats: analyzeGpx(gpx) });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue