diff --git a/src/components/FirecallItems/elements/FirecallLine.tsx b/src/components/FirecallItems/elements/FirecallLine.tsx
index ae77674..00a89b9 100644
--- a/src/components/FirecallItems/elements/FirecallLine.tsx
+++ b/src/components/FirecallItems/elements/FirecallLine.tsx
@@ -1,6 +1,8 @@
+import { ReactNode } from 'react';
import { Line } from '../../firebase/firestore';
import { FirecallConnection } from './FirecallConnection';
import { FirecallItemBase } from './FirecallItemBase';
+import { LatLngPosition } from '../../../common/geo';
export class FirecallLine extends FirecallConnection {
opacity?: number;
@@ -43,4 +45,21 @@ export class FirecallLine extends FirecallConnection {
opacity: this.opacity,
};
}
+
+ public body(): ReactNode {
+ return (
+ <>
+ {super.body()}
+
+ Positionen:
+
+ {(JSON.parse(this.positions || '[]') as LatLngPosition[]).map((p) => (
+ <>
+ {p[0].toFixed(4)},{p[1].toFixed(4)}
+
+ >
+ ))}
+ >
+ );
+ }
}
diff --git a/src/components/Map/RecordButton.tsx b/src/components/Map/RecordButton.tsx
index d066519..f3b6136 100644
--- a/src/components/Map/RecordButton.tsx
+++ b/src/components/Map/RecordButton.tsx
@@ -46,6 +46,7 @@ export default function RecordButton() {
distance: calculateDistance(allPos),
};
await updateFirecallItem(newRecord);
+ setRecordItem(newRecord);
} else {
console.warn(`tracking not possible, record id undefined`);
}
@@ -104,8 +105,10 @@ export default function RecordButton() {
const lastPos = positions[positions.length - 1];
const distance = position.distanceTo(toLatLng(lastPos[0], lastPos[1]));
- // more than 5m or 30 seconds
- if (distance > 5 || (+currentTime - +timestamp) / 1000 > 30) {
+ // more than 5m and > 1 sec or > 30 seconds
+
+ const timeSinceLastPos = (+currentTime - +timestamp) / 1000;
+ if ((distance > 5 && timeSinceLastPos > 1) || timeSinceLastPos > 30) {
map.setView(position);
setTimestamp(new Date());
addPos([lastPos[0], lastPos[1]], recordItem);
diff --git a/src/components/pages/Layers.tsx b/src/components/pages/Layers.tsx
index 05c105e..7f83533 100644
--- a/src/components/pages/Layers.tsx
+++ b/src/components/pages/Layers.tsx
@@ -101,14 +101,16 @@ export default function LayersPage() {
Object.fromEntries(
Object.keys(layers).map((key) => [
key,
- items.filter((i) => i.layer === key),
+ items
+ .filter((i) => i.layer === key)
+ .sort((a, b) => a.datum?.localeCompare(b.datum || '') || 0),
])
)
);
- elements['default'] = items.filter(
- (i) => i.layer === '' || i.layer === undefined
- );
+ elements['default'] = items
+ .filter((i) => i.layer === '' || i.layer === undefined)
+ .sort((a, b) => a.datum?.localeCompare(b.datum || '') || 0);
return elements;
}, [items, layers]);