<Trk> component
This commit is contained in:
1 parent
79fb39100f
commit
54f2ab06d9
6 files changed
+65
-10
No files matched your search
@@ -23,8 +23,9 @@ export const AllGpxes: Component<Props> = ({ map }) => {
|
||||
});
|
||||
|
||||
return (
|
||||
// @ts-ignore
|
||||
<For each={allGpxIds()}>
|
||||
{(gpxId) => {
|
||||
{(gpxId: string) => {
|
||||
console.log({ caller: 'AllGpxes / loop', gpxId });
|
||||
return <Gpx map={map} gpxId={gpxId} />;
|
||||
}}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Component, createEffect, createResource } from 'solid-js';
|
||||
import { Component, createEffect, createResource, For } from 'solid-js';
|
||||
|
||||
import OlMap from 'ol/Map';
|
||||
|
||||
import dispatch from '../../workers/dispatcher-main';
|
||||
//import Trk from './Trk';
|
||||
import Trk from '../trk';
|
||||
import getUri from '../../lib/ids';
|
||||
|
||||
interface Props {
|
||||
@@ -27,7 +27,15 @@ export const Gpx: Component<Props> = ({ map, gpxId }) => {
|
||||
console.log({ caller: 'Gpx', map: map(), gpxId, gpx: gpx() });
|
||||
});
|
||||
|
||||
return <></>;
|
||||
return (
|
||||
// @ts-ignore
|
||||
<For each={gpx() ? gpx().trk || [] : []}>
|
||||
{(trkId: string) => {
|
||||
console.log({ caller: 'Gpx / loop', trkId });
|
||||
return <Trk map={map} trkId={trkId} />;
|
||||
}}
|
||||
</For>
|
||||
);
|
||||
};
|
||||
|
||||
export default Gpx;
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Component, createEffect, createResource } from 'solid-js';
|
||||
|
||||
import OlMap from 'ol/Map';
|
||||
|
||||
import dispatch from '../../workers/dispatcher-main';
|
||||
import getUri from '../../lib/ids';
|
||||
|
||||
//import Trkseg from './Trkseg';
|
||||
|
||||
interface Props {
|
||||
trkId: string;
|
||||
map: () => OlMap | null;
|
||||
}
|
||||
export const Trk: Component<Props> = ({ map, trkId }) => {
|
||||
const [trk] = createResource(
|
||||
trkId,
|
||||
async () =>
|
||||
await dispatch({
|
||||
action: 'getTrk',
|
||||
params: {
|
||||
id: trkId,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
createEffect(() => {
|
||||
console.log({ caller: 'Trk', map: map(), trkId, trk: trk() });
|
||||
});
|
||||
|
||||
return <></>;
|
||||
};
|
||||
|
||||
export default Trk;
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './Trk';
|
||||
Reference in new issue
Block a user