fix: Fixed issue where "Open downloads" button would not show up for the latest version in "Whats New"

This commit is contained in:
Aman Harwara
2023-01-11 23:11:34 +05:30
parent b1f59b68f6
commit 00466c731e

View File

@@ -49,6 +49,10 @@ const WhatsNew = ({ application }: { application: WebApplication }) => {
) )
} }
const firstValidVersionIndex = changelog.versions.findIndex(
(version) => version.version && (getSectionItems(version, 'Bug Fixes') || getSectionItems(version, 'Features')),
)
return ( return (
<PreferencesPane> <PreferencesPane>
{changelog.versions.map((version, index) => { {changelog.versions.map((version, index) => {
@@ -65,12 +69,12 @@ const WhatsNew = ({ application }: { application: WebApplication }) => {
const isUnreadVersion = lastReadVersion && compareSemVersions(version.version, lastReadVersion) > 0 const isUnreadVersion = lastReadVersion && compareSemVersions(version.version, lastReadVersion) > 0
const isLatest = index === 0 const isLatest = index === firstValidVersionIndex
const isDesktopEnvironment = isDesktopApplication() const isDesktopEnvironment = isDesktopApplication()
const showDownloadLink = isDesktopEnvironment && isLatest const showDownloadLink = isDesktopEnvironment && isLatest
return ( return (
<PreferencesGroup> <PreferencesGroup key={version.version}>
<div key={version.version}> <div key={version.version}>
<div className="flex justify-between"> <div className="flex justify-between">
<div className="flex items-start"> <div className="flex items-start">