diff --git a/CHANGELOG.md b/CHANGELOG.md index b9628fd1b..76352c5e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,28 @@ changes. ### Fixed +- + +### Changed + +- + +### Removed + +- + +## [v2.0.1](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.1) 2024-12-16 + +### Added + +- Integrate matomo analytics + +### Fixed + - Fix mzero parsing error on fetching the /proposal/list [Issue 2446](https://github.com/IntersectMBO/govtool/issues/2446) +- Fix scaling gov action votes on lower resolutions +- Fix storing url missing length validation [Issue 2044](https://github.com/IntersectMBO/govtool/issues/2044) +- Fix governance action details page crash on missing data [Issue 2511](https://github.com/IntersectMBO/govtool/issues/2511) ### Changed diff --git a/govtool/backend/Dockerfile b/govtool/backend/Dockerfile index 9252841bd..65a5b97ee 100644 --- a/govtool/backend/Dockerfile +++ b/govtool/backend/Dockerfile @@ -4,4 +4,4 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG WORKDIR /src COPY . . RUN cabal build -RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.0/x/vva-be/build/vva-be/vva-be /usr/local/bin +RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.1/x/vva-be/build/vva-be/vva-be /usr/local/bin diff --git a/govtool/backend/Dockerfile.qovery b/govtool/backend/Dockerfile.qovery index 18d873579..c5845a2bd 100644 --- a/govtool/backend/Dockerfile.qovery +++ b/govtool/backend/Dockerfile.qovery @@ -4,7 +4,7 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG WORKDIR /src COPY . . RUN cabal build -RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.0/x/vva-be/build/vva-be/vva-be /usr/local/bin +RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.1/x/vva-be/build/vva-be/vva-be /usr/local/bin # Expose the necessary port EXPOSE 9876 diff --git a/govtool/backend/vva-be.cabal b/govtool/backend/vva-be.cabal index d7d8a4e41..ea1cb50d1 100644 --- a/govtool/backend/vva-be.cabal +++ b/govtool/backend/vva-be.cabal @@ -1,6 +1,6 @@ cabal-version: 3.6 name: vva-be -version: 2.0.0 +version: 2.0.1 -- A short (one-line) description of the package. -- synopsis: diff --git a/govtool/frontend/package-lock.json b/govtool/frontend/package-lock.json index af8b9e7db..55b16c656 100644 --- a/govtool/frontend/package-lock.json +++ b/govtool/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "@govtool/frontend", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@govtool/frontend", - "version": "2.0.0", + "version": "2.0.1", "hasInstallScript": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/govtool/frontend/package.json b/govtool/frontend/package.json index 41d072d2d..4bbc7adea 100644 --- a/govtool/frontend/package.json +++ b/govtool/frontend/package.json @@ -1,7 +1,7 @@ { "name": "@govtool/frontend", "private": true, - "version": "2.0.0", + "version": "2.0.1", "type": "module", "scripts": { "build": "vite build", @@ -113,5 +113,5 @@ "nth-check": "^2.0.1", "postcss": "^8.4.31" }, - "_id": "govtool@2.0.0" + "_id": "govtool@2.0.1" } diff --git a/govtool/frontend/src/App.tsx b/govtool/frontend/src/App.tsx index 553d5295f..7745ceefb 100644 --- a/govtool/frontend/src/App.tsx +++ b/govtool/frontend/src/App.tsx @@ -39,8 +39,10 @@ import { import { PublicRoute } from "./pages/PublicRoute"; import { TopBanners } from "./components/organisms/TopBanners"; import { DashboardHome } from "./pages/DashboardHome"; +import { useMatomo } from "./hooks/useMatomo"; export default () => { + useMatomo(); const { isProposalDiscussionForumEnabled } = useFeatureFlag(); const { enable, isEnabled } = useCardano(); const navigate = useNavigate(); diff --git a/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx b/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx index 4d37dad7a..a76571396 100644 --- a/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx +++ b/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx @@ -34,8 +34,13 @@ export const GovernanceActionDetailsCardLinks = ({ > {t("govActions.supportingLinks")} - {links.map(({ uri, label }) => ( - + {links?.map(({ uri, label }) => ( + {label && ( { isCopyButton isSliderCard /> - + {vote && ( + + )} >; isInProgress?: boolean; - previousVote?: ProposalVote; + previousVote?: ProposalVote | null; proposal: ProposalData; }; diff --git a/govtool/frontend/src/components/organisms/DashboardGovernanceActionsVotedOn.tsx b/govtool/frontend/src/components/organisms/DashboardGovernanceActionsVotedOn.tsx index 5e5667109..5d4dcf134 100644 --- a/govtool/frontend/src/components/organisms/DashboardGovernanceActionsVotedOn.tsx +++ b/govtool/frontend/src/components/organisms/DashboardGovernanceActionsVotedOn.tsx @@ -42,7 +42,7 @@ export const DashboardGovernanceActionsVotedOn = ({ .includes(searchPhrase.toLowerCase()), ), })) - .filter((entry) => entry.actions.length > 0); + .filter((entry) => entry.actions?.length > 0); } return data; }, [data, searchPhrase, pendingTransaction.vote]); @@ -70,12 +70,12 @@ export const DashboardGovernanceActionsVotedOn = ({ title={getProposalTypeLabel(item.title)} navigateKey={item.title} searchPhrase={searchPhrase} - dataLength={item.actions.slice(0, 6).length} + dataLength={item.actions.slice(0, 6)?.length} onDashboard data={item.actions.map((action) => (
(false); const { screenWidth, isMobile } = useScreenDimension(); - const isOneColumn = (isDashboard && screenWidth < 1645) ?? isMobile; + const isOneColumn = (isDashboard && screenWidth < 1036) ?? isMobile; const { pathname, hash } = useLocation(); const govActionLinkToShare = `${window.location.protocol}//${ diff --git a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx index 4c8afb370..8928a6566 100644 --- a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx +++ b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx @@ -260,7 +260,7 @@ export const GovernanceActionDetailsCardData = ({ textVariant={screenWidth > 1600 ? "longText" : "oneLine"} /> - {tabs.length === 1 ? ( + {tabs?.length === 1 ? ( tabs[0].content ) : ( <> diff --git a/govtool/frontend/src/components/organisms/GovernanceActionsToVote.tsx b/govtool/frontend/src/components/organisms/GovernanceActionsToVote.tsx index 28777ba85..3a603668b 100644 --- a/govtool/frontend/src/components/organisms/GovernanceActionsToVote.tsx +++ b/govtool/frontend/src/components/organisms/GovernanceActionsToVote.tsx @@ -32,7 +32,7 @@ export const GovernanceActionsToVote = ({ return ( <> - {!proposals.length ? ( + {!proposals?.length ? ( {t("govActions.noResultsForTheSearch")} @@ -91,10 +91,10 @@ export const GovernanceActionsToVote = ({ />
))} - dataLength={item.actions.slice(0, 6).length} + dataLength={item.actions.slice(0, 6)?.length} filters={filters} navigateKey={item.title} - notSlicedDataLength={item.actions.length} + notSlicedDataLength={item.actions?.length} onDashboard={onDashboard} searchPhrase={searchPhrase} sorting={sorting} diff --git a/govtool/frontend/src/components/organisms/VoteContext/VoteContextStoringInformation.tsx b/govtool/frontend/src/components/organisms/VoteContext/VoteContextStoringInformation.tsx index c4ff3e53b..953528fba 100644 --- a/govtool/frontend/src/components/organisms/VoteContext/VoteContextStoringInformation.tsx +++ b/govtool/frontend/src/components/organisms/VoteContext/VoteContextStoringInformation.tsx @@ -7,7 +7,7 @@ import { ICONS } from "@consts"; import { useTranslation, useScreenDimension, useVoteContextForm } from "@hooks"; import { Step } from "@molecules"; import { ControlledField, VoteContextWrapper } from "@organisms"; -import { URL_REGEX, openInNewTab } from "@utils"; +import { URL_REGEX, isValidURLLength, openInNewTab } from "@utils"; import { LINKS } from "@/consts/links"; type VoteContextStoringInformationProps = { @@ -144,6 +144,7 @@ export const VoteContextStoringInformation = ({ value: URL_REGEX, message: t("createGovernanceAction.fields.validations.url"), }, + validate: isValidURLLength, }} /> } diff --git a/govtool/frontend/src/hooks/forms/useVoteActionForm.tsx b/govtool/frontend/src/hooks/forms/useVoteActionForm.tsx index 447204fdb..4f215199a 100644 --- a/govtool/frontend/src/hooks/forms/useVoteActionForm.tsx +++ b/govtool/frontend/src/hooks/forms/useVoteActionForm.tsx @@ -31,7 +31,7 @@ export const useVoteActionFormController = () => { }; type Props = { - previousVote?: ProposalVote; + previousVote?: ProposalVote | null; voteContextHash?: string; voteContextUrl?: string; }; diff --git a/govtool/frontend/src/hooks/useMatomo.ts b/govtool/frontend/src/hooks/useMatomo.ts new file mode 100644 index 000000000..381de7105 --- /dev/null +++ b/govtool/frontend/src/hooks/useMatomo.ts @@ -0,0 +1,31 @@ +/* eslint-disable func-names */ +/* eslint-disable no-multi-assign */ +/* eslint-disable prefer-template */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable wrap-iife */ +import { useEffect } from "react"; + +export const useMatomo = () => { + useEffect(() => { + const env = import.meta.env.VITE_APP_ENV; + if (env !== "prodction" || env !== "staging") { + return; + } + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-expect-error + const _paq = (window._paq = window._pag || []); + _paq.push(["trackPageView"]); + _paq.push(["enableLinkTracking"]); + (function () { + const u = "//analytics.gov.tools/"; + _paq.push(["setTrackerUrl", u + "matomo.php"]); + _paq.push(["setSiteId", env === "production" ? "1" : "2"]); + const d = document; + const g = d.createElement("script"); + const s = d.getElementsByTagName("script")[0]; + g.async = true; + g.src = u + "matomo.js"; + s.parentNode?.insertBefore(g, s); + })(); + }, []); +}; diff --git a/govtool/frontend/src/models/api.ts b/govtool/frontend/src/models/api.ts index 32ef7bcc5..cbd271368 100644 --- a/govtool/frontend/src/models/api.ts +++ b/govtool/frontend/src/models/api.ts @@ -224,12 +224,12 @@ export type NewConstitutionAnchor = { }; export type VotedProposalDTO = { - vote: ProposalVote; + vote: ProposalVote | null; proposal: ProposalDataDTO; }; export type VotedProposal = { - vote: ProposalVote; + vote: ProposalVote | null; proposal: ProposalData; }; diff --git a/govtool/metadata-validation/src/main.ts b/govtool/metadata-validation/src/main.ts index b5ad664f1..24c6de032 100644 --- a/govtool/metadata-validation/src/main.ts +++ b/govtool/metadata-validation/src/main.ts @@ -13,7 +13,7 @@ async function bootstrap() { const config = new DocumentBuilder() .setTitle('Metadata Validation Tool') .setDescription('The Metadata Validation Tool API description') - .setVersion('2.0.0') + .setVersion('2.0.1') .build(); const document = SwaggerModule.createDocument(app, config);