Skip to content

Commit

Permalink
Merge pull request #2522 from IntersectMBO/develop
Browse files Browse the repository at this point in the history
GovTool-v2.0.1
  • Loading branch information
MSzalowski authored Dec 16, 2024
2 parents 90c8092 + eaf476b commit 56b2534
Show file tree
Hide file tree
Showing 20 changed files with 91 additions and 26 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion govtool/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion govtool/backend/Dockerfile.qovery
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion govtool/backend/vva-be.cabal
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions govtool/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions govtool/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@govtool/frontend",
"private": true,
"version": "2.0.0",
"version": "2.0.1",
"type": "module",
"scripts": {
"build": "vite build",
Expand Down Expand Up @@ -113,5 +113,5 @@
"nth-check": "^2.0.1",
"postcss": "^8.4.31"
},
"_id": "[email protected].0"
"_id": "[email protected].1"
}
2 changes: 2 additions & 0 deletions govtool/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ export const GovernanceActionDetailsCardLinks = ({
>
{t("govActions.supportingLinks")}
</Typography>
{links.map(({ uri, label }) => (
<Box display="flex" flexDirection="column" overflow="hidden">
{links?.map(({ uri, label }) => (
<Box
key={`${label}-${uri}-label`}
display="flex"
flexDirection="column"
overflow="hidden"
>
{label && (
<Typography
data-testid={`${label}-${uri}-label`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type GovernanceActionCardVotesProps = {
isDashboard?: boolean;
isInProgress?: boolean;
isVoter?: boolean;
vote?: ProposalVote;
vote?: ProposalVote | null;
proposal: ProposalData;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ export const GovernanceVotedOnCard = ({ votedProposal, inProgress }: Props) => {
isCopyButton
isSliderCard
/>
<GovernanceActionCardMyVote voteTxHash={vote.txHash} vote={vote.vote} />
{vote && (
<GovernanceActionCardMyVote
voteTxHash={vote.txHash}
vote={vote.vote}
/>
)}
</Box>
<Box
bgcolor="white"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { VoteContextModalState, SubmittedVotesModalState } from "../organisms";
type VoteActionFormProps = {
setIsVoteSubmitted: Dispatch<SetStateAction<boolean>>;
isInProgress?: boolean;
previousVote?: ProposalVote;
previousVote?: ProposalVote | null;
proposal: ProposalData;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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) => (
<div
className="keen-slider__slide"
key={`${action?.proposal.id}${action.vote.vote}`}
key={`${action?.proposal.id}${action.vote?.vote}`}
style={{ overflow: "visible", width: "auto" }}
>
<GovernanceVotedOnCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type GovernanceActionDetailsCardProps = {
isDataMissing: null | MetadataValidationStatus;
isInProgress?: boolean;
isVoter?: boolean;
vote?: ProposalVote;
vote?: ProposalVote | null;
proposal: ProposalData;
};

Expand All @@ -31,7 +31,7 @@ export const GovernanceActionDetailsCard = ({
const [isVoteSubmitted, setIsVoteSubmitted] = useState<boolean>(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}//${
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export const GovernanceActionDetailsCardData = ({
textVariant={screenWidth > 1600 ? "longText" : "oneLine"}
/>

{tabs.length === 1 ? (
{tabs?.length === 1 ? (
tabs[0].content
) : (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const GovernanceActionsToVote = ({

return (
<>
{!proposals.length ? (
{!proposals?.length ? (
<Typography fontWeight={300} sx={{ py: 4 }}>
{t("govActions.noResultsForTheSearch")}
</Typography>
Expand Down Expand Up @@ -91,10 +91,10 @@ export const GovernanceActionsToVote = ({
/>
</div>
))}
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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -144,6 +144,7 @@ export const VoteContextStoringInformation = ({
value: URL_REGEX,
message: t("createGovernanceAction.fields.validations.url"),
},
validate: isValidURLLength,
}}
/>
}
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/hooks/forms/useVoteActionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const useVoteActionFormController = () => {
};

type Props = {
previousVote?: ProposalVote;
previousVote?: ProposalVote | null;
voteContextHash?: string;
voteContextUrl?: string;
};
Expand Down
31 changes: 31 additions & 0 deletions govtool/frontend/src/hooks/useMatomo.ts
Original file line number Diff line number Diff line change
@@ -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);
})();
}, []);
};
4 changes: 2 additions & 2 deletions govtool/frontend/src/models/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
2 changes: 1 addition & 1 deletion govtool/metadata-validation/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 56b2534

Please sign in to comment.