Colota - Android GPS Location tracker
Add welcome card and improve settings UX
Max Dietrich93537959b5c1
diff --git a/src/components/features/settings/ConnectionSettings.tsx b/src/components/features/settings/ConnectionSettings.tsxindex a392b8ef..86d17ad8 100644--- a/src/components/features/settings/ConnectionSettings.tsx+++ b/src/components/features/settings/ConnectionSettings.tsx@@ -47,7 +47,7 @@ export function ConnectionSettings({try {const recentLocation = await NativeLocationService.getMostRecentLocation()if (!recentLocation) {- setTestResponse("No location available yet. Start tracking first.")+ setTestResponse("No location data yet — Start tracking to collect a test point, then try again.")setTestError(true)return}@@ -166,6 +166,12 @@ export function ConnectionSettings({keyboardType="url"/>+ {!endpointInput && (+ <Text style={[styles.endpointHint, { color: colors.warning }]}>+ No server configured — locations are saved locally+ </Text>+ )}+{endpointInput.startsWith("http://") && !isPrivateHost(endpointInput) && (<Text style={[styles.httpWarning, { color: colors.warning }]}>HTTP only allowed for private IPs / localhost@@ -318,6 +324,11 @@ const styles = StyleSheet.create({fontWeight: "300",marginLeft: 12},+ endpointHint: {+ marginTop: 6,+ fontSize: 12,+ fontWeight: "500"+ },httpWarning: {marginTop: 6,fontSize: 12,diff --git a/src/components/features/settings/WelcomeCard.tsx b/src/components/features/settings/WelcomeCard.tsxnew file mode 100644index 00000000..452cfc2f--- /dev/null+++ b/src/components/features/settings/WelcomeCard.tsx@@ -0,0 +1,180 @@+/**+ * Copyright (C) 2026 Max Dietrich+ * Licensed under the GNU AGPLv3. See LICENSE in the project root for details.+ */++import React from "react"+import { Text, StyleSheet, View, TouchableOpacity } from "react-native"+import { Settings, ThemeColors } from "../../../types/global"+import { Card } from "../../ui/Card"++interface WelcomeCardProps {+ settings: Settings+ tracking: boolean+ colors: ThemeColors+ onDismiss: () => void+ onStartTracking: () => void+ onNavigateToSettings: () => void+ onNavigateToApiConfig: () => void+}++interface ChecklistItemProps {+ label: string+ completed: boolean+ colors: ThemeColors+ onPress?: () => void+}++function ChecklistItem({ label, completed, colors, onPress }: ChecklistItemProps) {+ const content = (+ <View style={styles.checklistItem}>+ <View+ style={[+ styles.checkCircle,+ {+ borderColor: completed ? colors.success : colors.border,+ backgroundColor: completed ? colors.success + "20" : "transparent"+ }+ ]}+ >+ {completed && <Text style={[styles.checkMark, { color: colors.success }]}>✓</Text>}+ </View>+ <Text+ style={[+ styles.checklistLabel,+ { color: completed ? colors.textSecondary : colors.text },+ completed && styles.checklistLabelCompleted+ ]}+ >+ {label}+ </Text>+ {onPress && !completed && <Text style={[styles.checklistArrow, { color: colors.textLight }]}>›</Text>}+ </View>+ )++ if (onPress && !completed) {+ return (+ <TouchableOpacity onPress={onPress} activeOpacity={0.6}>+ {content}+ </TouchableOpacity>+ )+ }++ return content+}++export function WelcomeCard({+ settings,+ tracking,+ colors,+ onDismiss,+ onStartTracking,+ onNavigateToSettings,+ onNavigateToApiConfig+}: WelcomeCardProps) {+ const hasEndpoint = settings.endpoint.trim().length > 0++ return (+ <View style={styles.container}>+ <Card style={{ borderColor: colors.primary, borderWidth: 2 }}>+ <Text style={[styles.title, { color: colors.text }]}>Welcome to Colota</Text>+ <Text style={[styles.subtitle, { color: colors.textSecondary }]}>Get started by completing these steps:</Text>++ <View style={styles.checklist}>+ <ChecklistItem label="Start tracking" completed={tracking} colors={colors} onPress={onStartTracking} />+ <ChecklistItem+ label="Configure your server endpoint"+ completed={hasEndpoint}+ colors={colors}+ onPress={onNavigateToSettings}+ />+ </View>++ <View style={styles.linkRow}>+ <TouchableOpacity onPress={onNavigateToApiConfig} activeOpacity={0.6}>+ <Text style={[styles.link, { color: colors.primary }]}>API field mapping ›</Text>+ </TouchableOpacity>+ <TouchableOpacity onPress={onNavigateToSettings} activeOpacity={0.6}>+ <Text style={[styles.link, { color: colors.primary }]}>Tracking presets ›</Text>+ </TouchableOpacity>+ </View>++ <TouchableOpacity+ style={[styles.dismissButton, { borderColor: colors.border }]}+ onPress={onDismiss}+ activeOpacity={0.6}+ >+ <Text style={[styles.dismissText, { color: colors.textSecondary }]}>Got it</Text>+ </TouchableOpacity>+ </Card>+ </View>+ )+}++const styles = StyleSheet.create({+ container: {+ marginBottom: 16+ },+ title: {+ fontSize: 20,+ fontWeight: "700",+ marginBottom: 4+ },+ subtitle: {+ fontSize: 14,+ marginBottom: 16+ },+ checklist: {+ gap: 12,+ marginBottom: 12+ },+ checklistItem: {+ flexDirection: "row",+ alignItems: "center"+ },+ checkCircle: {+ width: 24,+ height: 24,+ borderRadius: 12,+ borderWidth: 2,+ justifyContent: "center",+ alignItems: "center",+ marginRight: 12+ },+ checkMark: {+ fontSize: 13,+ fontWeight: "700"+ },+ checklistLabel: {+ fontSize: 15,+ fontWeight: "500",+ flex: 1+ },+ checklistLabelCompleted: {+ textDecorationLine: "line-through"+ },+ checklistArrow: {+ fontSize: 22,+ fontWeight: "300",+ marginLeft: 8+ },+ linkRow: {+ flexDirection: "row",+ gap: 16,+ marginBottom: 16+ },+ link: {+ fontSize: 14,+ fontWeight: "600"+ },+ dismissButton: {+ paddingVertical: 10,+ alignItems: "center",+ borderRadius: 10,+ borderWidth: 1.5+ },+ dismissText: {+ fontSize: 14,+ fontWeight: "600"+ }+})diff --git a/src/components/index.ts b/src/components/index.tsindex a2e4149f..05cde870 100644--- a/src/components/index.ts+++ b/src/components/index.ts@@ -48,3 +48,4 @@ export { StatsCard } from "./features/settings/StatsCard"export { PresetOption } from "./features/settings/PresetOption"export { ConnectionSettings } from "./features/settings/ConnectionSettings"export { SyncStrategySettings } from "./features/settings/SyncStrategySettings"+export { WelcomeCard } from "./features/settings/WelcomeCard"diff --git a/src/screens/DashboardScreen.tsx b/src/screens/DashboardScreen.tsxindex f1c67973..2ea3b7f5 100644--- a/src/screens/DashboardScreen.tsx+++ b/src/screens/DashboardScreen.tsx@@ -17,12 +17,13 @@ import {CoordinateDisplay,Container,QuickAccess,- DatabaseStatistics+ DatabaseStatistics,+ WelcomeCard} from "../components"import { STATS_REFRESH_IDLE } from "../constants"export function DashboardScreen({ navigation }: ScreenProps) {- const { coords, settings, tracking, startTracking, stopTracking } = useTracking()+ const { coords, settings, tracking, startTracking, stopTracking, setSettings } = useTracking()const { colors } = useTheme()const [stats, setStats] = useState<DatabaseStats>({@@ -186,6 +187,19 @@ export function DashboardScreen({ navigation }: ScreenProps) {{/* Content Section */}<View style={[styles.content, { backgroundColor: colors.background }]}>+ {/* Welcome Card (first run) */}+ {!settings.hasCompletedSetup && (+ <WelcomeCard+ settings={settings}+ tracking={tracking}+ colors={colors}+ onDismiss={() => setSettings({ ...settings, hasCompletedSetup: true })}+ onStartTracking={handleStart}+ onNavigateToSettings={() => navigation.navigate("Settings")}+ onNavigateToApiConfig={() => navigation.navigate("API Config")}+ />+ )}+{/* Coordinates */}{tracking && coords && (<View style={styles.metricsSection}>diff --git a/src/services/__tests__/NativeLocationService.test.ts b/src/services/__tests__/NativeLocationService.test.tsindex 010dc507..230081b0 100644--- a/src/services/__tests__/NativeLocationService.test.ts+++ b/src/services/__tests__/NativeLocationService.test.ts@@ -91,7 +91,8 @@ describe("NativeLocationService", () => {isOfflineMode: false,customFields: [],apiTemplate: "custom" as const,- syncPreset: "instant" as const+ syncPreset: "instant" as const,+ hasCompletedSetup: false}await NativeLocationService.start(settings)diff --git a/src/types/global.ts b/src/types/global.tsindex 88bee3d9..14590e06 100644--- a/src/types/global.ts+++ b/src/types/global.ts@@ -293,6 +293,7 @@ export interface Settings {// UI StatesyncPreset: SyncPreset+ hasCompletedSetup: boolean}export const DEFAULT_SETTINGS: Settings = {@@ -308,7 +309,8 @@ export const DEFAULT_SETTINGS: Settings = {accuracyThreshold: 50,syncPreset: "instant",maxRetries: 5,- isOfflineMode: false+ isOfflineMode: false,+ hasCompletedSetup: false} as const// ============================================================================