From f9a44b3b70954984d1b25a31db74a95ad1c0f1d8 Mon Sep 17 00:00:00 2001 From: evlist Date: Sat, 7 Jan 2023 19:18:25 +0100 Subject: [PATCH] Bug fix --- src/components/trkseg/TrksegViewer.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/trkseg/TrksegViewer.tsx b/src/components/trkseg/TrksegViewer.tsx index e872fa4..2778a3a 100644 --- a/src/components/trkseg/TrksegViewer.tsx +++ b/src/components/trkseg/TrksegViewer.tsx @@ -16,14 +16,18 @@ const TrksegViewer: Component = ({ trksegId }) => { const trkseg = peekCachedSignal({ id: trksegId, action: 'getTrkseg' }); console.log({ caller: 'TrksegViewer', trksegId, trkseg: trkseg() }); - const title = () => { - return trkseg().name; - }; const lineString = new LineString( trkseg().trkpt.map((trkpt: any) => [trkpt.$.lon, trkpt.$.lat]) ); + const firstTrkpt = () => trkseg().trkpt.at(0); + const lastTrkpt = () => trkseg().trkpt.at(-1); + + const title = () => { + return firstTrkpt().time; + }; + return ( = ({ trksegId }) => {
{getFormatedLength(lineString)} {t('from')}{' '} trkseg().trkpt.at(0)} + target={firstTrkpt} putAction='putTrkpt' putParamName='trkpt' />{' '} {t('to')}{' '} trkseg().trkpt.at(-1)} + target={lastTrkpt} putAction='putTrkpt' putParamName='trkpt' />