mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-12-05 17:30:50 +00:00
Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # src/pages/graphique.tsx # src/pages/map.tsx
This commit is contained in:
+34
-17
@@ -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 (
|
||||
<Flex px={2} align="center" borderRadius={bRadius} overflow={'hidden'}
|
||||
justify={'space-between'} bgColor={'purple.50'} height={500}
|
||||
bgImage={images[currentIndex]} bgSize={'cover'}
|
||||
bgRepeat={'no-repeat'} bgPosition={'center'} width={'100%'}>
|
||||
<IconButton aria-label="left-arrow" borderRadius="full"
|
||||
onClick={handleClickPrevious}>
|
||||
<BiLeftArrowAlt/>
|
||||
</IconButton>
|
||||
<Flex
|
||||
px={2}
|
||||
align="center"
|
||||
borderRadius={bRadius}
|
||||
overflow={"hidden"}
|
||||
justify={"space-between"}
|
||||
bgColor={"purple.50"}
|
||||
height={500}
|
||||
bgImage={images[currentIndex]}
|
||||
bgSize={"contain"}
|
||||
bgRepeat={"no-repeat"}
|
||||
bgPosition={"center"}
|
||||
width={"100%"}
|
||||
>
|
||||
<IconButton
|
||||
aria-label="left-arrow"
|
||||
borderRadius="full"
|
||||
onClick={handleClickPrevious}
|
||||
>
|
||||
<BiLeftArrowAlt />
|
||||
</IconButton>
|
||||
|
||||
<IconButton aria-label="left-arrow" borderRadius="full" onClick={handleClickNext}>
|
||||
<BiRightArrowAlt/>
|
||||
</IconButton>
|
||||
</Flex>
|
||||
<IconButton
|
||||
aria-label="left-arrow"
|
||||
borderRadius="full"
|
||||
onClick={handleClickNext}
|
||||
>
|
||||
<BiRightArrowAlt />
|
||||
</IconButton>
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,31 +1,28 @@
|
||||
import { Flex } from "@chakra-ui/react";
|
||||
import { MapContainer, TileLayer } from "react-leaflet";
|
||||
import SimpleMarkerBar from "./SimpleMarkerBar";
|
||||
import "leaflet/dist/leaflet.css";
|
||||
import {Flex} from '@chakra-ui/react';
|
||||
import {MapContainer, TileLayer} from 'react-leaflet';
|
||||
import SimpleMarkerBar from './SimpleMarkerBar';
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
|
||||
type MapBarProps = {
|
||||
lat: string;
|
||||
lon: string;
|
||||
name: string;
|
||||
align: "left" | "right";
|
||||
align: 'left' | 'right';
|
||||
};
|
||||
|
||||
export default function MapBar({ lat, lon, name, align }: MapBarProps) {
|
||||
export default function MapBar({lat, lon, name}: MapBarProps) {
|
||||
return (
|
||||
<Flex justifyContent={align}>
|
||||
<MapContainer
|
||||
center={[Number(lat), Number(lon)]}
|
||||
zoom={13}
|
||||
minZoom={6}
|
||||
zoomControl={false}
|
||||
style={{ width: "100%", height: "20rem" }}
|
||||
>
|
||||
center={[Number(lat), Number(lon)]}
|
||||
zoom={13}
|
||||
minZoom={6}
|
||||
zoomControl={false}
|
||||
style={{width: '100%', height: '20rem'}}>
|
||||
<TileLayer
|
||||
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
/>
|
||||
<SimpleMarkerBar lat={lat} lon={lon} name={name} />
|
||||
<SimpleMarkerBar lat={lat} lon={lon} name={name}/>
|
||||
</MapContainer>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type {Message as MessageType} from '@prisma/client';
|
||||
import type {Message as MessageType, User} from '@prisma/client';
|
||||
import MessageText from '@/components/chat/MessageText';
|
||||
import React from 'react';
|
||||
import MessageMap from '@/components/chat/MessageMap';
|
||||
@@ -6,9 +6,10 @@ import MessageMap from '@/components/chat/MessageMap';
|
||||
type Props = {
|
||||
align: "left" | 'right'
|
||||
message: MessageType
|
||||
user?: User
|
||||
}
|
||||
|
||||
const Message = ({message, align}: Props) => {
|
||||
const Message = ({message, align, user}: Props) => {
|
||||
if (message.text.match(/<!.+>/g)) {
|
||||
const regex = /<!lon=(?<lon>-?\d+\.\d+),lat=(?<lat>-?\d+\.\d+),name=(?<name>.+)>/g;
|
||||
const p = regex.exec(message.text)?.groups as unknown as {
|
||||
@@ -16,12 +17,10 @@ const Message = ({message, align}: Props) => {
|
||||
lat: number
|
||||
name: string
|
||||
}
|
||||
if (p) return <MessageMap align={align} point={p}/>
|
||||
if (p) return <MessageMap user={user} align={align} point={p}/>
|
||||
}
|
||||
|
||||
return (
|
||||
<MessageText message={message} align={align} />
|
||||
)
|
||||
return <MessageText user={user} message={message} align={align} />
|
||||
}
|
||||
|
||||
export default Message;
|
||||
@@ -1,19 +1,24 @@
|
||||
import type {Message as MessageType, User} from '@prisma/client';
|
||||
import type {Message as MessageType, User, Chat} from '@prisma/client';
|
||||
import Message from '@/components/chat/Message';
|
||||
import {Flex} from '@chakra-ui/react';
|
||||
|
||||
type Props = {
|
||||
user: User,
|
||||
messages: MessageType[]
|
||||
chat: Chat & { User: User[] }
|
||||
}
|
||||
|
||||
const MessageList = ({messages, user}: Props) => (
|
||||
<Flex direction={'column'} gap={1} justifyContent={'flex-end'}>
|
||||
{messages.map((message, index) => <Message
|
||||
align={user.id === message.UserID ? 'right' : 'left'} key={index}
|
||||
message={message}/>,
|
||||
)}
|
||||
</Flex>
|
||||
);
|
||||
const MessageList = ({messages, user, chat}: Props) => {
|
||||
if (chat?.User)
|
||||
return (
|
||||
<Flex direction={'column'} gap={1} justifyContent={'flex-end'}>
|
||||
{messages.map((message, index) =>
|
||||
<Message user={chat.User.find(u => u.id === message.UserID)}
|
||||
align={user.id === message.UserID ? 'right' : 'left'}
|
||||
key={index} message={message}/>,
|
||||
)}
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
||||
export default MessageList;
|
||||
@@ -1,6 +1,7 @@
|
||||
import {Box, Flex, Text} from '@chakra-ui/react';
|
||||
import {Avatar, Box, Flex, Text} from '@chakra-ui/react';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
import {User} from '@prisma/client';
|
||||
|
||||
const MapBarWithNoSSR = dynamic(() => import('./MapBar'), {
|
||||
ssr: false,
|
||||
@@ -13,16 +14,18 @@ type Props = {
|
||||
lat: string;
|
||||
name: string;
|
||||
};
|
||||
user?: User
|
||||
};
|
||||
|
||||
export default function MessageMap({align, point}: Props) {
|
||||
export default function MessageMap({align, point, user}: Props) {
|
||||
const {lon, lat, name} = point;
|
||||
return (
|
||||
<Flex justifyContent={align}>
|
||||
<Flex justifyContent={align} gap={2}>
|
||||
{user && align === "left" && <Avatar src={`/${user.images[0]}`} name={`${user.firstName} ${user.lastName}`}/>}
|
||||
<Box w={'50%'} bg={'purple.500'} borderRadius={10} p={2}>
|
||||
<MapBarWithNoSSR lon={lon} lat={lat} name={name}/>
|
||||
{/*<Text align={align}>{lon}, {lat}, {name}</Text>*/}
|
||||
</Box>
|
||||
{user && align === "right" && <Avatar src={`/${user.images[0]}`} name={`${user.firstName} ${user.lastName}`}/>}
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
import {Flex, Text} from '@chakra-ui/react';
|
||||
import {Avatar, Flex, Text} from '@chakra-ui/react';
|
||||
import type {Message as MessageType, User} from '@prisma/client';
|
||||
|
||||
type Props = {
|
||||
align: 'left' | 'right'
|
||||
message: MessageType
|
||||
message: MessageType,
|
||||
user?: User
|
||||
}
|
||||
|
||||
const MessageText = ({message, align}: Props) => (
|
||||
<Flex justifyContent={align}>
|
||||
const MessageText = ({message, align, user}: Props) => (
|
||||
|
||||
<Flex justifyContent={align} gap={2}>
|
||||
{user && align === "left" && <Avatar src={`/${user.images[0]}`} name={`${user.firstName} ${user.lastName}`}/>}
|
||||
<Text maxW={'70%'} w={'fit-content'} bg={'purple.500'} borderRadius={10}
|
||||
color={'white'} px={'10px'} py={'5px'}>
|
||||
{message.text}
|
||||
</Text>
|
||||
{user && align === "right" && <Avatar src={`/${user.images[0]}`} name={`${user.firstName} ${user.lastName}`}/>}
|
||||
</Flex>
|
||||
);
|
||||
|
||||
|
||||
@@ -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
|
||||
<Heading size={"sm"} fontWeight={"bold"} mb="0.5rem">
|
||||
A propos :
|
||||
</Heading>
|
||||
<Text as="i">"{listUsers[0].bio}"</Text>
|
||||
<Text as="i" fontWeight={"bold"}>
|
||||
{listUsers[0].bio && `"${listUsers[0].bio}"`}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
|
||||
@@ -33,11 +33,12 @@ export default function LeftPanel(props) {
|
||||
bg={"#faf9ff"}
|
||||
>
|
||||
<Flex direction={"column"} height={"100%"} margin={"10%"}>
|
||||
<Box>
|
||||
<Flex direction={"column"} align={"center"}>
|
||||
<Image
|
||||
src={user.images[0] ?? "/blank_profile_picture.webp"}
|
||||
objectFit={"contain"}
|
||||
borderRadius={"1rem"}
|
||||
maxHeight={"50vh"}
|
||||
/>
|
||||
<Box mt={"2rem"}>
|
||||
<Flex align={"center"} justifyContent="space-between" mb={"1rem"}>
|
||||
@@ -53,23 +54,26 @@ export default function LeftPanel(props) {
|
||||
{user.bio && `"${user.bio}"`}
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
</Flex>
|
||||
<Spacer />
|
||||
<Flex
|
||||
gap={2}
|
||||
direction={"column"}
|
||||
mt={"1vh"}
|
||||
spacing={3.5}
|
||||
alignContent={"bottom"}>
|
||||
alignContent={"bottom"}
|
||||
>
|
||||
<LeftPanelButton
|
||||
leftIcon={<FaMapMarkedAlt />}
|
||||
onClickHandler={() => router.push("/map")}>
|
||||
onClickHandler={() => router.push("/map")}
|
||||
>
|
||||
Carte
|
||||
</LeftPanelButton>
|
||||
|
||||
<LeftPanelButton
|
||||
leftIcon={<BsFillPersonFill />}
|
||||
onClickHandler={() => router.push("/profile")}>
|
||||
onClickHandler={() => router.push("/profile")}
|
||||
>
|
||||
Profil
|
||||
</LeftPanelButton>
|
||||
|
||||
@@ -82,7 +86,8 @@ export default function LeftPanel(props) {
|
||||
<LeftPanelButton
|
||||
variant={"outline"}
|
||||
leftIcon={<BiLogOut />}
|
||||
onClickHandler={() => signOut({ callbackUrl: "/" })}>
|
||||
onClickHandler={() => signOut({ callbackUrl: "/" })}
|
||||
>
|
||||
Déconnexion
|
||||
</LeftPanelButton>
|
||||
</Flex>
|
||||
|
||||
@@ -138,7 +138,7 @@ export default function ModalModifyImages(props) {
|
||||
<GridItem key={index}>
|
||||
<Flex
|
||||
bg={"purple.100"}
|
||||
height={"95%"}
|
||||
height={"60vh"}
|
||||
direction={"column"}
|
||||
gap={"1rem"}
|
||||
justifyContent={"space-between"}
|
||||
|
||||
Reference in New Issue
Block a user