Skip to content

Commit 5e4920e

Browse files
authored
Merge branch 'develop' into fix/3560-allow-empty-image-in-drep-form
Signed-off-by: Artur W. <[email protected]>
2 parents 1d1d231 + a207f56 commit 5e4920e

File tree

13 files changed

+85
-15338
lines changed

13 files changed

+85
-15338
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
if [ -d "gh-pages/$REPORT_NAME" ]; then
4+
cd gh-pages/$REPORT_NAME
5+
# Find the oldest numerical directory
6+
oldest_dir=$(find . -maxdepth 1 -type d -regex './[0-9]+' | sort -n | head -1)
7+
if [ -n "$oldest_dir" ]; then
8+
echo "Removing oldest report directory: $oldest_dir"
9+
rm -rf "$oldest_dir"
10+
else
11+
echo "No report directories found to remove"
12+
fi
13+
cd ../../
14+
else
15+
echo "Report directory does not exist yet"
16+
fi

.github/workflows/test_backend.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ jobs:
115115
path: gh-pages
116116
repository: ${{vars.GH_PAGES}}
117117
ssh-key: ${{ secrets.DEPLOY_KEY }}
118+
119+
- name: Remove oldest report to save space
120+
if: ${{success()}}
121+
run: |
122+
chmod +x .github/scripts/remove_oldest_report.sh
123+
.github/scripts/remove_oldest_report.sh
118124
119125
- name: Register report
120126
id: register-project

.github/workflows/test_integration_playwright.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ on:
3333
workflow_run:
3434
workflows: ["Build and deploy GovTool test stack"]
3535
types: [completed]
36-
branches:
36+
branches:
3737
- test
3838
- infra/test-chores
3939

@@ -153,12 +153,19 @@ jobs:
153153
repository: ${{vars.GH_PAGES}}
154154
ssh-key: ${{ secrets.DEPLOY_KEY }}
155155

156+
- name: Remove oldest report to save space
157+
if: ${{success()}}
158+
run: |
159+
chmod +x .github/scripts/remove_oldest_report.sh
160+
.github/scripts/remove_oldest_report.sh
161+
156162
- name: Register report
157163
id: register-project
158164
if: ${{success()}}
159165
run: |
160166
chmod +x .github/scripts/register_report.sh
161167
.github/scripts/register_report.sh
168+
162169
- if: steps.register-project.outputs.project_exists != 'true'
163170
uses: JamesIves/github-pages-deploy-action@v4
164171
with:

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ changes.
1515
### Fixed
1616

1717
- Fix an issue where the submit button remained disabled after removing an invalid value from the IMAGE input field on DRrep form [Issue 3560](https://github.com/IntersectMBO/govtool/issues/3560)
18+
- Fix app crash on unhandled wallet error [Issue 3123](https://github.com/IntersectMBO/govtool/issues/3123)
19+
- Preserve new lines in markdown text [Issue 2712](https://github.com/IntersectMBO/govtool/issues/2712)
20+
- Add scroll to markdown tables [Issue 3615](https://github.com/IntersectMBO/govtool/issues/3615)
1821

1922
### Changed
2023

2124
### Removed
2225

2326
## [v2.0.21](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.21) 2025-05-09
2427

25-
2628
### Added
2729

2830
- Add support for the tables in markdown [Issue 3581](https://github.com/IntersectMBO/govtool/issues/3581)

govtool/frontend/package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

govtool/frontend/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"react-query": "^3.39.3",
5858
"react-router-dom": "^6.13.0",
5959
"rehype-katex": "^7.0.1",
60-
"remark-breaks": "^4.0.0",
6160
"remark-gfm": "^4.0.1",
6261
"remark-math": "^6.0.0",
6362
"storybook-addon-manual-mocks": "^1.0.3",

govtool/frontend/src/components/molecules/GovernanceActionCardElement.tsx

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Markdown from "react-markdown";
55
import remarkMath from "remark-math";
66
import remarkGfm from "remark-gfm";
77
import rehypeKatex from "rehype-katex";
8-
import remarkBreaks from "remark-breaks";
98
import "katex/dist/katex.min.css";
109
import "./tableMarkdown.css";
1110

@@ -120,29 +119,42 @@ export const GovernanceActionCardElement = ({
120119
fontWeight: 400,
121120
lineHeight: "24px",
122121
maxWidth: "auto",
123-
whiteSpace: "pre-wrap",
124122
}}
125123
>
126124
{children}
127125
</Typography>
128126
);
129127

130128
const markdownComponents = {
131-
p: (props: PropsWithChildren) => {
132-
const { children } = props;
133-
return renderMarkdownText({ children });
134-
},
129+
p: ({ children }: PropsWithChildren) => renderMarkdownText({ children }),
130+
br: () => <br />,
135131
};
136132

137-
const renderMarkdown = () => (
138-
<Markdown
139-
components={markdownComponents}
140-
remarkPlugins={[remarkMath, remarkBreaks, remarkGfm]}
141-
rehypePlugins={[rehypeKatex]}
142-
>
143-
{text.toString()}
144-
</Markdown>
145-
);
133+
const renderMarkdown = () => {
134+
const formattedText = text
135+
.toString()
136+
.replace(/\r\n|\r/g, "\n")
137+
.replace(
138+
/\n\n+/g,
139+
(match) =>
140+
`\n\n${Array(match.length - 1)
141+
.fill("&nbsp; \n")
142+
.join("")}\n`,
143+
)
144+
.split("\n")
145+
.map((line) => `${line} `)
146+
.join("\n");
147+
148+
return (
149+
<Markdown
150+
components={markdownComponents}
151+
remarkPlugins={[remarkMath, remarkGfm]}
152+
rehypePlugins={[rehypeKatex]}
153+
>
154+
{formattedText}
155+
</Markdown>
156+
);
157+
};
146158

147159
const renderCopyButton = () =>
148160
isCopyButton && (

govtool/frontend/src/components/molecules/tableMarkdown.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
table {
2+
display: block;
3+
overflow-x: auto;
24
margin: 32px 0;
35
border-spacing: 0;
46
border-collapse: collapse;
7+
max-width: 100%;
58
}
69

710
table thead {

govtool/frontend/src/components/organisms/Modal/StatusModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const StatusModal = forwardRef<HTMLDivElement>((_, ref) => {
6767
whiteSpace: "pre-line",
6868
}}
6969
>
70-
{state?.message}{" "}
70+
{typeof state?.message === "string" && state?.message}
7171
{state?.link && (
7272
<Link
7373
onClick={() => openInNewTab(state?.link || "")}

govtool/frontend/src/hooks/useWalletErrorModal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export const useWalletErrorModal = () => {
2020
buttonText,
2121
dataTestId,
2222
}: WalletErrorModalProps) => {
23-
const errorMessage = (error && typeof error === 'object' && 'info' in error) ? error.info : error;
23+
const errorMessage =
24+
error && typeof error === "object" && "info" in error
25+
? error.info
26+
: JSON.stringify(error, Object.getOwnPropertyNames(error));
2427

2528
openModal({
2629
type: "statusModal",

0 commit comments

Comments
 (0)