Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/IntersectMBO/govtool int…
Browse files Browse the repository at this point in the history
…o fix/1244-bug-cip-108-metadata-markdown-text-styling-not-shown
  • Loading branch information
Sworzen1 committed Jun 14, 2024
2 parents 2176317 + 5af9a31 commit 7b9f8bd
Show file tree
Hide file tree
Showing 16 changed files with 2,432 additions and 1,681 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
KUBER_API_URL: https://kuber-govtool.cardanoapi.io

- name: Upload report
if: always()
uses: actions/upload-artifact@v3
with:
name: allure-results
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ changes.
- Add eslint & prettier to frontend package [Issue 166](https://github.com/IntersectMBO/govtool/issues/166)
- Add DRep list pagination [Issue 740](https://github.com/IntersectMBO/govtool/issues/740)
- Add PDF pillar [Issue 1090](https://github.com/IntersectMBO/govtool/issues/1090)
- Replace govtool-wrapper governance action creation in favor of pdf-pillar [Issue 1284](https://github.com/IntersectMBO/govtool/issues/1284)

### Fixed

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

import { PATHS, gray } from "@consts";
Expand All @@ -9,11 +9,16 @@ import { Card } from "./Card";
export const WalletInfoCard = () => {
const { address, disconnectWallet } = useCardano();
const navigate = useNavigate();
const { pathname, hash } = useLocation();
const { t } = useTranslation();

const onClickDisconnect = async () => {
await disconnectWallet();
navigate(PATHS.home);
navigate(
pathname.includes("/connected")
? `${pathname.replace("/connected", "")}${hash}`
: PATHS.home,
);
window.location.reload();
};

Expand Down
9 changes: 7 additions & 2 deletions govtool/frontend/src/components/molecules/WalletOption.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useCallback } from "react";
import { To, useNavigate } from "react-router-dom";
import { To, useNavigate, useLocation } from "react-router-dom";
import { Box, CircularProgress, Typography } from "@mui/material";

import { PATHS } from "@consts";
Expand All @@ -23,6 +23,7 @@ export const WalletOptionButton: FC<WalletOption> = ({
cip95Available,
pathToNavigate,
}) => {
const { pathname, hash } = useLocation();
const { enable, isEnableLoading } = useCardano();
const {
palette: { lightBlue },
Expand All @@ -33,7 +34,11 @@ export const WalletOptionButton: FC<WalletOption> = ({
if (isEnableLoading) return;
const result = await enable(name);
if (result?.stakeKey) {
navigate(pathToNavigate ?? PATHS.dashboard);
navigate(
pathToNavigate ?? pathname === "/"
? "/dashboard"
: `connected${pathname}${hash}`,
);
return;
}
navigate(PATHS.stakeKeys);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNavigate } from "react-router-dom";

import { IMAGES, PATHS } from "@consts";
import { PendingTransaction } from "@context";
import { IMAGES, PATHS, PDF_PATHS } from "@consts";
import { PendingTransaction, useFeatureFlag } from "@context";
import { useTranslation, useWalletErrorModal } from "@hooks";
import { DashboardActionCard } from "@molecules";
import { correctAdaFormat, openInNewTab } from "@utils";
Expand All @@ -18,6 +18,7 @@ export const ProposeGovActionDashboardCard = ({
deposit,
votingPower,
}: ProposeGovActionDashboardCardProps) => {
const { isProposalDiscussionForumEnabled } = useFeatureFlag();
const navigate = useNavigate();
const { t } = useTranslation();
const openWalletErrorModal = useWalletErrorModal();
Expand All @@ -34,8 +35,14 @@ export const ProposeGovActionDashboardCard = ({
return;
}

navigate(PATHS.createGovernanceAction);
}, [deposit, votingPower]);
navigate(
isProposalDiscussionForumEnabled
? `${PATHS.connectedProposalPillar.replace("/*", "")}${
PDF_PATHS.proposalDiscussion
}`
: PATHS.createGovernanceAction,
);
}, [deposit, votingPower, isProposalDiscussionForumEnabled]);

return (
<DashboardActionCard
Expand Down
11 changes: 9 additions & 2 deletions govtool/frontend/src/components/organisms/PDFWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import { useCardano, useGovernanceActions } from "@/context";
const PDF = React.lazy(() => import("@intersect.mbo/pdf-ui/cjs"));

export const PDFWrapper = () => {
const walletAPI = useCardano();
const { walletApi, ...context } = useCardano();
const { createGovernanceActionJsonLD, createHash } = useGovernanceActions();

return (
<Box
sx={{
px: { xs: 2, sm: 5 },
py: 3,
display: "flex",
flex: 1,
}}
>
<Suspense
Expand All @@ -32,7 +34,12 @@ export const PDFWrapper = () => {
}
>
<PDF
walletAPI={{ ...walletAPI, createGovernanceActionJsonLD, createHash }}
walletAPI={{
...context,
...walletApi,
createGovernanceActionJsonLD,
createHash,
}}
pathname={window.location.pathname}
/>
</Suspense>
Expand Down
Loading

0 comments on commit 7b9f8bd

Please sign in to comment.