-
{account && account?.provider === "github" ? (
) : (
diff --git a/src/components/profile/UserProfileCard.js b/src/components/profile/UserProfileCard.js
index 3a72059..961df81 100644
--- a/src/components/profile/UserProfileCard.js
+++ b/src/components/profile/UserProfileCard.js
@@ -1,15 +1,20 @@
-import React, { useRef } from 'react';
+import React, { useRef, useState } from 'react';
import Image from 'next/image';
import { Menu } from 'primereact/menu';
import { Tooltip } from 'primereact/tooltip';
import { nip19 } from 'nostr-tools';
import { useImageProxy } from '@/hooks/useImageProxy';
import { useToast } from '@/hooks/useToast';
+import UserBadges from '@/components/profile/UserBadges';
+import useWindowWidth from '@/hooks/useWindowWidth';
const UserProfileCard = ({ user }) => {
+ const [showBadges, setShowBadges] = useState(false);
const menu = useRef(null);
const { showToast } = useToast();
const { returnImageProxy } = useImageProxy();
+ const windowWidth = useWindowWidth();
+
const copyToClipboard = (text) => {
navigator.clipboard.writeText(text);
showToast("success", "Copied", "Copied to clipboard");
@@ -40,9 +45,96 @@ const UserProfileCard = ({ user }) => {
}
];
- return (
-
-
+ const MobileProfileCard = () => (
+
+
+
+ menu.current.toggle(e)}
+ />
+
+
+
+
+
+ {user.username || user?.name || user?.email || "Anon"}
+
+
+ {
+ user?.pubkey && (
+
+
+ {nip19.npubEncode(user.pubkey)}
+
+
+
+
+ )
+ }
+ {user?.createdAt && (
+
+ Joined: {new Date(user.createdAt).toLocaleDateString()}
+
+ )}
+
+
+
+ {user?.lightningAddress ? (
+
+ Lightning Address: {user.lightningAddress.name}@plebdevs.com copyToClipboard(user.lightningAddress.name + "@plebdevs.com")} />
+
+ ) : (
+
+
+ Lightning Address: None
+
+ {/* todo: add tooltip */}
+
+
+
+ )}
+ {user?.nip05 ? (
+
+ NIP-05: {user.nip05.name}@plebdevs.com copyToClipboard(user.nip05.name + "@plebdevs.com")} />
+
+ ) : (
+
+
+ NIP-05: None
+
+ {/* todo: add tooltip */}
+
+
+
+ )}
+
+
+
+
+
+
+ );
+
+ const DesktopProfileCard = () => (
+
+
{
height={100}
className="rounded-full my-4"
/>
-
-
-
+
+
menu.current.toggle(e)}
@@ -85,13 +176,13 @@ const UserProfileCard = ({ user }) => {
)}
-
+
{user?.lightningAddress ? (
-
+
Lightning Address: {user.lightningAddress.name}@plebdevs.com copyToClipboard(user.lightningAddress.name + "@plebdevs.com")} />
) : (
-
+
Lightning Address: None
@@ -101,11 +192,11 @@ const UserProfileCard = ({ user }) => {
)}
{user?.nip05 ? (
-
+
NIP-05: {user.nip05.name}@plebdevs.com copyToClipboard(user.nip05.name + "@plebdevs.com")} />
) : (
-
+
NIP-05: None
@@ -114,9 +205,26 @@ const UserProfileCard = ({ user }) => {
)}
+
);
+
+ // 1440px is the max-lap breakpoint from tailwind config
+ return (
+ <>
+ {windowWidth <= 1440 ? : }
+ setShowBadges(false)}
+ />
+ >
+ );
};
export default UserProfileCard;
diff --git a/src/components/profile/progress/UserProgress.js b/src/components/profile/progress/UserProgress.js
index 0f4b63f..dfb5d65 100644
--- a/src/components/profile/progress/UserProgress.js
+++ b/src/components/profile/progress/UserProgress.js
@@ -4,7 +4,6 @@ import { Accordion, AccordionTab } from 'primereact/accordion';
import { useSession, signIn, getSession } from 'next-auth/react';
import { useRouter } from 'next/router';
import GenericButton from '@/components/buttons/GenericButton';
-import UserBadges from '@/components/profile/UserBadges';
import UserProgressFlow from './UserProgressFlow';
import { Tooltip } from 'primereact/tooltip';
@@ -56,7 +55,6 @@ const UserProgress = () => {
const [expandedItems, setExpandedItems] = useState({});
const [completedCourses, setCompletedCourses] = useState([]);
const [tasks, setTasks] = useState([]);
- const [showBadges, setShowBadges] = useState(false);
const [isLoading, setIsLoading] = useState(true);
const router = useRouter();
@@ -177,7 +175,7 @@ const UserProgress = () => {
};
return (
-
+
Dev Journey
{
)}
-
-
+
+
{tasks.map((task, index) => (
-
@@ -291,7 +289,7 @@ const UserProgress = () => {
-
+
{isLoading ? (
@@ -301,18 +299,6 @@ const UserProgress = () => {
)}
-
-
-
-
setShowBadges(false)}
- />
);
};