Skip to content

Commit ba33e0b

Browse files
authored
Feature/release notes formatting (#23)
* format markdown release notes in update modal * remove release.yml
1 parent c421bee commit ba33e0b

File tree

4 files changed

+46
-27
lines changed

4 files changed

+46
-27
lines changed

.github/release.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"react-hook-form": "^7.54.2",
3535
"react-hook-form-mui": "^7.5.0",
3636
"react-icons": "^5.4.0",
37+
"react-markdown": "^10.1.0",
3738
"react-router-dom": "^7.2.0",
3839
"react-virtualized": "^9.22.6",
3940
"shortid": "^2.2.17",

frontend/src/components/modals/UpdateModal.tsx

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Box, Button, CircularProgress, Typography } from '@mui/material';
22
import axios from 'axios';
33
import { useEffect, useState } from 'react';
4+
import ReactMarkdown from 'react-markdown';
45

56
import { CenteredModal } from './CenteredModal';
67
import { PopupManager } from './PopupManager';
@@ -63,9 +64,6 @@ export const UpdateModal = ({ open, handleClose, latestVersion, isAdmin }: Updat
6364
cleanedNotes = cleanedNotes.substring(0, fullChangelogIndex).trim();
6465
}
6566

66-
// Replace "## What's Changed" with empty string (keeping content that follows)
67-
cleanedNotes = cleanedNotes.replace(/## What's Changed\n?/g, '');
68-
6967
// Remove everything after "by @" including "by @" itself
7068
const byAuthorIndex = cleanedNotes.indexOf('by @');
7169
if (byAuthorIndex > 0) {
@@ -148,21 +146,59 @@ export const UpdateModal = ({ open, handleClose, latestVersion, isAdmin }: Updat
148146
</Typography>
149147
{releaseNotes.map((note, index) => (
150148
<Box key={note.version} sx={{ mb: index < releaseNotes.length - 1 ? 3 : 0 }}>
151-
<Typography variant='subtitle2' fontWeight='bold' color='primary'>
149+
<Typography variant='subtitle2' fontWeight='bold'>
152150
{note.version} - {note.date}
153151
</Typography>
154152
<Box
155153
sx={{
156-
whiteSpace: 'pre-line',
157154
backgroundColor: 'rgba(255,255,255,0.03)',
158155
p: 2,
159156
borderRadius: 1,
160157
fontSize: '0.9rem',
161158
border: '1px solid rgba(255,255,255,0.1)',
162-
mt: 1
159+
mt: 1,
160+
'& h1, h2, h3, h4, h5, h6': {
161+
margin: '0.5rem 0 0.2rem 0',
162+
fontSize: 'inherit',
163+
fontWeight: 'bold',
164+
},
165+
'& h1, h2': {
166+
fontSize: '1.1rem',
167+
marginTop: '0.3rem',
168+
marginBottom: '0.2rem',
169+
},
170+
'& ul, ol': {
171+
paddingLeft: '1.5rem',
172+
marginTop: '0.2rem',
173+
marginBottom: '0.2rem',
174+
},
175+
'& li': {
176+
marginBottom: '0.2rem',
177+
},
178+
'& p': {
179+
marginTop: '0.2rem',
180+
marginBottom: '0.2rem',
181+
},
182+
'& a': {
183+
color: 'primary.main',
184+
textDecoration: 'none',
185+
'&:hover': {
186+
textDecoration: 'underline',
187+
}
188+
}
163189
}}
164190
>
165-
{note.notes}
191+
<ReactMarkdown
192+
// remarkPlugins={[remarkGfm]}
193+
components={{
194+
// Override to use smaller margins for headers
195+
h2: ({ node, ...props }) => <h2 style={{ marginTop: '0.2rem', marginBottom: '0.8rem' }} {...props} />,
196+
// Override to use proper styling for links
197+
a: ({ node, ...props }) => <a target='_blank' rel='noopener noreferrer' {...props} />
198+
}}
199+
>
200+
{note.notes}
201+
</ReactMarkdown>
166202
</Box>
167203
</Box>
168204
))}
@@ -196,7 +232,7 @@ export const UpdateModal = ({ open, handleClose, latestVersion, isAdmin }: Updat
196232
{isUpdating ? 'Updating...' : 'Update Now'}
197233
</Button> */}
198234
<Button
199-
variant='outlined'
235+
variant='contained'
200236
onClick={() => {
201237
window.open('https://github.com/AnthonyGress/lab-dash/blob/main/README.md#updating', '_blank');
202238
handleClose();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lab-dash",
3-
"version": "1.0.16",
3+
"version": "1.0.17",
44
"description": "This is an open-source user interface designed to manage your server and homelab",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)