Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: explorer host revenue calculator #534

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
},
}
Loading