Skip to content

Colota - Android GPS Location tracker

fix(ui): replace hardcoded colors and unify floating feedback component

Max Dietrich4c68a369b7df
diff --git a/src/components/ui/FloatingSaveIndicator.tsx b/src/components/ui/FloatingSaveIndicator.tsx
index 9b89d0c4..ca4ed1a8 100644
--- a/src/components/ui/FloatingSaveIndicator.tsx
+++ b/src/components/ui/FloatingSaveIndicator.tsx
@@ -9,6 +9,8 @@ import { View, Text, StyleSheet } from "react-native";
interface Props {
saving: boolean;
success: boolean;
+ /** Optional custom message. When provided, controls visibility instead of saving/success. */
+ message?: string | null;
colors: {
info: string;
success: string;
@@ -19,9 +21,19 @@ interface Props {
export const FloatingSaveIndicator: React.FC<Props> = ({
saving,
success,
+ message,
colors,
}) => {
- if (!saving && !success) return null;
+ const hasMessage = message != null;
+ const visible = hasMessage || saving || success;
+
+ if (!visible) return null;
+
+ const displayText = hasMessage
+ ? message
+ : saving
+ ? "⏳ Saving & restarting..."
+ : "✓ Saved";
return (
<View style={styles.container}>
@@ -34,9 +46,7 @@ export const FloatingSaveIndicator: React.FC<Props> = ({
},
]}
>
- <Text style={[styles.text, { color: colors.text }]}>
- {saving ? "⏳ Saving & restarting..." : "✓ Saved"}
- </Text>
+ <Text style={[styles.text, { color: colors.text }]}>{displayText}</Text>
</View>
</View>
);
@@ -61,5 +71,5 @@ const styles = StyleSheet.create({
shadowRadius: 8,
elevation: 8,
},
- text: { fontSize: 14, fontWeight: "600", color: "#fff" },
+ text: { fontSize: 14, fontWeight: "600" },
});
diff --git a/src/screens/DataManagementScreen.tsx b/src/screens/DataManagementScreen.tsx
index 0b05c400..43af517d 100644
--- a/src/screens/DataManagementScreen.tsx
+++ b/src/screens/DataManagementScreen.tsx
@@ -18,7 +18,14 @@ import { useFocusEffect } from "@react-navigation/native";
import { ScreenProps, DatabaseStats } from "../types/global";
import { useTheme } from "../hooks/useTheme";
import NativeLocationService from "../services/NativeLocationService";
-import { Button, SectionTitle, Card, Container, Divider } from "../components";
+import {
+ Button,
+ SectionTitle,
+ Card,
+ Container,
+ Divider,
+ FloatingSaveIndicator,
+} from "../components";
export function DataManagementScreen({}: ScreenProps) {
const { colors } = useTheme();
@@ -322,20 +329,12 @@ export function DataManagementScreen({}: ScreenProps) {
</ScrollView>
{/* Floating Feedback */}
- {feedback && (
- <View style={styles.feedbackContainer}>
- <View
- style={[
- styles.feedbackBadge,
- {
- backgroundColor: isProcessing ? colors.info : colors.success,
- },
- ]}
- >
- <Text style={styles.feedbackText}>{feedback}</Text>
- </View>
- </View>
- )}
+ <FloatingSaveIndicator
+ saving={isProcessing}
+ success={false}
+ message={feedback}
+ colors={colors}
+ />
</KeyboardAvoidingView>
</Container>
);
@@ -478,27 +477,4 @@ const styles = StyleSheet.create({
buttonDisabled: {
opacity: 0.5,
},
- feedbackContainer: {
- position: "absolute",
- bottom: 20,
- left: 0,
- right: 0,
- alignItems: "center",
- zIndex: 1000,
- pointerEvents: "none",
- },
- feedbackBadge: {
- paddingHorizontal: 20,
- paddingVertical: 12,
- borderRadius: 24,
- shadowOffset: { width: 0, height: 4 },
- shadowOpacity: 0.3,
- shadowRadius: 8,
- elevation: 8,
- },
- feedbackText: {
- fontSize: 14,
- fontWeight: "600",
- color: "#fff",
- },
});
diff --git a/src/screens/ExportDataScreen.tsx b/src/screens/ExportDataScreen.tsx
index 7c2deca5..6cb5b912 100644
--- a/src/screens/ExportDataScreen.tsx
+++ b/src/screens/ExportDataScreen.tsx
@@ -328,10 +328,10 @@ export function ExportDataScreen() {
<View style={styles.exportContent}>
<Text style={styles.exportIcon}>📤</Text>
<View style={styles.exportText}>
- <Text style={styles.exportTitle}>
+ <Text style={[styles.exportTitle, { color: "#fff" }]}>
Export {selectedFormat.toUpperCase()}
</Text>
- <Text style={styles.exportSubtitle}>
+ <Text style={[styles.exportSubtitle, { color: "#fff" }]}>
{stats.totalLocations.toLocaleString()} locations
{fileSize ? ` • ${fileSize}` : ""}
</Text>
@@ -748,12 +748,10 @@ const styles = StyleSheet.create({
exportTitle: {
fontSize: 17,
fontWeight: "600",
- color: "#fff",
marginBottom: 2,
},
exportSubtitle: {
fontSize: 13,
- color: "#fff",
opacity: 0.9,
},
disabledButton: {
diff --git a/src/screens/LocationInspectorScreen.tsx b/src/screens/LocationInspectorScreen.tsx
index 4b7ef7ff..cf9fd4c1 100644
--- a/src/screens/LocationInspectorScreen.tsx
+++ b/src/screens/LocationInspectorScreen.tsx
@@ -264,9 +264,7 @@ export function LocationInspectorScreen() {
<Text
style={[
styles.limitBtnText,
- limit === v
- ? styles.limitBtnTextActive
- : { color: colors.text },
+ { color: limit === v ? "#fff" : colors.text },
]}
>
{v}
@@ -457,9 +455,6 @@ const styles = StyleSheet.create({
fontSize: 12,
fontWeight: "600",
},
- limitBtnTextActive: {
- color: "#FFFFFF",
- },
paginationRow: {
flexDirection: "row",
alignItems: "center",