Skip to content

Commit

Permalink
Merge pull request #534 from SiaFoundation/03-21-feat_explorer_host_r…
Browse files Browse the repository at this point in the history
…evenue_calculator

feat: explorer host revenue calculator
  • Loading branch information
n8maninger authored Mar 22, 2024
2 parents 3ffeded + 5bafe41 commit d518ac3
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-icons-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'explorer': minor
---

The explorer now features a host revenue calculator tool.
13 changes: 13 additions & 0 deletions apps/explorer/app/host-revenue-calculator/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use client'

import { StateError } from '../../components/StateError'

export default function Page({ error }: { error: Error }) {
console.error(error)
return (
<StateError
code={500}
message="Error, there was an issue loading the calculator."
/>
)
}
5 changes: 5 additions & 0 deletions apps/explorer/app/host-revenue-calculator/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { StateError } from '../../components/StateError'

export default function Page() {
return <StateError message="There was an issue loading the calculator." />
}
20 changes: 20 additions & 0 deletions apps/explorer/app/host-revenue-calculator/opengraph-image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { getOGImage } from '../../components/OGImage'

export const alt = 'Faucet'
export const size = {
width: 1200,
height: 630,
}

export const contentType = 'image/png'

export default async function Image() {
return getOGImage(
{
title: 'Host revenue calculator',
subtitle:
'Calculator for modeling revenue based on storage cost, usage, pricing, and collateral.',
},
size
)
}
31 changes: 31 additions & 0 deletions apps/explorer/app/host-revenue-calculator/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Metadata } from 'next'
import { routes } from '../../config/routes'
import { buildMetadata } from '../../lib/utils'
import { Container, Heading } from '@siafoundation/design-system'

export function generateMetadata(): Metadata {
const title = 'Host revenue calculator'
const description =
'Calculator for modeling revenue based on storage cost, usage, pricing, and collateral.'
const url = routes.hostRevenueCalculator.index
return buildMetadata({
title,
description,
url,
})
}

export default function Page() {
return (
<Container>
<div className="flex flex-col gap-3">
<Heading>Host Revenue Calculator</Heading>
<iframe
src="https://bafybeiguvt6gevjdyxmruhetnbryyqqdnvwqnwuu3bobjuh35vg4trgvwm.ipfs.fsd.link"
width="100%"
height="1000px"
/>
</div>
</Container>
)
}
12 changes: 9 additions & 3 deletions apps/explorer/components/Layout/NavDropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ThemeRadio,
} from '@siafoundation/design-system'
import { Menu24 } from '@siafoundation/react-icons'
import { routes } from '../../config/routes'

type Props = React.ComponentProps<typeof Button> & {
trigger?: React.ReactNode
Expand All @@ -29,7 +30,7 @@ export function NavDropdownMenu({ trigger, children, ...props }: Props) {
}
contentProps={{ align: 'end' }}
>
<DropdownMenuGroup className="py-1 px-1 w-[120px]">
<DropdownMenuGroup className="py-1 px-1">
<DropdownMenuLabel className="px-1">Network</DropdownMenuLabel>
<DropdownMenuItem className="p-2">
<Link href={webLinks.explore.mainnet} underline="none">
Expand All @@ -42,15 +43,20 @@ export function NavDropdownMenu({ trigger, children, ...props }: Props) {
</Link>
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuGroup className="py-1 px-1 w-[120px]">
<DropdownMenuGroup className="py-1 px-1">
<DropdownMenuLabel className="px-1">Tools</DropdownMenuLabel>
<DropdownMenuItem className="p-2">
<Link href={webLinks.explore.testnetZenFaucet} underline="none">
Zen Faucet
</Link>
</DropdownMenuItem>
<DropdownMenuItem className="p-2">
<Link href={routes.hostRevenueCalculator.index} underline="none">
Host Revenue Calculator
</Link>
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuGroup className="py-1 px-1 w-[120px]">
<DropdownMenuGroup className="py-1 px-1">
<DropdownMenuLabel className="px-1">Settings</DropdownMenuLabel>
<div className="py-2 px-1">
<CurrencyFiatSelector />
Expand Down
3 changes: 3 additions & 0 deletions apps/explorer/config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ export const routes = {
faucet: {
index: '/faucet',
},
hostRevenueCalculator: {
index: '/host-revenue-calculator',
},
}

0 comments on commit d518ac3

Please sign in to comment.