diff --git a/src/components/charts/ActivityContributionChart.js b/src/components/charts/ActivityContributionChart.js index 40f1d33..4806166 100644 --- a/src/components/charts/ActivityContributionChart.js +++ b/src/components/charts/ActivityContributionChart.js @@ -157,7 +157,7 @@ const ActivityContributionChart = ({ session }) => { const weekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; return ( -
+

Activity

{ }, [calendar]); return ( -
+

Activity

{ +const UserProgressTable = ({ session, ndk }) => { + const windowWidth = useWindowWidth(); const prepareProgressData = () => { if (!session?.user?.userCourses) return []; @@ -129,7 +130,8 @@ const UserProgressTable = ({ session, ndk, windowWidth }) => { emptyMessage="No Courses or Milestones completed" value={prepareProgressData()} header={header} - style={{ margin: 8, width: "100%", borderRadius: "8px", border: "1px solid #333", boxShadow: "0 0 10px 0 rgba(0, 0, 0, 0.1)" }} + className="m-2 max-lap:m-0" + style={{ width: "100%", borderRadius: "8px", border: "1px solid #333", boxShadow: "0 0 10px 0 rgba(0, 0, 0, 0.1)" }} pt={{ wrapper: { className: "rounded-b-lg shadow-md" diff --git a/src/components/profile/DataTables/UserPurchaseTable.js b/src/components/profile/DataTables/UserPurchaseTable.js index 1226aad..2624ada 100644 --- a/src/components/profile/DataTables/UserPurchaseTable.js +++ b/src/components/profile/DataTables/UserPurchaseTable.js @@ -53,7 +53,8 @@ const UserPurchaseTable = ({ session, windowWidth }) => { emptyMessage="No purchases" value={session.user?.purchased} header={purchasesHeader} - style={{ margin: 8, width: "100%", borderRadius: "8px", border: "1px solid #333", boxShadow: "0 0 10px 0 rgba(0, 0, 0, 0.1)" }} + className="m-2 max-lap:m-0" + style={{ width: "100%", borderRadius: "8px", border: "1px solid #333", boxShadow: "0 0 10px 0 rgba(0, 0, 0, 0.1)" }} pt={{ wrapper: { className: "rounded-b-lg shadow-md" diff --git a/src/components/profile/UserProfile.js b/src/components/profile/UserProfile.js index bcc1bc5..2df31b6 100644 --- a/src/components/profile/UserProfile.js +++ b/src/components/profile/UserProfile.js @@ -37,10 +37,9 @@ const UserProfile = () => {

Profile

) } -
+
- {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's avatar +

+ {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 = () => ( +
+
user's avatar { 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)} - />
); };