diff --git a/govtool/analytics-dashboard/src/app/[locale]/page.js b/govtool/analytics-dashboard/src/app/[locale]/page.js index c714503fd..68100c295 100644 --- a/govtool/analytics-dashboard/src/app/[locale]/page.js +++ b/govtool/analytics-dashboard/src/app/[locale]/page.js @@ -1,27 +1,36 @@ 'use client'; import { Grid, Card, CardContent, Typography, Box } from '@mui/material'; -import { PeopleAltOutlined, ArticleOutlined, AccountBalanceWalletOutlined, HowToVoteOutlined, PersonOutline, BalanceOutlined } from '@mui/icons-material'; +import { + PeopleAltOutlined, + ArticleOutlined, + AccountBalanceWalletOutlined, + HowToVoteOutlined, + PersonOutline, + BalanceOutlined, +} from '@mui/icons-material'; import { useTheme } from '@mui/material/styles'; import getGoogleData from '@/lib/api'; import { useEffect, useState } from 'react'; import { Link } from '@/navigation'; function Dashboard() { - const [stats, setStats] = useState([ // { title: 'Total users', value: 0, Icon: PeopleAltOutlined }, { title: 'Unique users', value: 0, Icon: PeopleAltOutlined }, - { title: 'Wallet connections', value: 0, Icon: AccountBalanceWalletOutlined }, + { + title: 'Wallet connections', + value: 0, + Icon: AccountBalanceWalletOutlined, + }, { title: 'Proposal views', value: 0, Icon: ArticleOutlined }, { title: 'DRep Registrations', value: 0, Icon: PersonOutline }, { title: 'Votes submitted', value: 0, Icon: HowToVoteOutlined }, - { title: 'Delegations', value: 0, Icon: BalanceOutlined } - ]) - + { title: 'Delegations', value: 0, Icon: BalanceOutlined }, + ]); const fetchData = async () => { - const resp = await getGoogleData() + const resp = await getGoogleData(); const statMap = resp.reduce((acc, event) => { acc[event.eventName] = event.eventCount; return acc; @@ -29,50 +38,119 @@ function Dashboard() { let statsTemplate = [ // { title: 'Total users', value: statMap['user_engagement'], Icon: PeopleAltOutlined }, - { title: 'Unique users', value: statMap['first_visit'], Icon: PeopleAltOutlined }, - { title: 'Wallet connections', value: +statMap['Connect wallet'] + +statMap['Connect your wallet'], Icon: AccountBalanceWalletOutlined }, - { title: 'Proposal views', value: statMap['View proposal details'], Icon: ArticleOutlined }, - { title: 'DRep Registrations', value: statMap['Register'], Icon: PersonOutline }, - { title: 'Votes submitted', value: statMap['Vote'], Icon: HowToVoteOutlined }, - { title: 'Delegations', value: statMap['Delegate'], Icon: BalanceOutlined }, + { + title: 'Unique users', + value: statMap['first_visit'], + Icon: PeopleAltOutlined, + }, + { + title: 'Wallet connections', + value: + +statMap['Connect wallet'] + + +statMap['Connect your wallet'], + Icon: AccountBalanceWalletOutlined, + }, + { + title: 'Proposal views', + value: statMap['View proposal details'], + Icon: ArticleOutlined, + }, + { + title: 'DRep Registrations', + value: statMap['Register'], + Icon: PersonOutline, + }, + { + title: 'Votes submitted', + value: statMap['Vote'], + Icon: HowToVoteOutlined, + }, + { + title: 'Delegations', + value: statMap['Delegate'], + Icon: BalanceOutlined, + }, ]; - setStats(statsTemplate) - } + setStats(statsTemplate); + }; useEffect(() => { - fetchData() - }, []) - - + fetchData(); + }, []); const theme = useTheme(); return ( - theme?.palette?.text?.black }}> - - + theme?.palette?.text?.black }} + > + + SanchoNet Govtool Participation Dashboard - theme?.palette?.text?.gray }}> - This dashboard shows the overall participation and usage of SanchoNet Govtool from 1st of December 2023 + theme?.palette?.text?.gray }} + > + This dashboard shows the overall participation and usage + of SanchoNet Govtool from 1st of December 2023 - {stats.map((stat, index) => ( theme?.palette?.background?.info, width: '100%' }} + sx={{ + background: (theme) => + theme?.palette?.background?.info, + width: '100%', + }} > - - - - theme?.palette?.text?.gray }}> + + + + + theme?.palette?.text?.gray, + }} + > {stat.title} @@ -85,18 +163,28 @@ function Dashboard() { - + - © {new Date().getFullYear()} Intersect MBO + © {new Date().getFullYear()} GovTool - theme?.palette?.text?.primaryBlue }}> + theme?.palette?.text?.primaryBlue, + }} + > Sancho Govtool - - + ); } diff --git a/govtool/frontend/package-lock.json b/govtool/frontend/package-lock.json index fa16b20ad..aa7470bca 100644 --- a/govtool/frontend/package-lock.json +++ b/govtool/frontend/package-lock.json @@ -13,7 +13,7 @@ "@emotion/styled": "^11.11.0", "@emurgo/cardano-serialization-lib-asmjs": "^14.1.1", "@hookform/resolvers": "^3.3.1", - "@intersect.mbo/govtool-outcomes-pillar-ui": "v1.5.8", + "@intersect.mbo/govtool-outcomes-pillar-ui": "v1.5.9", "@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8", "@intersect.mbo/pdf-ui": "1.0.14-beta", "@mui/icons-material": "^5.14.3", @@ -3392,9 +3392,9 @@ } }, "node_modules/@intersect.mbo/govtool-outcomes-pillar-ui": { - "version": "1.5.8", - "resolved": "https://registry.npmjs.org/@intersect.mbo/govtool-outcomes-pillar-ui/-/govtool-outcomes-pillar-ui-1.5.8.tgz", - "integrity": "sha512-uRLY+tvuV/lWxZCLpMKa72fcYKYAvE9FdfYn7s1KeLcbw8rpezFPu6dHlqVaF6zPngBu2UFwJqrB3FL6iSEs7Q==", + "version": "1.5.9", + "resolved": "https://registry.npmjs.org/@intersect.mbo/govtool-outcomes-pillar-ui/-/govtool-outcomes-pillar-ui-1.5.9.tgz", + "integrity": "sha512-Lq0ILRbUrFSqT8QK6meXud7S45uEwvABmSIIXhm+4fgLm7iPtKpr0ctu9++M7EsYJxPsUFHpa/4sM4zhmVB46w==", "license": "ISC", "dependencies": { "@fontsource/poppins": "^5.0.14", diff --git a/govtool/frontend/package.json b/govtool/frontend/package.json index 233ca770d..578e6c801 100644 --- a/govtool/frontend/package.json +++ b/govtool/frontend/package.json @@ -27,7 +27,7 @@ "@emotion/styled": "^11.11.0", "@emurgo/cardano-serialization-lib-asmjs": "^14.1.1", "@hookform/resolvers": "^3.3.1", - "@intersect.mbo/govtool-outcomes-pillar-ui": "v1.5.8", + "@intersect.mbo/govtool-outcomes-pillar-ui": "v1.5.9", "@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8", "@intersect.mbo/pdf-ui": "1.0.14-beta", "@mui/icons-material": "^5.14.3", diff --git a/govtool/frontend/src/components/molecules/DataActionsBar.tsx b/govtool/frontend/src/components/molecules/DataActionsBar.tsx index 1ff86d706..b6672a968 100644 --- a/govtool/frontend/src/components/molecules/DataActionsBar.tsx +++ b/govtool/frontend/src/components/molecules/DataActionsBar.tsx @@ -65,6 +65,11 @@ export const DataActionsBar: FC = ({ [chosenFilters, filterOptions], ); + const chosenSortingLabel = useMemo(() => { + const opt = (sortOptions ?? []).find((o) => o.key === chosenSorting); + return opt?.label ?? chosenSorting; + }, [sortOptions, chosenSorting]); + const handleRemoveFilter = (key: string) => setChosenFilters?.((prev) => (prev ?? []).filter((k) => k !== key)); @@ -135,7 +140,7 @@ export const DataActionsBar: FC = ({ filtersOpen={effectiveFiltersOpen} isFiltering={isFiltering} setFiltersOpen={setEffectiveFiltersOpen} - chosenSorting={chosenSorting} + chosenSorting={chosenSortingLabel} setSortOpen={setEffectiveSortOpen} sortOpen={effectiveSortOpen} > diff --git a/govtool/frontend/src/components/organisms/DashboardGovernanceActionsVotedOn.tsx b/govtool/frontend/src/components/organisms/DashboardGovernanceActionsVotedOn.tsx index 670d50498..3c145d98d 100644 --- a/govtool/frontend/src/components/organisms/DashboardGovernanceActionsVotedOn.tsx +++ b/govtool/frontend/src/components/organisms/DashboardGovernanceActionsVotedOn.tsx @@ -77,7 +77,7 @@ export const DashboardGovernanceActionsVotedOn = ({ diff --git a/govtool/frontend/src/components/organisms/GovernanceActionsToVote.tsx b/govtool/frontend/src/components/organisms/GovernanceActionsToVote.tsx index 4154474cb..7d04f3fdf 100644 --- a/govtool/frontend/src/components/organisms/GovernanceActionsToVote.tsx +++ b/govtool/frontend/src/components/organisms/GovernanceActionsToVote.tsx @@ -121,7 +121,7 @@ export const GovernanceActionsToVote = ({ diff --git a/govtool/frontend/src/consts/dRepDirectory/sorting.ts b/govtool/frontend/src/consts/dRepDirectory/sorting.ts index 2ae238b15..339f708ae 100644 --- a/govtool/frontend/src/consts/dRepDirectory/sorting.ts +++ b/govtool/frontend/src/consts/dRepDirectory/sorting.ts @@ -1,7 +1,7 @@ export const DREP_DIRECTORY_SORTING = [ { key: "Activity", - label: "Activity", + label: "Voting Activity", }, { key: "RegistrationDate", diff --git a/govtool/frontend/src/i18n/locales/en.json b/govtool/frontend/src/i18n/locales/en.json index c4b054471..b5240664c 100644 --- a/govtool/frontend/src/i18n/locales/en.json +++ b/govtool/frontend/src/i18n/locales/en.json @@ -377,7 +377,7 @@ } }, "footer": { - "copyright": "© {{year}} Intersect MBO", + "copyright": "© {{year}} GovTool", "privacyPolicy": "Privacy policy", "termOfService": "Terms of Use" }, diff --git a/govtool/frontend/src/stories/Footer.stories.ts b/govtool/frontend/src/stories/Footer.stories.ts index fb40c74f9..d3d42c075 100644 --- a/govtool/frontend/src/stories/Footer.stories.ts +++ b/govtool/frontend/src/stories/Footer.stories.ts @@ -21,7 +21,7 @@ export const FooterComponent: Story = { const nowDate = new Date(); await expect( - canvas.getByText(`© ${nowDate.getFullYear()} Intersect MBO`), + canvas.getByText(`© ${nowDate.getFullYear()} GovTool`), ).toBeInTheDocument(); await userEvent.click(canvas.getByTestId("privacy-policy-footer-link")); await expect(window.open).toHaveBeenCalledTimes(1);