From 7450ab0feddef510dc4781407e48b4451cc8fa9d Mon Sep 17 00:00:00 2001 From: J Caso Date: Wed, 18 Sep 2024 16:45:40 +0200 Subject: [PATCH 01/32] fix: open terms and package.json details --- ui/summit-2024/package.json | 4 ++-- ui/summit-2024/src/components/Footer/Footer.tsx | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/summit-2024/package.json b/ui/summit-2024/package.json index 3d4785c66..96fd1e4a3 100644 --- a/ui/summit-2024/package.json +++ b/ui/summit-2024/package.json @@ -1,7 +1,7 @@ { - "name": "vite-project", + "name": "cardano-ballot", "private": true, - "version": "0.0.0", + "version": "0.1.0", "type": "module", "scripts": { "dev": "vite", diff --git a/ui/summit-2024/src/components/Footer/Footer.tsx b/ui/summit-2024/src/components/Footer/Footer.tsx index d2e089857..0d742ca53 100644 --- a/ui/summit-2024/src/components/Footer/Footer.tsx +++ b/ui/summit-2024/src/components/Footer/Footer.tsx @@ -14,7 +14,6 @@ import { eventBus, EventName } from "../../utils/EventBus"; const Footer = () => { const handleOpenTerms = () => { - console.log("handleOpenTerms"); eventBus.publish(EventName.OpenTermsModal); }; return ( @@ -80,7 +79,7 @@ const Footer = () => { display: "flex", }} > - handleOpenTerms()}> + { marginRight: 1, cursor: "pointer", }} + onClick={() => handleOpenTerms()} > {i18n.t("footer.menu.termsAndConditions")} @@ -98,6 +98,7 @@ const Footer = () => { marginRight: 1, cursor: "pointer", }} + onClick={() => handleOpenTerms()} > {i18n.t("footer.menu.privacyPolicy")} From 4ae00158b3e301df16c1883e0bf05f5f7d0c5fb5 Mon Sep 17 00:00:00 2001 From: J Caso Date: Thu, 19 Sep 2024 09:53:02 +0200 Subject: [PATCH 02/32] fix: open github commit from current version --- ui/summit-2024/src/components/Footer/Footer.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ui/summit-2024/src/components/Footer/Footer.tsx b/ui/summit-2024/src/components/Footer/Footer.tsx index 0d742ca53..e9e49c416 100644 --- a/ui/summit-2024/src/components/Footer/Footer.tsx +++ b/ui/summit-2024/src/components/Footer/Footer.tsx @@ -79,7 +79,7 @@ const Footer = () => { display: "flex", }} > - + { {i18n.t("footer.menu.privacyPolicy")} - Version {env.APP_VERSION}( + + window.open( + `https://github.com/cardano-foundation/cf-cardano-ballot/commit/${env.APP_VERSION}`, + ) + } + > + Version {env.APP_VERSION} + + ( Date: Thu, 19 Sep 2024 15:08:44 +0200 Subject: [PATCH 03/32] feat: set matomo env vars --- ui/summit-2024/.env.example | 9 +++++---- ui/summit-2024/src/common/constants/env.ts | 5 +++++ ui/summit-2024/src/index.tsx | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ui/summit-2024/.env.example b/ui/summit-2024/.env.example index dac154daf..4c5781869 100644 --- a/ui/summit-2024/.env.example +++ b/ui/summit-2024/.env.example @@ -14,18 +14,19 @@ VITE_DISCORD_CHANNEL_URL=https://discord.gg/WyB6QSVh ## Discord bot URL for Wallet verification VITE_DISCORD_BOT_URL=https://discord.com/channels/1255818615886843945/1255820482180284448 -## Matomo Base URL +## Matomo VITE_MATOMO_BASE_URL=http://localhost:8080 +VITE_MATOMO_PROJECT_ID=1 # Config vars ## Cardano Network Target. Possible values: MAINNET or PREPROD VITE_TARGET_NETWORK=PREPROD ## ID of the running event on chain -VITE_EVENT_ID="CF_SUMMIT_2024_8BCC" +VITE_EVENT_ID=CF_SUMMIT_2024_12BAF-LOCAL ## List of supported wallets -VITE_SUPPORTED_WALLETS=flint,eternl,nami,typhon,yoroi,nufi,gerowallet,lace +VITE_SUPPORTED_WALLETS=eternl,nami,typhon,yoroi,nufi,gerowallet,lace ## Controls the visibility of the winners of the voting VITE_SHOW_WINNERS=false @@ -34,4 +35,4 @@ VITE_SHOW_WINNERS=false VITE_SHOW_HYDRA_TALLY=false ## Using dummy data -VITE_USING_FIXTURES=false +VITE_USING_FIXTURES=true diff --git a/ui/summit-2024/src/common/constants/env.ts b/ui/summit-2024/src/common/constants/env.ts index 4370ca3e5..041a9203f 100644 --- a/ui/summit-2024/src/common/constants/env.ts +++ b/ui/summit-2024/src/common/constants/env.ts @@ -15,6 +15,10 @@ const MATOMO_BASE_URL = window._env_?.VITE_MATOMO_BASE_URL || import.meta.env.VITE_MATOMO_BASE_URL || "none"; +const MATOMO_PROJECT_ID = + window._env_?.VITE_MATOMO_PROJECT_ID || + import.meta.env.VITE_MATOMO_PROJECT_ID || + "none"; const DISCORD_CHANNEL_URL = window._env_?.VITE_DISCORD_CHANNEL_URL || import.meta.env.VITE_DISCORD_CHANNEL_URL; @@ -55,6 +59,7 @@ export const env = { APP_VERSION, SUPPORTED_WALLETS, MATOMO_BASE_URL, + MATOMO_PROJECT_ID, FRONTEND_URL, COMMIT_HASH, DISCORD_CHANNEL_URL, diff --git a/ui/summit-2024/src/index.tsx b/ui/summit-2024/src/index.tsx index aecdcb9cd..2313e540a 100644 --- a/ui/summit-2024/src/index.tsx +++ b/ui/summit-2024/src/index.tsx @@ -12,7 +12,7 @@ import { env } from "./common/constants/env"; const instance = createInstance({ urlBase: env.MATOMO_BASE_URL, - siteId: 1, + siteId: env.MATOMO_PROJECT_ID, trackerUrl: `${env.MATOMO_BASE_URL}/matomo.php`, srcUrl: `${env.MATOMO_BASE_URL}/matomo.js`, disabled: false, From 9c352ba52241dd82daec8133b5ae0f14e5d9fd38 Mon Sep 17 00:00:00 2001 From: J Caso Date: Thu, 19 Sep 2024 15:14:52 +0200 Subject: [PATCH 04/32] feat: parse matomo project id --- ui/summit-2024/src/common/constants/env.ts | 2 +- ui/summit-2024/src/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/summit-2024/src/common/constants/env.ts b/ui/summit-2024/src/common/constants/env.ts index 041a9203f..128bf01dd 100644 --- a/ui/summit-2024/src/common/constants/env.ts +++ b/ui/summit-2024/src/common/constants/env.ts @@ -18,7 +18,7 @@ const MATOMO_BASE_URL = const MATOMO_PROJECT_ID = window._env_?.VITE_MATOMO_PROJECT_ID || import.meta.env.VITE_MATOMO_PROJECT_ID || - "none"; + "0"; const DISCORD_CHANNEL_URL = window._env_?.VITE_DISCORD_CHANNEL_URL || import.meta.env.VITE_DISCORD_CHANNEL_URL; diff --git a/ui/summit-2024/src/index.tsx b/ui/summit-2024/src/index.tsx index 2313e540a..42da60e78 100644 --- a/ui/summit-2024/src/index.tsx +++ b/ui/summit-2024/src/index.tsx @@ -12,7 +12,7 @@ import { env } from "./common/constants/env"; const instance = createInstance({ urlBase: env.MATOMO_BASE_URL, - siteId: env.MATOMO_PROJECT_ID, + siteId: parseInt(env.MATOMO_PROJECT_ID, 10), trackerUrl: `${env.MATOMO_BASE_URL}/matomo.php`, srcUrl: `${env.MATOMO_BASE_URL}/matomo.js`, disabled: false, From 0c22635ec029f192731e083f81420973c4e5b55b Mon Sep 17 00:00:00 2001 From: J Caso Date: Thu, 19 Sep 2024 15:49:15 +0200 Subject: [PATCH 05/32] feat: add trackEvents --- .../ConnectWalletModal/ConnectWalletModal.tsx | 23 +++++++++- .../src/components/Footer/Footer.tsx | 46 +++++++++++++------ .../VerifyWalletModal/VerifyWalletModal.tsx | 18 +++++++- .../src/pages/Categories/Categories.tsx | 13 ++++++ .../pages/Home/components/TicketsSection.tsx | 6 +++ 5 files changed, 90 insertions(+), 16 deletions(-) diff --git a/ui/summit-2024/src/components/ConnectWalletModal/ConnectWalletModal.tsx b/ui/summit-2024/src/components/ConnectWalletModal/ConnectWalletModal.tsx index 4b064510e..ee582ae48 100644 --- a/ui/summit-2024/src/components/ConnectWalletModal/ConnectWalletModal.tsx +++ b/ui/summit-2024/src/components/ConnectWalletModal/ConnectWalletModal.tsx @@ -16,6 +16,7 @@ import { setConnectedWallet } from "../../store/reducers/userCache"; import { ToastType } from "../common/Toast/Toast.types"; import { initialConnectedWallet } from "../../store/reducers/userCache/initialState"; import { clearUserInSessionStorage } from "../../utils/session"; +import { useMatomo } from "@datapunt/matomo-tracker-react"; const ConnectWalletModal = (props: ConnectWalletProps) => { const dispatch = useAppDispatch(); @@ -45,7 +46,7 @@ const ConnectWalletModal = (props: ConnectWalletProps) => { } = useCardano({ limitNetwork: resolveCardanoNetwork(env.TARGET_NETWORK), }); - + const { trackEvent } = useMatomo(); const isMobile = useIsPortrait(); const onConnectWalletError = (e: Error) => { @@ -103,6 +104,11 @@ const ConnectWalletModal = (props: ConnectWalletProps) => { `${name} Wallet connected successfully`, ); props.handleCloseConnectWalletModal(); + trackEvent({ + category: "connect-keri-wallet", + action: "click-event", + name: "idw_p2p", + }); } else { eventBus.publish( EventName.ShowToast, @@ -129,6 +135,11 @@ const ConnectWalletModal = (props: ConnectWalletProps) => { `${name} Wallet connected successfully`, ); props.handleCloseConnectWalletModal(); + trackEvent({ + category: "connect-cardano-wallet", + action: "click-event", + name: name, + }); } }, (e: Error) => { @@ -181,6 +192,11 @@ const ConnectWalletModal = (props: ConnectWalletProps) => { ); eventBus.publish(EventName.CloseConnectWalletModal); eventBus.publish(EventName.ShowToast, "Wallet connected successfully"); + trackEvent({ + category: "connect-cardano-wallet", + action: "click-event", + name: walletName, + }); }, onConnectError, ); @@ -211,6 +227,11 @@ const ConnectWalletModal = (props: ConnectWalletProps) => { address: keriIdentifier.id, }), ); + trackEvent({ + category: "connect-keri-wallet", + action: "click-event", + name: "idw_p2p", + }); } else { eventBus.publish( EventName.ShowToast, diff --git a/ui/summit-2024/src/components/Footer/Footer.tsx b/ui/summit-2024/src/components/Footer/Footer.tsx index e9e49c416..68fedc2cb 100644 --- a/ui/summit-2024/src/components/Footer/Footer.tsx +++ b/ui/summit-2024/src/components/Footer/Footer.tsx @@ -11,11 +11,37 @@ import { env } from "../../common/constants/env"; import discordLogo from "../../assets/discord.svg"; import { i18n } from "../../i18n"; import { eventBus, EventName } from "../../utils/EventBus"; +import { useMatomo } from "@datapunt/matomo-tracker-react"; const Footer = () => { + const { trackEvent } = useMatomo(); + const handleOpenTerms = () => { eventBus.publish(EventName.OpenTermsModal); + trackEvent({ + category: "open-terms-from-footer", + action: "click-event", + }); + }; + + const handleJoinDiscord = () => { + window.open(env.DISCORD_SUPPORT_CHANNEL_URL, "_blank"); + trackEvent({ + category: "click-join-discord", + action: "click-event", + }); }; + + const handleOpenGithubCommit = () => { + window.open( + `https://github.com/cardano-foundation/cf-cardano-ballot/commit/${env.APP_VERSION}`, + ); + trackEvent({ + category: "click-open-github-commit", + action: "click-event", + }); + }; + return ( <> { - window.open( - `https://github.com/cardano-foundation/cf-cardano-ballot/commit/${env.APP_VERSION}`, - ) - } + style={{ + cursor: "pointer", + }} + onClick={() => handleOpenGithubCommit()} > Version {env.APP_VERSION} @@ -148,9 +170,7 @@ const Footer = () => { > - window.open(env.DISCORD_SUPPORT_CHANNEL_URL, "_blank") - } + onClick={() => handleJoinDiscord()} sx={{ p: 0, color: "secondary.main", marginRight: "40px" }} > @@ -158,9 +178,7 @@ const Footer = () => { - window.open(env.DISCORD_SUPPORT_CHANNEL_URL, "_blank") - } + onClick={() => handleJoinDiscord()} sx={{ p: 0, color: "secondary.main" }} > { const connectedWallet = useAppSelector(getConnectedWallet); const dispatch = useAppDispatch(); - + const { trackEvent } = useMatomo(); const isMobile = useMediaQuery(theme.breakpoints.down("sm")); const [isOpen, setIsOpen] = useState(false); const [verifyCurrentPaths, setVerifyCurrentPaths] = useState< @@ -167,6 +168,7 @@ const VerifyWalletModal = () => { ToastType.Error, ); setPhoneCodeIsBeenSending(false); + trackEvent({ category: "sms-sent-error", action: "backend-event" }); } else { handleSetCurrentPath(VerifyWalletFlow.CONFIRM_CODE); dispatch( @@ -179,6 +181,7 @@ const VerifyWalletModal = () => { setPhoneCodeIsSent(true); setCheckImNotARobot(false); setPhoneCodeIsBeenSending(false); + trackEvent({ category: "sms-sent", action: "backend-event" }); } }) .catch(() => { @@ -206,6 +209,10 @@ const VerifyWalletModal = () => { "Phone number verified successfully", ); setIsOpen(false); + trackEvent({ + category: "phone-number-verified", + action: "backend-event", + }); } else { setPhoneCodeShowError(true); eventBus.publish( @@ -215,6 +222,10 @@ const VerifyWalletModal = () => { ); setPhoneCodeIsBeenConfirming(false); handleSetCurrentPath(VerifyWalletFlow.DID_NOT_RECEIVE_CODE); + trackEvent({ + category: "phone-number-verified-failed", + action: "backend-event", + }); } }) .catch(() => { @@ -250,12 +261,17 @@ const VerifyWalletModal = () => { verifyDiscordResult.message || "Error while verifying", ToastType.Error, ); + trackEvent({ + category: "discord-verification-failed", + action: "backend-event", + }); return; } // @ts-ignore dispatch(setWalletIsVerified(verifyDiscordResult.verified)); eventBus.publish(EventName.ShowToast, "Wallet verified successfully"); handleCloseModal(); + trackEvent({ category: "discord-verified", action: "backend-event" }); }; const renderStartVerification = () => { diff --git a/ui/summit-2024/src/pages/Categories/Categories.tsx b/ui/summit-2024/src/pages/Categories/Categories.tsx index 51a70c479..3a7323eec 100644 --- a/ui/summit-2024/src/pages/Categories/Categories.tsx +++ b/ui/summit-2024/src/pages/Categories/Categories.tsx @@ -49,6 +49,7 @@ import { import { useCardano } from "@cardano-foundation/cardano-connect-with-wallet"; import { env } from "../../common/constants/env"; import { formatISODate } from "../../utils/utils"; +import { useMatomo } from "@datapunt/matomo-tracker-react"; interface CategoriesProps { embedded?: boolean; @@ -82,6 +83,7 @@ const Categories: React.FC = ({ embedded }) => { const session = getUserInSession(); const dispatch = useAppDispatch(); + const { trackEvent } = useMatomo(); const showEventDate = eventCache.notStarted || @@ -308,9 +310,20 @@ const Categories: React.FC = ({ embedded }) => { eventBus.publish(EventName.OpenLoginModal); } + trackEvent({ + category: "vote-failed", + action: "click-event", + // @ts-ignore + name: submitVoteResult.message, + }); return; } eventBus.publish(EventName.ShowToast, "Vote submitted successfully"); + trackEvent({ + category: "vote-successfully", + action: "click-event", + name: proposalId, + }); const updatedVotes = [ ...userVotes, diff --git a/ui/summit-2024/src/pages/Home/components/TicketsSection.tsx b/ui/summit-2024/src/pages/Home/components/TicketsSection.tsx index fd733cfad..def55e86f 100644 --- a/ui/summit-2024/src/pages/Home/components/TicketsSection.tsx +++ b/ui/summit-2024/src/pages/Home/components/TicketsSection.tsx @@ -3,12 +3,18 @@ import Logo from "../../../assets/logo.svg"; import dubaiBg from "@assets/dubai-bg.svg"; import { CustomButton } from "../../../components/common/CustomButton/CustomButton"; import theme from "../../../common/styles/theme"; +import { useMatomo } from "@datapunt/matomo-tracker-react"; const TicketsSection = () => { const isMobile = useMediaQuery(theme.breakpoints.down("sm")); + const { trackEvent } = useMatomo(); const handleButtonClick = () => { window.open("https://summit.cardano.org/registration/", "_blank"); + trackEvent({ + category: "open-buy-summit-tickets", + action: "click-event", + }); }; return ( From 4d4af8b53952187bf45b502b5b4a6d81e418da06 Mon Sep 17 00:00:00 2001 From: J Caso Date: Thu, 19 Sep 2024 21:38:56 +0200 Subject: [PATCH 06/32] feat: set VITE_MATOMO_PROJECT_ID 1 by default --- ui/summit-2024/src/common/constants/env.ts | 2 +- ui/summit-2024/src/index.tsx | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/summit-2024/src/common/constants/env.ts b/ui/summit-2024/src/common/constants/env.ts index 128bf01dd..148ac4c32 100644 --- a/ui/summit-2024/src/common/constants/env.ts +++ b/ui/summit-2024/src/common/constants/env.ts @@ -18,7 +18,7 @@ const MATOMO_BASE_URL = const MATOMO_PROJECT_ID = window._env_?.VITE_MATOMO_PROJECT_ID || import.meta.env.VITE_MATOMO_PROJECT_ID || - "0"; + "1"; const DISCORD_CHANNEL_URL = window._env_?.VITE_DISCORD_CHANNEL_URL || import.meta.env.VITE_DISCORD_CHANNEL_URL; diff --git a/ui/summit-2024/src/index.tsx b/ui/summit-2024/src/index.tsx index 42da60e78..4290b2d9f 100644 --- a/ui/summit-2024/src/index.tsx +++ b/ui/summit-2024/src/index.tsx @@ -10,6 +10,9 @@ import App from "./App"; import { store } from "./store"; import { env } from "./common/constants/env"; +console.log("env.MATOMO_PROJECT_ID"); +console.log(env.MATOMO_PROJECT_ID); +console.log(parseInt(env.MATOMO_PROJECT_ID, 10)); const instance = createInstance({ urlBase: env.MATOMO_BASE_URL, siteId: parseInt(env.MATOMO_PROJECT_ID, 10), From d97d2fba4a04e79d524eb7ab0ebc496f5b37c16b Mon Sep 17 00:00:00 2001 From: J Caso Date: Thu, 19 Sep 2024 21:39:26 +0200 Subject: [PATCH 07/32] fix: remove debugs --- ui/summit-2024/src/index.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/ui/summit-2024/src/index.tsx b/ui/summit-2024/src/index.tsx index 4290b2d9f..42da60e78 100644 --- a/ui/summit-2024/src/index.tsx +++ b/ui/summit-2024/src/index.tsx @@ -10,9 +10,6 @@ import App from "./App"; import { store } from "./store"; import { env } from "./common/constants/env"; -console.log("env.MATOMO_PROJECT_ID"); -console.log(env.MATOMO_PROJECT_ID); -console.log(parseInt(env.MATOMO_PROJECT_ID, 10)); const instance = createInstance({ urlBase: env.MATOMO_BASE_URL, siteId: parseInt(env.MATOMO_PROJECT_ID, 10), From 9658977d59f29a804c20ef90727d9908c8b954f7 Mon Sep 17 00:00:00 2001 From: J Caso Date: Fri, 20 Sep 2024 13:56:14 +0200 Subject: [PATCH 08/32] fix: update status page --- ui/summit-2024/src/components/Footer/Footer.tsx | 2 +- .../pages/Categories/components/ViewReceipt.tsx | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ui/summit-2024/src/components/Footer/Footer.tsx b/ui/summit-2024/src/components/Footer/Footer.tsx index 68fedc2cb..fdafff4c9 100644 --- a/ui/summit-2024/src/components/Footer/Footer.tsx +++ b/ui/summit-2024/src/components/Footer/Footer.tsx @@ -139,7 +139,7 @@ const Footer = () => { ( = ({ categoryId, close }) => { const session = getUserInSession(); @@ -77,10 +79,11 @@ const ViewReceipt: React.FC = ({ categoryId, close }) => { const viewOnChainVote = () => { if (receipt?.merkleProof?.transactionHash) { - window.open( - `https://preprod.cardanoscan.io/transaction/${receipt?.merkleProof?.transactionHash}`, - "_blank", - ); + let url = `https://explorer.cardano.org/transaction?id=${receipt?.merkleProof?.transactionHash}`; + if (resolveCardanoNetwork(env.TARGET_NETWORK) === NetworkType.TESTNET) { + url = `https://preprod.cardanoscan.io/transaction/${receipt?.merkleProof?.transactionHash}`; + } + window.open(url, "_blank"); } }; @@ -204,7 +207,7 @@ const ViewReceipt: React.FC = ({ categoryId, close }) => { ), title: "In Progress", description: - "Your transaction has been sent and is awaiting confirmation from the Cardano network (this could be 5-10 minutes). Once this has been confirmed you’ll be able to verify your vote.", + "Your transaction has been sent and is awaiting for the event's grace period to finish. Once it ends you'll be able to verify your vote.", iconBottom: ( = ({ categoryId, close }) => { ), title: "In Progress", description: - "Your transaction has been sent and is awaiting confirmation from the Cardano network (this could be 5-10 minutes). Once this has been confirmed you’ll be able to verify your vote.", + "Your transaction has been sent and is awaiting for the event's grace period to finish. Once it ends you'll be able to verify your vote.", iconBottom: ( Date: Fri, 20 Sep 2024 14:14:42 +0200 Subject: [PATCH 09/32] feat: multiple winners --- .../pages/Categories/components/Winners.tsx | 70 +++++++++++-------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/ui/summit-2024/src/pages/Categories/components/Winners.tsx b/ui/summit-2024/src/pages/Categories/components/Winners.tsx index 3939f6436..9b5a7efc9 100644 --- a/ui/summit-2024/src/pages/Categories/components/Winners.tsx +++ b/ui/summit-2024/src/pages/Categories/components/Winners.tsx @@ -67,10 +67,12 @@ const Winners: React.FC = ({ (v) => v.categoryId === categoryId, )?.proposalId; - let nominees = + const nominees = extendedCategoryData.find((c) => c.id === categoryId)?.proposals || []; - const winner = nominees[0]; - nominees.shift(); + + const maxVotes = Math.max(...nominees.map((n) => n.votes || 0)); + const winners = nominees.filter((n) => n.votes === maxVotes); + const remainingNominees = nominees.filter((n) => n.votes !== maxVotes); useEffect(() => { getVotingResults().then((response) => { @@ -169,7 +171,7 @@ const Winners: React.FC = ({ zIndex: 3, }} > - {votedFor === winner.id ? ( + {winners.find((w) => w.id === votedFor) ? ( ) : null} @@ -188,32 +190,45 @@ const Winners: React.FC = ({ marginBottom: "40px", }} > - Winner! + Winner + {winners.length > 1 ? "s" : ""}! - - Placeholder - - ) => - handleLearnMoreClick(event, "") - } - align="center" + - {winner?.name} - + Placeholder + + {winners.map((winner) => { + return ( + ) => + handleLearnMoreClick(event, "") + } + align="center" + mt={2} + sx={{ + color: theme.palette.text.neutralLightest, + textAlign: "center", + textShadow: "0px 0px 12px rgba(18, 18, 18, 0.20)", + fontFamily: "Dosis", + fontSize: "28px", + fontStyle: "normal", + fontWeight: 700, + lineHeight: "32px", + marginTop: "10px", + cursor: "pointer", + }} + > + {winner?.name} + + ); + })} = ({ marginTop: "4px", }} > - {winner?.votes} + {winners[0].votes} - = ({ - {nominees?.map((nominee, index) => ( + {remainingNominees?.map((nominee, index) => ( Date: Mon, 23 Sep 2024 15:17:01 +0200 Subject: [PATCH 10/32] fix: winner learn more --- ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx | 2 +- ui/summit-2024/src/pages/Categories/components/Winners.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx b/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx index a85da8167..06ce84ef9 100644 --- a/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx +++ b/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx @@ -98,7 +98,7 @@ const ViewReceipt: React.FC = ({ categoryId, close }) => { eventBus.publish(EventName.ShowToast, r.message, ToastType.Error); return; } - if (JSON.stringify(r) === JSON.stringify(receipts[categoryId])) { + if (JSON.stringify(r) === JSON.stringify(receipt)) { eventBus.publish( EventName.ShowToast, "No changes detected in the receipt", diff --git a/ui/summit-2024/src/pages/Categories/components/Winners.tsx b/ui/summit-2024/src/pages/Categories/components/Winners.tsx index 9b5a7efc9..4e8eeff0e 100644 --- a/ui/summit-2024/src/pages/Categories/components/Winners.tsx +++ b/ui/summit-2024/src/pages/Categories/components/Winners.tsx @@ -208,7 +208,7 @@ const Winners: React.FC = ({ return ( ) => - handleLearnMoreClick(event, "") + handleLearnMoreClick(event, winner.id) } align="center" mt={2} From 1744b0ffbed5537edb58ef7adf3576f0e8064d20 Mon Sep 17 00:00:00 2001 From: J Caso Date: Tue, 24 Sep 2024 11:27:51 +0200 Subject: [PATCH 11/32] fix: include missing VERY_HIGH state --- .../pages/Categories/components/ViewReceipt.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx b/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx index 06ce84ef9..18c7bd68e 100644 --- a/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx +++ b/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx @@ -342,7 +342,20 @@ const ViewReceipt: React.FC = ({ categoryId, close }) => { /> ), }; - + case "VERY_HIGH": + return { + description: + "Your vote is currently being verified. While in VERY HIGH, the chance of a rollback is very unlikely. Check back later to see if verification has completed.", + icon: ( + + ), + }; case "FINAL": return { description: "Your vote has been successfully verified.", From 4055a3d48176f36ece31284b10f0afb411bc62ea Mon Sep 17 00:00:00 2001 From: J Caso Date: Tue, 24 Sep 2024 11:34:37 +0200 Subject: [PATCH 12/32] fix: dispatch update receipt --- .../src/pages/Categories/components/ViewReceipt.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx b/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx index 18c7bd68e..147793f0f 100644 --- a/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx +++ b/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx @@ -15,7 +15,7 @@ import ArrowUpwardOutlinedIcon from "@mui/icons-material/ArrowUpwardOutlined"; import { STATE, ViewReceiptProps } from "./ViewReceipt.type"; import { CustomAccordion } from "../../../components/common/CustomAccordion/CustomAccordion"; import { JsonView } from "../../../components/common/JsonView/JsonView"; -import { useAppSelector } from "../../../store/hooks"; +import {useAppDispatch, useAppSelector} from "../../../store/hooks"; import { getReceipts, setVoteReceipt, @@ -36,9 +36,11 @@ import { NetworkType } from "../../../components/ConnectWalletList/ConnectWallet const ViewReceipt: React.FC = ({ categoryId, close }) => { const session = getUserInSession(); + const dispatch = useAppDispatch(); const receipts = useAppSelector(getReceipts); const receipt = receipts[categoryId]; + const handleCopy = async (data: string) => { await copyToClipboard(data); eventBus.publish(EventName.ShowToast, "Copied to clipboard successfully"); From 2ff86ba6b405e8f0908e171dc6ebae17b99ad7f9 Mon Sep 17 00:00:00 2001 From: J Caso Date: Tue, 24 Sep 2024 11:59:19 +0200 Subject: [PATCH 13/32] fix: view viewOnChainVote when STATE.FULL --- ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx b/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx index 147793f0f..762571cf3 100644 --- a/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx +++ b/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx @@ -380,7 +380,7 @@ const ViewReceipt: React.FC = ({ categoryId, close }) => { })(); const actionButton = - receipt?.finalityScore === "FINAL" + receipt?.status === STATE.FULL ? { action: viewOnChainVote, iconBottom: , From 403f7e75397637d31bb2c4ccb440e284cb5856d8 Mon Sep 17 00:00:00 2001 From: J Caso Date: Tue, 24 Sep 2024 13:23:37 +0200 Subject: [PATCH 14/32] fix: selected category id and run prettier --- ui/summit-2024/src/pages/Categories/Categories.tsx | 8 +++++++- .../src/pages/Categories/components/ViewReceipt.tsx | 5 ++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ui/summit-2024/src/pages/Categories/Categories.tsx b/ui/summit-2024/src/pages/Categories/Categories.tsx index 3a7323eec..0dd091e62 100644 --- a/ui/summit-2024/src/pages/Categories/Categories.tsx +++ b/ui/summit-2024/src/pages/Categories/Categories.tsx @@ -147,6 +147,8 @@ const Categories: React.FC = ({ embedded }) => { }, [fadeChecked, selectedCategory]); const handleClickMenuItem = (category: string) => { + console.log("handleClickMenuItem"); + console.log(category); setFadeChecked(false); // @ts-ignore setSelectedCategory(category); @@ -239,7 +241,11 @@ const Categories: React.FC = ({ embedded }) => { return; } - const category = categoriesData.find((c) => c.name === selectedCategory); + const category = categoriesData.find( + (c) => + c.name === selectedCategory || + c.id === selectedCategory?.toUpperCase().replace(/\s+/g, "_"), + ); const proposalId = category?.proposals?.find( (p) => p.id === selectedNominee, diff --git a/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx b/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx index 762571cf3..d9c6f71ee 100644 --- a/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx +++ b/ui/summit-2024/src/pages/Categories/components/ViewReceipt.tsx @@ -15,7 +15,7 @@ import ArrowUpwardOutlinedIcon from "@mui/icons-material/ArrowUpwardOutlined"; import { STATE, ViewReceiptProps } from "./ViewReceipt.type"; import { CustomAccordion } from "../../../components/common/CustomAccordion/CustomAccordion"; import { JsonView } from "../../../components/common/JsonView/JsonView"; -import {useAppDispatch, useAppSelector} from "../../../store/hooks"; +import { useAppDispatch, useAppSelector } from "../../../store/hooks"; import { getReceipts, setVoteReceipt, @@ -40,7 +40,6 @@ const ViewReceipt: React.FC = ({ categoryId, close }) => { const receipts = useAppSelector(getReceipts); const receipt = receipts[categoryId]; - const handleCopy = async (data: string) => { await copyToClipboard(data); eventBus.publish(EventName.ShowToast, "Copied to clipboard successfully"); @@ -380,7 +379,7 @@ const ViewReceipt: React.FC = ({ categoryId, close }) => { })(); const actionButton = - receipt?.status === STATE.FULL + receipt?.status === STATE.FULL ? { action: viewOnChainVote, iconBottom: , From fe63d7f52dc58473d3f95c1d0b0ea335ba5c076e Mon Sep 17 00:00:00 2001 From: J Caso Date: Tue, 24 Sep 2024 13:34:26 +0200 Subject: [PATCH 15/32] fix: remove debugs --- ui/summit-2024/src/pages/Categories/Categories.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui/summit-2024/src/pages/Categories/Categories.tsx b/ui/summit-2024/src/pages/Categories/Categories.tsx index 0dd091e62..239e403dd 100644 --- a/ui/summit-2024/src/pages/Categories/Categories.tsx +++ b/ui/summit-2024/src/pages/Categories/Categories.tsx @@ -147,8 +147,6 @@ const Categories: React.FC = ({ embedded }) => { }, [fadeChecked, selectedCategory]); const handleClickMenuItem = (category: string) => { - console.log("handleClickMenuItem"); - console.log(category); setFadeChecked(false); // @ts-ignore setSelectedCategory(category); From fe582b6594d4db24c9dd052e74a5633010c93e1a Mon Sep 17 00:00:00 2001 From: J Caso Date: Tue, 24 Sep 2024 13:53:44 +0200 Subject: [PATCH 16/32] fix: add debugs --- ui/summit-2024/src/pages/Categories/Categories.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/summit-2024/src/pages/Categories/Categories.tsx b/ui/summit-2024/src/pages/Categories/Categories.tsx index 239e403dd..72ccc33c2 100644 --- a/ui/summit-2024/src/pages/Categories/Categories.tsx +++ b/ui/summit-2024/src/pages/Categories/Categories.tsx @@ -147,6 +147,7 @@ const Categories: React.FC = ({ embedded }) => { }, [fadeChecked, selectedCategory]); const handleClickMenuItem = (category: string) => { + console.info(`Selected category option: ${category}`); setFadeChecked(false); // @ts-ignore setSelectedCategory(category); @@ -249,6 +250,9 @@ const Categories: React.FC = ({ embedded }) => { (p) => p.id === selectedNominee, )?.id; + console.info(`Selected Category: ${selectedCategory}`); + console.info(`Category Data: ${JSON.stringify(category)}`); + if (!category?.id) { eventBus.publish( EventName.ShowToast, @@ -279,6 +283,8 @@ const Categories: React.FC = ({ embedded }) => { slotNumber: absoluteSlot.toString(), }); + console.info(`Canonical Vote: ${JSON.stringify(canonicalVoteInput)}`); + const requestVoteResult = await signMessageWithWallet( connectedWallet, canonicalVoteInput, From 50b7eb9488e0d3f44b84abf72b19d7ad02bfc2d3 Mon Sep 17 00:00:00 2001 From: J Caso Date: Tue, 24 Sep 2024 16:01:13 +0200 Subject: [PATCH 17/32] fix: ConnectWalletButton styles --- .../components/ConnectWalletButton/ConnectWalletButton.scss | 5 +++-- .../components/ConnectWalletButton/ConnectWalletButton.tsx | 2 +- ui/summit-2024/src/components/Header/Header.tsx | 5 ++++- ui/summit-2024/src/components/Layout/Layout.tsx | 4 ++-- ui/summit-2024/src/pages/Categories/Categories.tsx | 6 ------ 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ui/summit-2024/src/components/ConnectWalletButton/ConnectWalletButton.scss b/ui/summit-2024/src/components/ConnectWalletButton/ConnectWalletButton.scss index f72d7bb9a..bb7bb2b46 100644 --- a/ui/summit-2024/src/components/ConnectWalletButton/ConnectWalletButton.scss +++ b/ui/summit-2024/src/components/ConnectWalletButton/ConnectWalletButton.scss @@ -1,7 +1,9 @@ .button-container { position: relative; - + z-index: 1300; .main-button { + position: relative; + z-index: 1301; border-radius: 12px; border: 1px solid var(--orange, #ee9766); display: inline-flex; @@ -102,7 +104,6 @@ border: 1px solid #d2d2d9; background: var(--color-light-blue); display: inline-flex; - padding: 16px 20px; justify-content: center; align-items: center; gap: 10px; diff --git a/ui/summit-2024/src/components/ConnectWalletButton/ConnectWalletButton.tsx b/ui/summit-2024/src/components/ConnectWalletButton/ConnectWalletButton.tsx index d31f21c1a..9bd2e54dd 100644 --- a/ui/summit-2024/src/components/ConnectWalletButton/ConnectWalletButton.tsx +++ b/ui/summit-2024/src/components/ConnectWalletButton/ConnectWalletButton.tsx @@ -73,7 +73,7 @@ const ConnectWalletButton = (props: ConnectWalletButtonProps) => { >