completed final todo

This commit is contained in:
Sanidhya Kumar Verma
2024-09-04 12:32:35 +00:00
committed by GitHub
parent 96d14cecad
commit 2a0e9a79dc
4 changed files with 15 additions and 97 deletions
+4 -2
View File
@@ -24,7 +24,9 @@ const Home = () => {
const { setUserLocation, setDestinationLocation } = useLocationStore(); const { setUserLocation, setDestinationLocation } = useLocationStore();
const { signOut } = useAuth(); const { signOut } = useAuth();
const { user } = useUser(); const { user } = useUser();
const { data: recentRides, loading } = useFetch(`/(api)/ride/${user?.id}`); const { data: recentRides, loading } = useFetch<Ride[]>(
`/(api)/ride/${user?.id}`,
);
const [hasPermissions, setHasPermissions] = useState(false); const [hasPermissions, setHasPermissions] = useState(false);
@@ -71,7 +73,7 @@ const Home = () => {
return ( return (
<SafeAreaView className="bg-general-500"> <SafeAreaView className="bg-general-500">
<FlatList <FlatList
data={(recentRides as Ride[])?.slice(0, 5)} data={recentRides?.slice(0, 5)}
renderItem={({ item }) => <RideCard ride={item} />} renderItem={({ item }) => <RideCard ride={item} />}
className="px-5" className="px-5"
keyboardShouldPersistTaps="handled" keyboardShouldPersistTaps="handled"
+3 -3
View File
@@ -30,7 +30,7 @@ const Profile = () => {
<View className="flex flex-col items-start justify-start w-full"> <View className="flex flex-col items-start justify-start w-full">
<InputField <InputField
label="First name" label="First name"
placeholder={user?.firstName || "Not Found"} placeholder={user?.firstName ?? "Your First name"}
containerStyles="w-full mb-4" containerStyles="w-full mb-4"
inputStyles="p-3.5" inputStyles="p-3.5"
editable={false} editable={false}
@@ -38,7 +38,7 @@ const Profile = () => {
<InputField <InputField
label="Last name" label="Last name"
placeholder={user?.lastName || "Not Found"} placeholder={user?.lastName ?? "Your Last name"}
containerStyles="w-full mb-4" containerStyles="w-full mb-4"
inputStyles="p-3.5" inputStyles="p-3.5"
editable={false} editable={false}
@@ -47,7 +47,7 @@ const Profile = () => {
<InputField <InputField
label="Email" label="Email"
placeholder={ placeholder={
user?.primaryEmailAddress?.emailAddress || "Not Found" user?.primaryEmailAddress?.emailAddress ?? "Your Email address"
} }
containerStyles="w-full mb-4" containerStyles="w-full mb-4"
inputStyles="p-3.5" inputStyles="p-3.5"
+4 -14
View File
@@ -1,8 +1,8 @@
import { View, Image, TouchableOpacity } from "react-native"; import { View, Image } from "react-native";
import { GooglePlacesAutocomplete } from "react-native-google-places-autocomplete"; import { GooglePlacesAutocomplete } from "react-native-google-places-autocomplete";
import { icons } from "@/constants"; import { icons } from "@/constants";
import { GoogleInputProps } from "@/types/type"; import type { GoogleInputProps } from "@/types/type";
export const GoogleTextInput = ({ export const GoogleTextInput = ({
icon, icon,
@@ -64,24 +64,14 @@ export const GoogleTextInput = ({
language: "en", language: "en",
}} }}
renderLeftButton={() => ( renderLeftButton={() => (
// TODO: replace later with View and remove onPress <View className="justify-center items-center w-6 h-6">
<TouchableOpacity
onPress={() => {
handlePress({
latitude: 26.8467,
longitude: 80.9462,
address: "Lucknow, Uttar Pradesh",
});
}}
className="justify-center items-center w-6 h-6"
>
<Image <Image
source={icon ? icon : icons.search} source={icon ? icon : icons.search}
alt="Search" alt="Search"
className="w-6 h-6" className="w-6 h-6"
resizeMode="contain" resizeMode="contain"
/> />
</TouchableOpacity> </View>
)} )}
textInputProps={{ textInputProps={{
placeholderTextColor: "gray", placeholderTextColor: "gray",
+3 -77
View File
@@ -13,74 +13,6 @@ import {
import { useDriverStore, useLocationStore } from "@/store"; import { useDriverStore, useLocationStore } from "@/store";
import type { Driver, MarkerData } from "@/types/type"; import type { Driver, MarkerData } from "@/types/type";
// TODO: Remove mocked drivers later
const mockedDrivers = [
{
id: 1,
driver_id: 1,
first_name: "James",
last_name: "Wilson",
profile_image_url:
"https://ucarecdn.com/dae59f69-2c1f-48c3-a883-017bcf0f9950/-/preview/1000x666/",
car_image_url:
"https://ucarecdn.com/a2dc52b2-8bf7-4e49-9a36-3ffb5229ed02/-/preview/465x466/",
car_seats: 4,
rating: 4.8,
latitude: 0,
longitude: 0,
price: "45",
time: 5,
},
{
id: 2,
driver_id: 2,
first_name: "David",
last_name: "Brown",
profile_image_url:
"https://ucarecdn.com/6ea6d83d-ef1a-483f-9106-837a3a5b3f67/-/preview/1000x666/",
car_image_url:
"https://ucarecdn.com/a3872f80-c094-409c-82f8-c9ff38429327/-/preview/930x932/",
car_seats: 5,
rating: 4.6,
latitude: 0,
longitude: 0,
price: "45",
time: 5,
},
{
id: 3,
driver_id: 3,
first_name: "Michael",
last_name: "Johnson",
profile_image_url:
"https://ucarecdn.com/0330d85c-232e-4c30-bd04-e5e4d0e3d688/-/preview/826x822/",
car_image_url:
"https://ucarecdn.com/289764fb-55b6-4427-b1d1-f655987b4a14/-/preview/930x932/",
car_seats: 4,
rating: 4.7,
latitude: 0,
longitude: 0,
price: "45",
time: 5,
},
{
id: 4,
driver_id: 4,
first_name: "Robert",
last_name: "Green",
profile_image_url:
"https://ucarecdn.com/fdfc54df-9d24-40f7-b7d3-6f391561c0db/-/preview/626x417/",
car_image_url:
"https://ucarecdn.com/b6fb3b55-7676-4ff3-8484-fb115e268d32/-/preview/930x932/",
car_seats: 4,
rating: 4.9,
latitude: 0,
longitude: 0,
price: "45",
time: 5,
},
];
export const Map = () => { export const Map = () => {
const { data: drivers, loading, error } = useFetch<Driver[]>("/(api)/driver"); const { data: drivers, loading, error } = useFetch<Driver[]>("/(api)/driver");
@@ -117,21 +49,15 @@ export const Map = () => {
useEffect(() => { useEffect(() => {
if (markers.length > 0 && destinationLatitude && destinationLatitude) { if (markers.length > 0 && destinationLatitude && destinationLatitude) {
// TODO: Uncomment this code block calculateDriverTimes({
/* calculateDriverTimes({
markers, markers,
userLatitude, userLatitude,
userLongitude, userLongitude,
destinationLatitude, destinationLatitude,
destinationLongitude, destinationLongitude,
}) }).then((drivers) => {
.then((drivers) => {
setDrivers(drivers as MarkerData[]); setDrivers(drivers as MarkerData[]);
}) */ });
// TODO: Remove this line
setDrivers(mockedDrivers);
} }
}, [ }, [
markers, markers,