change
This commit is contained in:
parent
6ad04baf06
commit
de59d21671
@ -27,6 +27,7 @@ import PartyInvite from "./PartyInvite.tsx";
|
|||||||
|
|
||||||
// import {User, Conv, Message} from "../../../interfaces.tsx"
|
// import {User, Conv, Message} from "../../../interfaces.tsx"
|
||||||
import {User, Conv} from "../../../interfaces.tsx"
|
import {User, Conv} from "../../../interfaces.tsx"
|
||||||
|
import { IoLogoOctocat } from "react-icons/io5";
|
||||||
|
|
||||||
const TouchDiv = styled.div`
|
const TouchDiv = styled.div`
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
@ -388,12 +389,13 @@ function Chats(){
|
|||||||
<div className="chat">
|
<div className="chat">
|
||||||
|
|
||||||
<div className='navbar'>
|
<div className='navbar'>
|
||||||
<img src={DefaultPic} alt="profile" className="pic"/>
|
{/* <img src={DefaultPic} alt="profile" className="pic"/> */}
|
||||||
|
<IoLogoOctocat className="catchat"/>
|
||||||
<span>
|
<span>
|
||||||
{isLoading || !user ? (
|
{isLoading || !user ? (
|
||||||
<h4>Loading...</h4>
|
<h4>Loading...</h4>
|
||||||
) : (
|
) : (
|
||||||
<h4>{user.nickname}</h4>
|
<h2>Chat</h2>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
{/* <div className="end">
|
{/* <div className="end">
|
||||||
@ -462,7 +464,7 @@ function Chats(){
|
|||||||
))}
|
))}
|
||||||
<TouchDiv>
|
<TouchDiv>
|
||||||
<motion.div onClick={handleAddFriend}>
|
<motion.div onClick={handleAddFriend}>
|
||||||
<MdOutlineGroupAdd />
|
<MdOutlineGroupAdd className="catchat"/>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
<AnimatePresence initial={false} onExitComplete={() => null}>
|
<AnimatePresence initial={false} onExitComplete={() => null}>
|
||||||
{showAddFriendAlert && addFriend && (
|
{showAddFriendAlert && addFriend && (
|
||||||
@ -475,7 +477,7 @@ function Chats(){
|
|||||||
</TouchDiv>
|
</TouchDiv>
|
||||||
<TouchDiv>
|
<TouchDiv>
|
||||||
<motion.div onClick={handleBlockFriend}>
|
<motion.div onClick={handleBlockFriend}>
|
||||||
<ImBlocked />
|
<ImBlocked className="block"/>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
<AnimatePresence initial={false} onExitComplete={() => null}>
|
<AnimatePresence initial={false} onExitComplete={() => null}>
|
||||||
{showBlockAlert && block && (
|
{showBlockAlert && block && (
|
||||||
|
|||||||
@ -6,11 +6,7 @@
|
|||||||
/* By: sadjigui <sadjigui@student.42.fr> +#+ +:+ +#+ */
|
/* By: sadjigui <sadjigui@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/06/01 18:24:46 by apommier #+# #+# */
|
/* Created: 2023/06/01 18:24:46 by apommier #+# #+# */
|
||||||
<<<<<<< HEAD
|
/* Updated: 2023/06/23 21:14:59 by sadjigui ### ########.fr */
|
||||||
/* Updated: 2023/06/23 19:33:40 by sadjigui ### ########.fr */
|
|
||||||
=======
|
|
||||||
/* Updated: 2023/06/20 19:05:10 by apommier ### ########.fr */
|
|
||||||
>>>>>>> apommier
|
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
import {motion} from "framer-motion"
|
import {motion} from "framer-motion"
|
||||||
// import Backdrop from "../Sidebar/Backdrop"
|
// import Backdrop from "../Sidebar/Backdrop"
|
||||||
import {Link} from 'react-router-dom';
|
import {Link} from 'react-router-dom';
|
||||||
import { UserProfile } from "../../DataBase/DataUserProfile";
|
// import { UserProfile } from "../../DataBase/DataUserProfile";
|
||||||
import {useState} from 'react';
|
import {useState} from 'react';
|
||||||
import "../../styles/Profile.css"
|
import "../../styles/Profile.css"
|
||||||
|
|
||||||
import api from '../../script/axiosApi.tsx';
|
import api from '../../script/axiosApi.tsx';
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import RedAlert from "../Alert/RedAlert.tsx";
|
||||||
|
|
||||||
const dropIn = {
|
const dropIn = {
|
||||||
hidden: {
|
hidden: {
|
||||||
@ -29,6 +30,9 @@ const dropIn = {
|
|||||||
const ModalEdit = ( handleClose ) => {
|
const ModalEdit = ( handleClose ) => {
|
||||||
// let new_name = "";
|
// let new_name = "";
|
||||||
const [nickname, setNickname] = useState("");
|
const [nickname, setNickname] = useState("");
|
||||||
|
const [closeModal, setModalClose] = useState(false);
|
||||||
|
const [err, setErr] = useState(false);
|
||||||
|
const close = () => setErr(false);
|
||||||
|
|
||||||
const handler = e =>
|
const handler = e =>
|
||||||
{
|
{
|
||||||
@ -51,8 +55,24 @@ const ModalEdit = ( handleClose ) => {
|
|||||||
{
|
{
|
||||||
console.log("nickname=" ,nickname)
|
console.log("nickname=" ,nickname)
|
||||||
try{
|
try{
|
||||||
await api.post("/nickname", {nickname: nickname})
|
const ret = await api.post("/nickname", {nickname: nickname});
|
||||||
window.location.reload();
|
// console.log("cest ici = ",ret);
|
||||||
|
// if (!ret)
|
||||||
|
console.log("test ret =",ret.data);
|
||||||
|
if(ret.data)
|
||||||
|
{
|
||||||
|
console.log ("ici error = ", ret.data);
|
||||||
|
// window.location.reload();
|
||||||
|
}
|
||||||
|
else if (!ret.data)
|
||||||
|
{
|
||||||
|
console.log ("nickname already set = ", ret.data);
|
||||||
|
|
||||||
|
setErr(true);
|
||||||
|
setModalClose(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// setUser(tmpUser.data);
|
// setUser(tmpUser.data);
|
||||||
// setIsLoading(false)
|
// setIsLoading(false)
|
||||||
}
|
}
|
||||||
@ -73,12 +93,17 @@ const ModalEdit = ( handleClose ) => {
|
|||||||
animate="visible"
|
animate="visible"
|
||||||
exit="exit">
|
exit="exit">
|
||||||
<h2>Type your new name</h2>
|
<h2>Type your new name</h2>
|
||||||
<input className="text" maxLength="10" type="text" value={nickname} onChange={handler} handleClose/>
|
<input className="text" minLength={2} maxLength={10} type="text" value={nickname} onChange={handler}/>
|
||||||
<div>
|
<div>
|
||||||
<div className="button" onClick={ () => handlePostNickname()}>
|
<div className="button" onClick={handlePostNickname}>
|
||||||
change
|
change
|
||||||
{/* <Link className="button" to={""}>change</Link> */}
|
{/* <Link className="button" to={""}>change</Link> */}
|
||||||
</div>
|
</div>
|
||||||
|
{
|
||||||
|
err ? (
|
||||||
|
<RedAlert handleClose={close} text="Nickname already taken"/>
|
||||||
|
) : ("")
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* Home.tsx :+: :+: :+: */
|
/* Home.tsx :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
/* By: sadjigui <sadjigui@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/06/09 08:19:04 by apommier #+# #+# */
|
/* Created: 2023/06/09 08:19:04 by apommier #+# #+# */
|
||||||
/* Updated: 2023/06/20 15:27:00 by apommier ### ########.fr */
|
/* Updated: 2023/06/23 22:46:23 by sadjigui ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ function Profile () {
|
|||||||
{isLoading || !user ? (
|
{isLoading || !user ? (
|
||||||
<h1>Loading...</h1>
|
<h1>Loading...</h1>
|
||||||
) : (
|
) : (
|
||||||
<h1>{user.nickname}</h1>
|
<h1 className='user_name'>{user.nickname}</h1>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ function Home () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
fetchSuccess();
|
fetchSuccess();
|
||||||
})
|
},[])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.div className="page"
|
<motion.div className="page"
|
||||||
|
|||||||
@ -373,3 +373,12 @@ input.in_howLong{
|
|||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.catchat{
|
||||||
|
font-size: 30px;
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block{
|
||||||
|
font-size: 25px;
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|||||||
@ -154,6 +154,13 @@
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user_name{
|
||||||
|
/* background-image: linear-gradient(90deg, #5843e4, #5a0760); */
|
||||||
|
background: -webkit-linear-gradient(60deg, #5843e4, #5a0760);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
}
|
||||||
/* canvas {
|
/* canvas {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
border: solid 0px #ccc;
|
border: solid 0px #ccc;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user