further ProfileCard adjustments

This commit is contained in:
2022-12-30 19:20:37 +01:00
parent b3908b6ace
commit e749b051b0
4 changed files with 57 additions and 22 deletions

View File

@@ -28,6 +28,8 @@
}
.inner {
width: 100%;
display: flex;
flex-direction: column;
header {
display: flex;
flex-direction: row;
@@ -49,6 +51,7 @@
flex-direction: row;
gap: 1rem;
margin: 8px 0;
margin-top: auto;
.badge {
display: flex;
flex-direction: row;

View File

@@ -60,7 +60,7 @@ const ProfileCard = ({ data }: UserProfileCardProps) => {
className={styles.dot}
style={{ background: data.accentColor }}
/>
DEV
Developer
</div>
)}
</div>

View File

@@ -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 && (

View File

@@ -46,7 +46,7 @@ const ProfilePage = () => {
return (
<>
<SEO title={person.Name} />
<main>
{/* <main>
<div
style={{
display: "flex",
@@ -71,26 +71,26 @@ const ProfilePage = () => {
<h1>{person.Name}</h1>
<p>{person.Desc}</p>
</div>
</div>
</div> */}
{/* FOR LATER BIGDESC DATASET */}
{/* {person.profile?.bigdesc.map((el, index) => {
return <p key={index}>{el || <br />}</p>;
})} */}
</main>
{/* </main> */}
<main>
<ProfileCard
data={{
username: person.Name,
picture: person.Img,
description: "Twój opis. ヽ(*・ω・)ノ",
// accentColor: "violet",
description: person.Desc,
isAdmin: person.IsAdmin,
isDeveloper: person.DevBadge,
experience: {
level: 69,
looseXP: 420,
tilNextLevel: 69,
},
// accentColor: "violet",
// experience: {
// level: 69,
// looseXP: 420,
// tilNextLevel: 69,
// },
badges: [
{
badgeName: "Odkrywca internetowy",