-
Notifications
You must be signed in to change notification settings - Fork 2
feat: improve home, setting, profile and error handling #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| import { TouchableOpacity, Text, View } from "react-native"; | ||
| import { TouchableOpacity, Text, View, ActivityIndicator } from "react-native"; | ||
| import Ionicons from "@expo/vector-icons/Ionicons"; | ||
| import {ProfileDisplayProps} from "@/lib/types/profile" | ||
| import { ProfileDisplayProps } from "@/lib/types/profile"; | ||
| import { useProfile } from "@/lib/api/profile"; | ||
|
|
||
| export function ProfileDisplay({ onEditPress }: ProfileDisplayProps) { | ||
| const { data: profile } = useProfile(); | ||
| const { data: profile, isLoading, isError } = useProfile(); | ||
|
|
||
| if (!profile) { | ||
| if (isLoading) return <ActivityIndicator />; | ||
|
|
||
| if (isError || !profile) { | ||
| return null; | ||
| } | ||
|
Comment on lines
+9
to
13
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { RoutineCard } from "@/components/routine-card"; | ||
| import { Text, View } from "react-native"; | ||
| import type { RoutineContentProps } from "@/lib/types/routine"; | ||
|
|
||
| export function RoutineContent({ | ||
| isLoading, | ||
| routineData, | ||
| todayRoutine, | ||
| }: RoutineContentProps) { | ||
| if (isLoading || !routineData) return null; | ||
|
|
||
| const isWeekEmpty = routineData.week.every((day) => day.slots.length === 0); | ||
|
|
||
| if (isWeekEmpty) { | ||
| return ( | ||
| <View className="px-4 py-20"> | ||
| <Text className="text-center text-muted-foreground text-lg"> | ||
| No classes scheduled this week | ||
| </Text> | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| if (!todayRoutine?.slots.length) { | ||
| return ( | ||
| <View className="px-4 py-20"> | ||
| <Text className="text-center text-muted-foreground text-lg"> | ||
| No classes scheduled for this day | ||
| </Text> | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| {todayRoutine.slots.map((slot) => ( | ||
| <RoutineCard | ||
| key={`${slot.moduleCode}-${slot.startTime}-${slot.classType}`} | ||
| slot={slot} | ||
| /> | ||
| ))} | ||
| </> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import { View, Text, TouchableOpacity } from "react-native"; | ||
| import Ionicons from "@expo/vector-icons/Ionicons"; | ||
| import { useColorScheme } from "@/lib/use-color-scheme"; | ||
| import type { SettingItemProps } from "@/lib/types/setting"; | ||
|
|
||
| export function SettingItem({ | ||
| icon, | ||
| label, | ||
| value, | ||
| onPress, | ||
| showChevron = true, | ||
| isDestructive = false, | ||
| rightElement, | ||
| isLast = false, | ||
| isDark, | ||
| }: SettingItemProps) { | ||
|
Comment on lines
+14
to
+16
|
||
| const { isDarkColorScheme } = useColorScheme(); | ||
| const effectiveDark = isDark ?? isDarkColorScheme; | ||
|
|
||
| return ( | ||
| <View> | ||
| <TouchableOpacity | ||
| onPress={onPress} | ||
| disabled={!onPress} | ||
| className={`flex-row items-center px-5 py-4 gap-4 ${ | ||
| onPress ? "active:bg-accent/50" : "" | ||
| }`} | ||
| > | ||
| <View | ||
| className={`w-9 h-9 rounded-full items-center justify-center ${ | ||
| isDestructive | ||
| ? "bg-destructive/15" | ||
| : effectiveDark | ||
| ? "bg-primary/20" | ||
| : "bg-primary/10" | ||
| }`} | ||
| > | ||
| <Ionicons | ||
| name={icon} | ||
| size={20} | ||
| color={ | ||
| isDestructive ? "#ef4444" : effectiveDark ? "#60a5fa" : "#2563eb" | ||
| } | ||
| /> | ||
| </View> | ||
| <View className="flex-1"> | ||
| <Text | ||
| className={`text-base font-semibold ${ | ||
| isDestructive ? "text-destructive" : "text-foreground" | ||
| }`} | ||
| > | ||
| {label} | ||
| </Text> | ||
| </View> | ||
| {value && ( | ||
| <Text className="text-muted-foreground text-sm mr-3 font-medium"> | ||
| {value} | ||
| </Text> | ||
| )} | ||
| {rightElement} | ||
| {showChevron && !rightElement && ( | ||
| <Ionicons | ||
| name="chevron-forward" | ||
| size={18} | ||
| color={effectiveDark ? "#9ca3af" : "#6b7280"} | ||
| /> | ||
| )} | ||
| </TouchableOpacity> | ||
| {!isLast && <View className="mx-5 h-[0.5px] bg-border" />} | ||
| </View> | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing
extra.eas.projectIdandownerwill repoint EAS builds/updates to a different Expo project/account. This isn’t mentioned in the PR description and is likely to break CI/CD or OTA updates for existing users. If this wasn’t intentional, revert these fields; if it was, please document why and ensureeas.json/deployment docs are updated accordingly.