diff --git a/src/map/HistoryControls.tsx b/src/map/HistoryControls.tsx index 4fee19bf..47bf833d 100644 --- a/src/map/HistoryControls.tsx +++ b/src/map/HistoryControls.tsx @@ -1,6 +1,7 @@ import type { TimeSpan } from '#api/api.js' import { timeSpans, type TimeSpanInfo } from '#chart/timeSpans.js' import { useDeviceLocation } from '#context/DeviceLocation.js' +import { formatInt } from '#utils/format.js' import { HistoryIcon } from 'lucide-preact' import { useState } from 'preact/hooks' @@ -8,7 +9,7 @@ const byTimeSpan = (timeSpan: TimeSpan | undefined) => (t: TimeSpanInfo) => t.id === timeSpan export const HistoryControls = () => { - const { timeSpan, clustering, enableClustering, setTimeSpan } = + const { timeSpan, clustering, enableClustering, setTimeSpan, trail } = useDeviceLocation() const [expanded, setExpanded] = useState(false) @@ -26,9 +27,14 @@ export const HistoryControls = () => { setExpanded(true) }} > - - History: {timeSpans.find(byTimeSpan(timeSpan))?.title ?? 'off'} - + {trail.length >= 500 && ( + last {formatInt(trail.length)} locations + )} + {trail.length < 500 && ( + + History: {timeSpans.find(byTimeSpan(timeSpan))?.title ?? 'off'} + + )} )