|
|
|
import { Coordinates, Waypoint } from '../shared/types';
|
|
|
|
|
|
|
|
export type Marker = Waypoint & {
|
|
|
|
key: string;
|
|
|
|
remove: () => void;
|
|
|
|
moveUp: () => void;
|
|
|
|
moveDown: () => void;
|
|
|
|
label: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
type GenericReducerAction<TType extends string, TData> = {
|
|
|
|
type: TType;
|
|
|
|
data: TData;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ReducerAction =
|
|
|
|
| GenericReducerAction<
|
|
|
|
'add',
|
|
|
|
{
|
|
|
|
coordinates: Coordinates;
|
|
|
|
remove: (key: string) => void;
|
|
|
|
moveUp: (key: string) => void;
|
|
|
|
moveDown: (key: string) => void;
|
|
|
|
}
|
|
|
|
>
|
|
|
|
| GenericReducerAction<'remove', { key: string }>
|
|
|
|
| GenericReducerAction<'moveUp', { key: string }>
|
|
|
|
| GenericReducerAction<'moveDown', { key: string }>
|
|
|
|
| GenericReducerAction<'reorder', { oldIndex: number; newIndex: number }>;
|
|
|
|
|
|
|
|
export type ReorderMarkersParams = {
|
|
|
|
oldIndex: number;
|
|
|
|
newIndex: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type MarkersProps = {
|
|
|
|
markers: Marker[];
|
|
|
|
onMarkersReorder: (params: ReorderMarkersParams) => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type MapProps = {
|
|
|
|
markers: Marker[];
|
|
|
|
onMapClick: (coordinates: Coordinates) => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ExportProps = {
|
|
|
|
markers: Marker[];
|
|
|
|
};
|
|
|
|
|
|
|
|
export type MarkerProps = {
|
|
|
|
marker: Marker;
|
|
|
|
isFirst: boolean;
|
|
|
|
isLast: boolean;
|
|
|
|
};
|