reload fix , friends , navbarSocial change margin friends

This commit is contained in:
Lara REALI 2023-06-26 04:17:07 +02:00
parent 26b3c82790
commit 84cc25a5a1
7 changed files with 28 additions and 11 deletions

View File

@ -74,10 +74,13 @@ export class loginClass {
friends: null, friends: null,
blocked: null, blocked: null,
photo: null, photo: null,
sessionNumber: 1, sessionNumber: 0,
}; };
await this.usersService.create(user); await this.usersService.create(user);
} }
// if (user.status !== 2 || user.status === 0) //super
// user.status = 1;
// user.sessionNumber++;
// console.log(`in login42 user= ${user}`) // console.log(`in login42 user= ${user}`)
const myJSON = JSON.stringify(user); const myJSON = JSON.stringify(user);
console.log(`in login42 user= ${myJSON}`) console.log(`in login42 user= ${myJSON}`)

View File

@ -27,8 +27,6 @@ function AnimatedRoute () {
useEffect(() => { useEffect(() => {
const handleBeforeUnload = async (event: { preventDefault: () => void; returnValue: string; }) => { const handleBeforeUnload = async (event: { preventDefault: () => void; returnValue: string; }) => {
event.preventDefault(); // Cancel the default event behavior if needed
event.returnValue = ''; // Chrome requires a return value to display a custom message
if (!localStorage.getItem('token')) if (!localStorage.getItem('token'))
return ; return ;
try { try {
@ -36,9 +34,6 @@ function AnimatedRoute () {
} catch(err) { } catch(err) {
console.log(err); console.log(err);
} }
// Perform your desired actions before the user leaves the page
// For example, you can show a confirmation dialog or save user data
}; };
window.addEventListener('beforeunload', handleBeforeUnload); window.addEventListener('beforeunload', handleBeforeUnload);

View File

@ -26,7 +26,7 @@ export const SidebarData = [
cName: 'nav-text' cName: 'nav-text'
}, },
{ {
title: 'Friend', title: 'Friends',
path: '/social', path: '/social',
icon: <IoIcons.IoMdPeople />, icon: <IoIcons.IoMdPeople />,
cName: 'nav-text' cName: 'nav-text'

View File

@ -27,6 +27,7 @@ const UserChat = styled.div `
gap: 5px; gap: 5px;
color: white; color: white;
cursor: pointer; cursor: pointer;
margin-top: 15px;
&:hover{ &:hover{
background-color: #3e3c61; background-color: #3e3c61;
@ -93,7 +94,7 @@ export default function Friend({currentUser}: UserProps)
}; };
return ( return (
<UserChat> <UserChat className="centermargin">
{profilePicture ? ( {profilePicture ? (
<img className="pic-user" src={`data:image/jpeg;base64,${profilePicture}`} /> <img className="pic-user" src={`data:image/jpeg;base64,${profilePicture}`} />
) : ( ) : (

View File

@ -87,14 +87,14 @@ function Social (){
return ( return (
<div> <div>
<div className='navbar'> <div className='navbarSocial'>
{/* <img src={DefaultPic} alt="profile" className="pic"/> */} {/* <img src={DefaultPic} alt="profile" className="pic"/> */}
<IoMdPeople className="catchat"/> <IoMdPeople className="catchat"/>
<span> <span>
{isLoading || !user ? ( {isLoading || !user ? (
<h4>Loading...</h4> <h4>Loading...</h4>
) : ( ) : (
<h2>Social</h2> <h2>Friends</h2>
)} )}
</span> </span>

View File

@ -35,6 +35,11 @@ input.qr{
height: 40vmin; height: 40vmin;
pointer-events: none; pointer-events: none;
} }
.centermargin
{
margin-left: 40px;
margin-right: 40px;
}
@media (prefers-reduced-motion: no-preference) { @media (prefers-reduced-motion: no-preference) {
.App-logo { .App-logo {

View File

@ -108,6 +108,19 @@ select{
margin-top: 0px; margin-top: 0px;
} }
.navbarSocial{
/* width: clamp(50%, 500px, 20%); */
/* height: min(50%, 100px); */
display: flex;
align-items: center;
/* background-color: yellow; */
margin: 10px;
background-image: linear-gradient(90deg, #5843e4, #5a0760);
color: white;
padding: 3px;
border-radius: 100px;
}
.pic{ .pic{
height: 35px; height: 35px;
width: 35px; width: 35px;