import { Component, createEffect } from 'solid-js';
import style from './index.module.css';
import Tree from '../tree/Tree';
import getUri from '../../lib/ids';
import { createCachedSignal } from '../../workers/cached-signals';
import { FormControlLabel, Radio, RadioGroup } from '@suid/material';
import { getDrawingSelections } from '../../db/drawing-selections';
import dispatch from '../../workers/dispatcher-main';
const id = getUri('drawingSelections', undefined);
type SelectionType = 'ALL' | 'NONE' | 'CURRENT';
type DrawingSelections = {
gpxSelection: SelectionType;
trkSelection: SelectionType;
wptSelection: SelectionType;
};
const defaultDrawingSelections: DrawingSelections = {
gpxSelection: 'ALL',
trkSelection: 'ALL',
wptSelection: 'ALL',
};
const drawingSelections = createCachedSignal({
id,
method: 'getDrawingSelections',
defaultDrawingSelections,
}) as () => DrawingSelections;
createEffect(() => {
console.log({
caller: 'DrawingSelections',
drawingSelections: drawingSelections(),
});
});
const AllNoneCurrent: Component<{}> = (props) => {
return (
<>
}
label='All'
>
}
label='None'
>
}
label='Current'
>
>
);
};
const handleGpxSelectionChange = (ev: any) => {
const value = ev.target.value;
console.log({
caller: 'DrawingSelector / handleGpxSelectionChange',
ev,
value,
});
const newDrawingSelections = drawingSelections();
newDrawingSelections.gpxSelection = value;
dispatch({
action: 'putDrawingSelections',
params: { id, drawingSelections: newDrawingSelections },
});
};
const DrawingSelector: Component<{}> = (props) => {
return (
Trips
>
}
subTree={undefined}
/>
);
};
export default DrawingSelector;