@ -3,10 +3,8 @@ import type { ExportProps } from './types';
export const ExportComponent = ({ markers }: ExportProps) => {
return (
<>
<button onClick={() => exportMarkersToGpx(markers)}>
Download your route
</button>
</>
);
};
@ -56,11 +56,11 @@ export const markersReducer = (
switch (type) {
case 'add': {
const key = nanoid(10);
return reindexMarkers([
return [
...markers,
{
key,
shortLabel: 'placeholder',
shortLabel: `${markers.length + 1}`,
longLabel: key.substring(0, 4),
remove: () =>
action.data.dispatcher({
@ -84,7 +84,7 @@ export const markersReducer = (
}),
coordinates: action.data.coordinates,
},
]);
];
}
case 'remove': {
@ -13,13 +13,6 @@ void t.test('reorderElements', (t) => {
checkReordering(0, -1, 'bcde');
checkReordering(1, -1, 'acde');
checkReordering(2, -1, 'abde');
checkReordering(3, -1, 'abce');
checkReordering(4, -1, 'abcd');
checkReordering(5, -1, 'abcde');
checkReordering(0, 0, 'abcde');
checkReordering(0, 1, 'bacde');
checkReordering(0, 2, 'bcade');
@ -3,13 +3,6 @@ export const reorderElements = <T>(
oldIndex: number,
newIndex: number,
) => {
if (newIndex < 0) {
...collection.slice(0, oldIndex),
...collection.slice(oldIndex + 1, collection.length),
if (oldIndex < newIndex) {