diff --git a/public/ImageUsers/646a90e4d97a217e2f6a9a71_1684705597601.jpg b/public/ImageUsers/646a90e4d97a217e2f6a9a71_1684705597601.jpg new file mode 100644 index 0000000..be307b6 Binary files /dev/null and b/public/ImageUsers/646a90e4d97a217e2f6a9a71_1684705597601.jpg differ diff --git a/public/ImageUsers/646a90e4d97a217e2f6a9a71_1684705637040.webp b/public/ImageUsers/646a90e4d97a217e2f6a9a71_1684705637040.webp new file mode 100644 index 0000000..fcdc947 Binary files /dev/null and b/public/ImageUsers/646a90e4d97a217e2f6a9a71_1684705637040.webp differ diff --git a/public/ImageUsers/646a92aad97a217e2f6a9aab_1684706024489.jpg b/public/ImageUsers/646a92aad97a217e2f6a9aab_1684706024489.jpg new file mode 100644 index 0000000..a9f5e68 Binary files /dev/null and b/public/ImageUsers/646a92aad97a217e2f6a9aab_1684706024489.jpg differ diff --git a/public/ImageUsers/646a931dd97a217e2f6a9abf_1684706141723.jpg b/public/ImageUsers/646a931dd97a217e2f6a9abf_1684706141723.jpg new file mode 100644 index 0000000..2f2e591 Binary files /dev/null and b/public/ImageUsers/646a931dd97a217e2f6a9abf_1684706141723.jpg differ diff --git a/public/ImageUsers/646a93bbd97a217e2f6a9ad7_1684706286377.jpg b/public/ImageUsers/646a93bbd97a217e2f6a9ad7_1684706286377.jpg new file mode 100644 index 0000000..7ff4130 Binary files /dev/null and b/public/ImageUsers/646a93bbd97a217e2f6a9ad7_1684706286377.jpg differ diff --git a/public/ImageUsers/646a946ad97a217e2f6a9ae8_1684706498941.jpg b/public/ImageUsers/646a946ad97a217e2f6a9ae8_1684706498941.jpg new file mode 100644 index 0000000..92d0f4c Binary files /dev/null and b/public/ImageUsers/646a946ad97a217e2f6a9ae8_1684706498941.jpg differ diff --git a/public/ImageUsers/646a99a9d97a217e2f6a9be3_1684708044756.jpg b/public/ImageUsers/646a99a9d97a217e2f6a9be3_1684708044756.jpg new file mode 100644 index 0000000..b8d59e2 Binary files /dev/null and b/public/ImageUsers/646a99a9d97a217e2f6a9be3_1684708044756.jpg differ diff --git a/public/ImageUsers/646a9efbd97a217e2f6a9c68_1684709263934.jpg b/public/ImageUsers/646a9efbd97a217e2f6a9c68_1684709263934.jpg new file mode 100644 index 0000000..28d8ded Binary files /dev/null and b/public/ImageUsers/646a9efbd97a217e2f6a9c68_1684709263934.jpg differ diff --git a/public/ImageUsers/646a9fced97a217e2f6a9c87_1684709377150.jpg b/public/ImageUsers/646a9fced97a217e2f6a9c87_1684709377150.jpg new file mode 100644 index 0000000..57583a0 Binary files /dev/null and b/public/ImageUsers/646a9fced97a217e2f6a9c87_1684709377150.jpg differ diff --git a/src/components/Carousel.tsx b/src/components/Carousel.tsx index 3fde1ce..6fa4991 100644 --- a/src/components/Carousel.tsx +++ b/src/components/Carousel.tsx @@ -1,13 +1,13 @@ -import {useState} from 'react'; -import {Flex, IconButton} from '@chakra-ui/react'; -import {BiLeftArrowAlt, BiRightArrowAlt} from 'react-icons/bi'; +import { useState } from "react"; +import { Flex, IconButton } from "@chakra-ui/react"; +import { BiLeftArrowAlt, BiRightArrowAlt } from "react-icons/bi"; interface Props { images: string[]; borderRadius?: string | number; } -const Carousel = ({images, borderRadius: bRadius}: Props) => { +const Carousel = ({ images, borderRadius: bRadius }: Props) => { const [currentIndex, setCurrentIndex] = useState(0); const handleClickPrevious = () => { @@ -18,22 +18,39 @@ const Carousel = ({images, borderRadius: bRadius}: Props) => { setCurrentIndex(currentIndex === images.length - 1 ? 0 : currentIndex + 1); }; - if (images.length === 0) images = ['blank_profile_picture.webp']; + if (images.length === 0) images = ["blank_profile_picture.webp"]; return ( - - - - + + + + - - - - + + + + ); }; diff --git a/src/components/layout/dashboard/card_user/CardUser.tsx b/src/components/layout/dashboard/card_user/CardUser.tsx index 3bdb560..960771f 100644 --- a/src/components/layout/dashboard/card_user/CardUser.tsx +++ b/src/components/layout/dashboard/card_user/CardUser.tsx @@ -17,16 +17,21 @@ import PassionTagList from "@/components/layout/dashboard/card_user/PassionTagLi import { useState } from "react"; import SearchFailCard from "./SearchFailCard"; import LoadingPage from "@/components/LoadingPage"; -import {User} from '@prisma/client'; +import { User } from "@prisma/client"; type Props = { - users: User[] - loggedUser: User - setMatch: any - refetchLoggedUser: any -} + users: User[]; + loggedUser: User; + setMatch: any; + refetchLoggedUser: any; +}; -export default function CardUser({users, loggedUser, setMatch, refetchLoggedUser}: Props) { +export default function CardUser({ + users, + loggedUser, + setMatch, + refetchLoggedUser, +}: Props) { const toast = useToast({ position: "top", duration: 2000, @@ -174,7 +179,9 @@ export default function CardUser({users, loggedUser, setMatch, refetchLoggedUser A propos : - "{listUsers[0].bio}" + + {listUsers[0].bio && `"${listUsers[0].bio}"`} + diff --git a/src/components/layout/dashboard/left_panel/LeftPanel.tsx b/src/components/layout/dashboard/left_panel/LeftPanel.tsx index f81a929..49deb30 100644 --- a/src/components/layout/dashboard/left_panel/LeftPanel.tsx +++ b/src/components/layout/dashboard/left_panel/LeftPanel.tsx @@ -32,11 +32,12 @@ export default function LeftPanel(props) { bg={"#faf9ff"} > - + @@ -52,29 +53,33 @@ export default function LeftPanel(props) { {user.bio && `"${user.bio}"`} - + + alignContent={"bottom"} + > } - onClickHandler={() => router.push("/map")}> + onClickHandler={() => router.push("/map")} + > Carte } - onClickHandler={() => router.push("/profile")}> + onClickHandler={() => router.push("/profile")} + > Profil } - onClickHandler={() => signOut({ callbackUrl: "/" })}> + onClickHandler={() => signOut({ callbackUrl: "/" })} + > Déconnexion diff --git a/src/components/layout/profile/ModalModifyImages.tsx b/src/components/layout/profile/ModalModifyImages.tsx index cdeb84d..92e8cab 100644 --- a/src/components/layout/profile/ModalModifyImages.tsx +++ b/src/components/layout/profile/ModalModifyImages.tsx @@ -138,7 +138,7 @@ export default function ModalModifyImages(props) { { - const {user} = session as unknown as Session; + const { user } = session as unknown as Session; return fetch(`/api/users/${user.id}?include=Notification`) - .then((res) => { - return res.json(); - }) - .catch((err) => { - return err; - }); + .then((res) => { + return res.json(); + }) + .catch((err) => { + return err; + }); }, }); @@ -58,89 +62,104 @@ export default function Dashboard() { isLoading: isLoadingListUsers, error: errorListUsers, } = useQuery({ - queryKey: ['ListUsers'], - enabled: status === 'authenticated' && !isLoading, + queryKey: ["ListUsers"], + enabled: status === "authenticated" && !isLoading, queryFn: async () => { - return fetch( - `/api/user/userDashboard?userID=${loggedUser.id}`) //exclure les profils déjà like ou dislike - .then((res) => res.json()) - .catch((err) => { - return err; - }); + return fetch(`/api/user/userDashboard?userID=${loggedUser.id}`) //exclure les profils déjà like ou dislike + .then((res) => res.json()) + .catch((err) => { + return err; + }); }, }); if (isLoading) { - if (status === 'unauthenticated') router.push('/login'); - return ; + if (status === "unauthenticated") router.push("/login"); + return ; } if (isError) { toast({ title: `Erreur lors de la récupération des données du profil`, - status: 'error', - position: 'top', + status: "error", + position: "top", }); - if (status === 'unauthenticated') router.push('/'); + if (status === "unauthenticated") router.push("/"); } let modal; if (loggedUser?.Notification?.length > 0) { const matchNotification = loggedUser.Notification.filter( - (notif: Notification) => - notif.type === NotificationType.NEW_MATCH && - notif.hasBeenConsulted === false, + (notif: Notification) => + notif.type === NotificationType.NEW_MATCH && + notif.hasBeenConsulted === false ); modal = matchNotification.map((notif: Notification) => { return ( - + ); }); } - if (status === 'loading') return ; + if (status === "loading") return ; return ( - <> - {modal} + <> + {modal} - - {websiteName} | Dashboard - + + {websiteName} | Dashboard + - - - - - - - {isLoadingListUsers - ? () - : (isErrorListUsers || !listUsers || !listUsers.users || - listUsers.users.length === 0) - ? - : - } - - - - - - - {router.push('/chat')}}>Conversations - - - - - - - - {/*Right Bottom*/} - - + + + + + + + {isLoadingListUsers ? ( + + ) : isErrorListUsers || + !listUsers || + !listUsers.users || + listUsers.users.length === 0 ? ( + + ) : ( + + )} + + + + + + + { + router.push("/chat"); + }} + > + Conversations + + + + + + + + + {/*Right Bottom*/} + + ); } diff --git a/src/pages/map.tsx b/src/pages/map.tsx index 7e82cb2..99082e5 100644 --- a/src/pages/map.tsx +++ b/src/pages/map.tsx @@ -56,7 +56,9 @@ export default function Map() { } = useQuery({ queryKey: ["listBars"], refetchOnWindowFocus: false, - enabled: Boolean(loggedUser) && loggedUser.location.length > 0, + enabled: + Boolean(loggedUser) && + (loggedUser.location?.length > 0 || location[0] !== null), queryFn: async () => { ///Utiliser api de noratim diff --git a/src/pages/profile.tsx b/src/pages/profile.tsx index b7d5572..e03a4d5 100644 --- a/src/pages/profile.tsx +++ b/src/pages/profile.tsx @@ -30,7 +30,7 @@ import CustomSlider from "@/components/layout/profile/CustomSlider"; import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; -import { useQuery } from "@tanstack/react-query"; +import { useQuery, useQueryClient } from "@tanstack/react-query"; export default function UserProfile() { const router = useRouter(); @@ -45,6 +45,8 @@ export default function UserProfile() { const [showTooltipDistance, setShowTooltipDistance] = useState(false); const [sliderDistanceValue, setSliderDistanceValue] = useState(0); + const queryClient = useQueryClient(); + const { handleSubmit, control, @@ -147,6 +149,7 @@ export default function UserProfile() { status: "success", isClosable: true, }); + queryClient.invalidateQueries({ queryKey: ["user"] }); }) .catch((err) => { setCurrentlyLoading(false);