mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-12-05 17:30:50 +00:00
fonctionnalités de la page Profile user
This commit is contained in:
@@ -1,24 +1,30 @@
|
||||
import {
|
||||
Box,
|
||||
Flex,
|
||||
Text,
|
||||
Button,
|
||||
Image,
|
||||
} from '@chakra-ui/react';
|
||||
|
||||
|
||||
export default function BottomBar(props) {
|
||||
|
||||
const {variant, saveData} = props;
|
||||
|
||||
return (
|
||||
<Box position={variant} zIndex={0} bottom={0}
|
||||
backdropFilter={'auto'} px={10} py={2}>
|
||||
<Flex align={'center'}>
|
||||
<Button colorScheme={"purple"} onClick={() => saveData()}>Sauvegarder les modifications</Button>
|
||||
</Flex>
|
||||
</Box>
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
import { Box, Flex, Text, Button, Image } from "@chakra-ui/react";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export default function BottomBar(props) {
|
||||
const router = useRouter();
|
||||
|
||||
const { variant, saveData } = props;
|
||||
|
||||
return (
|
||||
<Box
|
||||
position={variant}
|
||||
zIndex={0}
|
||||
bottom={0}
|
||||
backdropFilter={"auto"}
|
||||
px={10}
|
||||
py={2}
|
||||
>
|
||||
<Flex align={"center"}>
|
||||
<Button
|
||||
colorScheme={"purple"}
|
||||
onClick={() => {
|
||||
saveData();
|
||||
}}
|
||||
>
|
||||
Sauvegarder les modifications
|
||||
</Button>
|
||||
</Flex>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
+36
-26
@@ -1,45 +1,55 @@
|
||||
import {useState} from 'react';
|
||||
import {Flex, IconButton} from '@chakra-ui/react';
|
||||
import { useState } from "react";
|
||||
import { Flex, IconButton } from "@chakra-ui/react";
|
||||
import { BiLeftArrowAlt, BiRightArrowAlt } from "react-icons/bi";
|
||||
|
||||
interface Props {
|
||||
images: string[]
|
||||
images: string[];
|
||||
borderRadius?: string | number;
|
||||
}
|
||||
|
||||
const Carousel = ({images, borderRadius: bRadius}: Props) => {
|
||||
const Carousel = ({ images, borderRadius: bRadius }: Props) => {
|
||||
const [currentIndex, setCurrentIndex] = useState(0);
|
||||
|
||||
const handleClickPrevious = () => {
|
||||
setCurrentIndex(
|
||||
(currentIndex === 0)
|
||||
? images.length - 1 : currentIndex - 1,
|
||||
);
|
||||
setCurrentIndex(currentIndex === 0 ? images.length - 1 : currentIndex - 1);
|
||||
};
|
||||
|
||||
const handleClickNext = () => {
|
||||
setCurrentIndex(
|
||||
(currentIndex === images.length - 1)
|
||||
? 0 : currentIndex + 1,
|
||||
);
|
||||
setCurrentIndex(currentIndex === images.length - 1 ? 0 : currentIndex + 1);
|
||||
};
|
||||
|
||||
if (images.length === 0) images = ["blank_profile_picture.webp"];
|
||||
|
||||
return (
|
||||
<Flex px={2} align="center" borderRadius={bRadius} overflow={"hidden"} justify={'space-between'}
|
||||
bgImage={images[currentIndex]} bgSize={'cover'} width={'100%'}
|
||||
height={500}>
|
||||
<Flex
|
||||
px={2}
|
||||
align="center"
|
||||
borderRadius={bRadius}
|
||||
overflow={"hidden"}
|
||||
justify={"space-between"}
|
||||
bgImage={images[currentIndex]}
|
||||
bgSize={"cover"}
|
||||
width={"100%"}
|
||||
height={500}
|
||||
>
|
||||
<IconButton
|
||||
aria-label="left-arrow"
|
||||
colorScheme="purple"
|
||||
borderRadius="full"
|
||||
onClick={handleClickPrevious}
|
||||
>
|
||||
<BiLeftArrowAlt />
|
||||
</IconButton>
|
||||
|
||||
<IconButton aria-label="left-arrow" colorScheme="purple"
|
||||
borderRadius="full" onClick={handleClickPrevious}>
|
||||
<BiLeftArrowAlt/>
|
||||
</IconButton>
|
||||
|
||||
<IconButton aria-label="left-arrow" colorScheme="purple"
|
||||
borderRadius="full" onClick={handleClickNext}>
|
||||
<BiRightArrowAlt/>
|
||||
</IconButton>
|
||||
|
||||
</Flex>
|
||||
<IconButton
|
||||
aria-label="left-arrow"
|
||||
colorScheme="purple"
|
||||
borderRadius="full"
|
||||
onClick={handleClickNext}
|
||||
>
|
||||
<BiRightArrowAlt />
|
||||
</IconButton>
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import {
|
||||
Button,
|
||||
Flex,
|
||||
Grid,
|
||||
GridItem,
|
||||
Image,
|
||||
Input,
|
||||
Modal,
|
||||
ModalBody,
|
||||
ModalCloseButton,
|
||||
ModalContent,
|
||||
ModalFooter,
|
||||
ModalHeader,
|
||||
ModalOverlay,
|
||||
useDisclosure,
|
||||
} from "@chakra-ui/react";
|
||||
import { RiEditBoxLine } from "react-icons/ri";
|
||||
|
||||
export default function ModalModifyImages(props) {
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const { images, userData, setUserData } = props;
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
colorScheme={"purple"}
|
||||
onClick={onOpen}
|
||||
leftIcon={<RiEditBoxLine />}
|
||||
>
|
||||
Modifier les images
|
||||
</Button>
|
||||
|
||||
<Modal
|
||||
blockScrollOnMount={false}
|
||||
size={"4xl"}
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
scrollBehavior={"inside"}
|
||||
>
|
||||
<ModalOverlay />
|
||||
<ModalContent>
|
||||
<ModalHeader>Modification des images</ModalHeader>
|
||||
<ModalCloseButton />
|
||||
<ModalBody>
|
||||
<Grid templateColumns={`repeat(${images.length + 1}, 1fr)`} gap={5}>
|
||||
{images.map((image, index) => (
|
||||
<GridItem key={index}>
|
||||
<Flex direction={"column"} gap={"1rem"}>
|
||||
<Image src={image} />
|
||||
<Button
|
||||
id={"" + index}
|
||||
colorScheme={"red"}
|
||||
onClick={(e) => {
|
||||
images.splice(index, 1);
|
||||
setUserData({
|
||||
...userData,
|
||||
images: [...images],
|
||||
});
|
||||
}}
|
||||
>
|
||||
Supprimer l'image
|
||||
</Button>
|
||||
</Flex>
|
||||
</GridItem>
|
||||
))}
|
||||
{images.length < 5 ? (
|
||||
<GridItem width={"100%"}>
|
||||
<Input
|
||||
type={"file"}
|
||||
height={"100%"}
|
||||
accept={"image/png, image/jpeg, image/webp"}
|
||||
onChange={(e) => {
|
||||
setUserData({
|
||||
...userData,
|
||||
images: [...images, e.target.files[0].name],
|
||||
});
|
||||
}}
|
||||
></Input>
|
||||
</GridItem>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</Grid>
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter>
|
||||
<Button colorScheme="purple" mr={3} onClick={onClose}>
|
||||
Save
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,53 +1,62 @@
|
||||
import {
|
||||
Card,
|
||||
Flex,
|
||||
Box,
|
||||
Image,
|
||||
Text,
|
||||
Spacer,
|
||||
} from '@chakra-ui/react';
|
||||
import {useRouter} from 'next/router';
|
||||
import { Card, Flex, Box, Image, Text, Spacer } from "@chakra-ui/react";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
import {AiFillMessage} from 'react-icons/ai';
|
||||
import {BsFillPersonFill} from 'react-icons/bs';
|
||||
import {BiLogOut} from 'react-icons/bi';
|
||||
import { AiFillMessage } from "react-icons/ai";
|
||||
import { BsFillPersonFill } from "react-icons/bs";
|
||||
import { BiLogOut } from "react-icons/bi";
|
||||
|
||||
import LeftPanelButton
|
||||
from '@/components/layout/dashboard/left_panel/LeftPanelButton';
|
||||
import {signOut} from 'next-auth/react';
|
||||
import LeftPanelButton from "@/components/layout/dashboard/left_panel/LeftPanelButton";
|
||||
import { signOut } from "next-auth/react";
|
||||
|
||||
export default function LeftPanel(props) {
|
||||
const router = useRouter();
|
||||
const {user} = props;
|
||||
const { user } = props;
|
||||
|
||||
return (
|
||||
<Card width={'20vw'} height={'100%'} borderRadius={0} padding={'0px'} bg={'#faf9ff'}>
|
||||
<Flex direction={'column'} height={'100%'} margin={'10%'}>
|
||||
<Card
|
||||
width={"20vw"}
|
||||
height={"100%"}
|
||||
borderRadius={0}
|
||||
padding={"0px"}
|
||||
bg={"#faf9ff"}
|
||||
>
|
||||
<Flex direction={"column"} height={"100%"} margin={"10%"}>
|
||||
<Box>
|
||||
<Image src={user.images[0]} borderRadius={'1rem'}/>
|
||||
<Box mt={'1vh'}>
|
||||
<Text fontSize={'1.5rem'} fontWeight={'bold'}>
|
||||
<Image src={user.images[0]} borderRadius={"1rem"} />
|
||||
<Box mt={"1vh"}>
|
||||
<Text fontSize={"1.5rem"} fontWeight={"bold"}>
|
||||
{user.firstName} {user.lastName}
|
||||
</Text>
|
||||
<Text as="i" fontWeight={'bold'}>
|
||||
<Text as="i" fontWeight={"bold"}>
|
||||
"{user.aPropos}"
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
<Spacer/>
|
||||
<Flex gap={2} direction={'column'} mt={'1vh'} spacing={3.5}
|
||||
alignContent={'bottom'}>
|
||||
|
||||
<LeftPanelButton leftIcon={<AiFillMessage/>}
|
||||
onClickHandler={() => router.push('/dashboard')}>
|
||||
<Spacer />
|
||||
<Flex
|
||||
gap={2}
|
||||
direction={"column"}
|
||||
mt={"1vh"}
|
||||
spacing={3.5}
|
||||
alignContent={"bottom"}
|
||||
>
|
||||
<LeftPanelButton
|
||||
leftIcon={<AiFillMessage />}
|
||||
onClickHandler={() => router.push("/dashboard")}
|
||||
>
|
||||
Messages
|
||||
</LeftPanelButton>
|
||||
<LeftPanelButton leftIcon={<BsFillPersonFill/>}
|
||||
onClickHandler={() => router.push('/dashboard')}>
|
||||
<LeftPanelButton
|
||||
leftIcon={<BsFillPersonFill />}
|
||||
onClickHandler={() => router.push("/userProfile")}
|
||||
>
|
||||
Profile
|
||||
</LeftPanelButton>
|
||||
<LeftPanelButton variant={"outline"} leftIcon={<BiLogOut/>}
|
||||
onClickHandler={() => signOut({callbackUrl: "/"})}>
|
||||
<LeftPanelButton
|
||||
variant={"outline"}
|
||||
leftIcon={<BiLogOut />}
|
||||
onClickHandler={() => signOut({ callbackUrl: "/" })}
|
||||
>
|
||||
Deconnexion
|
||||
</LeftPanelButton>
|
||||
</Flex>
|
||||
|
||||
Reference in New Issue
Block a user