diff --git a/CHANGELOG.md b/CHANGELOG.md index c8102c766..1accf1918 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,25 @@ changes. - +## [v2.0.7](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.7) 2025-01-20 + +### Added + +- + +### Fixed + +- Fix calculating DRep activity +- Fix fetching Governance Actions being navigated from dashboard + +### Changed + +- Bump @intersect.mbo/pdf-ui to v0.5.7 + +### Removed + +- + ## [v2.0.6](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.6) 2025-01-16 ### Added diff --git a/govtool/backend/Dockerfile b/govtool/backend/Dockerfile index da4ee5635..ea0c3d15d 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.6/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.7/x/vva-be/build/vva-be/vva-be /usr/local/bin diff --git a/govtool/backend/Dockerfile.qovery b/govtool/backend/Dockerfile.qovery index 237b09b53..6b5b38703 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.6/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.7/x/vva-be/build/vva-be/vva-be /usr/local/bin # Expose the necessary port EXPOSE 9876 diff --git a/govtool/backend/sql/list-dreps.sql b/govtool/backend/sql/list-dreps.sql index e02ba95be..5ccbfb1a7 100644 --- a/govtool/backend/sql/list-dreps.sql +++ b/govtool/backend/sql/list-dreps.sql @@ -44,7 +44,7 @@ SELECT DISTINCT ON (dh.raw) encode(va.data_hash, 'hex'), dr_deposit.deposit, DRepDistr.amount, - (DRepActivity.epoch_no - GREATEST(MAX(COALESCE(block.epoch_no, block_first_register.epoch_no)), lve.epoch_no)) <= DRepActivity.drep_activity AS active, + (DRepActivity.epoch_no - GREATEST(COALESCE(block.epoch_no, block_first_register.epoch_no), lve.epoch_no, newestRegister.epoch_no)) <= DRepActivity.drep_activity AS active, encode(dr_voting_anchor.tx_hash, 'hex') AS tx_hash, newestRegister.time AS last_register_time, COALESCE(latestDeposit.deposit, 0), diff --git a/govtool/backend/vva-be.cabal b/govtool/backend/vva-be.cabal index 7b7dddd6d..7ae32cc47 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.6 +version: 2.0.7 -- A short (one-line) description of the package. -- synopsis: diff --git a/govtool/frontend/.env.example b/govtool/frontend/.env.example index 2489d65a0..5050248ee 100644 --- a/govtool/frontend/.env.example +++ b/govtool/frontend/.env.example @@ -7,6 +7,7 @@ VITE_GTM_ID="" VITE_IS_DEV=true VITE_USERSNAP_SPACE_API_KEY="" VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED='true' +VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED='true' VITE_PDF_API_URL="" VITE_IPFS_GATEWAY="" VITE_IPFS_PROJECT_ID="" \ No newline at end of file diff --git a/govtool/frontend/package-lock.json b/govtool/frontend/package-lock.json index d4b54a722..3479de187 100644 --- a/govtool/frontend/package-lock.json +++ b/govtool/frontend/package-lock.json @@ -1,20 +1,21 @@ { "name": "@govtool/frontend", - "version": "2.0.6", + "version": "2.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@govtool/frontend", - "version": "2.0.6", + "version": "2.0.7", "hasInstallScript": true, "dependencies": { "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@emurgo/cardano-serialization-lib-asmjs": "^12.1.1", "@hookform/resolvers": "^3.3.1", + "@intersect.mbo/govtool-outcomes-pillar-ui": "^1.0.0-beta.1", "@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8", - "@intersect.mbo/pdf-ui": "^0.5.6", + "@intersect.mbo/pdf-ui": "^0.5.7", "@mui/icons-material": "^5.14.3", "@mui/material": "^5.14.4", "@rollup/plugin-babel": "^6.0.4", @@ -3350,6 +3351,16 @@ "@types/node": ">=18" } }, + "node_modules/@intersect.mbo/govtool-outcomes-pillar-ui": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@intersect.mbo/govtool-outcomes-pillar-ui/-/govtool-outcomes-pillar-ui-1.0.7.tgz", + "integrity": "sha512-I214XRhLfrQUWmfy8XfoCZDjtz7kWB2qf5/Fh5Jh/QfJ95H+AkO4R3jWvCAwN3apjKy5nhgWchCgD09464EovQ==", + "license": "ISC", + "dependencies": { + "rollup-plugin-livereload": "^2.0.5", + "rollup-plugin-serve": "^1.1.1" + } + }, "node_modules/@intersect.mbo/intersectmbo.org-icons-set": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@intersect.mbo/intersectmbo.org-icons-set/-/intersectmbo.org-icons-set-1.1.0.tgz", @@ -3357,9 +3368,9 @@ "license": "ISC" }, "node_modules/@intersect.mbo/pdf-ui": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/@intersect.mbo/pdf-ui/-/pdf-ui-0.5.6.tgz", - "integrity": "sha512-YmHZlXrAfC9fNGxshEeWNNobA6M5c6m2YrKkYro0TqyMdrpigoEN70fIrBwmO001UTvaZgBYBJ3gbiNy/f8zgg==", + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@intersect.mbo/pdf-ui/-/pdf-ui-0.5.7.tgz", + "integrity": "sha512-EvZdzO1mqGikiuabioX+bkGi7XqG+QuCRhWjRw2nwGom1WmqdBN6Bt04BdwIOBtjCK0yP1KaMMjXDDepvb5txg==", "dependencies": { "@emurgo/cardano-serialization-lib-asmjs": "^12.0.0-beta.2", "@fontsource/poppins": "^5.0.14", @@ -10587,7 +10598,6 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "license": "MIT", - "peer": true, "engines": { "node": ">=8" }, @@ -11117,7 +11127,6 @@ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "license": "MIT", - "peer": true, "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -11142,7 +11151,6 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "license": "ISC", - "peer": true, "dependencies": { "is-glob": "^4.0.1" }, @@ -17102,7 +17110,6 @@ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "license": "MIT", - "peer": true, "dependencies": { "binary-extensions": "^2.0.0" }, @@ -20446,6 +20453,51 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "license": "MIT" }, + "node_modules/livereload": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/livereload/-/livereload-0.9.3.tgz", + "integrity": "sha512-q7Z71n3i4X0R9xthAryBdNGVGAO2R5X+/xXpmKeuPMrteg+W2U8VusTKV3YiJbXZwKsOlFlHe+go6uSNjfxrZw==", + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.0", + "livereload-js": "^3.3.1", + "opts": ">= 1.2.0", + "ws": "^7.4.3" + }, + "bin": { + "livereload": "bin/livereload.js" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/livereload-js": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/livereload-js/-/livereload-js-3.4.1.tgz", + "integrity": "sha512-5MP0uUeVCec89ZbNOT/i97Mc+q3SxXmiUGhRFOTmhrGPn//uWVQdCvcLJDy64MSBR5MidFdOR7B9viumoavy6g==", + "license": "MIT" + }, + "node_modules/livereload/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "license": "MIT", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/loader-runner": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", @@ -22414,6 +22466,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "license": "(WTFPL OR MIT)", + "bin": { + "opener": "bin/opener-bin.js" + } + }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -22431,6 +22492,12 @@ "node": ">= 0.8.0" } }, + "node_modules/opts": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/opts/-/opts-2.0.2.tgz", + "integrity": "sha512-k41FwbcLnlgnFh69f4qdUfvDQ+5vaSDnVPFI/y5XuhKRq97EnVVneO9F1ESVCdiVu4fCS2L8usX3mU331hB7pg==", + "license": "BSD-2-Clause" + }, "node_modules/os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", @@ -26758,7 +26825,6 @@ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "license": "MIT", - "peer": true, "dependencies": { "picomatch": "^2.2.1" }, @@ -26771,7 +26837,6 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "license": "MIT", - "peer": true, "engines": { "node": ">=8.6" }, @@ -27417,6 +27482,40 @@ "fsevents": "~2.3.2" } }, + "node_modules/rollup-plugin-livereload": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/rollup-plugin-livereload/-/rollup-plugin-livereload-2.0.5.tgz", + "integrity": "sha512-vqQZ/UQowTW7VoiKEM5ouNW90wE5/GZLfdWuR0ELxyKOJUIaj+uismPZZaICU4DnWPVjnpCDDxEqwU7pcKY/PA==", + "license": "MIT", + "dependencies": { + "livereload": "^0.9.1" + }, + "engines": { + "node": ">=8.3" + } + }, + "node_modules/rollup-plugin-serve": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-serve/-/rollup-plugin-serve-1.1.1.tgz", + "integrity": "sha512-H0VarZRtFR0lfiiC9/P8jzCDvtFf1liOX4oSdIeeYqUCKrmFA7vNiQ0rg2D+TuoP7leaa/LBR8XBts5viF6lnw==", + "license": "MIT", + "dependencies": { + "mime": "^2", + "opener": "1" + } + }, + "node_modules/rollup-plugin-serve/node_modules/mime": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/rollup/node_modules/@rollup/rollup-linux-arm64-musl": { "version": "4.27.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.27.4.tgz", diff --git a/govtool/frontend/package.json b/govtool/frontend/package.json index 35c3ddbfa..24f695d4c 100644 --- a/govtool/frontend/package.json +++ b/govtool/frontend/package.json @@ -1,7 +1,7 @@ { "name": "@govtool/frontend", "private": true, - "version": "2.0.6", + "version": "2.0.7", "type": "module", "scripts": { "build": "vite build", @@ -27,8 +27,9 @@ "@emotion/styled": "^11.11.0", "@emurgo/cardano-serialization-lib-asmjs": "^12.1.1", "@hookform/resolvers": "^3.3.1", + "@intersect.mbo/govtool-outcomes-pillar-ui": "^1.0.0-beta.1", "@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8", - "@intersect.mbo/pdf-ui": "^0.5.6", + "@intersect.mbo/pdf-ui": "^0.5.7", "@mui/icons-material": "^5.14.3", "@mui/material": "^5.14.4", "@rollup/plugin-babel": "^6.0.4", diff --git a/govtool/frontend/src/App.tsx b/govtool/frontend/src/App.tsx index 553d5295f..38fa605a5 100644 --- a/govtool/frontend/src/App.tsx +++ b/govtool/frontend/src/App.tsx @@ -2,7 +2,7 @@ import { useCallback, useEffect } from "react"; import { Route, Routes, useNavigate } from "react-router-dom"; import { Modal, ScrollToTop } from "@atoms"; -import { PATHS, PDF_PATHS } from "@consts"; +import { PATHS, PDF_PATHS, OUTCOMES_PATHS, USER_PATHS } from "@consts"; import { useCardano, useFeatureFlag, useModal } from "@context"; import { useWalletConnectionListener } from "@hooks"; import { @@ -39,9 +39,13 @@ import { import { PublicRoute } from "./pages/PublicRoute"; import { TopBanners } from "./components/organisms/TopBanners"; import { DashboardHome } from "./pages/DashboardHome"; +import { GovernanceActionOutComesPillar } from "./pages/GovernanceActionOutComes"; export default () => { - const { isProposalDiscussionForumEnabled } = useFeatureFlag(); + const { + isProposalDiscussionForumEnabled, + isGovernanceOutcomesPillarEnabled, + } = useFeatureFlag(); const { enable, isEnabled } = useCardano(); const navigate = useNavigate(); const { modal, openModal, modals } = useModal(); @@ -111,6 +115,18 @@ export default () => { element={} /> )} + {isGovernanceOutcomesPillarEnabled && ( + <> + } + /> + } + /> + + )} } diff --git a/govtool/frontend/src/components/organisms/DashboardDrawerMobile.tsx b/govtool/frontend/src/components/organisms/DashboardDrawerMobile.tsx index 00bb80cec..704d2f1ed 100644 --- a/govtool/frontend/src/components/organisms/DashboardDrawerMobile.tsx +++ b/govtool/frontend/src/components/organisms/DashboardDrawerMobile.tsx @@ -18,7 +18,7 @@ export const DashboardDrawerMobile = ({ isDrawerOpen, setIsDrawerOpen, }: DashboardDrawerMobileProps) => { - const { isProposalDiscussionForumEnabled } = useFeatureFlag(); + const { isProposalDiscussionForumEnabled, isGovernanceOutcomesPillarEnabled } = useFeatureFlag(); const { screenWidth } = useScreenDimension(); const { voter } = useGetVoterInfo(); @@ -74,30 +74,62 @@ export const DashboardDrawerMobile = ({ - {CONNECTED_NAV_ITEMS.map((navItem) => { - if ( - !isProposalDiscussionForumEnabled && - navItem.dataTestId === "proposal-discussion-link" - ) { - return null; - } - - return ( - - { - // TODO: Refine if it is needed to remove this eslint-disable - // eslint-disable-next-line no-unused-expressions - navItem.newTabLink && openInNewTab(navItem.newTabLink); + {CONNECTED_NAV_ITEMS.map((navItem) => ( + + { + if (navItem.newTabLink) { + openInNewTab(navItem.newTabLink); + } setIsDrawerOpen(false); }} - isConnectWallet - /> + isConnectWallet + /> + {navItem.childNavItems && ( + + {navItem.childNavItems.map((childItem) => { + if ( + !isProposalDiscussionForumEnabled && + childItem.dataTestId === "proposal-discussion-link" + ) { + return null; + } + + if ( + !isGovernanceOutcomesPillarEnabled && + (childItem.dataTestId === "governance-actions-voted-by-me-link" || + childItem.dataTestId === "governance-actions-outcomes-link") + ) { + return null; + } + + return ( + { + if (childItem.newTabLink) { + openInNewTab(childItem.newTabLink); + } + setIsDrawerOpen(false); + }} + isConnectWallet + /> + ); + })} - ); - })} + )} + + ))} {(voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter) && ( diff --git a/govtool/frontend/src/components/organisms/Drawer.tsx b/govtool/frontend/src/components/organisms/Drawer.tsx index 02b74ae1e..0e7b6d9a3 100644 --- a/govtool/frontend/src/components/organisms/Drawer.tsx +++ b/govtool/frontend/src/components/organisms/Drawer.tsx @@ -9,7 +9,7 @@ import { WalletInfoCard, DRepInfoCard } from "@molecules"; import { openInNewTab } from "@utils"; export const Drawer = () => { - const { isProposalDiscussionForumEnabled } = useFeatureFlag(); + const { isProposalDiscussionForumEnabled, isGovernanceOutcomesPillarEnabled } = useFeatureFlag(); const { voter } = useGetVoterInfo(); return ( @@ -46,27 +46,59 @@ export const Drawer = () => { px={3} rowGap={2} > - {CONNECTED_NAV_ITEMS.map((navItem) => { - if ( - !isProposalDiscussionForumEnabled && - navItem.dataTestId === "proposal-discussion-link" - ) { - return null; - } - - return ( - - ( + + openInNewTab(navItem.newTabLink) : undefined } - /> + /> + {navItem.childNavItems && ( + + {navItem.childNavItems.map((childItem) => { + if ( + !isProposalDiscussionForumEnabled && + childItem.dataTestId === "proposal-discussion-link" + ) { + return null; + } + + if ( + !isGovernanceOutcomesPillarEnabled && + (childItem.dataTestId === "governance-actions-voted-by-me-link" || + childItem.dataTestId === "governance-actions-outcomes-link") + ) { + return null; + } + + return ( + openInNewTab(childItem.newTabLink!) + : undefined + } + /> + ); + })} - ); - })} + )} + + ))} {voter?.isRegisteredAsDRep && } diff --git a/govtool/frontend/src/consts/navItems.tsx b/govtool/frontend/src/consts/navItems.tsx index 74795d562..922f2b360 100644 --- a/govtool/frontend/src/consts/navItems.tsx +++ b/govtool/frontend/src/consts/navItems.tsx @@ -4,7 +4,7 @@ import { theme } from "@/theme"; import { ICONS } from "./icons"; import { LINKS } from "./links"; -import { PATHS, PDF_PATHS } from "./paths"; +import { PATHS, PDF_PATHS, OUTCOMES_PATHS, USER_PATHS } from "./paths"; export const NAV_ITEMS = [ { @@ -59,6 +59,7 @@ export const CONNECTED_NAV_ITEMS = [ navTo: PATHS.dashboardDRepDirectory, activeIcon: ICONS.dRepDirectoryActiveIcon, icon: ICONS.dRepDirectoryIcon, + newTabLink: null, }, { dataTestId: "governance-actions-link", @@ -67,28 +68,54 @@ export const CONNECTED_NAV_ITEMS = [ activeIcon: ICONS.governanceActionsActiveIcon, icon: ICONS.governanceActionsIcon, newTabLink: null, - }, - { - dataTestId: "proposal-discussion-link", - label: i18n.t("proposalDiscussion.title"), - navTo: PDF_PATHS.proposalDiscussion, - activeIcon: ( - - ), - icon: ( - - ), - newTabLink: null, + childNavItems: [ + { + dataTestId: "proposal-discussion-link", + label: i18n.t("proposalDiscussion.title"), + navTo: PDF_PATHS.proposalDiscussion, + activeIcon: ( + + ), + icon: ( + + ), + newTabLink: null, + }, + { + dataTestId: "governance-actions-live-voting-link", + label: i18n.t("govActions.liveVoting.title"), + navTo: OUTCOMES_PATHS.governanceActionsLiveVoting, + activeIcon: ICONS.governanceActionsActiveIcon, + icon: ICONS.governanceActionsIcon, + newTabLink: null, + }, + { + dataTestId: "governance-actions-outcomes-link", + label: i18n.t("govActions.outcomes.title"), + navTo: OUTCOMES_PATHS.governanceActionsOutcomes, + activeIcon: ICONS.governanceActionsActiveIcon, + icon: ICONS.governanceActionsIcon, + newTabLink: null, + }, + { + dataTestId: "governance-actions-voted-by-me-link", + label: i18n.t("govActions.votedByMe.title"), + navTo: USER_PATHS.governanceActionsVotedByMe, + activeIcon: ICONS.governanceActionsActiveIcon, + icon: ICONS.governanceActionsIcon, + newTabLink: null, + }, + ], }, { dataTestId: "guides-link", diff --git a/govtool/frontend/src/consts/paths.ts b/govtool/frontend/src/consts/paths.ts index 296b61d7e..9862acefa 100644 --- a/govtool/frontend/src/consts/paths.ts +++ b/govtool/frontend/src/consts/paths.ts @@ -31,3 +31,13 @@ export const PDF_PATHS = { proposalDiscussionProposal: "/proposal_discussion/:id", proposalDiscussionPropose: "/proposal_discussion/propose", }; + +export const USER_PATHS = { + governanceActionsVotedByMe: "/my/votes_and_favorites", +}; + +export const OUTCOMES_PATHS = { + governanceActionsOutcomes: "/outcomes", + governanceActionOutcomes: "/outcomes/governance_actions/:id", + governanceActionsLiveVoting: "/connected/governance_actions", +}; diff --git a/govtool/frontend/src/context/dataActionsBar.tsx b/govtool/frontend/src/context/dataActionsBar.tsx index 8ae91c39d..9ef913a26 100644 --- a/govtool/frontend/src/context/dataActionsBar.tsx +++ b/govtool/frontend/src/context/dataActionsBar.tsx @@ -70,7 +70,7 @@ const DataActionsBarProvider: FC = ({ children }) => { const userMovedToDifferentAppArea = pathname !== lastPath && - (!pathname.startsWith(lastPath) || lastPath === ""); + (!pathname.startsWith(lastPath) || lastPath === "" || lastPath === "/"); const userOpenedGADetailsFromCategoryPage = lastPath.includes("governance_actions/category") && pathname.includes("governance_actions/"); diff --git a/govtool/frontend/src/context/featureFlag.tsx b/govtool/frontend/src/context/featureFlag.tsx index 23b1a9ecd..b45eacaa5 100644 --- a/govtool/frontend/src/context/featureFlag.tsx +++ b/govtool/frontend/src/context/featureFlag.tsx @@ -15,6 +15,7 @@ import { useAppContext } from "./appContext"; */ type FeatureFlagContextType = { isProposalDiscussionForumEnabled: boolean; + isGovernanceOutcomesPillarEnabled: boolean; isVotingOnGovernanceActionEnabled: ( governanceActionType: GovernanceActionType, ) => boolean; @@ -33,6 +34,7 @@ type FeatureFlagContextType = { const FeatureFlagContext = createContext({ isProposalDiscussionForumEnabled: false, + isGovernanceOutcomesPillarEnabled: false, isVotingOnGovernanceActionEnabled: () => false, areDRepVoteTotalsDisplayed: () => false, areSPOVoteTotalsDisplayed: () => false, @@ -129,6 +131,10 @@ const FeatureFlagProvider = ({ children }: PropsWithChildren) => { import.meta.env.VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED === "true" || import.meta.env.VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED === true || false, + isGovernanceOutcomesPillarEnabled: + import.meta.env.VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED === "true" || + import.meta.env.VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED === true || + false, isVotingOnGovernanceActionEnabled, areDRepVoteTotalsDisplayed, areSPOVoteTotalsDisplayed, diff --git a/govtool/frontend/src/i18n/locales/en.json b/govtool/frontend/src/i18n/locales/en.json index d3faf4074..75b45a80d 100644 --- a/govtool/frontend/src/i18n/locales/en.json +++ b/govtool/frontend/src/i18n/locales/en.json @@ -455,6 +455,18 @@ "title": "Info Action", "label": "Info Action" } + }, + "liveVoting": { + "title": "Live Voting", + "label": "Live Voting" + }, + "outcomes": { + "title": "Outcomes", + "label": "Outcomes" + }, + "votedByMe": { + "title": "Voted by me", + "label": "Voted by me" } }, "hero": { diff --git a/govtool/frontend/src/pages/Dashboard.tsx b/govtool/frontend/src/pages/Dashboard.tsx index 18f7a504b..497b34413 100644 --- a/govtool/frontend/src/pages/Dashboard.tsx +++ b/govtool/frontend/src/pages/Dashboard.tsx @@ -19,13 +19,19 @@ export const Dashboard = () => { const getPageTitle = (path: string) => { if (path === PATHS.dashboard) return t("dashboard.title"); - return ( - Object.values(CONNECTED_NAV_ITEMS).find(({ navTo }) => - pathname.startsWith(navTo), - )?.label ?? "" - ); + return findNavItem(CONNECTED_NAV_ITEMS, path) ?? ""; }; + const findNavItem = (items: NavItem[], targetPath: string): string | null => ( + items.reduce((result, item) => ( + result ?? ( + targetPath === item.navTo + ? item.label + : (item.childNavItems ? findNavItem(item.childNavItems, targetPath) : null) + ) + ), null) + ); + useEffect(() => { if (divRef.current && pathname !== PATHS.dashboardGovernanceActions) { divRef.current.scrollTo({ top: 0 }); diff --git a/govtool/frontend/src/pages/GovernanceActionOutComes.tsx b/govtool/frontend/src/pages/GovernanceActionOutComes.tsx new file mode 100644 index 000000000..5801cea32 --- /dev/null +++ b/govtool/frontend/src/pages/GovernanceActionOutComes.tsx @@ -0,0 +1,49 @@ +import Outcomes from "@intersect.mbo/govtool-outcomes-pillar-ui"; +import { Box, CircularProgress } from "@mui/material"; +import { Suspense } from "react"; +import { Footer, TopNav } from "@/components/organisms"; +import { useCardano } from "@/context"; +import { useScreenDimension } from "@/hooks"; + +export const GovernanceActionOutComesPillar = () => { + const { pagePadding } = useScreenDimension(); + const { ...context } = useCardano(); + return ( + + {!context.isEnabled && } + + + + + } + > + + + + {!context.isEnabled &&