Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions mobile/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,26 @@
"**/*"
],
"ios": {
"supportsTablet": false
"supportsTablet": false,
"bundleIdentifier": "com.discoverly.app"
},
"android": {
"package": "com.discoverly.app",
"intentFilters": [
{
"action": "VIEW",
"data": [
{
"scheme": "discoverly"
}
],
"category": [
"BROWSABLE",
"DEFAULT"
]
}
]
},
"android": {},
"web": {
"bundler": "metro"
},
Expand Down
14 changes: 14 additions & 0 deletions mobile/app/(auth)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Stack } from "expo-router"

Check warning on line 1 in mobile/app/(auth)/_layout.tsx

View workflow job for this annotation

GitHub Actions / mobile-checks

Insert `;`

export default function AuthLayout() {
return (
<Stack
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen name="login" />
<Stack.Screen name="register" />
</Stack>
)

Check warning on line 13 in mobile/app/(auth)/_layout.tsx

View workflow job for this annotation

GitHub Actions / mobile-checks

Insert `;`
}
22 changes: 18 additions & 4 deletions mobile/app/(auth)/login.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { Link } from "expo-router"
import { Text, View } from "react-native"
import { Link, useRouter } from "expo-router"

Check warning on line 1 in mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / mobile-checks

Insert `;`
import { Pressable, Text, View } from "react-native"

Check warning on line 2 in mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / mobile-checks

Insert `;`

Check warning on line 2 in mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / mobile-checks

There should be at least one empty line between import groups
import { useAuthStore } from "../../src/store/useAuthStore"

Check warning on line 3 in mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / mobile-checks

Insert `;`

export default function LoginScreen() {
const router = useRouter()

Check warning on line 6 in mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / mobile-checks

Insert `;`
const setToken = useAuthStore((state) => state.setToken)

Check warning on line 7 in mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / mobile-checks

Insert `;`

const onSignIn = () => {
setToken("session_token")

Check warning on line 10 in mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / mobile-checks

Insert `;`
router.replace("/(tabs)/discover")

Check warning on line 11 in mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / mobile-checks

Insert `;`
}

return (
<View
style={{
Expand All @@ -14,8 +23,13 @@
}}
>
<Text style={{ fontSize: 28, fontWeight: "700" }}>Welcome Back</Text>
<Text>Phase 1 auth UI scaffold.</Text>
<Link href="/(tabs)/discover">Mock Sign In</Link>
<Text>Sign in to discover dishes curated for your taste.</Text>
<Pressable
onPress={onSignIn}
style={{ backgroundColor: "#111827", borderRadius: 10, paddingHorizontal: 14, paddingVertical: 10 }}
>
<Text style={{ color: "#fff", fontWeight: "700" }}>Sign In</Text>
</Pressable>
<Link href="/(auth)/register">Go To Register</Link>
</View>
)
Expand Down
2 changes: 1 addition & 1 deletion mobile/app/(auth)/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function RegisterScreen() {
}}
>
<Text style={{ fontSize: 28, fontWeight: "700" }}>Create Account</Text>
<Text>Phase 1 registration UI scaffold.</Text>
<Text>Create your account and start matching meals instantly.</Text>
<Link href="/(auth)/login">Back To Login</Link>
</View>
)
Expand Down
8 changes: 7 additions & 1 deletion mobile/app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { Tabs } from "expo-router"
import { Redirect, Tabs } from "expo-router"
import { useCartStore } from "../../src/store/useCartStore"
import { useAuthStore } from "../../src/store/useAuthStore"

export default function TabsLayout() {
const token = useAuthStore((state) => state.token)
const itemCount = useCartStore((state) => state.items.length)

if (!token) {
return <Redirect href="/(auth)/login" />
}

return (
<Tabs>
<Tabs.Screen name="discover" options={{ title: "Discover" }} />
Expand Down
20 changes: 18 additions & 2 deletions mobile/app/(tabs)/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import { Text, View } from "react-native"
import { useRouter } from "expo-router"
import { Pressable, Text, View } from "react-native"
import { useAuthStore } from "../../src/store/useAuthStore"

export default function ProfileScreen() {
const router = useRouter()
const logout = useAuthStore((state) => state.logout)

const onLogout = () => {
logout()
router.replace("/(auth)/login")
}

return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<View style={{ flex: 1, alignItems: "center", justifyContent: "center", gap: 12 }}>
<Text>User Profile & Wallet.</Text>
<Pressable
onPress={onLogout}
style={{ backgroundColor: "#E53935", borderRadius: 10, paddingHorizontal: 14, paddingVertical: 10 }}
>
<Text style={{ color: "#fff", fontWeight: "700" }}>Logout</Text>
</Pressable>
</View>
)
}
5 changes: 4 additions & 1 deletion mobile/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Redirect } from "expo-router"
import { useAuthStore } from "../src/store/useAuthStore"

export default function IndexScreen() {
return <Redirect href="/(auth)/login" />
const token = useAuthStore((state) => state.token)

return <Redirect href={token ? "/(tabs)/discover" : "/(auth)/login"} />
}