Colota - Android GPS Location tracker
feat: replace quick access grid with bottom tab bar navigation
Max Dietrich1f374c995de9
diff --git a/apps/mobile/App.tsx b/apps/mobile/App.tsxindex 756156bf..0c7e4700 100644--- a/apps/mobile/App.tsx+++ b/apps/mobile/App.tsx@@ -2,11 +2,11 @@* Copyright (C) 2026 Max Dietrich* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useMemo } from "react"-import { NavigationContainer } from "@react-navigation/native"+import React, { useMemo, useState, useCallback } from "react"+import { NavigationContainer, NavigationContainerRef } from "@react-navigation/native"import { createNativeStackNavigator } from "@react-navigation/native-stack"import { SafeAreaProvider } from "react-native-safe-area-context"-import { StatusBar, Platform } from "react-native"+import { View, StatusBar, Platform } from "react-native"import MapLibreGL from "@maplibre/maplibre-react-native"import { ThemeProvider, useTheme } from "./src/hooks/useTheme"import { fonts } from "./src/styles/typography"@@ -32,6 +32,7 @@ import {TripDetailScreen,OfflineMapsScreen} from "./src/screens/"+import { BottomTabBar } from "./src/components"import { loadDisplayPreferences } from "./src/utils/geo"MapLibreGL.setAccessToken(null)@@ -135,6 +136,7 @@ const SCREEN_CONFIG = [function AppNavigator() {const { colors, isDark } = useTheme()+ const [currentRoute, setCurrentRoute] = useState<string | undefined>("Dashboard")const screenOptions = useMemo(() => ({headerStyle: {@@ -177,20 +179,34 @@ function AppNavigator() {[])+ const navigationRef = React.useRef<NavigationContainerRef<Record<string, undefined>>>(null)++ const handleStateChange = useCallback(() => {+ const route = navigationRef.current?.getCurrentRoute()+ if (route) setCurrentRoute(route.name)+ }, [])++ const handleTabNavigate = useCallback((route: string) => {+ navigationRef.current?.reset({ index: 0, routes: [{ name: route }] })+ }, [])+return (<SafeAreaProvider><StatusBar {...statusBarConfig} />- <NavigationContainer linking={linking}>- <Stack.Navigator initialRouteName="Dashboard" screenOptions={screenOptions}>- {SCREEN_CONFIG.map((screen) => (- <Stack.Screen- key={screen.name}- name={screen.name}- component={screen.component}- options={{ headerTitle: screen.title }}- />- ))}- </Stack.Navigator>+ <NavigationContainer linking={linking} ref={navigationRef} onStateChange={handleStateChange}>+ <View style={{ flex: 1 }}>+ <Stack.Navigator initialRouteName="Dashboard" screenOptions={screenOptions}>+ {SCREEN_CONFIG.map((screen) => (+ <Stack.Screen+ key={screen.name}+ name={screen.name}+ component={screen.component}+ options={{ headerTitle: screen.title }}+ />+ ))}+ </Stack.Navigator>+ <BottomTabBar currentRoute={currentRoute} onNavigate={handleTabNavigate} />+ </View></NavigationContainer></SafeAreaProvider>)diff --git a/apps/mobile/src/components/features/dashboard/QuickAccess.tsx b/apps/mobile/src/components/features/dashboard/QuickAccess.tsxdeleted file mode 100644index ed1ba533..00000000--- a/apps/mobile/src/components/features/dashboard/QuickAccess.tsx+++ /dev/null@@ -1,141 +0,0 @@-/**- * Copyright (C) 2026 Max Dietrich- * Licensed under the GNU AGPLv3. See LICENSE in the project root for details.- */-import React from "react"-import { View, StyleSheet, Text, Pressable, Linking } from "react-native"-import { Settings, Fence, Search, Download, Info, Heart, LucideIcon } from "lucide-react-native"-import { useTheme } from "../../../hooks/useTheme"-import { fonts } from "../../../styles/typography"-import { SectionTitle } from "../../ui/SectionTitle"--interface NavItem {- name: string- icon: LucideIcon- color: string- onPress?: () => void-}--interface QuickAccessProps {- navigation: { navigate: (screen: string) => void }-}--export function QuickAccess({ navigation }: QuickAccessProps) {- const { colors } = useTheme()-- const navItems: NavItem[] = [- {- name: "Settings",- icon: Settings,- color: colors.primary,- onPress: () => navigation.navigate("Settings")- },- {- name: "Geofences",- icon: Fence,- color: colors.success,- onPress: () => navigation.navigate("Geofences")- },- {- name: "History",- icon: Search,- color: colors.info,- onPress: () => navigation.navigate("Location History")- },- {- name: "Export",- icon: Download,- color: colors.warning,- onPress: () => navigation.navigate("Export Data")- },- {- name: "About",- icon: Info,- color: colors.info,- onPress: () => navigation.navigate("About Colota")- },- {- name: "Support",- icon: Heart,- color: colors.error,- onPress: () => Linking.openURL("https://mxd.codes/support")- }- ]-- return (- <View style={styles.container}>- <SectionTitle>QUICK ACCESS</SectionTitle>- <View style={styles.navGrid}>- {navItems.map((item) => (- <Pressable- key={item.name}- style={({ pressed }) => [- styles.navItem,- {- backgroundColor: colors.card,- borderColor: colors.border- },- pressed && { opacity: colors.pressedOpacity }- ]}- onPress={item.onPress}- >- <View- style={[- styles.navIconBox,- {- backgroundColor: item.color + "15",- borderColor: item.color + "30"- }- ]}- >- <item.icon size={24} color={item.color} />- </View>-- <Text style={[styles.navLabel, { color: colors.text }]} numberOfLines={1}>- {item.name}- </Text>- </Pressable>- ))}- </View>- </View>- )-}--const styles = StyleSheet.create({- container: {- marginBottom: 16- },- navGrid: {- flexDirection: "row",- flexWrap: "wrap",- gap: 12- },- navItem: {- width: "31%",- aspectRatio: 1,- padding: 12,- borderRadius: 16,- borderWidth: 1,- alignItems: "center",- justifyContent: "center",- shadowColor: "#000",- shadowOffset: { width: 0, height: 2 },- shadowOpacity: 0.05,- shadowRadius: 4,- elevation: 1- },- navIconBox: {- width: 48,- height: 48,- borderRadius: 14,- justifyContent: "center",- alignItems: "center",- marginBottom: 8- },- navLabel: {- fontSize: 12,- ...fonts.bold,- textAlign: "center",- letterSpacing: 0.3- }-})diff --git a/apps/mobile/src/components/features/inspector/TrackMap.tsx b/apps/mobile/src/components/features/inspector/TrackMap.tsxindex ba31a4df..147ad6ff 100644--- a/apps/mobile/src/components/features/inspector/TrackMap.tsx+++ b/apps/mobile/src/components/features/inspector/TrackMap.tsx@@ -377,7 +377,7 @@ const styles = StyleSheet.create({},legend: {position: "absolute",- bottom: 10,+ bottom: 30,left: 10,borderRadius: 12,borderWidth: 1,diff --git a/apps/mobile/src/components/index.ts b/apps/mobile/src/components/index.tsindex cdb2bd9f..dddb77a7 100644--- a/apps/mobile/src/components/index.ts+++ b/apps/mobile/src/components/index.ts@@ -30,13 +30,13 @@ export { FormatOption } from "./ui/FormatOption"export { FormatSelector } from "./ui/FormatSelector"export { RadioDot } from "./ui/RadioDot"export { SettingRow } from "./ui/SettingRow"+export { BottomTabBar } from "./ui/BottomTabBar"// ============================================================================// Feature Components - Dashboard// ============================================================================export { DashboardMap } from "./features/dashboard/DashboardMap"export { CoordinateDisplay } from "./features/dashboard/CoordinateDisplay"-export { QuickAccess } from "./features/dashboard/QuickAccess"export { ConnectionStatus } from "./features/dashboard/ConnectionStatus"export { WelcomeCard } from "./features/dashboard/WelcomeCard"export { DatabaseStatistics } from "./features/dashboard/DatabaseStatistics"diff --git a/apps/mobile/src/components/ui/BottomTabBar.tsx b/apps/mobile/src/components/ui/BottomTabBar.tsxnew file mode 100644index 00000000..d66fa04e--- /dev/null+++ b/apps/mobile/src/components/ui/BottomTabBar.tsx@@ -0,0 +1,87 @@+/**+ * Copyright (C) 2026 Max Dietrich+ * Licensed under the GNU AGPLv3. See LICENSE in the project root for details.+ */+import React from "react"+import { View, Pressable, Text, StyleSheet } from "react-native"+import { useSafeAreaInsets } from "react-native-safe-area-context"+import { Map, Clock, Fence, Settings, LucideIcon } from "lucide-react-native"+import { useTheme } from "../../hooks/useTheme"+import { fonts } from "../../styles/typography"++interface Tab {+ name: string+ label: string+ icon: LucideIcon+ route: string+}++const TABS: Tab[] = [+ { name: "dashboard", label: "Dashboard", icon: Map, route: "Dashboard" },+ { name: "history", label: "History", icon: Clock, route: "Location History" },+ { name: "geofences", label: "Geofences", icon: Fence, route: "Geofences" },+ { name: "settings", label: "Settings", icon: Settings, route: "Settings" }+]++/** Routes where the tab bar is visible. */+const TAB_ROUTES = new Set(TABS.map((t) => t.route))++interface BottomTabBarProps {+ currentRoute: string | undefined+ onNavigate: (route: string) => void+}++export function BottomTabBar({ currentRoute, onNavigate }: BottomTabBarProps) {+ const { colors } = useTheme()+ const insets = useSafeAreaInsets()++ if (!currentRoute || !TAB_ROUTES.has(currentRoute)) return null++ return (+ <View+ style={[+ styles.container,+ {+ backgroundColor: colors.card,+ borderTopColor: colors.border,+ paddingBottom: Math.max(insets.bottom, 6)+ }+ ]}+ >+ {TABS.map((tab) => {+ const active = currentRoute === tab.route+ const color = active ? colors.primary : colors.textLight+ return (+ <Pressable+ key={tab.name}+ style={({ pressed }) => [styles.tab, pressed && { opacity: 0.6 }]}+ onPress={() => onNavigate(tab.route)}+ >+ <tab.icon size={22} color={color} />+ <Text style={[styles.label, { color }]}>{tab.label}</Text>+ </Pressable>+ )+ })}+ </View>+ )+}++export { TAB_ROUTES }++const styles = StyleSheet.create({+ container: {+ flexDirection: "row",+ borderTopWidth: 1,+ paddingTop: 8+ },+ tab: {+ flex: 1,+ alignItems: "center",+ justifyContent: "center",+ gap: 3+ },+ label: {+ fontSize: 11,+ ...fonts.medium+ }+})diff --git a/apps/mobile/src/components/ui/Container.tsx b/apps/mobile/src/components/ui/Container.tsxindex e74afea6..0385e8df 100644--- a/apps/mobile/src/components/ui/Container.tsx+++ b/apps/mobile/src/components/ui/Container.tsx@@ -25,7 +25,6 @@ export function Container({ children, style }: ContainerProps) {const styles = StyleSheet.create({root: { flex: 1 },container: {- flex: 1,- marginBottom: 24+ flex: 1}})diff --git a/apps/mobile/src/screens/DashboardScreen.tsx b/apps/mobile/src/screens/DashboardScreen.tsxindex 2754bc6c..12b5a651 100644--- a/apps/mobile/src/screens/DashboardScreen.tsx+++ b/apps/mobile/src/screens/DashboardScreen.tsx@@ -16,7 +16,6 @@ import {DashboardMap,CoordinateDisplay,Container,- QuickAccess,DatabaseStatistics,WelcomeCard} from "../components"@@ -221,9 +220,6 @@ export function DashboardScreen({ navigation }: ScreenProps) {{/* Server Connection */}{!settings.isOfflineMode && <ConnectionStatus endpoint={settings.endpoint} navigation={navigation} />}-- {/* Quick Access */}- <QuickAccess navigation={navigation} /></View></ScrollView></Container>@@ -262,7 +258,7 @@ const styles = StyleSheet.create({flex: 1,paddingTop: 20,paddingHorizontal: 16,- paddingBottom: 24+ paddingBottom: 8},metricsSection: {marginBottom: 20diff --git a/apps/mobile/src/screens/GeofenceEditorScreen.tsx b/apps/mobile/src/screens/GeofenceEditorScreen.tsxindex b878db6e..2705e1bf 100644--- a/apps/mobile/src/screens/GeofenceEditorScreen.tsx+++ b/apps/mobile/src/screens/GeofenceEditorScreen.tsx@@ -240,7 +240,7 @@ export function GeofenceEditorScreen({ navigation, route }: any) {<SectionTitle>GPS Pause Options</SectionTitle><Card style={styles.card}>- <SettingRow label="Don't record in zone" hint="Locations are not saved while inside this zone">+ <SettingRow label="Don't record in zone" hint="Pause saving and syncing" style={styles.toggleRow}><SwitchtestID="pause-tracking-toggle"value={pauseTracking}@@ -250,7 +250,7 @@ export function GeofenceEditorScreen({ navigation, route }: any) {/></SettingRow>- <SettingRow label="Pause when on WiFi or Ethernet" hint="Stop GPS when connected to an unmetered network">+ <SettingRow label="WiFi/Ethernet pause" hint="Stop GPS on unmetered networks" style={styles.toggleRow}><SwitchtestID="pause-wifi-toggle"value={pauseOnWifi}@@ -260,7 +260,7 @@ export function GeofenceEditorScreen({ navigation, route }: any) {/></SettingRow>- <SettingRow label="Pause when motionless" hint="Stop GPS after no device motion is detected for a set time">+ <SettingRow label="Motionless pause" hint="Stop GPS after no motion for a set time" style={styles.toggleRow}><SwitchtestID="pause-motionless-toggle"value={pauseOnMotionless}@@ -272,10 +272,7 @@ export function GeofenceEditorScreen({ navigation, route }: any) {{pauseOnMotionless && (<View style={[styles.nestedSetting, { borderLeftColor: colors.border }]}>- <SettingRow- label="Motionless timeout (min)"- hint="GPS pauses after this many minutes without motion. Resumes automatically when the device moves again."- >+ <SettingRow label="Timeout (min)" hint="Minutes without motion before GPS stops"><TextInputtestID="motionless-timeout-input"style={[inputStyle, styles.numInput]}@@ -289,10 +286,7 @@ export function GeofenceEditorScreen({ navigation, route }: any) {</View>)}- <SettingRow- label="Stationary heartbeat"- hint="Send periodic location updates to the server while paused in this zone"- >+ <SettingRow label="Stationary heartbeat" hint="Periodic server update while paused" style={styles.toggleRow}><SwitchtestID="heartbeat-toggle"value={heartbeatEnabled}@@ -304,7 +298,7 @@ export function GeofenceEditorScreen({ navigation, route }: any) {{heartbeatEnabled && (<View style={[styles.nestedSetting, { borderLeftColor: colors.border }]}>- <SettingRow label="Heartbeat interval (min)" hint="How often to send a location update to the server">+ <SettingRow label="Interval (min)" hint="How often to send a location update"><TextInputtestID="heartbeat-interval-input"style={[inputStyle, styles.numInput]}@@ -350,7 +344,8 @@ const styles = StyleSheet.create({},nameInput: { flex: 1 },numInput: { width: 80, textAlign: "center" },- nestedSetting: { marginLeft: 16, paddingLeft: 12, borderLeftWidth: 3 },+ toggleRow: { paddingVertical: 10 },+ nestedSetting: { marginLeft: 16, paddingLeft: 12, borderLeftWidth: 3, marginTop: 4, marginBottom: 4 },combinedNote: {marginTop: 8,paddingTop: 12,diff --git a/apps/mobile/src/screens/SettingsScreen.tsx b/apps/mobile/src/screens/SettingsScreen.tsxindex b33ee992..1c244349 100644--- a/apps/mobile/src/screens/SettingsScreen.tsx+++ b/apps/mobile/src/screens/SettingsScreen.tsx@@ -4,7 +4,7 @@*/import React, { useState, useCallback, useEffect } from "react"-import { Text, StyleSheet, Switch, View, ScrollView, Pressable, TextInput } from "react-native"+import { Text, StyleSheet, Switch, View, ScrollView, Pressable, TextInput, Linking } from "react-native"import { ScreenProps, Settings } from "../types/global"import { useTheme } from "../hooks/useTheme"import { useAutoSave } from "../hooks/useAutoSave"@@ -14,7 +14,7 @@ import { useTracking } from "../contexts/TrackingProvider"import { FloatingSaveIndicator } from "../components/ui/FloatingSaveIndicator"import { fonts } from "../styles/typography"import { SectionTitle, Card, Container, Divider, SettingRow, StatsCard } from "../components"-import { ChevronRight, ChevronDown, ChevronUp } from "lucide-react-native"+import { ChevronRight, ChevronDown, ChevronUp, ExternalLink } from "lucide-react-native"import { logger } from "../utils/logger"import { ConnectionSettings } from "../components/features/settings/ConnectionSettings"import { SyncStrategySettings } from "../components/features/settings/SyncStrategySettings"@@ -422,6 +422,53 @@ export function SettingsScreen({ navigation }: ScreenProps) {</View><ChevronRight size={20} color={colors.textLight} /></Pressable>++ <Divider />++ <Pressable+ testID="nav-export-data"+ style={({ pressed }) => [styles.linkRow, pressed && { opacity: colors.pressedOpacity }]}+ onPress={() => navigation.navigate("Export Data")}+ >+ <View style={styles.linkContent}>+ <Text style={[styles.linkLabel, { color: colors.text }]}>Export Data</Text>+ <Text style={[styles.linkSub, { color: colors.textSecondary }]}>+ Export locations as CSV, GeoJSON, GPX or KML+ </Text>+ </View>+ <ChevronRight size={20} color={colors.textLight} />+ </Pressable>+ </Card>+ </View>++ {/* About & Support */}+ <View style={styles.section}>+ <Card>+ <Pressable+ testID="nav-about"+ style={({ pressed }) => [styles.linkRow, pressed && { opacity: colors.pressedOpacity }]}+ onPress={() => navigation.navigate("About Colota")}+ >+ <View style={styles.linkContent}>+ <Text style={[styles.linkLabel, { color: colors.text }]}>About Colota</Text>+ <Text style={[styles.linkSub, { color: colors.textSecondary }]}>Version, licenses and links</Text>+ </View>+ <ChevronRight size={20} color={colors.textLight} />+ </Pressable>++ <Divider />++ <Pressable+ testID="nav-support"+ style={({ pressed }) => [styles.linkRow, pressed && { opacity: colors.pressedOpacity }]}+ onPress={() => Linking.openURL("https://mxd.codes/support")}+ >+ <View style={styles.linkContent}>+ <Text style={[styles.linkLabel, { color: colors.text }]}>Support</Text>+ <Text style={[styles.linkSub, { color: colors.textSecondary }]}>Support development of the app</Text>+ </View>+ <ExternalLink size={18} color={colors.textLight} />+ </Pressable></Card></View></ScrollView>@@ -435,7 +482,7 @@ const styles = StyleSheet.create({scrollContent: {paddingHorizontal: 16,paddingTop: 16,- paddingBottom: 40+ paddingBottom: 16},header: {marginBottom: 20