mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-30 05:12:54 +00:00
feat: check if it's primary release
This commit is contained in:
parent
8566e5bb1f
commit
dfdf95639e
1 changed files with 19 additions and 52 deletions
|
|
@ -11,8 +11,16 @@ import {
|
||||||
Stack
|
Stack
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { FC } from 'react';
|
import { FC } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
getOS,
|
||||||
|
getParsedDate,
|
||||||
|
isDarwinPrimaryRelease,
|
||||||
|
isLinuxPrimaryRelease,
|
||||||
|
isMobilePrimaryRelease,
|
||||||
|
isWindowsPrimaryRelease
|
||||||
|
} from '../../utils';
|
||||||
import { OpenPGPSignaturesData, ReleaseData } from '../../types';
|
import { OpenPGPSignaturesData, ReleaseData } from '../../types';
|
||||||
import { getParsedDate } from '../../utils';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
columnHeaders: string[];
|
columnHeaders: string[];
|
||||||
|
|
@ -72,66 +80,25 @@ export const DataTable: FC<Props> = ({ columnHeaders, data }) => {
|
||||||
{dataType === 'Releases' &&
|
{dataType === 'Releases' &&
|
||||||
data.map((r: ReleaseData, idx: number) => {
|
data.map((r: ReleaseData, idx: number) => {
|
||||||
const url = r?.release?.url;
|
const url = r?.release?.url;
|
||||||
const os = url?.includes('darwin')
|
const os = getOS(url);
|
||||||
? 'darwin'
|
|
||||||
: url?.includes('linux')
|
|
||||||
? 'linux'
|
|
||||||
: url?.includes('windows')
|
|
||||||
? 'windows'
|
|
||||||
: url?.includes('android')
|
|
||||||
? 'android'
|
|
||||||
: 'ios';
|
|
||||||
|
|
||||||
const isLatestStableLinuxRelease =
|
const _isLinuxPrimaryRelease = isLinuxPrimaryRelease(r, os, data);
|
||||||
os === 'linux' &&
|
const _isDarwinPrimaryRelease = isDarwinPrimaryRelease(r, os, data);
|
||||||
data
|
const _isWindowsPrimaryRelease = isWindowsPrimaryRelease(r, os, data);
|
||||||
.slice(0, 12) // get latest build to filter on
|
const _isMobilePrimaryRelease = isMobilePrimaryRelease(r, os, data);
|
||||||
.filter(
|
|
||||||
(e: ReleaseData) => e.arch === '64-bit' && !e.release.url.includes('unstable')
|
|
||||||
).includes(r)
|
|
||||||
|
|
||||||
const x = data.filter((e: ReleaseData, _: any, array: any) => {
|
|
||||||
const maxDate = array
|
|
||||||
.map((e: ReleaseData) => new Date(e.published))
|
|
||||||
.filter((f: Date, _: any, array: any) =>
|
|
||||||
array.every((f: Date) => f <= new Date(e.published))
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
e.arch === '64-bit' &&
|
|
||||||
!e.release.url.includes('unstable') &&
|
|
||||||
new Date(e.published) === new Date(maxDate)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(x);
|
|
||||||
|
|
||||||
const latestDarwinRelease = os === 'darwin' && r.arch === '64-bit';
|
|
||||||
const latestWindowsRelease = os === 'darwin' && r.kind === 'Installer';
|
|
||||||
const latestAndroidRelease = os === 'android' && r.arch === 'all';
|
|
||||||
const latestiOSRelease = os === 'ios' && r.arch === 'all';
|
|
||||||
|
|
||||||
// const latest = data.filter(
|
|
||||||
// (rel: ReleaseData) =>
|
|
||||||
// os === 'linux' && rel.arch === '64-bit' && !rel.release.url.includes('unstable')
|
|
||||||
// );
|
|
||||||
// .every((otherRelease: ReleaseData) => r.published > otherRelease.published);
|
|
||||||
|
|
||||||
// console.log({ latest });
|
|
||||||
|
|
||||||
const isPrimaryRelease =
|
const isPrimaryRelease =
|
||||||
isLatestStableLinuxRelease ||
|
_isLinuxPrimaryRelease ||
|
||||||
latestDarwinRelease ||
|
_isDarwinPrimaryRelease ||
|
||||||
latestWindowsRelease ||
|
_isWindowsPrimaryRelease ||
|
||||||
latestAndroidRelease ||
|
_isMobilePrimaryRelease;
|
||||||
latestiOSRelease;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tr
|
<Tr
|
||||||
key={idx}
|
key={idx}
|
||||||
transition={'all 0.5s'}
|
transition={'all 0.5s'}
|
||||||
_hover={{ background: 'button-bg', transition: 'all 0.5s' }}
|
_hover={{ background: 'button-bg', transition: 'all 0.5s' }}
|
||||||
fontWeight={isLatestStableLinuxRelease ? 700 : 400}
|
fontWeight={isPrimaryRelease ? 700 : 400}
|
||||||
>
|
>
|
||||||
{Object.entries(r).map((item, idx) => {
|
{Object.entries(r).map((item, idx) => {
|
||||||
const objectItems = ['release', 'commit', 'signature'];
|
const objectItems = ['release', 'commit', 'signature'];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue