Reimplementing GPX imports.
This commit is contained in:
1 parent
a2d0e8cf6a
commit
5fdd63103e
8 files changed
+148
-5
No files matched your search
@@ -5,6 +5,9 @@ import GPX from '../../lib/gpx-parser-builder/src/gpx';
|
||||
import css from './GpxImport.module.css';
|
||||
import { IonIcon, IonItem } from '@ionic/react';
|
||||
import { cloudUpload } from 'ionicons/icons';
|
||||
import { findStartTime } from '../../lib/gpx';
|
||||
import dispatch from '../../workers/dispatcher-main';
|
||||
import { intToGpxId } from '../../lib/ids';
|
||||
|
||||
const GpxImport: React.FC<{}> = () => {
|
||||
const onChangeHandler = (event: any) => {
|
||||
@@ -20,6 +23,11 @@ const GpxImport: React.FC<{}> = () => {
|
||||
console.log(fileReader.result);
|
||||
const gpx = GPX.parse(fileReader.result);
|
||||
console.log(`gpx: ${JSON.stringify(gpx)}`);
|
||||
const startTime = new Date(findStartTime(gpx)!);
|
||||
dispatch({
|
||||
action: 'pruneAndSaveImportedGpx',
|
||||
params: { id: { gpx: intToGpxId(startTime.valueOf()) }, gpx: gpx },
|
||||
});
|
||||
// pushGpx(db, {
|
||||
// gpx,
|
||||
// metadata: {
|
||||
|
||||
Reference in new issue
Block a user