diff --git a/src/components/charts/ActivityContributionChart.js b/src/components/charts/ActivityContributionChart.js index 4806166..782cba4 100644 --- a/src/components/charts/ActivityContributionChart.js +++ b/src/components/charts/ActivityContributionChart.js @@ -1,10 +1,12 @@ import React, { useState, useCallback } from 'react'; import { Tooltip } from 'primereact/tooltip'; import { formatDateTime } from "@/utils/time"; +import useWindowWidth from '@/hooks/useWindowWidth'; const ActivityContributionChart = ({ session }) => { const [contributionData, setContributionData] = useState({}); const [totalActivities, setTotalActivities] = useState(0); + const windowWidth = useWindowWidth(); // Prepare activity data const prepareActivityData = useCallback(() => { @@ -156,6 +158,12 @@ const ActivityContributionChart = ({ session }) => { const calendar = generateCalendar(); const weekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; + const getScaleClass = (width) => { + if (width <= 800) return 'scale-75 origin-top-left'; + if (width <= 1000) return 'scale-95 origin-top-left'; + return ''; + }; + return (
@@ -164,7 +172,7 @@ const ActivityContributionChart = ({ session }) => { data-pr-tooltip="Total number of learning activities on the platform" />
-
+

{totalActivities} learning activities in the last year diff --git a/src/components/charts/CombinedContributionChart.js b/src/components/charts/CombinedContributionChart.js index 1312ede..76675b7 100644 --- a/src/components/charts/CombinedContributionChart.js +++ b/src/components/charts/CombinedContributionChart.js @@ -2,10 +2,12 @@ import React, { useState, useCallback, useEffect } from 'react'; import { useFetchGithubCommits } from '@/hooks/githubQueries/useFetchGithubCommits'; import { Tooltip } from 'primereact/tooltip'; import { formatDateTime } from "@/utils/time"; +import useWindowWidth from '@/hooks/useWindowWidth'; const CombinedContributionChart = ({ session }) => { const [contributionData, setContributionData] = useState({}); const [totalContributions, setTotalContributions] = useState(0); + const windowWidth = useWindowWidth(); const prepareProgressData = useCallback(() => { if (!session?.user?.userCourses) return {}; @@ -180,6 +182,12 @@ const CombinedContributionChart = ({ session }) => { return months; }, [calendar]); + const getScaleClass = (width) => { + if (width <= 800) return 'overflow-x-auto'; + if (width <= 1000) return 'scale-95 origin-top-left'; + return ''; + }; + return (
@@ -188,70 +196,72 @@ const CombinedContributionChart = ({ session }) => { data-pr-tooltip="Combined total of GitHub commits and learning activities (starting/completing courses and lessons)" />
-
- {(isLoading || isFetching) &&

Loading contribution data... ({totalContributions} total contributions / activities fetched)

} - {!isLoading && !isFetching && -
-

- {totalContributions} total contributions / activities in the last year -

-
- } -
- {/* Days of week labels */} -
- {weekDays.map((day, index) => ( -
- {index % 2 === 0 && day} +
+
+ {(isLoading || isFetching) &&

Loading contribution data... ({totalContributions} total contributions / activities fetched)

} + {!isLoading && !isFetching && +
+

+ {totalContributions} total contributions / activities in the last year +

+
+ } +
+ {/* Days of week labels */} +
+ {weekDays.map((day, index) => ( +
+ {index % 2 === 0 && day} +
+ ))} +
+
+ {/* Calendar grid */} +
+ {calendar[0].map((_, weekIndex) => ( +
+ {calendar.map((row, dayIndex) => ( + row[weekIndex] && ( +
0 ? `${row[weekIndex].githubCount} contribution${row[weekIndex].githubCount !== 1 ? 's' : ''}` : '', + row[weekIndex].activityCount > 0 ? `${row[weekIndex].activityCount} activit${row[weekIndex].activityCount !== 1 ? 'ies' : 'y'}` : '' + ].filter(Boolean).join(' & ') || 'No contributions or activities' + }`} + >
+ ) + ))} +
+ ))}
- ))} + {/* Month labels moved to bottom */} +
+ {getMonthLabels().map((month, index) => ( +
+ {month.name} +
+ ))} +
+
-
- {/* Calendar grid */} +
+ Less
- {calendar[0].map((_, weekIndex) => ( -
- {calendar.map((row, dayIndex) => ( - row[weekIndex] && ( -
0 ? `${row[weekIndex].githubCount} contribution${row[weekIndex].githubCount !== 1 ? 's' : ''}` : '', - row[weekIndex].activityCount > 0 ? `${row[weekIndex].activityCount} activit${row[weekIndex].activityCount !== 1 ? 'ies' : 'y'}` : '' - ].filter(Boolean).join(' & ') || 'No contributions or activities' - }`} - >
- ) - ))} -
- ))} -
- {/* Month labels moved to bottom */} -
- {getMonthLabels().map((month, index) => ( -
- {month.name} -
- ))} +
+
+
+
+
+ More
-
- Less -
-
-
-
-
-
-
- More -
); diff --git a/src/components/profile/UserProfile.js b/src/components/profile/UserProfile.js index cd10e04..c35fc41 100644 --- a/src/components/profile/UserProfile.js +++ b/src/components/profile/UserProfile.js @@ -38,11 +38,11 @@ const UserProfile = () => { ) }
-
+
{user && }
-
+
{account && account?.provider === "github" ? ( ) : ( diff --git a/src/components/profile/UserProfileCard.js b/src/components/profile/UserProfileCard.js index e7186e2..0c93869 100644 --- a/src/components/profile/UserProfileCard.js +++ b/src/components/profile/UserProfileCard.js @@ -71,15 +71,17 @@ const UserProfileCard = ({ user }) => {

{user.username || user?.name || user?.email || "Anon"}

-
+
{ user?.pubkey && ( -
-

- {nip19.npubEncode(user.pubkey)} -

+
+
+

+ {nip19.npubEncode(user.pubkey)} +

+
- +
) } @@ -134,7 +136,7 @@ const UserProfileCard = ({ user }) => { const DesktopProfileCard = () => (
-
+
user's avatar { className="rounded-full my-4" />
-
+
menu.current.toggle(e)} diff --git a/src/components/profile/UserSettings.js b/src/components/profile/UserSettings.js index 6b0be80..9e9d045 100644 --- a/src/components/profile/UserSettings.js +++ b/src/components/profile/UserSettings.js @@ -32,7 +32,7 @@ const UserSettings = () => {

Settings

)}
-
+
{/* Lightning Info Card */} @@ -51,7 +51,7 @@ const UserSettings = () => { {user && }
-
+