|
1 | 1 | import { Box, Button, CircularProgress, Typography } from '@mui/material'; |
2 | 2 | import axios from 'axios'; |
3 | 3 | import { useEffect, useState } from 'react'; |
| 4 | +import ReactMarkdown from 'react-markdown'; |
4 | 5 |
|
5 | 6 | import { CenteredModal } from './CenteredModal'; |
6 | 7 | import { PopupManager } from './PopupManager'; |
@@ -63,9 +64,6 @@ export const UpdateModal = ({ open, handleClose, latestVersion, isAdmin }: Updat |
63 | 64 | cleanedNotes = cleanedNotes.substring(0, fullChangelogIndex).trim(); |
64 | 65 | } |
65 | 66 |
|
66 | | - // Replace "## What's Changed" with empty string (keeping content that follows) |
67 | | - cleanedNotes = cleanedNotes.replace(/## What's Changed\n?/g, ''); |
68 | | - |
69 | 67 | // Remove everything after "by @" including "by @" itself |
70 | 68 | const byAuthorIndex = cleanedNotes.indexOf('by @'); |
71 | 69 | if (byAuthorIndex > 0) { |
@@ -148,21 +146,59 @@ export const UpdateModal = ({ open, handleClose, latestVersion, isAdmin }: Updat |
148 | 146 | </Typography> |
149 | 147 | {releaseNotes.map((note, index) => ( |
150 | 148 | <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'> |
152 | 150 | {note.version} - {note.date} |
153 | 151 | </Typography> |
154 | 152 | <Box |
155 | 153 | sx={{ |
156 | | - whiteSpace: 'pre-line', |
157 | 154 | backgroundColor: 'rgba(255,255,255,0.03)', |
158 | 155 | p: 2, |
159 | 156 | borderRadius: 1, |
160 | 157 | fontSize: '0.9rem', |
161 | 158 | 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 | + } |
163 | 189 | }} |
164 | 190 | > |
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> |
166 | 202 | </Box> |
167 | 203 | </Box> |
168 | 204 | ))} |
@@ -196,7 +232,7 @@ export const UpdateModal = ({ open, handleClose, latestVersion, isAdmin }: Updat |
196 | 232 | {isUpdating ? 'Updating...' : 'Update Now'} |
197 | 233 | </Button> */} |
198 | 234 | <Button |
199 | | - variant='outlined' |
| 235 | + variant='contained' |
200 | 236 | onClick={() => { |
201 | 237 | window.open('https://github.com/AnthonyGress/lab-dash/blob/main/README.md#updating', '_blank'); |
202 | 238 | handleClose(); |
|
0 commit comments