Implementing notes (WIP)
This commit is contained in:
parent
07cd0d04c5
commit
5404a6e5ad
|
@ -1,14 +1,24 @@
|
|||
import { IconButton } from '@suid/material';
|
||||
import { Component, createSignal } from 'solid-js';
|
||||
import { Geolocation } from '@awesome-cordova-plugins/geolocation';
|
||||
|
||||
import NoteIcon from '@suid/icons-material/Note';
|
||||
|
||||
import style from './Note.module.css';
|
||||
import WptEditDialog from '../wpt/WptEditDialog';
|
||||
import { Coordinate } from 'ol/coordinate';
|
||||
|
||||
interface Props {}
|
||||
|
||||
const Note: Component<Props> = (props) => {
|
||||
const [open, setOpen] = createSignal<boolean>();
|
||||
const [open, setOpen] = createSignal<boolean>(false);
|
||||
const [coordinate, setCoordinate] = createSignal<Coordinate>();
|
||||
|
||||
const openWptEditDialogWithCurrentLocation = async () => {
|
||||
const position = await Geolocation.getCurrentPosition();
|
||||
setCoordinate([position.coords.longitude, position.coords.latitude]);
|
||||
setOpen(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -20,14 +30,15 @@ const Note: Component<Props> = (props) => {
|
|||
}
|
||||
>
|
||||
{' '}
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setOpen(true);
|
||||
}}
|
||||
>
|
||||
<IconButton onClick={openWptEditDialogWithCurrentLocation}>
|
||||
<NoteIcon />
|
||||
</IconButton>
|
||||
</div>
|
||||
<WptEditDialog
|
||||
open={open}
|
||||
closeHandler={() => setOpen(false)}
|
||||
coordinate={coordinate}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -18,12 +18,13 @@ import { Coordinate } from 'ol/coordinate';
|
|||
interface Props {
|
||||
wptId?: string;
|
||||
coordinate?: () => Coordinate | undefined;
|
||||
type?: string;
|
||||
open: () => boolean;
|
||||
closeHandler?: () => vpod;
|
||||
closeHandler?: () => void;
|
||||
}
|
||||
|
||||
const WptEditDialog: Component<Props> = (props) => {
|
||||
const { wptId, closeHandler, open, coordinate } = props;
|
||||
const { wptId, closeHandler, open, coordinate, type = 'poi' } = props;
|
||||
const [t, { add, locale, dict }] = useI18n();
|
||||
|
||||
const wpt = !!wptId
|
||||
|
|
|
@ -42,6 +42,17 @@ interface Bounds_ {
|
|||
maxlon: number;
|
||||
}
|
||||
|
||||
export enum Category {
|
||||
NOTE = 'note',
|
||||
POI = 'poi',
|
||||
UNKNOWN = '',
|
||||
}
|
||||
|
||||
export enum SubCategory {
|
||||
ACCOMMODATION = 'accommodation',
|
||||
UNKNOWN = '',
|
||||
}
|
||||
|
||||
interface Extensions {
|
||||
'dyo:speed'?: number;
|
||||
'dyo:course'?: number;
|
||||
|
@ -51,6 +62,10 @@ interface Extensions {
|
|||
'dyo:minZoom'?: number;
|
||||
address?: any;
|
||||
to?: string;
|
||||
startTime?: string;
|
||||
endTime?: string;
|
||||
category?: Category;
|
||||
subCategory?: SubCategory;
|
||||
}
|
||||
|
||||
interface Trk {
|
||||
|
|
Loading…
Reference in New Issue