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