managarten/memoro/apps/mobile/features/location/LocationTracker.tsx
Till-JS e7f5f942f3 chore: initial commit - consolidate 4 projects into monorepo
Projects included:
- maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing)
- manacore (Expo mobile + SvelteKit web + Astro landing)
- manadeck (NestJS backend + Expo mobile + SvelteKit web)
- memoro (Expo mobile + SvelteKit web + Astro landing)

This commit preserves the current state before monorepo restructuring.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:38:24 +01:00

48 lines
1.3 KiB
TypeScript

import React, { useEffect } from 'react';
import { useLocation } from './LocationContext';
import {
requestLocationPermissions,
getCurrentLocation,
saveLocationData
} from './locationService';
/**
* Komponente zum Erfassen des Standorts basierend auf Benutzereinstellungen
*/
const LocationTracker: React.FC = () => {
const { saveLocation } = useLocation();
useEffect(() => {
// Nur Standort erfassen, wenn die Einstellung aktiviert ist
if (saveLocation) {
const captureLocation = async () => {
const hasPermission = await requestLocationPermissions();
if (hasPermission) {
const locationData = await getCurrentLocation();
if (locationData) {
await saveLocationData(locationData);
console.debug('Standort erfasst und gespeichert:', locationData);
}
}
};
// Beim Start erfassen
captureLocation();
// Regelmäßige Erfassung einrichten (alle 30 Minuten)
const intervalId = setInterval(captureLocation, 30 * 60 * 1000);
return () => {
clearInterval(intervalId);
};
}
}, [saveLocation]);
// Diese Komponente rendert nichts
return null;
};
export default LocationTracker;