|
1 | | -import { View, Text, ScrollView, Pressable, ActivityIndicator, Linking } from "react-native"; |
| 1 | +import { View, Text, ScrollView, Linking } from "react-native"; |
2 | 2 | import { SafeAreaView } from "react-native-safe-area-context"; |
3 | 3 | import { useLocalSearchParams, useRouter } from "expo-router"; |
4 | | -import { Inbox, ChevronRight } from "lucide-react-native"; |
5 | | -import { Card, CardContent } from "~/components/ui/Card"; |
| 4 | +import { Inbox, ChevronRight, AlertCircle } from "lucide-react-native"; |
| 5 | +import { PressableCard } from "~/components/ui/PressableCard"; |
| 6 | +import { EmptyState } from "~/components/ui/EmptyState"; |
| 7 | +import { ListSkeleton } from "~/components/ui/ListSkeleton"; |
6 | 8 | import { ScreenHeader } from "~/components/common/ScreenHeader"; |
7 | 9 | import { useApp, type NavigationItem } from "~/hooks/useApps"; |
8 | 10 | import { getIcon } from "~/lib/getIcon"; |
@@ -59,24 +61,23 @@ export default function AppHomeScreen() { |
59 | 61 | const Icon = getIcon(item.icon); |
60 | 62 | const navigable = isNavigable(item); |
61 | 63 | return ( |
62 | | - <Pressable |
| 64 | + <PressableCard |
63 | 65 | key={item.id} |
64 | 66 | disabled={!navigable} |
| 67 | + haptic={navigable} |
65 | 68 | onPress={() => navigate(item)} |
66 | | - className={navigable ? "" : "opacity-40"} |
| 69 | + className={`flex-row items-center p-3.5 ${navigable ? "" : "opacity-40"}`} |
| 70 | + accessibilityRole={navigable ? "button" : undefined} |
| 71 | + accessibilityLabel={item.label} |
67 | 72 | > |
68 | | - <Card> |
69 | | - <CardContent className="flex-row items-center py-3.5"> |
70 | | - <View className="rounded-xl bg-primary/10 p-2.5"> |
71 | | - <Icon size={20} color="#1e40af" /> |
72 | | - </View> |
73 | | - <Text className="ml-3 flex-1 text-base font-medium text-card-foreground"> |
74 | | - {item.label} |
75 | | - </Text> |
76 | | - {navigable ? <ChevronRight size={18} color="#94a3b8" /> : null} |
77 | | - </CardContent> |
78 | | - </Card> |
79 | | - </Pressable> |
| 73 | + <View className="rounded-xl bg-primary/10 p-2.5"> |
| 74 | + <Icon size={20} color="#1e40af" /> |
| 75 | + </View> |
| 76 | + <Text className="ml-3 flex-1 text-base font-medium text-card-foreground"> |
| 77 | + {item.label} |
| 78 | + </Text> |
| 79 | + {navigable ? <ChevronRight size={18} color="#94a3b8" /> : null} |
| 80 | + </PressableCard> |
80 | 81 | ); |
81 | 82 | }; |
82 | 83 |
|
@@ -105,22 +106,25 @@ export default function AppHomeScreen() { |
105 | 106 | <ScreenHeader title={displayName} backFallback="/(tabs)/apps" /> |
106 | 107 | <ScrollView className="flex-1" contentContainerClassName="px-5 pb-8 pt-2"> |
107 | 108 | {isLoading ? ( |
108 | | - <View className="flex-1 items-center justify-center pt-20"> |
109 | | - <ActivityIndicator size="large" color="#1e40af" /> |
| 109 | + <View className="pt-3"> |
| 110 | + <ListSkeleton count={6} /> |
110 | 111 | </View> |
111 | 112 | ) : error ? ( |
112 | | - <View className="flex-1 items-center justify-center pt-20"> |
113 | | - <Text className="text-base text-destructive">{error.message}</Text> |
| 113 | + <View className="pt-20"> |
| 114 | + <EmptyState |
| 115 | + icon={AlertCircle} |
| 116 | + variant="error" |
| 117 | + title="Couldn't Load App" |
| 118 | + description={error.message} |
| 119 | + /> |
114 | 120 | </View> |
115 | 121 | ) : navigation.length === 0 ? ( |
116 | | - <View className="flex-1 items-center justify-center pt-20"> |
117 | | - <View className="rounded-2xl bg-muted p-6"> |
118 | | - <Inbox size={40} color="#94a3b8" /> |
119 | | - </View> |
120 | | - <Text className="mt-5 text-lg font-semibold text-foreground">No Navigation</Text> |
121 | | - <Text className="mt-2 text-center text-sm text-muted-foreground"> |
122 | | - This app hasn't published a navigation menu yet. |
123 | | - </Text> |
| 122 | + <View className="pt-20"> |
| 123 | + <EmptyState |
| 124 | + icon={Inbox} |
| 125 | + title="No Navigation" |
| 126 | + description="This app hasn't published a navigation menu yet." |
| 127 | + /> |
124 | 128 | </View> |
125 | 129 | ) : ( |
126 | 130 | <View> |
|
0 commit comments