diff --git a/src/ss_frontend/src/components/Navbar.jsx b/src/ss_frontend/src/components/Navbar.jsx index 7cf65bb..5d2284e 100644 --- a/src/ss_frontend/src/components/Navbar.jsx +++ b/src/ss_frontend/src/components/Navbar.jsx @@ -83,7 +83,12 @@ const Navbar = () => { className="btn btn-ghost btn-circle avatar" >
- + + +
diff --git a/src/ss_frontend/src/pages/ProfileDetailPage.jsx b/src/ss_frontend/src/pages/ProfileDetailPage.jsx index 508d729..00dc82b 100644 --- a/src/ss_frontend/src/pages/ProfileDetailPage.jsx +++ b/src/ss_frontend/src/pages/ProfileDetailPage.jsx @@ -1,29 +1,70 @@ -import { useQuery } from "@tanstack/react-query"; -import React, { useEffect, useState } from "react"; -import { useNavigate } from "react-router-dom"; +import React, { useEffect } from "react"; +import { AiOutlineUser } from "react-icons/ai"; +import { Link, useNavigate } from "react-router-dom"; import { useAuth } from "../hooks/UseAuth"; +import { useQuery } from "@tanstack/react-query"; +import { useState } from "react"; +import profilePlaceholder from "../assets/profilePlaceholder.jpg"; export default function ProfileDetailPage() { - const { user, getUser } = useAuth(); + const { isAuthenticated, getUser, user } = useAuth(); + const navigate = useNavigate(); const { data, isLoading, error } = useQuery({ queryKey: ["getUser", user], queryFn: getUser, }); - const navigate = useNavigate(); + const [name, setName] = useState(""); const [username, setUsername] = useState(""); - + const [pfp, setPfp] = useState(""); useEffect(() => { console.log(data); - - if (!isLoading) { + + if (!isLoading && data != undefined) { if (data.ok) { setUsername(data.ok.username); + setName(data.ok.name); + setPfp(data.ok.profileUrl); } else { - navigate(`/profile-form`); + console.log(data); + + setName("Something's wrong"); } } }, [data, isLoading]); - // masukin post - return
{username}
; + return ( + <> +
+
+ {isAuthenticated ? ( + Upload a file + ) : ( + + )} +
+
+ {/* {isAuthenticated} */} + {isAuthenticated ? ( + <> +
{name}
+

{"@" + username}

+ + + ) : ( + + Login using internet identity + + )} +
+
+ + ); } diff --git a/src/ss_frontend/src/pages/ProfilePage.jsx b/src/ss_frontend/src/pages/ProfilePage.jsx index 7fbc595..3a455a5 100644 --- a/src/ss_frontend/src/pages/ProfilePage.jsx +++ b/src/ss_frontend/src/pages/ProfilePage.jsx @@ -20,7 +20,7 @@ export default function ProfilePage() { return ( <> - {isAuthenticated ? : } + {isAuthenticated ?
: }
);