tfrere HF Staff commited on
Commit
03f40d0
·
1 Parent(s): de2ba90

fix: filter auto-generated release notes, show fallback message

Browse files
Files changed (1) hide show
  1. src/pages/Download.jsx +89 -48
src/pages/Download.jsx CHANGED
@@ -88,6 +88,32 @@ function formatDate(dateString) {
88
  });
89
  }
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  // Windows Icon
92
  function WindowsIcon({ sx = {} }) {
93
  return (
@@ -728,54 +754,69 @@ export default function Download() {
728
  )}
729
  </Stack>
730
 
731
- {release.body ? (
732
- <Typography
733
- variant="body2"
734
- sx={{
735
- color: 'rgba(255,255,255,0.6)',
736
- whiteSpace: 'pre-line',
737
- lineHeight: 1.7,
738
- '& strong, & b': { color: 'rgba(255,255,255,0.8)' },
739
- }}
740
- >
741
- {release.body.split('\n').map((line, i) => {
742
- // Simple markdown parsing for headers and lists
743
- if (line.startsWith('### ')) {
744
- return (
745
- <Box
746
- key={i}
747
- component="span"
748
- sx={{
749
- display: 'block',
750
- fontWeight: 600,
751
- color: 'rgba(255,255,255,0.8)',
752
- mt: i > 0 ? 1.5 : 0,
753
- mb: 0.5,
754
- }}
755
- >
756
- {line.replace('### ', '')}
757
- </Box>
758
- );
759
- }
760
- if (line.startsWith('- ')) {
761
- return (
762
- <Box key={i} component="span" sx={{ display: 'block', pl: 2 }}>
763
- {line.replace('- ', '')}
764
- </Box>
765
- );
766
- }
767
- if (line.trim() === '') return null;
768
- return <Box key={i} component="span" sx={{ display: 'block' }}>{line}</Box>;
769
- })}
770
- </Typography>
771
- ) : (
772
- <Typography
773
- variant="body2"
774
- sx={{ color: 'rgba(255,255,255,0.4)', fontStyle: 'italic' }}
775
- >
776
- No release notes available
777
- </Typography>
778
- )}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
779
  </Box>
780
  ))}
781
  </Stack>
 
88
  });
89
  }
90
 
91
+ // Clean release body - filter out auto-generated GitHub content
92
+ function cleanReleaseBody(body) {
93
+ if (!body) return null;
94
+
95
+ // Filter out lines that are auto-generated or not useful
96
+ const filteredLines = body
97
+ .split('\n')
98
+ .filter(line => {
99
+ const trimmed = line.trim();
100
+ // Skip HTML comments
101
+ if (trimmed.startsWith('<!--') || trimmed.endsWith('-->')) return false;
102
+ // Skip "Full Changelog" links
103
+ if (trimmed.startsWith('**Full Changelog**:')) return false;
104
+ // Skip generic placeholder messages
105
+ if (trimmed === 'See the assets to download this version and install.') return false;
106
+ return true;
107
+ })
108
+ .join('\n')
109
+ .trim();
110
+
111
+ // If nothing meaningful left, return null
112
+ if (!filteredLines || filteredLines.length < 10) return null;
113
+
114
+ return filteredLines;
115
+ }
116
+
117
  // Windows Icon
118
  function WindowsIcon({ sx = {} }) {
119
  return (
 
754
  )}
755
  </Stack>
756
 
757
+ {(() => {
758
+ const cleanedBody = cleanReleaseBody(release.body);
759
+ if (cleanedBody) {
760
+ return (
761
+ <Typography
762
+ variant="body2"
763
+ sx={{
764
+ color: 'rgba(255,255,255,0.6)',
765
+ whiteSpace: 'pre-line',
766
+ lineHeight: 1.7,
767
+ '& strong, & b': { color: 'rgba(255,255,255,0.8)' },
768
+ }}
769
+ >
770
+ {cleanedBody.split('\n').map((line, i) => {
771
+ // Simple markdown parsing for headers and lists
772
+ if (line.startsWith('### ')) {
773
+ return (
774
+ <Box
775
+ key={i}
776
+ component="span"
777
+ sx={{
778
+ display: 'block',
779
+ fontWeight: 600,
780
+ color: 'rgba(255,255,255,0.8)',
781
+ mt: i > 0 ? 1.5 : 0,
782
+ mb: 0.5,
783
+ }}
784
+ >
785
+ {line.replace('### ', '')}
786
+ </Box>
787
+ );
788
+ }
789
+ if (line.startsWith('- ')) {
790
+ return (
791
+ <Box key={i} component="span" sx={{ display: 'block', pl: 2 }}>
792
+ • {line.replace('- ', '')}
793
+ </Box>
794
+ );
795
+ }
796
+ if (line.trim() === '') return null;
797
+ return <Box key={i} component="span" sx={{ display: 'block' }}>{line}</Box>;
798
+ })}
799
+ </Typography>
800
+ );
801
+ }
802
+ // No meaningful release notes - show link to changelog
803
+ return (
804
+ <Typography
805
+ variant="body2"
806
+ sx={{ color: 'rgba(255,255,255,0.5)' }}
807
+ >
808
+ Bug fixes and improvements.{' '}
809
+ <Box
810
+ component="a"
811
+ href={`https://github.com/pollen-robotics/reachy-mini-desktop-app/compare/${release.tag_name.replace('v', 'v')}...${release.tag_name}`}
812
+ target="_blank"
813
+ sx={{ color: '#FF9500', textDecoration: 'none', '&:hover': { textDecoration: 'underline' } }}
814
+ >
815
+ View changes →
816
+ </Box>
817
+ </Typography>
818
+ );
819
+ })()}
820
  </Box>
821
  ))}
822
  </Stack>