From eaec8d70f7e4523777a209a5624bc4cf859f6b2f Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Fri, 31 Mar 2023 05:21:25 +0600 Subject: [PATCH] chore: profile page --- src/components/Login/account-dropdown.tsx | 2 +- src/components/Profile/profile-details.tsx | 45 ++++++++++++++++++++++ src/pages/profile/index.astro | 10 +++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/components/Profile/profile-details.tsx create mode 100644 src/pages/profile/index.astro diff --git a/src/components/Login/account-dropdown.tsx b/src/components/Login/account-dropdown.tsx index 5e5cb2fb7..30b1889a5 100644 --- a/src/components/Login/account-dropdown.tsx +++ b/src/components/Login/account-dropdown.tsx @@ -6,7 +6,7 @@ export default function AccountDropdown() { const [isOpen, setIsOpen] = useState(false); useEffect(() => { - // If dropdown is open, close it. + // If user click outside the dropdown, and dropdown is open then close it. const handleOpen = () => { if (isOpen) setIsOpen(false); }; diff --git a/src/components/Profile/profile-details.tsx b/src/components/Profile/profile-details.tsx new file mode 100644 index 000000000..06a48ebb6 --- /dev/null +++ b/src/components/Profile/profile-details.tsx @@ -0,0 +1,45 @@ +import { useAuth } from '../../hooks/use-auth'; + +export default function ProfileDetails() { + const { user, isLoading } = useAuth(); + return ( +
+

Profile

+

Here you can view your profile details.

+
+
+ +
+ {isLoading || !user ? ( + + ) : ( +

+ {user?.name} +

+ )} +
+
+
+ +
+ {isLoading || !user ? ( + + ) : ( +

+ {user?.email} +

+ )} +
+
+
+
+ ); +} + +function Skeleton({ className }: { className?: string }) { + return ( +
+ ); +} diff --git a/src/pages/profile/index.astro b/src/pages/profile/index.astro new file mode 100644 index 000000000..e12b5b4b1 --- /dev/null +++ b/src/pages/profile/index.astro @@ -0,0 +1,10 @@ +--- +import ProfileDetails from '../../components/Profile/profile-details'; +import BaseLayout from '../../layouts/BaseLayout.astro'; +--- + + +
+ +
+