File tree Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,8 @@ const AppView = ({ match }) => {
211
211
const logoSrc = app . images . find ( ( img ) => img . logo ) ?. imageUrl
212
212
const screenshots = app . images . filter ( ( img ) => ! img . logo )
213
213
const versions = app . versions . sort ( ( a , b ) => b . created - a . created )
214
- const latestVersion = versions [ 0 ]
214
+ const stableVersions = versions . filter ( ( v ) => v . channel === 'stable' )
215
+ const latestVersion = stableVersions ?. [ 0 ] ?? versions [ 0 ]
215
216
216
217
const selectTab = ( tabName ) => ( ) => {
217
218
history . push ( '?tab=' + tabName )
@@ -263,7 +264,10 @@ const AppView = ({ match }) => {
263
264
latestVersion = { latestVersion }
264
265
sourceUrl = { app . sourceUrl }
265
266
/>
266
- < LatestUpdates changelog = { changelog ?. data } />
267
+ < LatestUpdates
268
+ versions = { versions }
269
+ changelog = { changelog ?. data }
270
+ />
267
271
</ >
268
272
) }
269
273
Original file line number Diff line number Diff line change
1
+ import PropTypes from 'prop-types'
1
2
import ReactMarkdown from 'react-markdown'
2
3
import { useHistory } from 'react-router-dom'
3
4
import styles from './LatestUpdates.module.css'
4
5
5
- export const LatestUpdates = ( { changelog } ) => {
6
+ export const LatestUpdates = ( { versions , changelog } ) => {
6
7
const history = useHistory ( )
7
8
if ( ! changelog ) {
8
9
return null
9
10
}
11
+
12
+ const versionsToShow = changelog . filter (
13
+ ( { version } ) =>
14
+ ! ! versions . find (
15
+ ( v ) => v . version === version && v . channel === 'stable'
16
+ )
17
+ )
18
+
19
+ if ( versionsToShow ?. length === 0 ) {
20
+ return null
21
+ }
22
+
10
23
return (
11
24
< div className = { styles . latestUpdatesWrapper } >
12
25
< div className = { styles . latestUpdates } >
13
26
< h2 className = { styles . latestUpdatesHeader } > Latest updates:</ h2 >
14
27
15
28
< ol className = { styles . versionList } >
16
- { changelog ?. slice ( 0 , 3 ) . map ( ( version , i ) => {
29
+ { versionsToShow ?. slice ( 0 , 3 ) . map ( ( version , i ) => {
17
30
return (
18
31
< li key = { version . version } >
19
32
< h3
@@ -44,3 +57,8 @@ export const LatestUpdates = ({ changelog }) => {
44
57
</ div >
45
58
)
46
59
}
60
+
61
+ LatestUpdates . propTypes = {
62
+ changelog : PropTypes . object ,
63
+ versions : PropTypes . array ,
64
+ }
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const def = Joi.object().keys({
40
40
hasPlugin : Joi . boolean ( ) . allow ( null , false ) ,
41
41
42
42
// only indicating if there is a changelog or not here
43
- // to avoid addding a masssive changelog to the payload
43
+ // to avoid adding a massive changelog to the payload
44
44
hasChangelog : Joi . boolean ( ) . allow ( null , false ) ,
45
45
46
46
pluginType : Joi . string ( ) . allow ( null ) ,
You can’t perform that action at this time.
0 commit comments