Skip to content

Commit

Permalink
feat(explorer): removed host benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
telestrial committed Feb 6, 2025
1 parent 62bf34d commit 1358042
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 62 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-suits-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'explorer': minor
---

Removed Host benchmarks, due to lack of explored support.
6 changes: 0 additions & 6 deletions apps/explorer/app/host/[id]/opengraph-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import { getOGImage } from '../../../components/OGImageEntity'
import { siaCentral } from '../../../config/siaCentral'
import {
getDownloadCost,
getDownloadSpeed,
getStorageCost,
getUploadCost,
getUploadSpeed,
humanBytes,
} from '@siafoundation/units'
import { truncate } from '@siafoundation/design-system'
import { CurrencyOption, currencyOptions } from '@siafoundation/react-core'
Expand Down Expand Up @@ -78,7 +75,6 @@ export default async function Image({ params }) {
rate: r.rates.sc.usd,
},
}),
subvalue: humanBytes(h.host.settings.remaining_storage),
},
{
label: 'download',
Expand All @@ -89,7 +85,6 @@ export default async function Image({ params }) {
rate: r.rates.sc.usd,
},
}),
subvalue: h.host.benchmark && getDownloadSpeed(h.host),
},
{
label: 'upload',
Expand All @@ -100,7 +95,6 @@ export default async function Image({ params }) {
rate: r.rates.sc.usd,
},
}),
subvalue: h.host.benchmark && getUploadSpeed(h.host),
},
]

Expand Down
38 changes: 14 additions & 24 deletions apps/explorer/components/Home/HostListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ import {
import {
CloudDownload16,
CloudUpload16,
OpenPanelFilledBottom16,
VmdkDisk16,
} from '@siafoundation/react-icons'
import { SiaCentralExchangeRates } from '@siafoundation/sia-central-types'
import {
getDownloadCost,
getDownloadSpeed,
getRemainingStorage,
getStorageCost,
getUploadCost,
getUploadSpeed,
} from '@siafoundation/units'
import { useMemo } from 'react'
import { routes } from '../../config/routes'
Expand Down Expand Up @@ -50,10 +49,6 @@ export function HostListItem({ host, rates, entity }: Props) {
[exchange, host]
)

const downloadSpeed = useMemo(() => getDownloadSpeed(host), [host])

const uploadSpeed = useMemo(() => getUploadSpeed(host), [host])

const remainingStorage = useMemo(() => getRemainingStorage(host), [host])

return (
Expand All @@ -62,7 +57,7 @@ export function HostListItem({ host, rates, entity }: Props) {
className="flex flex-col items-center gap-1 w-full"
data-testid="explorer-topHosts-item"
>
<div className="flex gap-2 items-center w-full">
<div className="flex gap-2 items-center w-full @container">
<div className="flex gap-2 items-center">
<Link
href={routes.host.view.replace(':id', host.public_key)}
Expand All @@ -73,14 +68,14 @@ export function HostListItem({ host, rates, entity }: Props) {
</Link>
</div>
<div className="flex-1" />
<Text color="subtle" className="hidden lg:flex">
<Text color="subtle" className="hidden @sm:flex">
{formatDistance(new Date(host.first_seen_timestamp), new Date(), {
addSuffix: false,
})}{' '}
old
</Text>
</div>
<div className="flex gap-2 justify-between w-full pt-1 pb-1">
<div className="flex gap-2 w-full pt-1 pb-1 @container">
<div className="flex gap-1 items-center">
<Text size="10" color="subtle" ellipsis className="scale-75">
<VmdkDisk16 />
Expand All @@ -90,13 +85,8 @@ export function HostListItem({ host, rates, entity }: Props) {
{storageCost}
</Text>
</Tooltip>
<Tooltip content="Remaining storage">
<Text size="10" color="subtle" ellipsis>
{remainingStorage}
</Text>
</Tooltip>
</div>
<div className="hidden lg:flex gap-1 items-center">
<div className="flex gap-1 items-center">
<Text size="10" color="subtle" ellipsis className="scale-75">
<CloudDownload16 />
</Text>
Expand All @@ -105,13 +95,8 @@ export function HostListItem({ host, rates, entity }: Props) {
{downloadCost}
</Text>
</Tooltip>
<Tooltip content="Download speed">
<Text size="10" color="subtle" ellipsis>
{downloadSpeed || '-'}
</Text>
</Tooltip>
</div>
<div className="hidden lg:flex gap-1 items-center">
<div className="flex gap-1 items-center">
<Text size="10" color="subtle" ellipsis className="scale-75">
<CloudUpload16 />
</Text>
Expand All @@ -120,9 +105,14 @@ export function HostListItem({ host, rates, entity }: Props) {
{uploadCost}
</Text>
</Tooltip>
<Tooltip content="Upload speed">
<Text size="10" color="subtle" ellipsis>
{uploadSpeed || '-'}
</div>
<div className="hidden @xs:flex gap-1 items-center">
<Text size="10" color="subtle" ellipsis className="scale-75">
<OpenPanelFilledBottom16 />
</Text>
<Tooltip content="Remaining storage">
<Text size="10" color="contrast" ellipsis>
{remainingStorage}
</Text>
</Tooltip>
</div>
Expand Down
32 changes: 0 additions & 32 deletions apps/explorer/components/Host/HostPricing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ import { SiaCentralExchangeRates } from '@siafoundation/sia-central-types'
import { useMemo } from 'react'
import {
getDownloadCost,
// getDownloadSpeed,
// getRemainingOverTotalStorage,
// getRemainingStorage,
getStorageCost,
getUploadCost,
// getUploadSpeed,
} from '@siafoundation/units'
import { useExchangeRate } from '../../hooks/useExchangeRate'

Expand Down Expand Up @@ -47,17 +43,6 @@ export function HostPricing({ host, rates }: Props) {
[exchange, host]
)

// const downloadSpeed = useMemo(() => getDownloadSpeed(host), [host])

// const uploadSpeed = useMemo(() => getUploadSpeed(host), [host])

// const remainingOverTotalStorage = useMemo(
// () => getRemainingOverTotalStorage(host),
// [host]
// )

// const remainingStorage = useMemo(() => getRemainingStorage(host), [host])

return (
<div className="flex flex-col" data-testid="explorer-hostPricing">
<div className="grid grid-cols-3 gap-4">
Expand Down Expand Up @@ -92,23 +77,6 @@ export function HostPricing({ host, rates }: Props) {
</div>
</Tooltip>
</div>
{/* <div className="grid grid-cols-3 gap-4">
<Tooltip content={remainingOverTotalStorage}>
<div className="flex justify-end">
<Text color="subtle">{remainingStorage}</Text>
</div>
</Tooltip>
<Tooltip content={`Download speed benchmarked at ${downloadSpeed}`}>
<div className="flex justify-end">
<Text color="subtle">{downloadSpeed}</Text>
</div>
</Tooltip>
<Tooltip content={`Upload speed benchmarked at ${uploadSpeed}`}>
<div className="flex justify-end">
<Text color="subtle">{uploadSpeed}</Text>
</div>
</Tooltip>
</div> */}
</div>
)
}

0 comments on commit 1358042

Please sign in to comment.