From 7f79d600ff0ee54505df0d0d0eb375359d88cace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Wed, 4 Dec 2024 14:06:22 +0100 Subject: [PATCH] fix(#2417): fix broken guides links --- CHANGELOG.md | 1 + README.md | 2 +- docs/architecture/README.md | 2 +- .../molecules/DataMissingInfoBox.tsx | 7 ++--- .../organisms/AutomatedVotingOptions.tsx | 11 ++----- .../StorageInformation.tsx | 5 ++-- .../StoreDataInfo.tsx | 6 ++-- .../DashboardCards/DRepDashboardCard.tsx | 11 ++----- .../DashboardCards/DelegateDashboardCard.tsx | 6 ++-- .../DirectVoterDashboardCard.tsx | 11 ++----- .../ListGovActionsDashboardCard.tsx | 6 ++-- .../ProposeGovActionDashboardCard.tsx | 6 ++-- .../src/components/organisms/DrawerMobile.tsx | 6 ++-- .../EditDRepStorageInformation.tsx | 5 ++-- .../EditDRepStoreDataInfo.tsx | 6 ++-- .../src/components/organisms/Footer.tsx | 6 ++-- .../src/components/organisms/HomeCards.tsx | 18 ++++-------- .../organisms/Modal/ChooseWalletModal.tsx | 7 ++--- .../DRepStorageInformation.tsx | 5 ++-- .../RegisterAsDRepSteps/DRepStoreDataInfo.tsx | 6 ++-- .../RolesAndResponsibilities.tsx | 6 ++-- .../src/components/organisms/TopBanners.tsx | 3 +- .../VoteContextStoringInformation.tsx | 5 ++-- .../VoteContext/VoteContextTerms.tsx | 6 ++-- govtool/frontend/src/consts/links.ts | 29 +++++++++++++++++++ govtool/frontend/src/consts/navItems.tsx | 9 +++--- 26 files changed, 85 insertions(+), 106 deletions(-) create mode 100644 govtool/frontend/src/consts/links.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 8079fcebf..9e5b15b7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ changes. - Fix inconsistent voting status [Issue 1713](https://github.com/IntersectMBO/govtool/issues/1713) - Fix removing a child (link) when is not registed in DOM [Issue 2398](https://github.com/IntersectMBO/govtool/issues/2398) - Fix blank screen on DRep delegation when UTXos are missing [Issue 2408](https://github.com/IntersectMBO/govtool/issues/2408) +- Fix broken guides links [Issue 2417](https://github.com/IntersectMBO/govtool/issues/2417) ### Changed diff --git a/README.md b/README.md index db07e081c..27388fa33 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The Cardano GovTool enables ada holders to experience the governance features de ### Documentation -Learn more; [docs.gov.tools](https://docs.gov.tools/). +Learn more; [docs.gov.tools](https://docs.gov.tools/cardano-govtool/using-govtool). ## 📍 Navigation diff --git a/docs/architecture/README.md b/docs/architecture/README.md index 66689da9c..8a74d4f8a 100644 --- a/docs/architecture/README.md +++ b/docs/architecture/README.md @@ -23,7 +23,7 @@ utility backend that serves validation of the governance actions metadata. # Description -Frontend is a React application using Vite as a built tool to enhance development speed and optimize production builds. Frontend interacts with the backend service via REST API and with the Cardano blockchain via cardano-serialization-lib and connected supported wallets (for the list of compatible wallets go [here](https://docs.gov.tools/how-to-use-the-govtool/getting-started/get-a-compatible-wallet)). +Frontend is a React application using Vite as a built tool to enhance development speed and optimize production builds. Frontend interacts with the backend service via REST API and with the Cardano blockchain via cardano-serialization-lib and connected supported wallets (for the list of compatible wallets go [here](https://docs.gov.tools/cardano-govtool/using-govtool/getting-started/compatible-wallets)). # Components diff --git a/govtool/frontend/src/components/molecules/DataMissingInfoBox.tsx b/govtool/frontend/src/components/molecules/DataMissingInfoBox.tsx index 2f5c190c5..4e0deb8ca 100644 --- a/govtool/frontend/src/components/molecules/DataMissingInfoBox.tsx +++ b/govtool/frontend/src/components/molecules/DataMissingInfoBox.tsx @@ -4,6 +4,7 @@ import { Typography } from "@atoms"; import { useTranslation } from "@hooks"; import { MetadataValidationStatus } from "@models"; import { openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; export const DataMissingInfoBox = ({ isDataMissing, @@ -78,11 +79,7 @@ export const DataMissingInfoBox = ({ {gaMetadataErrorDescription} - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/dreps/drep-error-conditions", - ) - } + onClick={() => openInNewTab(LINKS.DREP_ERROR_CONDITIONS)} sx={{ fontFamily: "Poppins", fontSize: "16px", diff --git a/govtool/frontend/src/components/organisms/AutomatedVotingOptions.tsx b/govtool/frontend/src/components/organisms/AutomatedVotingOptions.tsx index 4b84380e8..acfcf7c33 100644 --- a/govtool/frontend/src/components/organisms/AutomatedVotingOptions.tsx +++ b/govtool/frontend/src/components/organisms/AutomatedVotingOptions.tsx @@ -16,6 +16,7 @@ import { AutomatedVotingOptionCurrentDelegation, AutomatedVotingOptionDelegationId, } from "@/types/automatedVotingOptions"; +import { LINKS } from "@/consts/links"; type AutomatedVotingOptionsProps = { currentDelegation?: string | null; @@ -118,11 +119,7 @@ export const AutomatedVotingOptions = ({ onClickDelegate={() => delegate(AutomatedVotingOptionDelegationId.abstain) } - onClickInfo={() => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/delegating/abstain-from-every-vote", - ) - } + onClickInfo={() => openInNewTab(LINKS.ABSTAIN_FROM_EVERY_VOTE)} title={ isDelegatedToAbstain ? t("dRepDirectory.delegatedToAbstainTitle", { @@ -162,9 +159,7 @@ export const AutomatedVotingOptions = ({ delegate(AutomatedVotingOptionDelegationId.no_confidence) } onClickInfo={() => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/delegating/signal-no-confidence-on-every-vote", - ) + openInNewTab(LINKS.SIGNAL_NO_CONFIDENCE_ON_EVERY_VOTE) } title={ isDelegatedToNoConfidence diff --git a/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StorageInformation.tsx b/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StorageInformation.tsx index 0252327d0..7deecc45d 100644 --- a/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StorageInformation.tsx +++ b/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StorageInformation.tsx @@ -17,6 +17,7 @@ import { isValidURLLength, openInNewTab, } from "@utils"; +import { LINKS } from "@/consts/links"; type StorageInformationProps = { setStep: Dispatch>; @@ -39,9 +40,7 @@ export const StorageInformation = ({ setStep }: StorageInformationProps) => { const fileName = getValues("governance_action_type") as string; const openGuideAboutStoringInformation = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isActionButtonDisabled = !watch("storingURL") || !!errors.storingURL; diff --git a/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StoreDataInfo.tsx b/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StoreDataInfo.tsx index 9beb1f9e1..1dc5da480 100644 --- a/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StoreDataInfo.tsx +++ b/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StoreDataInfo.tsx @@ -10,6 +10,7 @@ import { import { CenteredBoxBottomButtons } from "@molecules"; import { ControlledField } from "@organisms"; import { openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; type StoreDataInfoProps = { setStep: Dispatch>; @@ -20,10 +21,7 @@ export const StoreDataInfo = ({ setStep }: StoreDataInfoProps) => { const { control, errors, watch } = useCreateGovernanceActionForm(); const { isMobile } = useScreenDimension(); - const openLink = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + const openLink = () => openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isContinueDisabled = !watch("storeData"); diff --git a/govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx index b9c4338f7..bd9908734 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx @@ -11,6 +11,7 @@ import { DashboardActionCardProps, } from "@molecules"; import { correctAdaFormat, openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; type DRepDashboardCardProps = { dRepID: string; @@ -37,10 +38,7 @@ export const DRepDashboardCard = ({ const learnMoreButton = { children: t("learnMore"), dataTestId: "d-rep-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/dreps/register-as-a-drep", - ), + onClick: () => openInNewTab(LINKS.REGISTER_AS_A_DREP), }; const navigateToDrepDirectory = () => { @@ -130,10 +128,7 @@ export const DRepDashboardCard = ({ ? { children: t("learnMore"), dataTestId: "register-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/dreps/retire-as-a-drep", - ), + onClick: () => openInNewTab(LINKS.RETIRE_AS_A_DREP), } : learnMoreButton, ]; diff --git a/govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx index 16459cd0b..b4a13d090 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx @@ -20,6 +20,7 @@ import { AutomatedVotingOptionCurrentDelegation, AutomatedVotingOptionDelegationId, } from "@/types/automatedVotingOptions"; +import { LINKS } from "@/consts/links"; type DelegateDashboardCardProps = { currentDelegation: CurrentDelegation; @@ -45,10 +46,7 @@ export const DelegateDashboardCard = ({ const learnMoreButton = { children: t("learnMore"), dataTestId: "delegate-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/how-to-use-the-govtool/using-govtool/delegating", - ), + onClick: () => openInNewTab(LINKS.DELEGATING), sx: { backgroundColor: "arcticWhite" }, }; diff --git a/govtool/frontend/src/components/organisms/DashboardCards/DirectVoterDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/DirectVoterDashboardCard.tsx index a32e9a2f9..386aca6d4 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/DirectVoterDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/DirectVoterDashboardCard.tsx @@ -8,6 +8,7 @@ import { useTranslation } from "@hooks"; import { VoterInfo } from "@models"; import { DashboardActionCard, DashboardActionCardProps } from "@molecules"; import { correctAdaFormat, openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; type DirectVoterDashboardCardProps = { pendingTransaction: PendingTransaction; @@ -29,10 +30,7 @@ export const DirectVoterDashboardCard = ({ const learnMoreButton: LoadingButtonProps = { children: t("learnMore"), dataTestId: "direct-voter-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/direct-voting", - ), + onClick: () => openInNewTab(LINKS.DIRECT_VOTING), }; const cardProps: Partial = (() => { @@ -96,10 +94,7 @@ export const DirectVoterDashboardCard = ({ { children: t("learnMore"), dataTestId: "learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/direct-voting", - ), + onClick: () => openInNewTab(LINKS.DIRECT_VOTING), }, ], description: ( diff --git a/govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx index 00973c58d..eb59c26c5 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx @@ -4,6 +4,7 @@ import { IMAGES, PATHS } from "@consts"; import { useTranslation } from "@hooks"; import { DashboardActionCard } from "@molecules"; import { openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; export const ListGovActionsDashboardCards = () => { const navigate = useNavigate(); @@ -21,10 +22,7 @@ export const ListGovActionsDashboardCards = () => { { children: t("learnMore"), dataTestId: "list-gov-actions-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/governance-actions/view-governance-actions", - ), + onClick: () => openInNewTab(LINKS.VIEW_GOVERNANCE_ACTIONS), variant: "outlined", }, ]} diff --git a/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx index 46191b137..165da2787 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx @@ -6,6 +6,7 @@ import { useTranslation } from "@hooks"; import { DashboardActionCard } from "@molecules"; import { openInNewTab } from "@utils"; import { useCallback } from "react"; +import { LINKS } from "@/consts/links"; type ProposeGovActionDashboardCardProps = { createGovActionTx: PendingTransaction["createGovAction"]; @@ -52,10 +53,7 @@ export const ProposeGovActionDashboardCard = ({ { children: t("learnMore"), dataTestId: "propose-gov-action-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/governance-actions/propose-a-governance-action", - ), + onClick: () => openInNewTab(LINKS.PROPOSE_A_GOVERNANCE_ACTION), }, ]} description={t("dashboard.cards.proposeGovernanceAction.description")} diff --git a/govtool/frontend/src/components/organisms/DrawerMobile.tsx b/govtool/frontend/src/components/organisms/DrawerMobile.tsx index b2e107da9..dd48651a0 100644 --- a/govtool/frontend/src/components/organisms/DrawerMobile.tsx +++ b/govtool/frontend/src/components/organisms/DrawerMobile.tsx @@ -7,6 +7,7 @@ import { useFeatureFlag, useModal } from "@context"; import { openInNewTab } from "@utils"; import { DrawerMobileProps } from "./types"; +import { LINKS } from "@/consts/links"; const DRAWER_PADDING = 2; const CALCULATED_DRAWER_PADDING = DRAWER_PADDING * 8 * 2; @@ -21,10 +22,7 @@ export const DrawerMobile = ({ const { openModal } = useModal(); const { t } = useTranslation(); - const onClickHelp = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/support#for-support-you-can-reach-the-team-on-the-intersect-discord-server-at", - ); + const onClickHelp = () => openInNewTab(LINKS.SUPPORT); return ( >; @@ -35,9 +36,7 @@ export const EditDRepStorageInformation = ({ const fileName = getValues("givenName"); const openGuideAboutStoringInformation = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isActionButtonDisabled = !watch("storingURL") || !!errors.storingURL; diff --git a/govtool/frontend/src/components/organisms/EditDRepInfoSteps/EditDRepStoreDataInfo.tsx b/govtool/frontend/src/components/organisms/EditDRepInfoSteps/EditDRepStoreDataInfo.tsx index e7fe54d7e..065e8e9e8 100644 --- a/govtool/frontend/src/components/organisms/EditDRepInfoSteps/EditDRepStoreDataInfo.tsx +++ b/govtool/frontend/src/components/organisms/EditDRepInfoSteps/EditDRepStoreDataInfo.tsx @@ -11,6 +11,7 @@ import { import { openInNewTab } from "@utils"; import { ControlledField } from ".."; +import { LINKS } from "@/consts/links"; export const EditDRepStoreDataInfo = ({ setStep, @@ -27,10 +28,7 @@ export const EditDRepStoreDataInfo = ({ const isContinueDisabled = !watch("storeData"); - const openLink = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + const openLink = () => openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); return ( <> diff --git a/govtool/frontend/src/components/organisms/Footer.tsx b/govtool/frontend/src/components/organisms/Footer.tsx index 79f037d8e..84b1e063d 100644 --- a/govtool/frontend/src/components/organisms/Footer.tsx +++ b/govtool/frontend/src/components/organisms/Footer.tsx @@ -5,6 +5,7 @@ import { ICONS } from "@consts"; import { useUsersnapApi } from "@context"; import { useScreenDimension, useTranslation } from "@hooks"; import { openInNewTab, testIdFromLabel } from "@utils"; +import { LINKS } from "@/consts/links"; type FooterLinkProps = { label: string; @@ -34,10 +35,7 @@ export const Footer = () => { const { t } = useTranslation(); const { openFeedbackWindow } = useUsersnapApi(); - const onClickHelp = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/support#for-support-you-can-reach-the-team-on-the-intersect-discord-server-at", - ); + const onClickHelp = () => openInNewTab(LINKS.SUPPORT); const onClickPrivacyPolicy = () => openInNewTab( diff --git a/govtool/frontend/src/components/organisms/HomeCards.tsx b/govtool/frontend/src/components/organisms/HomeCards.tsx index 59c97b252..8cc1e63f2 100644 --- a/govtool/frontend/src/components/organisms/HomeCards.tsx +++ b/govtool/frontend/src/components/organisms/HomeCards.tsx @@ -7,6 +7,7 @@ import { useFeatureFlag, useModal } from "@context"; import { ActionCard } from "@molecules"; import { useTranslation } from "@hooks"; import { openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; export const HomeCards = () => { const { isProposalDiscussionForumEnabled } = useFeatureFlag(); @@ -26,25 +27,16 @@ export const HomeCards = () => { [openModal], ); - const onClickLearnMoreAboutDelegation = () => - openInNewTab( - "https://docs.gov.tools/how-to-use-the-govtool/using-govtool/delegating", - ); + const onClickLearnMoreAboutDelegation = () => openInNewTab(LINKS.DELEGATING); const onClickLearnMoreAboutDRepRegistration = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/dreps/register-as-a-drep", - ); + openInNewTab(LINKS.REGISTER_AS_A_DREP); const onClickLearnMoreAboutDirectVoterRegistration = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/direct-voting", - ); + openInNewTab(LINKS.DIRECT_VOTING); const onClickLearnMoreAboutProposingGovAction = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/governance-actions/governance-actions/propose-a-governance-action", - ); + openInNewTab(LINKS.PROPOSE_A_GOVERNANCE_ACTION); const navigateToGovActions = useCallback( () => navigate(PATHS.governanceActions), diff --git a/govtool/frontend/src/components/organisms/Modal/ChooseWalletModal.tsx b/govtool/frontend/src/components/organisms/Modal/ChooseWalletModal.tsx index 87a2ed712..16acd5cfa 100644 --- a/govtool/frontend/src/components/organisms/Modal/ChooseWalletModal.tsx +++ b/govtool/frontend/src/components/organisms/Modal/ChooseWalletModal.tsx @@ -8,6 +8,7 @@ import { WalletOptionButton } from "@molecules"; import { openInNewTab } from "@utils"; import { useTranslation } from "@hooks"; import { To } from "react-router-dom"; +import { LINKS } from "@/consts/links"; type ChooseWalletModalState = { pathToNavigate?: To; @@ -105,11 +106,7 @@ export const ChooseWalletModal = forwardRef((_, ref) => { - openInNewTab( - "https://docs.gov.tools/how-to-use-the-govtool/getting-started/get-a-compatible-wallet", - ) - } + onClick={() => openInNewTab(LINKS.COMPATIBLE_WALLETS)} sx={{ cursor: "pointer" }} > {t("here")} diff --git a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStorageInformation.tsx b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStorageInformation.tsx index c36e73667..ab52f9882 100644 --- a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStorageInformation.tsx +++ b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStorageInformation.tsx @@ -12,6 +12,7 @@ import { import { CenteredBoxBottomButtons, Step } from "@molecules"; import { ControlledField } from "@organisms"; import { openInNewTab, ellipsizeText } from "@utils"; +import { LINKS } from "@/consts/links"; type StorageInformationProps = { setStep: Dispatch>; @@ -36,9 +37,7 @@ export const DRepStorageInformation = ({ const fileName = getValues("givenName"); const openGuideAboutStoringInformation = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isActionButtonDisabled = !watch("storingURL") || !!errors.storingURL; diff --git a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStoreDataInfo.tsx b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStoreDataInfo.tsx index a05696d7c..e8c31eff1 100644 --- a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStoreDataInfo.tsx +++ b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStoreDataInfo.tsx @@ -11,6 +11,7 @@ import { import { openInNewTab } from "@utils"; import { ControlledField } from ".."; +import { LINKS } from "@/consts/links"; export const DRepStoreDataInfo = ({ setStep, @@ -27,10 +28,7 @@ export const DRepStoreDataInfo = ({ const onClickContinue = () => setStep(4); - const openLink = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + const openLink = () => openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); return ( <> diff --git a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/RolesAndResponsibilities.tsx b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/RolesAndResponsibilities.tsx index a87883656..932bfe73f 100644 --- a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/RolesAndResponsibilities.tsx +++ b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/RolesAndResponsibilities.tsx @@ -11,6 +11,7 @@ import { openInNewTab, PROTOCOL_PARAMS_KEY, } from "@utils"; +import { LINKS } from "@/consts/links"; export const RolesAndResponsibilities = ({ setStep, @@ -24,10 +25,7 @@ export const RolesAndResponsibilities = ({ const onClickContinue = () => setStep(2); - const openLearnMoreAboutDrep = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/dreps", - ); + const openLearnMoreAboutDrep = () => openInNewTab(LINKS.DREPS); return ( <> diff --git a/govtool/frontend/src/components/organisms/TopBanners.tsx b/govtool/frontend/src/components/organisms/TopBanners.tsx index 332a2c440..e27b8138d 100644 --- a/govtool/frontend/src/components/organisms/TopBanners.tsx +++ b/govtool/frontend/src/components/organisms/TopBanners.tsx @@ -1,6 +1,7 @@ import { Box, Link, Typography } from "@mui/material"; import { Trans, useTranslation } from "react-i18next"; import { useAppContext } from "@/context"; +import { LINKS } from "@/consts/links"; export const TopBanners = () => { const { isMainnet, networkName, isInBootstrapPhase, isAppInitializing } = @@ -60,7 +61,7 @@ export const TopBanners = () => { components={{ docs: ( >; @@ -35,9 +36,7 @@ export const VoteContextStoringInformation = ({ } = useVoteContextForm(setSavedHash, setStep, setErrorMessage); const openGuideAboutStoringInformation = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isContinueDisabled = !watch("storingURL"); diff --git a/govtool/frontend/src/components/organisms/VoteContext/VoteContextTerms.tsx b/govtool/frontend/src/components/organisms/VoteContext/VoteContextTerms.tsx index a98a948c8..d59d1af38 100644 --- a/govtool/frontend/src/components/organisms/VoteContext/VoteContextTerms.tsx +++ b/govtool/frontend/src/components/organisms/VoteContext/VoteContextTerms.tsx @@ -5,6 +5,7 @@ import { Spacer, Typography } from "@atoms"; import { useScreenDimension, useTranslation, useVoteContextForm } from "@hooks"; import { ControlledField, VoteContextWrapper } from "@organisms"; import { openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; type StoreDataInfoProps = { setStep: Dispatch>; @@ -16,10 +17,7 @@ export const VoteContextTerms = ({ setStep, onCancel }: StoreDataInfoProps) => { const { control, errors, watch } = useVoteContextForm(); const { isMobile } = useScreenDimension(); - const openLink = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + const openLink = () => openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isContinueDisabled = !watch("terms"); diff --git a/govtool/frontend/src/consts/links.ts b/govtool/frontend/src/consts/links.ts new file mode 100644 index 000000000..c053c3001 --- /dev/null +++ b/govtool/frontend/src/consts/links.ts @@ -0,0 +1,29 @@ +export const LINKS = { + USING_GOVTOOL: "https://docs.gov.tools/cardano-govtool/using-govtool", + COMPATIBLE_WALLETS: + "https://docs.gov.tools/cardano-govtool/using-govtool/getting-started/compatible-wallets", + FAQS: "https://docs.gov.tools/cardano-govtool/faqs", + SUPPORT: "https://docs.gov.tools/cardano-govtool/support", + DREP_ERROR_CONDITIONS: + "https://docs.gov.tools/cardano-govtool/using-govtool/dreps/drep-error-conditions", + ABSTAIN_FROM_EVERY_VOTE: + "https://docs.gov.tools/cardano-govtool/using-govtool/delegating/abstain-from-every-vote", + SIGNAL_NO_CONFIDENCE_ON_EVERY_VOTE: + "https://docs.gov.tools/cardano-govtool/using-govtool/delegating/signal-no-confidence-on-every-vote", + REGISTER_AS_A_DREP: + "https://docs.gov.tools/cardano-govtool/using-govtool/dreps/register-as-a-drep", + PROPOSE_A_GOVERNANCE_ACTION: + "https://docs.gov.tools/cardano-govtool/using-govtool/governance-actions/propose-a-governance-action", + BOOTSTRAPPING_PHASE: + "https://docs.gov.tools/cardano-govtool/faqs/bootstrapping-phase", + STORING_INFORMATION_OFFLINE: + "https://docs.gov.tools/cardano-govtool/using-govtool/storing-information-offline", + DELEGATING: "https://docs.gov.tools/cardano-govtool/using-govtool/delegating", + DIRECT_VOTING: + "https://docs.gov.tools/cardano-govtool/using-govtool/direct-voting", + RETIRE_AS_A_DREP: + "https://docs.gov.tools/cardano-govtool/using-govtool/dreps/retire-as-a-drep", + VIEW_GOVERNANCE_ACTIONS: + "https://docs.gov.tools/cardano-govtool/using-govtool/governance-actions/view-governance-actions", + DREPS: "https://docs.gov.tools/cardano-govtool/using-govtool/dreps", +}; diff --git a/govtool/frontend/src/consts/navItems.tsx b/govtool/frontend/src/consts/navItems.tsx index c544fff52..74795d562 100644 --- a/govtool/frontend/src/consts/navItems.tsx +++ b/govtool/frontend/src/consts/navItems.tsx @@ -3,6 +3,7 @@ import i18n from "@/i18n"; import { theme } from "@/theme"; import { ICONS } from "./icons"; +import { LINKS } from "./links"; import { PATHS, PDF_PATHS } from "./paths"; export const NAV_ITEMS = [ @@ -33,13 +34,13 @@ export const NAV_ITEMS = [ dataTestId: "guides-link", navTo: "", label: i18n.t("menu.guides"), - newTabLink: "https://docs.gov.tools/", + newTabLink: LINKS.USING_GOVTOOL, }, { dataTestId: "faqs-link", navTo: "", label: i18n.t("menu.faqs"), - newTabLink: "https://docs.gov.tools/faqs", + newTabLink: LINKS.FAQS, }, ]; @@ -95,7 +96,7 @@ export const CONNECTED_NAV_ITEMS = [ navTo: "", activeIcon: ICONS.guidesActiveIcon, icon: ICONS.guidesIcon, - newTabLink: "https://docs.gov.tools/", + newTabLink: LINKS.USING_GOVTOOL, }, { dataTestId: "faqs-link", @@ -103,6 +104,6 @@ export const CONNECTED_NAV_ITEMS = [ navTo: "", activeIcon: ICONS.faqsActiveIcon, icon: ICONS.faqsIcon, - newTabLink: "https://docs.gov.tools/faqs", + newTabLink: LINKS.FAQS, }, ];