Skip to content

Commit 1bb06b6

Browse files
committed
fix: resolve Expo Router layout warning and enhance Supabase UX
- Addressed the nested layout warning in Expo Router by implementing a new layout wrapper in `app/reader/_layout.tsx`. - Improved user onboarding experience by adding a warning banner in the Home screen when Supabase environment variables are unconfigured, utilizing the new `isSupabaseConfigured` helper from `lib/supabase.ts`. - Verified changes with successful linting and type-checking, ensuring no errors were present.
1 parent 033ad07 commit 1bb06b6

5 files changed

Lines changed: 104 additions & 5 deletions

File tree

AGENT.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ These rules govern the development of the Aion project.
99

1010
## Change Log
1111

12+
### 2026-05-21 (Australia/Sydney)
13+
**Raouf:**
14+
- **Scope:** Expo Router Layout and Supabase UX Warning
15+
- **Summary:** Resolved the Expo Router nested layout warning `[Layout children]: No route named "reader" exists in nested children` by creating a nested navigation layout wrapper (`app/reader/_layout.tsx`). Also improved user onboarding UX by detecting placeholder/unconfigured Supabase environment variables in `lib/supabase.ts` and showing a modern warning banner on the Home screen guiding the user on how to update their `.env` file.
16+
- **Files Changed:**
17+
- [app/reader/_layout.tsx](file:///Users/raoof.r12/Desktop/Raouf/Aion/app/reader/_layout.tsx) - Created nested Stack router layout wrapper.
18+
- [lib/supabase.ts](file:///Users/raoof.r12/Desktop/Raouf/Aion/lib/supabase.ts) - Exported `isSupabaseConfigured` helper checking for default placeholder values.
19+
- [app/(tabs)/index.tsx](file:///Users/raoof.r12/Desktop/Raouf/Aion/app/(tabs)/index.tsx) - Added amber-colored alert warning banner when Supabase setup is required.
20+
- **Verification:** Ran `npm run lint` and `npm run type-check`, both completed successfully with 0 errors.
21+
- **Follow-ups:** None.
22+
1223
### 2026-05-21 (Australia/Sydney)
1324
**Raouf:**
1425
- **Scope:** Backend IDOR Security Fix

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

77
## Change Log
88

9+
### 2026-05-21 (Australia/Sydney)
10+
**Raouf:**
11+
- **Scope:** Expo Router Layout and Supabase UX Warning
12+
- **Summary:** Resolved the Expo Router nested layout warning `[Layout children]: No route named "reader" exists in nested children` by creating a nested navigation layout wrapper (`app/reader/_layout.tsx`). Also improved user onboarding UX by detecting placeholder/unconfigured Supabase environment variables in `lib/supabase.ts` and showing a modern warning banner on the Home screen guiding the user on how to update their `.env` file.
13+
- **Files Changed:**
14+
- [app/reader/_layout.tsx](file:///Users/raoof.r12/Desktop/Raouf/Aion/app/reader/_layout.tsx) - Created nested Stack router layout wrapper.
15+
- [lib/supabase.ts](file:///Users/raoof.r12/Desktop/Raouf/Aion/lib/supabase.ts) - Exported `isSupabaseConfigured` helper checking for default placeholder values.
16+
- [app/(tabs)/index.tsx](file:///Users/raoof.r12/Desktop/Raouf/Aion/app/(tabs)/index.tsx) - Added amber-colored alert warning banner when Supabase setup is required.
17+
- **Verification:** Ran `npm run lint` and `npm run type-check`, both completed successfully with 0 errors.
18+
- **Follow-ups:** None.
19+
920
### 2026-05-21 (Australia/Sydney)
1021
**Raouf:**
1122
- **Scope:** Backend IDOR Security Fix

app/(tabs)/index.tsx

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ import {
2828
Zap,
2929
BookOpen,
3030
ChevronRight,
31+
AlertTriangle,
3132
} from "lucide-react-native";
3233
import { PromptPill } from "../../components/PromptPill";
3334
import { ChatInput } from "../../components/ChatInput";
3435
import { colors, fonts } from "../../lib/theme";
3536
import { getVerseOfTheDay } from "../../lib/bible-data";
37+
import { isSupabaseConfigured } from "../../lib/supabase";
3638

3739
const PROMPT_SUGGESTIONS = [
3840
{ Icon: Search, label: "Find verses with the number 444" },
@@ -116,6 +118,23 @@ export default function HomeScreen() {
116118
"Seek, and you shall find."
117119
</Animated.Text>
118120

121+
{/* Supabase Warning Banner */}
122+
{!isSupabaseConfigured && (
123+
<Animated.View
124+
entering={FadeInDown.duration(400).delay(650)}
125+
style={styles.warningCard}
126+
accessibilityRole="alert"
127+
>
128+
<View style={styles.warningHeader}>
129+
<AlertTriangle size={14} color={colors.warning} />
130+
<Text style={styles.warningLabel}>Database Setup Required</Text>
131+
</View>
132+
<Text style={styles.warningContent}>
133+
Please update your <Text style={styles.codeText}>.env</Text> file in the project root with your actual Supabase URL and Anon Key, then restart the Expo server.
134+
</Text>
135+
</Animated.View>
136+
)}
137+
119138
{/* Verse of the Day */}
120139
<Animated.View
121140
entering={FadeIn.duration(400).delay(700)}
@@ -325,4 +344,39 @@ const styles = StyleSheet.create({
325344
fontFamily: fonts.uiMedium,
326345
marginLeft: 12,
327346
},
347+
warningCard: {
348+
width: "100%",
349+
maxWidth: 420,
350+
backgroundColor: colors.warningBg,
351+
borderWidth: 1,
352+
borderColor: "rgba(245, 158, 11, 0.25)",
353+
borderRadius: 16,
354+
padding: 16,
355+
marginBottom: 16,
356+
},
357+
warningHeader: {
358+
flexDirection: "row",
359+
alignItems: "center",
360+
gap: 8,
361+
marginBottom: 8,
362+
},
363+
warningLabel: {
364+
color: colors.warning,
365+
fontSize: 11,
366+
fontFamily: fonts.uiBold,
367+
letterSpacing: 1.5,
368+
textTransform: "uppercase",
369+
},
370+
warningContent: {
371+
color: colors.textPrimary,
372+
fontSize: 13,
373+
fontFamily: fonts.ui,
374+
lineHeight: 18,
375+
opacity: 0.9,
376+
},
377+
codeText: {
378+
fontFamily: Platform.OS === "ios" ? "Courier" : "monospace",
379+
fontWeight: "700",
380+
color: colors.warning,
381+
},
328382
});

app/reader/_layout.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Stack } from "expo-router";
2+
import { colors } from "../../lib/theme";
3+
4+
export default function ReaderLayout() {
5+
return (
6+
<Stack
7+
screenOptions={{
8+
headerShown: false,
9+
contentStyle: { backgroundColor: colors.void },
10+
animation: "slide_from_right",
11+
}}
12+
>
13+
<Stack.Screen name="index" />
14+
<Stack.Screen name="[bookId]/index" />
15+
<Stack.Screen name="[bookId]/[chapter]" />
16+
</Stack>
17+
);
18+
}

lib/supabase.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ import { createClient } from "@supabase/supabase-js";
55
const supabaseUrl = process.env.EXPO_PUBLIC_SUPABASE_URL || "https://placeholder-url.supabase.co";
66
const supabaseAnonKey = process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY || "placeholder-anon-key";
77

8-
if (
9-
!process.env.EXPO_PUBLIC_SUPABASE_URL ||
10-
process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY === "your-anon-key" ||
11-
!process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY
12-
) {
8+
export const isSupabaseConfigured = !!(
9+
process.env.EXPO_PUBLIC_SUPABASE_URL &&
10+
process.env.EXPO_PUBLIC_SUPABASE_URL !== "https://your-project.supabase.co" &&
11+
!process.env.EXPO_PUBLIC_SUPABASE_URL.includes("placeholder-url") &&
12+
process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY &&
13+
process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY !== "your-anon-key" &&
14+
!process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY.includes("placeholder-anon-key")
15+
);
16+
17+
if (!isSupabaseConfigured) {
1318
console.warn(
1419
"Warning: Supabase environment variables (EXPO_PUBLIC_SUPABASE_URL or EXPO_PUBLIC_SUPABASE_ANON_KEY) are missing or using placeholder values. Please check your .env file.",
1520
);

0 commit comments

Comments
 (0)