feat(mobile): add AsyncStorage dep + env reader + theme constants

This commit is contained in:
byGalax
2026-05-13 23:54:10 +02:00
parent 035b5f078d
commit a275703ba6
5 changed files with 72 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
# Copy to `.env.local` and fill in. Expo bundles only EXPO_PUBLIC_* vars
# into the JS, which is what we want for these — they are public Supabase
# project keys (anon key + URL) protected by RLS on the server.
EXPO_PUBLIC_SUPABASE_URL=https://your-supabase-host.example
EXPO_PUBLIC_SUPABASE_ANON_KEY=sb_publishable_...
EXPO_PUBLIC_AUTH_REDIRECT_URL=netralax://auth/callback
+19
View File
@@ -0,0 +1,19 @@
// EXPO_PUBLIC_* vars are inlined at bundle time by Expo's Babel plugin.
// We pull them through a single typed module so a missing var is a loud
// startup error rather than a confusing Supabase 401 later.
function required(name: string): string {
const v = process.env[name];
if (!v || v.length === 0) {
throw new Error(
'Missing required env var ' + name + '. Set it in apps/mobile/.env.local — see .env.example.',
);
}
return v;
}
export const env = {
supabaseUrl: required('EXPO_PUBLIC_SUPABASE_URL'),
supabaseAnonKey: required('EXPO_PUBLIC_SUPABASE_ANON_KEY'),
authRedirectUrl: process.env.EXPO_PUBLIC_AUTH_REDIRECT_URL ?? 'netralax://auth/callback',
} as const;
+1
View File
@@ -20,6 +20,7 @@
"dependencies": {
"@chat-app/db-types": "workspace:*",
"@chat-app/shared": "workspace:*",
"@react-native-async-storage/async-storage": "^3.0.2",
"@supabase/supabase-js": "^2.46.0",
"expo": "^52.0.0",
"expo-application": "^55.0.15",
+25
View File
@@ -0,0 +1,25 @@
// Centralised hex constants. Anything new screen / component should
// import from here instead of inlining a literal so we have a single
// place to swap brand tones later. The Phase-0 review flagged five
// hex codes duplicated across components — this is the fix.
export const colors = {
// Surfaces / chrome
bg: '#0b0b0f',
surface: '#16161c',
border: '#27272e',
// Text
text: '#ffffff',
textMuted: '#9ca3af',
textDim: '#6b7280',
// Accents
accent: '#5865f2',
accentMuted: 'rgba(88,101,242,0.15)',
// Status
danger: '#ef4444',
success: '#10b981',
} as const;
export type ColorKey = keyof typeof colors;