From 95059f21ac405d3008e05b12e1fc08765cc9a41a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=A0s?= Date: Sat, 20 May 2023 14:55:10 +0200 Subject: [PATCH 1/3] Edit Profile into Profil in `Navbar.tsx` Took 2 hours 22 minutes --- src/components/Navbar.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 3e9a778..831955a 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -11,18 +11,18 @@ import { useRouter } from "next/router"; import { signOut, useSession } from "next-auth/react"; type Props = { - variant: "static" | "fixed"; + variant?: "static" | "fixed"; }; export default function Navbar({ variant = "fixed" }: Props) { const router = useRouter(); - const { data: session, status } = useSession(); + const { status } = useSession(); const MiddleSection = () => { const authenticatedLinks = ( <> Tableau de bord - Profile + Profil Carte ); @@ -66,8 +66,7 @@ export default function Navbar({ variant = "fixed" }: Props) { backdropFilter={"auto"} backdropBlur={"20px"} px={10} - py={2} - > + py={2}> From afe3899457bf462d5d8838d3dfc59d69ddec40ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=A0s?= Date: Sat, 20 May 2023 15:00:37 +0200 Subject: [PATCH 2/3] Remove Birthdate from `GettingStartForm.tsx` Took 5 minutes --- .../form/GettingStartForm/BirthInput.tsx | 30 ------------------- .../GettingStartForm/GettingStartForm.tsx | 11 +++---- .../SubmitGettingStartForm.tsx | 13 ++------ src/redux/redux.tsx | 2 -- 4 files changed, 6 insertions(+), 50 deletions(-) delete mode 100644 src/components/form/GettingStartForm/BirthInput.tsx diff --git a/src/components/form/GettingStartForm/BirthInput.tsx b/src/components/form/GettingStartForm/BirthInput.tsx deleted file mode 100644 index 88f6e1a..0000000 --- a/src/components/form/GettingStartForm/BirthInput.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import {Button, Flex, FormControl, Input} from '@chakra-ui/react'; -import {useDispatch} from 'react-redux'; -import {useState} from 'react'; -import moment from 'moment'; - -const BirthInput = () => { - const dispatch = useDispatch(); - const [birth, setBirth] = useState(''); - - return ( - - - setBirth(evt.target.value)} - value={birth}/> - - - - - - - ); -}; - -export default BirthInput; \ No newline at end of file diff --git a/src/components/form/GettingStartForm/GettingStartForm.tsx b/src/components/form/GettingStartForm/GettingStartForm.tsx index 5f3791c..af0186d 100644 --- a/src/components/form/GettingStartForm/GettingStartForm.tsx +++ b/src/components/form/GettingStartForm/GettingStartForm.tsx @@ -4,12 +4,11 @@ import {useSelector} from 'react-redux'; import {RootState} from '@/redux/redux'; import Message from '@/components/chat/Message'; import {Message as MessageType} from '@prisma/client'; + import GenderInput from '@/components/form/GettingStartForm/GenderInput'; import AgeInput from '@/components/form/GettingStartForm/AgeInput'; -import BirthInput from '@/components/form/GettingStartForm/BirthInput'; import PassionsInput from '@/components/form/GettingStartForm/PassionsInput'; -import SubmitGettingStartForm - from '@/components/form/GettingStartForm/SubmitGettingStartForm'; +import SubmitGettingStartForm from '@/components/form/GettingStartForm/SubmitGettingStartForm'; type Props = { user: UserType @@ -19,7 +18,6 @@ type FormInputs = { ownGender?: Gender researchGender?: Gender, ages?: [number, number], - birth?: Date, passions?: Passion[] } @@ -31,9 +29,8 @@ export default function GettingStartForm({user}: Props) { , , , - , - , - , + , + , ]; return ( diff --git a/src/components/form/GettingStartForm/SubmitGettingStartForm.tsx b/src/components/form/GettingStartForm/SubmitGettingStartForm.tsx index 6999efe..a95a4c8 100644 --- a/src/components/form/GettingStartForm/SubmitGettingStartForm.tsx +++ b/src/components/form/GettingStartForm/SubmitGettingStartForm.tsx @@ -10,13 +10,7 @@ export default function SubmitGettingStartForm({user}: { user: User }) { (state: RootState) => state.gettingStartForm); const handleSubmit = () => { - const { - ownGender, - researchGender, - ages, - birth, - passions, - } = gettingStartForm.inputs; + const {ownGender, researchGender, ages, passions} = gettingStartForm.inputs; const options = { method: 'PUT', @@ -26,11 +20,8 @@ export default function SubmitGettingStartForm({user}: { user: User }) { prefGender: researchGender, ageMin: ages[0], ageMax: ages[1], - birthdate: new Date(birth), Passion: { - connect: passions.map((p: Passion) => { - return {id: p.id}; - }), + connect: passions.map((p: Passion) => ({id: p.id})), }, }), }; diff --git a/src/redux/redux.tsx b/src/redux/redux.tsx index 7e68cf2..6feee17 100644 --- a/src/redux/redux.tsx +++ b/src/redux/redux.tsx @@ -6,7 +6,6 @@ const questions: string[] = [ 'Salut, je suis Cupibot. Il me manque quelques détails avant de terminer ton inscription. C\'est quoi ton sexe ?', 'Ok et tu es attiré par quel genre ?', 'Ça marche, c\'est quoi la tranche d\'âge que tu recherche ?', - 'D\'ailleurs je ne t\'ai pas demandé, quand est-ce que tu est né ?', 'T\'as des passions dans la vie ? (Choisis-en 3 minimum)', 'Ok j\'ai toutes les infos d\'on j\'ai besoin, je vais tout faire pour te faire trouver la personne qui te correspond!', ]; @@ -19,7 +18,6 @@ const gettingStartFormSlice = createSlice({ ownGender: Gender.UNKNOWN, researchGender: Gender.UNKNOWN, ages: [18, 25], - birth: "", passions: [], }, messages: [ From 5921bb459692ad60b5dc21a55cf6f03ff4e89aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=A0s?= Date: Sat, 20 May 2023 15:01:53 +0200 Subject: [PATCH 3/3] Remove unused imports from `FormMessage.tsx` Took 1 minute --- src/components/form/FormMessage.tsx | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/components/form/FormMessage.tsx b/src/components/form/FormMessage.tsx index 35de198..9ab0e3f 100644 --- a/src/components/form/FormMessage.tsx +++ b/src/components/form/FormMessage.tsx @@ -1,8 +1,6 @@ import {Button, Flex, Input} from '@chakra-ui/react'; import {useState} from 'react'; import {User} from '@prisma/client'; -import {io, Socket} from 'socket.io-client'; -import Message from '@/components/chat/Message'; type Props = { user: User, @@ -15,19 +13,7 @@ export default function FormMessage(props: Props) { const [text, setText] = useState(""); const handleSubmit = () => { - if (text !== "") { - socket.emit("createdMessage", {text, sender: user.id}) - - // fetch("/api/messages", { - // method: "POST", - // headers: {'Content-Type': 'application/json'}, - // body: JSON.stringify({ - // text, - // 'User': {"connect": {'id': user.id}}, - // 'Chat': {"connect": {'id': chatId}} - // }) - // }).then(res => res.json()).then(res => console.log(res)).catch(err => console.error(err)) - } + if (text) socket.emit("createdMessage", {text, sender: user.id}) } return (