Adding a "shared" property to gpxes and family.

This commit is contained in:
vdv committed 2023-02-12 18:14:14 +01:00
1 parent 8853ea4670
commit 9dacad9af3
6 files changed
+66 -7

No files matched your search

+23 -1
View File
@@ -1,6 +1,6 @@
import { useI18n } from '@solid-primitives/i18n';
import { Box, Button, IconButton, SvgIcon, TextField } from '@suid/material';
import { cloneDeep } from 'lodash';
import { cloneDeep, isPlainObject } from 'lodash';
import { Component, createSignal, Show } from 'solid-js';
import { newEmptyGpx } from '../../db/gpx';
import { peekCachedSignal } from '../../workers/cached-signals';
@@ -93,6 +93,20 @@ const GpxDialog: Component<{}> = (props) => {
gpx: gpx(),
});
};
const gpxSharedChangeHandler = (event: any) => {
const newGpx: Gpx = cloneDeep(gpx()) as Gpx;
if (!isPlainObject(newGpx.extensions)) {
newGpx.extensions = {};
}
newGpx.extensions.shared = event.target.value;
setGpx(newGpx);
console.log({
caller: 'GpxDialog / gpxSharedChangeHandler',
value: event.target.value,
gpx: gpx(),
newGpx,
});
};
const gpxTimeChangeHandler = (event: any) => {
const newGpx: Gpx = cloneDeep(gpx()) as Gpx;
if (newGpx.metadata === undefined) {
@@ -164,6 +178,14 @@ const GpxDialog: Component<{}> = (props) => {
onChange={gpxDescChangeHandler}
InputProps={{ inputComponent: 'textarea' }}
/>
<TextField
label={t('gpxShared')}
multiline={true}
rows={5}
value={gpx()?.extensions?.shared || ''}
onChange={gpxSharedChangeHandler}
InputProps={{ inputComponent: 'textarea' }}
/>
<Button variant='contained' onClick={saveHandler}>
{t('gpxSave')}
</Button>