feat: seasonal race palette (Giro/Tour/Vuelta) + mobile picker

- theme.ts: useTheme() hook with race calendar (May–Sep windows),
  auto-detects Giro/Tour/Vuelta by date; stores override in SQLite
- All screens (feed, import, activity, tab bar) now use accent/dim
  from useTheme() instead of hardcoded #60a5fa
- Settings: Palette section with Auto/Default/Giro/Tour/Vuelta buttons
  to override the auto-detected palette for testing
This commit is contained in:
Davide Scaini
2026-04-25 15:41:20 +02:00
parent 5330b7b489
commit dfe5307ab4
6 changed files with 111 additions and 50 deletions
+4 -2
View File
@@ -6,6 +6,7 @@ import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
import { insertActivity } from '@/db/queries';
import { PyodideWebView } from '@/extraction/PyodideWebView';
import { extractFile } from '@/extraction/extractActivity';
import { useTheme } from '@/theme';
const FIT_EXTENSIONS = ['.fit', '.fit.gz'];
const OTHER_EXTENSIONS = ['.gpx', '.tcx', '.gpx.gz', '.tcx.gz'];
@@ -19,6 +20,7 @@ type ImportState =
export default function ImportScreen() {
const db = useSQLiteContext();
const theme = useTheme();
const [state, setState] = useState<ImportState>({ status: 'idle' });
async function pickFile() {
@@ -143,7 +145,7 @@ export default function ImportScreen() {
<Text style={styles.body}>
Import a FIT, GPX, or TCX file extracted on your device, nothing uploaded.
You can also import a pre-extracted BAS <Text style={styles.code}>.json</Text> file directly.
You can also import a pre-extracted BAS <Text style={[styles.code, { color: theme.accent }]}>.json</Text> file directly.
</Text>
<Pressable
@@ -157,7 +159,7 @@ export default function ImportScreen() {
{state.status === 'loading' && (
<View style={styles.statusBox}>
<Text style={styles.statusMsg}>{state.msg}</Text>
<Text style={[styles.statusMsg, { color: theme.accent }]}>{state.msg}</Text>
<Text style={styles.statusHint}>
First run downloads ~35 MB (Python runtime + packages). Subsequent runs are instant.
</Text>