Skip to content
New issue

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

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

Already on GitHub? # to your account

Feat: premium success now no longer client #92

Merged
merged 1 commit into from
Dec 30, 2024
Merged
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
41 changes: 23 additions & 18 deletions app/premium/success/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// TODO remove the use client directive in favor of a server component
'use client'
import { useSearchParams } from 'next/navigation'
import { Button } from '@/components/ui/button'
import { ExternalLink } from 'lucide-react'
import Head from 'next/head'
import Link from 'next/link'

export default function Premium() {
const searchParams = useSearchParams()

const type = searchParams.get('type')
const serverId = searchParams.get('server')
export default function Premium({
searchParams
}: {
searchParams: { [key: string]: string | string[] | undefined }
}) {
const type = searchParams.type ? (searchParams.type as string) : 'unknown'
const serverId =
searchParams.server ? (searchParams.server as string) : 'unknown'

return (
<>
Expand All @@ -20,22 +22,25 @@ export default function Premium() {
Payment Successful!
</h1>
<p className="mb-4 text-lg text-foreground">
Your payment for Would You Premium billed{' '}
<b>{type === 'monthly' ? 'monthly' : 'annually'}</b> was successful!
Your payment for Would You Premium billed <b>{type}</b> was
successful!
</p>
{
// TODO: Add space between the premium text
}
<Button
className="w-fit"
onClick={() =>
window.open(`https://discord.com/channels/${serverId}/`, '_blank')
}
<Link
href={`https://discord.com/channels/${serverId}/`}
target="_blank"
className="group outline-transparent"
>
<span>
<Button
className="w-fit group-focus-within:ring-2 group-focus-within:ring-offset-2 group-focus-within:ring-brand-primary"
tabIndex={-1}
>
Click to visit your new <b>Premium</b> server
</span>
</Button>
<ExternalLink className="size-4 ml-2" />
</Button>
</Link>
</main>
</>
)
Expand Down
Loading