Skip to content

Commit 5c8105b

Browse files
authored
Merge pull request #3653 from IntersectMBO/staging
feat(#3647): add fixed top banner for govtool maintenance notice
2 parents 25a4b29 + 7a1f869 commit 5c8105b

File tree

18 files changed

+322
-128
lines changed

18 files changed

+322
-128
lines changed

.github/scripts/register_report.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ if grep -q "$REPORT_NAME" "$PROJECT_DIR/$PROJECT_FILE"; then
1010
echo "Project already exists"
1111
echo "project_exists=true">> $GITHUB_OUTPUT
1212
else
13-
echo "$REPORT_NAME" >> "$PROJECT_DIR/$PROJECT_FILE"
13+
echo "\n$REPORT_NAME" >> "$PROJECT_DIR/$PROJECT_FILE"
1414
echo "project_exists=false">> $GITHUB_OUTPUT
1515
fi

.github/scripts/remove_oldest_report.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22

33
if [ -d "gh-pages/$REPORT_NAME" ]; then
44
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"
5+
6+
# Count the number of numerical directories
7+
dir_count=$(find . -maxdepth 1 -type d -regex './[0-9]+' | wc -l)
8+
9+
if [ "$dir_count" -gt 10 ]; then
10+
# Find the oldest numerical directory
11+
oldest_dir=$(find . -maxdepth 1 -type d -regex './[0-9]+' | sort -V | head -1)
12+
if [ -n "$oldest_dir" ]; then
13+
echo "More than 10 report directories exist. Removing oldest: $oldest_dir"
14+
rm -rf "$oldest_dir"
15+
fi
1016
else
11-
echo "No report directories found to remove"
17+
echo "Only $dir_count report directories exist (threshold: 10). Nothing to remove."
1218
fi
19+
1320
cd ../../
1421
else
1522
echo "Report directory does not exist yet"

.github/workflows/test_backend.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- "sanchogov.tools/api"
1717
- "staging.govtool.byron.network/api"
1818
- "govtool.cardanoapi.io/api"
19+
- "be.preview.gov.tools"
1920
- "z6b8d2f7a-zca4a4c45-gtw.z937eb260.rustrocks.fr"
2021
- "z78acf3c2-z5575152b-gtw.z937eb260.rustrocks.fr"
2122
- "be.gov.tools"
@@ -28,21 +29,25 @@ on:
2829
- "preview"
2930
- "mainnet"
3031
- "preprod"
32+
3133
workflow_run:
3234
workflows: ["Build and deploy GovTool test stack"]
3335
types: [completed]
3436
branches:
3537
- test
3638
- infra/test-chores
3739

40+
schedule:
41+
- cron: "0 0 * * *" # 12AM UTC
42+
3843
concurrency:
3944
group: ${{ github.workflow }}-${{ github.ref }}
4045
cancel-in-progress: false
4146

4247
jobs:
4348
backend-tests:
4449
runs-on: ubuntu-latest
45-
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
50+
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' || github.event.schedule }}
4651
outputs:
4752
start_time: ${{ steps.set-pending-status.outputs.timestamp }}
4853
status: ${{ steps.run-tests.outcome }}
@@ -115,7 +120,7 @@ jobs:
115120
path: gh-pages
116121
repository: ${{vars.GH_PAGES}}
117122
ssh-key: ${{ secrets.DEPLOY_KEY }}
118-
123+
119124
- name: Remove oldest report to save space
120125
if: ${{success()}}
121126
run: |
@@ -128,6 +133,7 @@ jobs:
128133
run: |
129134
chmod +x .github/scripts/register_report.sh
130135
.github/scripts/register_report.sh
136+
131137
- if: steps.register-project.outputs.project_exists != 'true'
132138
uses: JamesIves/github-pages-deploy-action@v4
133139
with:
@@ -191,7 +197,7 @@ jobs:
191197
GITHUB_TOKEN: ${{ github.token }}
192198

193199
env:
194-
BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }}
195-
REPORT_NAME: govtool-backend
200+
BASE_URL: https://${{github.event.schedule && 'be.preview.gov.tools' || inputs.deployment || 'govtool.cardanoapi.io/api' }}
201+
REPORT_NAME: ${{ github.event.schedule && 'nightly-'}}govtool-backend
196202
GH_PAGES: ${{vars.GH_PAGES}}
197203
COMMIT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}

.github/workflows/test_integration_playwright.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,17 @@ on:
3737
- test
3838
- infra/test-chores
3939

40+
schedule:
41+
- cron: "0 0 * * *" # 12AM UTC
42+
4043
concurrency:
4144
group: ${{ github.workflow }}-${{ github.ref }}
4245
cancel-in-progress: false
4346

4447
jobs:
4548
integration-tests:
4649
runs-on: ubuntu-latest
47-
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
50+
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' || github.event.schedule }}
4851
outputs:
4952
start_time: ${{ steps.set-pending-status.outputs.timestamp }}
5053
status: ${{ steps.run-test.outcome }}
@@ -103,6 +106,11 @@ jobs:
103106
export BLOCKFROST_API_KEY="${{ secrets.BLOCKFROST_API_KEY_MAINNET }}"
104107
fi
105108
109+
# Set schedule workflow variable
110+
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
111+
export SCHEDULED_WORKFLOW="true"
112+
fi
113+
106114
npm run test:headless
107115
108116
- name: Upload report
@@ -165,7 +173,7 @@ jobs:
165173
run: |
166174
chmod +x .github/scripts/register_report.sh
167175
.github/scripts/register_report.sh
168-
176+
169177
- if: steps.register-project.outputs.project_exists != 'true'
170178
uses: JamesIves/github-pages-deploy-action@v4
171179
with:
@@ -229,7 +237,7 @@ jobs:
229237
REPORT_NUMBER: ${{ needs.publish-report.outputs.report_number }}
230238
GITHUB_TOKEN: ${{ github.token }}
231239
env:
232-
HOST_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}
233-
REPORT_NAME: govtool-frontend
240+
HOST_URL: https://${{ github.event.schedule && 'preview.gov.tools' || (inputs.deployment || 'govtool.cardanoapi.io') }}
241+
REPORT_NAME: ${{ github.event.schedule && 'nightly-'}}govtool-frontend
234242
GH_PAGES: ${{vars.GH_PAGES}}
235243
COMMIT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ changes.
1212

1313
### Added
1414

15+
- Add maintenance ending banner [Issue 3647](https://github.com/IntersectMBO/govtool/issues/3647)
16+
1517
### Fixed
1618

1719
### Changed
@@ -20,7 +22,6 @@ changes.
2022

2123
## [v2.0.22](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.22) 2025-05-15
2224

23-
2425
### Added
2526

2627
### Fixed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import { Box, Typography, IconButton } from "@mui/material";
2+
import { useState } from "react";
3+
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
4+
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
5+
import { Trans, useTranslation } from "react-i18next";
6+
7+
export const MaintenanceEndingBanner = () => {
8+
const [isExpanded, setIsExpanded] = useState(true);
9+
const { t } = useTranslation();
10+
11+
const handleToggle = () => {
12+
setIsExpanded((prev) => !prev);
13+
};
14+
15+
return (
16+
<Box
17+
sx={{
18+
backgroundColor: "#9c2224",
19+
width: "100%",
20+
overflow: "hidden",
21+
transition: "all 0.3s ease-in-out",
22+
}}
23+
>
24+
{/* Banner Header */}
25+
<Box
26+
sx={{
27+
px: 2,
28+
py: 1,
29+
textAlign: "left",
30+
display: "flex",
31+
justifyContent: "space-between",
32+
alignItems: "center",
33+
}}
34+
>
35+
<Box sx={{ display: "flex", alignItems: "center" }}>
36+
<Typography
37+
variant="body2"
38+
fontWeight={600}
39+
color="common.white"
40+
sx={{ display: "flex", alignItems: "center" }}
41+
>
42+
{t("system.maintenanceEnding.title")}
43+
</Typography>
44+
</Box>
45+
<Box sx={{ display: "flex" }}>
46+
<IconButton
47+
onClick={handleToggle}
48+
size="small"
49+
data-testid="toggle-maintenance-banner"
50+
sx={{
51+
color: "white",
52+
transition: "transform 0.3s ease",
53+
}}
54+
>
55+
{isExpanded ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
56+
</IconButton>
57+
</Box>
58+
</Box>
59+
60+
{/* Expandable Content */}
61+
<Box
62+
sx={{
63+
maxHeight: isExpanded ? "500px" : "0px",
64+
transition: "max-height 0.3s ease-in-out",
65+
overflow: "hidden",
66+
}}
67+
>
68+
<Box
69+
sx={{
70+
px: 2,
71+
pb: 2,
72+
color: "white",
73+
display: "flex",
74+
flexDirection: "column",
75+
}}
76+
>
77+
<Typography
78+
fontWeight={600}
79+
variant="caption"
80+
color="common.white"
81+
mb={0.5}
82+
>
83+
{t("system.maintenanceEnding.description1")}
84+
</Typography>
85+
<Typography variant="caption" color="common.white" mb={0.5}>
86+
<Trans
87+
i18nKey="system.maintenanceEnding.description2"
88+
components={[
89+
<Typography
90+
key="1"
91+
variant="caption"
92+
fontWeight={600}
93+
color="common.white"
94+
component="span"
95+
/>,
96+
]}
97+
/>
98+
</Typography>
99+
<Typography variant="caption" color="common.white">
100+
{t("system.maintenanceEnding.description3")}
101+
</Typography>
102+
</Box>
103+
</Box>
104+
</Box>
105+
);
106+
};

0 commit comments

Comments
 (0)