From f0acadbd76d277aab7e3b513c1d516bff13caffb Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 1 Sep 2024 01:02:06 +0200 Subject: [PATCH] add contributor cards V0 --- src/app/state/locales/en/team.json | 5 +- src/app/state/locales/pt/team.json | 5 +- src/app/state/teamSlice.ts | 8 ++- src/app/team/page.tsx | 91 +++++++++++++++++++++++++----- 4 files changed, 93 insertions(+), 16 deletions(-) diff --git a/src/app/state/locales/en/team.json b/src/app/state/locales/en/team.json index 910d9b53..4a49c9e8 100644 --- a/src/app/state/locales/en/team.json +++ b/src/app/state/locales/en/team.json @@ -1,5 +1,8 @@ { "team": "Team", "meet_our_contributors": "Meet our contributors", - "we_have_a_diverse_talented": "We have a diverse, talented pool of contributors from various fields and locations worldwide. Anyone can join. Browse our current active or past members and connect with contributors to collaborate." + "we_have_a_diverse_talented": "We have a diverse, talented pool of contributors from various fields and locations worldwide. Anyone can join. Browse our current active or past members and connect with contributors to collaborate.", + "all": "All", + "activity_status": "Activity status", + "area_of_work": "Area of work" } diff --git a/src/app/state/locales/pt/team.json b/src/app/state/locales/pt/team.json index 1c2d06f2..feb7d0ac 100644 --- a/src/app/state/locales/pt/team.json +++ b/src/app/state/locales/pt/team.json @@ -1,5 +1,8 @@ { "team": "Equipe", "meet_our_contributors": "Conheça nossos colaboradores", - "we_have_a_diverse_talented": "Temos um grupo diversificado e talentoso de colaboradores de várias áreas e localizações ao redor do mundo. Qualquer pessoa pode participar. Explore nossos membros atuais ou passados e conecte-se com colaboradores para colaborar." + "we_have_a_diverse_talented": "Temos um grupo diversificado e talentoso de colaboradores de várias áreas e localizações ao redor do mundo. Qualquer pessoa pode participar. Explore nossos membros atuais ou passados e conecte-se com colaboradores para colaborar.", + "all": "Todos", + "activity_status": "Status da atividade", + "area_of_work": "Área de trabalho" } diff --git a/src/app/state/teamSlice.ts b/src/app/state/teamSlice.ts index f24a1491..fd93de83 100644 --- a/src/app/state/teamSlice.ts +++ b/src/app/state/teamSlice.ts @@ -79,6 +79,7 @@ function getEmission(phase: number): number { } export interface Contributor { + name: string; telegram: string; github?: string; discord?: string; @@ -89,7 +90,7 @@ export interface Contributor { isOG?: boolean; isLongTerm?: boolean; isActive: boolean; - phasesActive?: string[]; + phasesActive: number[]; // analytics tokensEarned: number; trophyGold: number; @@ -272,6 +273,9 @@ function runPhaseAnalytics( console.error({ phaseRows, phase, user, points }); continue; } + // Add phase to phasesActive array + contributor.phasesActive.push(phase); + // Add trophies if (row === 0) { contributor.trophyGold += 1; } @@ -327,6 +331,7 @@ function rowToContributor(row: string): Contributor { .filter((str) => Object.values(Expertise).includes(str as Expertise)) .map((str) => str.toUpperCase() as Expertise); return { + name: telegram, telegram: telegram.toLowerCase(), github: github.toLowerCase(), discord: discord.toLowerCase(), @@ -334,6 +339,7 @@ function rowToContributor(row: string): Contributor { isActive: false, expertise, radixWallet, + phasesActive: [], tokensEarned: 0, trophyGold: 0, trophySilver: 0, diff --git a/src/app/team/page.tsx b/src/app/team/page.tsx index 9e899f73..513cb99c 100644 --- a/src/app/team/page.tsx +++ b/src/app/team/page.tsx @@ -9,6 +9,7 @@ import { showActiveContributors, ActivityStatus, Expertise, + Contributor, } from "state/teamSlice"; import { store } from "state/store"; import { fetchTeamState } from "state/teamSlice"; @@ -24,8 +25,8 @@ export default function Team() { }, []); return ( -
-
+
+
@@ -35,13 +36,14 @@ export default function Team() { } function Filters() { + const t = useTranslations(); return (
-

Activity status

+

{t("activity_status")}

-

Area of work

+

{t("area_of_work")}

@@ -53,37 +55,39 @@ function Filters() { } function ActivityStatusToggle({ filter }: { filter?: ActivityStatus }) { + const t = useTranslations(); const dispatch = useAppDispatch(); const { activityStatusFilter } = useAppSelector((state) => state.teamSlice); - const label = filter === undefined ? "ALL" : filter; + const label = filter === undefined ? "all" : filter; const isActive = activityStatusFilter === filter; return (
dispatch(teamSlice.actions.setActivityStatusFilter(filter)) } > -

{label}

+

{t(label)}

); } function ExpertiseToggle({ filter }: { filter?: Expertise }) { + const t = useTranslations(); const dispatch = useAppDispatch(); const { expertiseFilter } = useAppSelector((state) => state.teamSlice); - const label = filter === undefined ? "ALL" : filter; + const label = filter === undefined ? "all" : filter; const isActive = expertiseFilter === filter; return (
dispatch(teamSlice.actions.setExpertiseFilter(filter))} > -

{label}

+

{t(label)}

); } @@ -99,7 +103,68 @@ function HeaderComponent() { } function Contributors() { - return
; + const { contributorMap } = useAppSelector((state) => state.teamSlice); + const contributors = contributorMap + .map((arr) => arr[1]) + .sort((a, b) => b.phasesActive.length - a.phasesActive.length); + return ( +
+ {contributors.map((contributor, indx) => { + return ; + })} +
+ ); +} + +// TODO: Expertise +// TODO: links to social channels +// TODO: active badge +function ContributorCard({ contributor }: { contributor: Contributor }) { + return ( +
+ {/* Flexbox container for image and text */} +
+ {/* Contributor Image */} + {contributor.telegram} + + {/* Contributor Details */} +
+ {/* Truncate telegram name */} +

+ {contributor.name} +

+ {/* Display ADMIN and OG on the same line */} +

+ ADMIN + OG +

+

+ contributed in {contributor.phasesActive.length} phases +

+
+
+
+

+ {contributor.telegram} +

+

+ {contributor.github} +

+

+ {contributor.discord} +

+
+
+ ); } function DexterParagraph({ text }: { text: string }) {