Remove Partner version of the Bank page

This commit is contained in:
Ella 2022-11-18 16:38:48 -05:00
parent 4b8bc04757
commit 6cd2427a09
2 changed files with 16 additions and 43 deletions

View file

@ -1,27 +1,16 @@
import { NextResponse } from 'next/server'
import country from 'country-list-js';
import country from 'country-list-js'
const partners = ['gb_help_desk']
export function middleware(request) {
if (request.nextUrl.pathname.startsWith('/bank')) {
const url = request.nextUrl.clone()
if (url.pathname === '/bank/') {
if (partners.includes(url.searchParams.get('ref'))) {
url.pathname = '/bank/partner'
} else {
url.pathname = '/bank/index'
}
return NextResponse.rewrite(url)
}
}
if (request.nextUrl.pathname.startsWith('/slack')) {
let url = request.nextUrl
if(!url.searchParams.get("continent")){
let continent = country.findByIso2(request.geo.country || "AU").continent
if(continent == "Oceania"){
continent = "Australia"
if (!url.searchParams.get('continent')) {
let continent = country.findByIso2(request.geo.country || 'AU').continent
if (continent == 'Oceania') {
continent = 'Australia'
}
url.searchParams.set("continent", continent)
url.searchParams.set('continent', continent)
return NextResponse.redirect(url)
}
}

View file

@ -22,7 +22,7 @@ const styles = `
}
`
export default function Bank({ isPartner, stats }) {
export default function Bank({ stats }) {
return (
<>
<Box as="main" key="main">
@ -34,28 +34,20 @@ export default function Bank({ isPartner, stats }) {
description="Hack Club Bank is the largest fiscal sponsor of teen-led organizations in the US. Get a 501(c)(3) status-backed fund optimized for events, nonprofits, and more."
image="/bank/og-image.png"
>
<title>Hack Club Bank Fiscal Sponsorship</title>
<title>Fiscal Sponsorship Hack Club Bank</title>
</Meta>
<style>{styles}</style>
<Box>
{isPartner ? (
<Landing eventsCount={stats.events_count} />
) : (
<Landing eventsCount={stats.events_count} showButton />
)}
{isPartner ? (
<Features partner={true} />
) : (
<Features partner={false} />
)}
<Landing eventsCount={stats.events_count} showButton />
<Features />
<Testimonials />
<Nonprofits />
{isPartner ? (
<Everything fee="10" partner={true} />
) : (
<Everything fee="7" partner={false} />
)}
{!isPartner && <Start />}
<Everything fee="7" />
<Start />
</Box>
</Box>
<Footer dark key="footer" />
@ -63,20 +55,12 @@ export default function Bank({ isPartner, stats }) {
)
}
export async function getStaticPaths() {
return {
paths: [{ params: { type: 'partner' } }, { params: { type: 'index' } }],
fallback: false
}
}
export async function getStaticProps(context) {
const res = await fetch(`https://bank.hackclub.com/stats`)
const stats = await res.json()
return {
props: {
isPartner: context.params.type === 'partner',
stats
}
}