Waseel: driver app, dispatch, POI suggestions, map fixes
This commit is contained in:
+23
-19
@@ -16,7 +16,9 @@ import { NearbySuggestions } from "@/components/nearby-suggestions";
|
||||
import { RideCard } from "@/components/ride-card";
|
||||
import { ServiceSelector } from "@/components/service-selector";
|
||||
import { icons, images } from "@/constants";
|
||||
import { useT } from "@/lib/i18n";
|
||||
import { useSession } from "@/lib/session";
|
||||
import { useTheme } from "@/lib/theme";
|
||||
import { useUserLocation } from "@/lib/use-user-location";
|
||||
import { useLocationStore } from "@/store";
|
||||
import { useFetch } from "@/lib/fetch";
|
||||
@@ -27,6 +29,8 @@ const Home = () => {
|
||||
(state) => state.setDestinationLocation,
|
||||
);
|
||||
const { signOut, user } = useSession();
|
||||
const { isDark } = useTheme();
|
||||
const t = useT();
|
||||
const { data: recentRides, loading } = useFetch<Ride[]>("/(api)/ride/list");
|
||||
|
||||
const { status: locationStatus, retry: retryLocation } = useUserLocation();
|
||||
@@ -47,7 +51,7 @@ const Home = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView className="bg-general-500">
|
||||
<SafeAreaView className="bg-general-500 dark:bg-neutral-950">
|
||||
<FlatList
|
||||
data={recentRides?.slice(0, 5)}
|
||||
renderItem={({ item }) => <RideCard ride={item} />}
|
||||
@@ -62,14 +66,14 @@ const Home = () => {
|
||||
<>
|
||||
<Image
|
||||
source={images.noResult}
|
||||
alt="No recent rides found"
|
||||
alt={t("home.noRecentAlt")}
|
||||
className="w-40 h-40"
|
||||
resizeMode="contain"
|
||||
/>
|
||||
<Text className="text-sm">No recent rides found.</Text>
|
||||
<Text className="text-sm text-black dark:text-white">{t("home.noRecent")}</Text>
|
||||
</>
|
||||
) : (
|
||||
<ActivityIndicator size="small" color="#000" />
|
||||
<ActivityIndicator size="small" color={isDark ? "#fff" : "#000"} />
|
||||
)}
|
||||
</View>
|
||||
}
|
||||
@@ -83,33 +87,33 @@ const Home = () => {
|
||||
<>
|
||||
<View className="flex flex-row items-center justify-between my-5">
|
||||
<Text
|
||||
className="text-base font-JakartaExtraBold"
|
||||
className="text-base font-JakartaExtraBold text-black dark:text-white"
|
||||
numberOfLines={1}
|
||||
>
|
||||
Welcome {user?.name || user?.email} 👋
|
||||
{t("home.welcome", { name: user?.name || user?.email || "" })}
|
||||
</Text>
|
||||
|
||||
<View className="flex flex-row items-center gap-x-1">
|
||||
<TouchableOpacity
|
||||
onPress={handleSignOut}
|
||||
className="justify-center items-center w-10 h-10 rounded-full bg-white"
|
||||
className="justify-center items-center w-10 h-10 rounded-full bg-white dark:bg-neutral-900"
|
||||
>
|
||||
<Image source={icons.out} className="w-4 h-4" alt="Logout" />
|
||||
<Image source={icons.out} className="w-4 h-4" alt={t("home.logoutAlt")} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<GoogleTextInput
|
||||
icon={icons.search}
|
||||
containerStyles="bg-white shadow-md shadow-neutral-300"
|
||||
containerStyles="bg-white dark:bg-neutral-900 shadow-md shadow-neutral-300 dark:shadow-neutral-950/40"
|
||||
handlePress={handleDestinationPress}
|
||||
/>
|
||||
|
||||
<Text className="text-xl font-JakartaBold mt-5 mb-3">
|
||||
Your Current Location
|
||||
<Text className="text-xl font-JakartaBold mt-5 mb-3 text-black dark:text-white">
|
||||
{t("home.currentLocation")}
|
||||
</Text>
|
||||
|
||||
<View className="w-full h-[300px] rounded-2xl overflow-hidden bg-white">
|
||||
<View className="w-full h-[300px] rounded-2xl overflow-hidden bg-white dark:bg-neutral-900">
|
||||
{locationStatus === "pending" || locationStatus === "granted" ? (
|
||||
<>
|
||||
{/* The map draws straight away on the Beirut fallback so the
|
||||
@@ -117,10 +121,10 @@ const Home = () => {
|
||||
<Map />
|
||||
|
||||
{locationStatus === "pending" ? (
|
||||
<View className="absolute bottom-3 self-center flex-row items-center rounded-full bg-white/95 px-4 py-2 shadow-md shadow-neutral-400/40">
|
||||
<View className="absolute bottom-3 self-center flex-row items-center rounded-full bg-white/95 dark:bg-neutral-900/95 px-4 py-2 shadow-md shadow-neutral-400/40 dark:shadow-neutral-950/40">
|
||||
<ActivityIndicator size="small" color="#0286ff" />
|
||||
<Text className="ml-2 text-xs font-JakartaMedium text-general-200">
|
||||
Finding your location…
|
||||
<Text className="ml-2 text-xs font-JakartaMedium text-general-200 dark:text-neutral-400">
|
||||
{t("home.findingLocation")}
|
||||
</Text>
|
||||
</View>
|
||||
) : null}
|
||||
@@ -133,8 +137,8 @@ const Home = () => {
|
||||
)}
|
||||
</View>
|
||||
|
||||
<Text className="text-xl font-JakartaBold mt-5 mb-3">
|
||||
What do you need?
|
||||
<Text className="text-xl font-JakartaBold mt-5 mb-3 text-black dark:text-white">
|
||||
{t("home.whatNeed")}
|
||||
</Text>
|
||||
|
||||
<ServiceSelector />
|
||||
@@ -143,8 +147,8 @@ const Home = () => {
|
||||
<NearbySuggestions />
|
||||
</View>
|
||||
|
||||
<Text className="text-xl font-JakartaBold mt-5 mb-3">
|
||||
Recent Rides
|
||||
<Text className="text-xl font-JakartaBold mt-5 mb-3 text-black dark:text-white">
|
||||
{t("home.recentRides")}
|
||||
</Text>
|
||||
</>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user