Skip to content

Commit

Permalink
Merge pull request #1245 from IntersectMBO/chore/add-pdf-enable-toggl…
Browse files Browse the repository at this point in the history
…e-to-every-deployment-workflow

chore: add pdf enable toggle to every deployment workflow
  • Loading branch information
MSzalowski authored Jun 11, 2024
2 parents 2b34325 + 9e3d52b commit 27f05ce
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 10 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build-and-deploy-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ run-name: Deploy by @${{ github.actor }}
# That should be executed on create: tag event
on:
workflow_dispatch:
inputs:
isProposalDiscussionForumEnabled:
description: "Enable proposal discussion forum"
required: true
type: choice
default: "disabled"
options:
- "enabled"
- "disabled"

env:
ENVIRONMENT: "beta"
Expand Down Expand Up @@ -38,7 +47,7 @@ jobs:
SENTRY_IGNORE_API_RESOLUTION_ERROR: "1"
TRAEFIK_LE_EMAIL: "admin+govtool@binarapps.com"
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: "false"
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: ${{ inputs.isProposalDiscussionForumEnabled == 'enabled' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/build-and-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ on:
push:
branches:
- staging
workflow_dispatch:
inputs:
isProposalDiscussionForumEnabled:
description: "Enable proposal discussion forum"
required: true
type: choice
default: "disabled"
options:
- "enabled"
- "disabled"

env:
ENVIRONMENT: "staging"
Expand Down Expand Up @@ -40,7 +50,7 @@ jobs:
SENTRY_IGNORE_API_RESOLUTION_ERROR: "1"
TRAEFIK_LE_EMAIL: "admin+govtool@binarapps.com"
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: "false"
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: ${{github.event_name == 'push' && 'false' || inputs.isProposalDiscussionForumEnabled == 'enabled'}}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ on:
push:
branches:
- test
workflow_dispatch:
inputs:
isProposalDiscussionForumEnabled:
description: "Enable proposal discussion forum"
required: true
type: choice
default: "disabled"
options:
- "enabled"
- "disabled"

env:
ENVIRONMENT: "test"
Expand Down Expand Up @@ -40,7 +50,7 @@ jobs:
SENTRY_IGNORE_API_RESOLUTION_ERROR: "1"
TRAEFIK_LE_EMAIL: "admin+govtool@binarapps.com"
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: "false"
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: ${{github.event_name == 'push' && 'false' || inputs.isProposalDiscussionForumEnabled == 'enabled'}}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ export const DashboardTopNav = ({
) : null}
</Box>
<Box display="flex">
{!isVotingPowerHidden && <VotingPowerChips />}
{!isVotingPowerHidden && !isProposalDiscussion && (
<VotingPowerChips />
)}
{isMobile && (
<IconButton
data-testid="open-drawer-button"
Expand Down
30 changes: 24 additions & 6 deletions govtool/frontend/src/components/organisms/PDFWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Box } from "@mui/material";
import PDF from "@intersect.mbo/pdf-ui/cjs";
import React, { Suspense } from "react";
import { Box, CircularProgress } from "@mui/material";
import "@intersect.mbo/pdf-ui/style";
import { useCardano, useGovernanceActions } from "@/context";

const PDF = React.lazy(() => import("@intersect.mbo/pdf-ui/cjs"));

export const PDFWrapper = () => {
const walletAPI = useCardano();
const { createGovernanceActionJsonLD, createHash } = useGovernanceActions();
Expand All @@ -14,10 +16,26 @@ export const PDFWrapper = () => {
py: 3,
}}
>
<PDF
walletAPI={{ ...walletAPI, createGovernanceActionJsonLD, createHash }}
pathname={window.location.pathname}
/>
<Suspense
fallback={
<Box
sx={{
display: "flex",
flex: 1,
height: "100vw",
alignItems: "center",
justifyContent: "center",
}}
>
<CircularProgress />
</Box>
}
>
<PDF
walletAPI={{ ...walletAPI, createGovernanceActionJsonLD, createHash }}
pathname={window.location.pathname}
/>
</Suspense>
</Box>
);
};

0 comments on commit 27f05ce

Please sign in to comment.