further ProfileCard adjustments
This commit is contained in:
@@ -1,10 +1,36 @@
|
||||
import { useUser } from "@auth0/nextjs-auth0/client";
|
||||
import Link from "next/link";
|
||||
import { useEffect, useState } from "react";
|
||||
import { ProfileCard } from "../../components/ProfileCard/ProfileCard";
|
||||
import { SEO } from "../../components/SEO";
|
||||
|
||||
const PageMe = () => {
|
||||
const { user, error, isLoading } = useUser();
|
||||
type personsSchema = {
|
||||
Id: string;
|
||||
Name: string;
|
||||
Desc?: string;
|
||||
Img?: string;
|
||||
IsAdmin?: boolean;
|
||||
DevBadge?: boolean;
|
||||
AssignedUser?: string;
|
||||
};
|
||||
const [personsData, setPersonsData] = useState<personsSchema | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetch("https://gractwo.pl/api/v1/admincards")
|
||||
.then((res) => {
|
||||
return res.json();
|
||||
})
|
||||
.then((data) => {
|
||||
setPersonsData(
|
||||
data.filter((el: personsSchema) => {
|
||||
if (!user) return false;
|
||||
return el.AssignedUser === user.sub?.replace("oauth2|discord|", "");
|
||||
})[0]
|
||||
);
|
||||
});
|
||||
}, [user]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -29,14 +55,15 @@ const PageMe = () => {
|
||||
data={{
|
||||
username: user.name || "unknown user",
|
||||
picture: user.picture,
|
||||
description: "Twój opis. ヽ(*・ω・)ノ",
|
||||
isAdmin: true,
|
||||
isDeveloper: true,
|
||||
experience: {
|
||||
level: 69,
|
||||
looseXP: 420,
|
||||
tilNextLevel: 69,
|
||||
},
|
||||
description: personsData?.Desc || "twój opis.",
|
||||
isAdmin: personsData?.IsAdmin,
|
||||
isDeveloper: personsData?.DevBadge,
|
||||
// isAdmin: true,
|
||||
// experience: {
|
||||
// level: 69,
|
||||
// looseXP: 420,
|
||||
// tilNextLevel: 69,
|
||||
// },
|
||||
badges: [
|
||||
{
|
||||
badgeName: "Odkrywca internetowy",
|
||||
@@ -71,10 +98,15 @@ const PageMe = () => {
|
||||
}}
|
||||
/>
|
||||
<Link href="/ja/ustawienia">
|
||||
<button style={{ width: "100%", margin: 0 }}>
|
||||
<button style={{ width: "100%", margin: 0, marginBottom: "12px" }}>
|
||||
Ustawienia Konta
|
||||
</button>
|
||||
</Link>
|
||||
{/* <Link href="/ja/ustawienia-profilu-publicznego">
|
||||
<button style={{ width: "100%", margin: 0, marginBottom: "12px" }}>
|
||||
Ustawienia Profilu Publicznego
|
||||
</button>
|
||||
</Link> */}
|
||||
</main>
|
||||
)}
|
||||
{!isLoading && !user && (
|
||||
|
||||
Reference in New Issue
Block a user