Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ changes.
### Fixed

- Fix scroll on a drawer on smaller resolution
- Fix incorrect routing on connecting wallet on budget discussion page

### Changed

Expand Down
20 changes: 17 additions & 3 deletions govtool/frontend/src/components/molecules/WalletInfoCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { useLocation, useNavigate } from "react-router-dom";
import { Box, Button, Typography } from "@mui/material";

import { PDF_PATHS, PATHS, gray, OUTCOMES_PATHS } from "@consts";
import {
PDF_PATHS,
PATHS,
gray,
OUTCOMES_PATHS,
BUDGET_DISCUSSION_PATHS,
} from "@consts";
import { useCardano } from "@context";
import { useTranslation } from "@hooks";
import { Card } from "./Card";
Expand All @@ -14,15 +20,23 @@ export const WalletInfoCard = () => {

const onClickDisconnect = async () => {
await disconnectWallet();

const isBudgetDiscussion = window.location.pathname.includes(
BUDGET_DISCUSSION_PATHS.budgetDiscussion.replace("/", ""),
);

const isProposalDiscussionForum = window.location.pathname.includes(
PDF_PATHS.proposalDiscussion.replace("/", ""),
);

const isGovernanceOutcomesPillar = window.location.pathname.includes(
OUTCOMES_PATHS.governanceActionsOutcomes.replace("/", ""),
);

if (!isProposalDiscussionForum && !isGovernanceOutcomesPillar) {
if (
!isBudgetDiscussion &&
!isProposalDiscussionForum &&
!isGovernanceOutcomesPillar
) {
navigate(
pathname.includes("/connected")
? `${pathname.replace("/connected", "")}${hash ?? ""}`
Expand Down
18 changes: 16 additions & 2 deletions govtool/frontend/src/components/molecules/WalletOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { FC, useCallback } from "react";
import { To, useNavigate, useLocation } from "react-router-dom";
import { Box, CircularProgress, Typography } from "@mui/material";

import { OUTCOMES_PATHS, PATHS, PDF_PATHS } from "@consts";
import {
BUDGET_DISCUSSION_PATHS,
OUTCOMES_PATHS,
PATHS,
PDF_PATHS,
} from "@consts";
import { useCardano } from "@context";
import { theme } from "@/theme";

Expand Down Expand Up @@ -32,6 +37,10 @@ export const WalletOptionButton: FC<WalletOption> = ({

const enableByWalletName = useCallback(async () => {
if (isEnableLoading) return;
const isBudgetDiscussion = window.location.pathname.includes(
BUDGET_DISCUSSION_PATHS.budgetDiscussion.replace("/", ""),
);

const isProposalDiscussionForum = window.location.pathname.includes(
PDF_PATHS.proposalDiscussion.replace("/", ""),
);
Expand All @@ -43,7 +52,12 @@ export const WalletOptionButton: FC<WalletOption> = ({
const result = await enable(name);

if (result?.stakeKey) {
if (isProposalDiscussionForum || isGovernanceOutcomesPillar) return;
if (
isBudgetDiscussion ||
isProposalDiscussionForum ||
isGovernanceOutcomesPillar
)
return;
navigate(
// eslint-disable-next-line no-unneeded-ternary
pathToNavigate
Expand Down