Skip to content

Commit

Permalink
style: format codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 4, 2024
1 parent cc86692 commit ddf6dba
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions Website/app/Releases.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,29 +148,33 @@ export default function Releases({ props }) {
}, [props.release]);
const filteredPreReleases = useMemo(() => {
const releases = [];

// Get the latest stable version
const sortedReleases = [...props.release].sort((a, b) => new Date(b.published_at) - new Date(a.published_at));
let latestStableVersion = sortedReleases.find(item => !item.prerelease)?.tag_name;

const sortedReleases = [...props.release].sort(
(a, b) => new Date(b.published_at) - new Date(a.published_at),
);
let latestStableVersion = sortedReleases.find(
(item) => !item.prerelease,
)?.tag_name;

props.release.forEach((item) => {
// Skip the pre-release if a stable version with the same base version exists
const baseVersion = item.tag_name.match(/^v?\d+\.\d+\.\d+/)?.[0]; // Match semantic versioning pattern

if (
item.prerelease &&
latestStableVersion &&
baseVersion === latestStableVersion // Compare base versions
) {
return; // Skip pre-releases if a stable version with the same base exists
}

if (item.prerelease && releases.length < 1) {
releases.push(item); // Only add one pre-release
}
});
return releases;
}, [props.release]);
}, [props.release]);
const filteredReleases = useMemo(() => {
// Starting from v2.0.0, separate executables for windows, linux and macOS are available. So, we need three buttons (in total) in that case.
const releases = [];
Expand Down Expand Up @@ -384,7 +388,10 @@ export default function Releases({ props }) {
<span className="font-bold">{item.tag_name} </span>
<p>
{new Date(item.published_at).toString()} with{" "}
{item.assets?.reduce((sum, asset) => sum + (asset.download_count || 0), 0)}{" "}
{item.assets?.reduce(
(sum, asset) => sum + (asset.download_count || 0),
0,
)}{" "}
Downloads
</p>
<button
Expand Down

0 comments on commit ddf6dba

Please sign in to comment.