new alert bad input qrcode resize button chat modif alert name already taken
This commit is contained in:
parent
b61531d8d2
commit
80ff5f6c9f
@ -17,6 +17,7 @@ import { ImBlocked } from 'react-icons/im';
|
|||||||
import { MdOutlineGroupAdd } from 'react-icons/md';
|
import { MdOutlineGroupAdd } from 'react-icons/md';
|
||||||
import { GrAdd } from 'react-icons/gr';
|
import { GrAdd } from 'react-icons/gr';
|
||||||
import { RiListSettingsLine } from 'react-icons/ri'
|
import { RiListSettingsLine } from 'react-icons/ri'
|
||||||
|
import { HiChatBubbleLeft } from 'react-icons/hi2'
|
||||||
|
|
||||||
// import { Rank } from "../../DataBase/DataRank";
|
// import { Rank } from "../../DataBase/DataRank";
|
||||||
import GreenAlert from "../Alert/GreenAlert.tsx";
|
import GreenAlert from "../Alert/GreenAlert.tsx";
|
||||||
@ -475,7 +476,7 @@ function Chats(){
|
|||||||
<motion.div
|
<motion.div
|
||||||
onClick={() => (setting ? setSetting(false) : setSetting(true))}
|
onClick={() => (setting ? setSetting(false) : setSetting(true))}
|
||||||
>
|
>
|
||||||
<RiListSettingsLine/>
|
<RiListSettingsLine className="block"/>
|
||||||
<AnimatePresence
|
<AnimatePresence
|
||||||
initial={false}
|
initial={false}
|
||||||
onExitComplete={() => null}
|
onExitComplete={() => null}
|
||||||
@ -526,7 +527,8 @@ function Chats(){
|
|||||||
<div key={index}
|
<div key={index}
|
||||||
onClick={() => setCurrentChat(c)}>
|
onClick={() => setCurrentChat(c)}>
|
||||||
<UserChat>
|
<UserChat>
|
||||||
<img className="pic-user" src={DefaultPic} alt="User" />
|
{/* <img className="pic-user" src={DefaultPic} alt="User" /> */}
|
||||||
|
<HiChatBubbleLeft className="catchat"/>
|
||||||
<div className="infoSideBar">
|
<div className="infoSideBar">
|
||||||
<span>{c.name}</span>
|
<span>{c.name}</span>
|
||||||
{/* <SideP>Desc?</SideP> */}
|
{/* <SideP>Desc?</SideP> */}
|
||||||
|
|||||||
@ -243,7 +243,7 @@ const ModalSetting = ({handleClose, convId, socket }: ModalSettingProps) => {
|
|||||||
<Link to="#" onClick={dark} className={ privateConv ? "darkSubmit" : "submit"}>Private</Link>
|
<Link to="#" onClick={dark} className={ privateConv ? "darkSubmit" : "submit"}>Private</Link>
|
||||||
</div>
|
</div>
|
||||||
{/* <p className="checkbox">Private<input className="check"type="checkbox" value="private" onChange={handleCheckPriv}/></p> */}
|
{/* <p className="checkbox">Private<input className="check"type="checkbox" value="private" onChange={handleCheckPriv}/></p> */}
|
||||||
<p className="checkbox">Password<input type="checkbox" value="password" checked={password} onChange={handleCheckPass}/> </p>
|
<p className="checkbox">Password<input className="inside_ckeckbox" type="checkbox" value="password" checked={password} onChange={handleCheckPass}/> </p>
|
||||||
|
|
||||||
|
|
||||||
{password ? (
|
{password ? (
|
||||||
@ -305,7 +305,7 @@ const ModalSetting = ({handleClose, convId, socket }: ModalSettingProps) => {
|
|||||||
onKeyDown={handleMute}
|
onKeyDown={handleMute}
|
||||||
type="number"
|
type="number"
|
||||||
className="in_howLong"
|
className="in_howLong"
|
||||||
placeholder="How long ?"
|
placeholder="Time"
|
||||||
value={time}
|
value={time}
|
||||||
onChange={(e) => setTime(e.target.value)}
|
onChange={(e) => setTime(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -54,22 +54,25 @@ const ModalEdit = (handleClose) => {
|
|||||||
const handlePostNickname = async () => {
|
const handlePostNickname = async () => {
|
||||||
console.log("nickname=", nickname)
|
console.log("nickname=", nickname)
|
||||||
try {
|
try {
|
||||||
const ret = await api.post("/nickname", { nickname: nickname });
|
|
||||||
// console.log("cest ici = ",ret);
|
// console.log("cest ici = ",ret);
|
||||||
// if (!ret)
|
// if (!ret)
|
||||||
console.log("test ret =", ret.data);
|
// console.log("test ret =", ret.data);
|
||||||
if (nickname.length < 3) {
|
if (nickname.length > 3) {
|
||||||
|
const ret = await api.post("/nickname", { nickname: nickname });
|
||||||
|
if (ret.data) {
|
||||||
|
console.log("ici error = ", ret.data);
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("nickname already set = ", ret.data);
|
||||||
|
|
||||||
|
setErrTaken(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (nickname.length < 3)
|
||||||
|
{
|
||||||
setErrTooShort(true);
|
setErrTooShort(true);
|
||||||
}
|
}
|
||||||
else if (ret.data) {
|
|
||||||
console.log("ici error = ", ret.data);
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log("nickname already set = ", ret.data);
|
|
||||||
|
|
||||||
setErrTaken(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// setUser(tmpUser.data);
|
// setUser(tmpUser.data);
|
||||||
|
|||||||
@ -6,7 +6,8 @@ import "../styles/App.css";
|
|||||||
import api from '../script/axiosApi.tsx';
|
import api from '../script/axiosApi.tsx';
|
||||||
|
|
||||||
import QRCodeStyling from "qr-code-styling";
|
import QRCodeStyling from "qr-code-styling";
|
||||||
import { motion } from 'framer-motion'
|
import { AnimatePresence, motion } from 'framer-motion'
|
||||||
|
import RedAlert from "../components/Alert/RedAlert.tsx";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -36,6 +37,8 @@ function QrCode () {
|
|||||||
const [secret, setSecret] = useState(false);
|
const [secret, setSecret] = useState(false);
|
||||||
const [code, setCode] = useState('');
|
const [code, setCode] = useState('');
|
||||||
const [activated, setActivated] = useState(false);
|
const [activated, setActivated] = useState(false);
|
||||||
|
const [err, setErr] = useState(false);
|
||||||
|
const closeErr = () => setErr(false);
|
||||||
|
|
||||||
// const history = useHistory();
|
// const history = useHistory();
|
||||||
|
|
||||||
@ -80,6 +83,10 @@ function QrCode () {
|
|||||||
const res = await api.post("/verifyOtp", {token: code})
|
const res = await api.post("/verifyOtp", {token: code})
|
||||||
console.log("res= ", res.data)
|
console.log("res= ", res.data)
|
||||||
console.log("res= ", res)
|
console.log("res= ", res)
|
||||||
|
if (!res.data)
|
||||||
|
{
|
||||||
|
setErr(true);
|
||||||
|
}
|
||||||
if (res.data === 1)
|
if (res.data === 1)
|
||||||
{
|
{
|
||||||
console.log("registered")
|
console.log("registered")
|
||||||
@ -158,6 +165,11 @@ function QrCode () {
|
|||||||
) : (
|
) : (
|
||||||
<button className="desactivate" onClick={handleDesactivate}>Desactivate 2FA</button>
|
<button className="desactivate" onClick={handleDesactivate}>Desactivate 2FA</button>
|
||||||
)}
|
)}
|
||||||
|
<AnimatePresence
|
||||||
|
initial={false}
|
||||||
|
onExitComplete={() => null}>
|
||||||
|
{err ? (<RedAlert handleClose={closeErr} text="Error: Bad intput. Try again"/>):("")}
|
||||||
|
</AnimatePresence>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
{/* {!localStorage.getItem('token') && (
|
{/* {!localStorage.getItem('token') && (
|
||||||
|
|||||||
@ -233,9 +233,9 @@ p {
|
|||||||
backdrop-filter: sepia(90%);
|
backdrop-filter: sepia(90%);
|
||||||
background-color: rgba(0, 0, 0, 0.3);
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
width: 11rem;
|
width: 15rem;
|
||||||
height: 1.5rem;
|
height: 2rem;
|
||||||
margin-top: 1rem;
|
margin-top: 1.3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.greenAlert{
|
.greenAlert{
|
||||||
@ -385,4 +385,11 @@ input.in_howLong{
|
|||||||
.block{
|
.block{
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inside_ckeckbox{
|
||||||
|
height: 25px;
|
||||||
|
margin-left: -50px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user