feat: view profile
This commit is contained in:
parent
00442be4b5
commit
82ffa06a00
17
src/App.css
17
src/App.css
@ -237,6 +237,7 @@ h3 {
|
|||||||
|
|
||||||
button,
|
button,
|
||||||
.button {
|
.button {
|
||||||
|
margin: 4px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: large;
|
font-size: large;
|
||||||
color: aliceblue;
|
color: aliceblue;
|
||||||
@ -395,11 +396,23 @@ button,
|
|||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
background-color: lightsteelblue;
|
background-color: lightsteelblue;
|
||||||
padding: 2px 8px;
|
padding: 3px 8px;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
margin: auto;
|
border: 3px solid black;
|
||||||
|
margin: 0 auto 16px auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-info {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 2px 16px;
|
||||||
|
|
||||||
|
div {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.networkroute {
|
.networkroute {
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -1,11 +1,35 @@
|
|||||||
import { createRef, MouseEventHandler, useEffect, useState } from "react";
|
import { createRef, MouseEventHandler, useEffect, useState } from "react";
|
||||||
import { useSession } from "./Session";
|
import { useSession } from "./Session";
|
||||||
|
import { User } from "./api";
|
||||||
|
|
||||||
interface ContextMenuItem {
|
interface ContextMenuItem {
|
||||||
label: string;
|
label: string;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UserInfo = (user: User) => {
|
||||||
|
return (
|
||||||
|
<div className="user-info">
|
||||||
|
<div>
|
||||||
|
<b>username: </b>
|
||||||
|
</div>
|
||||||
|
<div>{user?.username}</div>
|
||||||
|
<div>
|
||||||
|
<b>display name: </b>
|
||||||
|
</div>
|
||||||
|
<div>{user?.display_name}</div>
|
||||||
|
<div>
|
||||||
|
<b>number: </b>
|
||||||
|
</div>
|
||||||
|
<div>{user?.number ? user?.number : "-"}</div>
|
||||||
|
<div>
|
||||||
|
<b>email: </b>
|
||||||
|
</div>
|
||||||
|
<div>{user?.email ? user?.email : "-"}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export default function Avatar() {
|
export default function Avatar() {
|
||||||
const { user, onLogout } = useSession();
|
const { user, onLogout } = useSession();
|
||||||
const [contextMenu, setContextMenu] = useState<{
|
const [contextMenu, setContextMenu] = useState<{
|
||||||
@ -62,13 +86,11 @@ export default function Avatar() {
|
|||||||
|
|
||||||
function handleViewProfile() {
|
function handleViewProfile() {
|
||||||
handleMenuClose();
|
handleMenuClose();
|
||||||
|
if (user) {
|
||||||
setContextMenu({ ...contextMenu, allowOpen: false });
|
setContextMenu({ ...contextMenu, allowOpen: false });
|
||||||
dialogRef.current?.showModal();
|
dialogRef.current?.showModal();
|
||||||
setDialog(
|
setDialog(UserInfo(user));
|
||||||
<ul style={{ listStyle: "none" }}>
|
}
|
||||||
<li>username: {user?.username}</li>
|
|
||||||
</ul>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -235,7 +235,7 @@ export default function Rankings() {
|
|||||||
setOpenTab(pageName);
|
setOpenTab(pageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return user ? (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container navbar">
|
<div className="container navbar">
|
||||||
<button
|
<button
|
||||||
@ -261,13 +261,11 @@ export default function Rankings() {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div id="Chemistry" className="tabcontent">
|
<div id="Chemistry" className="tabcontent">
|
||||||
<Chemistry {...{ user, players }} />
|
{user && <Chemistry {...{ user, players }} />}
|
||||||
</div>
|
</div>
|
||||||
<div id="MVP" className="tabcontent">
|
<div id="MVP" className="tabcontent">
|
||||||
<MVP {...{ user, players }} />
|
{user && <MVP {...{ user, players }} />}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
|
||||||
<span>not logged in. refresh the page...</span>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user