Skip to content

Commit

Permalink
fix(#2417): fix broken guides links
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Dec 5, 2024
1 parent e9acc1b commit 7f79d60
Show file tree
Hide file tree
Showing 26 changed files with 85 additions and 106 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -78,11 +79,7 @@ export const DataMissingInfoBox = ({
{gaMetadataErrorDescription}
</Typography>
<Link
onClick={() =>
openInNewTab(
"https://docs.gov.tools/using-govtool/govtool-functions/dreps/drep-error-conditions",
)
}
onClick={() => openInNewTab(LINKS.DREP_ERROR_CONDITIONS)}
sx={{
fontFamily: "Poppins",
fontSize: "16px",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
AutomatedVotingOptionCurrentDelegation,
AutomatedVotingOptionDelegationId,
} from "@/types/automatedVotingOptions";
import { LINKS } from "@/consts/links";

type AutomatedVotingOptionsProps = {
currentDelegation?: string | null;
Expand Down Expand Up @@ -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", {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
isValidURLLength,
openInNewTab,
} from "@utils";
import { LINKS } from "@/consts/links";

type StorageInformationProps = {
setStep: Dispatch<SetStateAction<number>>;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SetStateAction<number>>;
Expand All @@ -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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
DashboardActionCardProps,
} from "@molecules";
import { correctAdaFormat, openInNewTab } from "@utils";
import { LINKS } from "@/consts/links";

type DRepDashboardCardProps = {
dRepID: string;
Expand All @@ -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 = () => {
Expand Down Expand Up @@ -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,
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
AutomatedVotingOptionCurrentDelegation,
AutomatedVotingOptionDelegationId,
} from "@/types/automatedVotingOptions";
import { LINKS } from "@/consts/links";

type DelegateDashboardCardProps = {
currentDelegation: CurrentDelegation;
Expand All @@ -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" },
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<DashboardActionCardProps> = (() => {
Expand Down Expand Up @@ -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: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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",
},
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -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")}
Expand Down
6 changes: 2 additions & 4 deletions govtool/frontend/src/components/organisms/DrawerMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 (
<SwipeableDrawer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { CenteredBoxBottomButtons, Step } from "@molecules";
import { ControlledField } from "@organisms";
import { ellipsizeText, openInNewTab } from "@utils";
import { LINKS } from "@/consts/links";

type StorageInformationProps = {
setStep: Dispatch<SetStateAction<number>>;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { openInNewTab } from "@utils";

import { ControlledField } from "..";
import { LINKS } from "@/consts/links";

export const EditDRepStoreDataInfo = ({
setStep,
Expand All @@ -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 (
<>
Expand Down
6 changes: 2 additions & 4 deletions govtool/frontend/src/components/organisms/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down
18 changes: 5 additions & 13 deletions govtool/frontend/src/components/organisms/HomeCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -105,11 +106,7 @@ export const ChooseWalletModal = forwardRef<HTMLDivElement>((_, ref) => {
<Link
fontSize={11}
fontWeight={500}
onClick={() =>
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")}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SetStateAction<number>>;
Expand All @@ -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;

Expand Down
Loading

0 comments on commit 7f79d60

Please sign in to comment.