Skip to content

Commit

Permalink
wip: project landing page header updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gaboesquivel committed Apr 15, 2024
1 parent 4c6f898 commit 0eaf6fa
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 296 deletions.
4 changes: 2 additions & 2 deletions apps/webapp/app/[project]/auction/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AuctionOrders } from '@/components/routes/auction/auction-orders'
import { ClaimTokens } from '@/components/routes/auction/claim-tokens'
import { RegisterAddress } from '@/components/routes/auction/register-address'
import { Tabs } from '@/components/ui/tabs'
import { ProjectWithAuction, getProjectBySlug, projects } from '@/lib/projects'
import { ProjectWithAuction, getProjectBySlug } from '@/lib/projects'
import { redirect } from 'next/navigation'
import React from 'react'

Expand Down Expand Up @@ -68,7 +68,7 @@ export default async function AuctionPage({
<Tabs tabs={tabs} />
</section>

<hr className="mx-auto mt-24 max-w-screen-xl border-gray-600/80" />
<hr className="max-w-screen-xl mx-auto mt-24 border-gray-600/80" />
</div>
)
}
6 changes: 2 additions & 4 deletions apps/webapp/app/[project]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ export default async function ProjectPage({ params }: ProjectPageProps) {

return (
<>
<div className="flex flex-col">
<header className="relative min-h-[calc(83vh-4rem)] w-screen py-40 backdrop-blur-[2.5px]">
<ProjectHeader project={project} />
</header>
<div className="flex min-h-[calc(83vh-4rem)] flex-col">
<ProjectHeader project={project} />

<div className="container py-24">
{projectContentObjectKeys.map((key, index) => {
Expand Down
6 changes: 3 additions & 3 deletions apps/webapp/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Metadata } from 'next'

import { Open_Sans } from 'next/font/google'
import React from 'react'
import { Toaster } from 'react-hot-toast'
// import { Toaster } from 'react-hot-toast'

const openSans = Open_Sans({
subsets: ['latin', 'latin-ext'],
Expand All @@ -32,8 +32,8 @@ export default function RootLayout({ children }: RootLayoutProps) {
disableTransitionOnChange
>
<Header />
<Toaster />
<main className="flex flex-col flex-1 py-5">{children}</main>
{/* <Toaster /> */}
<main className="flex flex-col flex-1">{children}</main>
<Footer />
</Providers>
<GoogleAnalytics gaId="G-78N0Z7NPQJ" />
Expand Down
6 changes: 5 additions & 1 deletion apps/webapp/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ export default async function IndexPage() {
// generate blur urls on server
const projects = await getProjects()

return <Upcoming projects={projects} />
return (
<div className="container">
<Upcoming projects={projects} />
</div>
)
}
78 changes: 40 additions & 38 deletions apps/webapp/components/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,49 @@ import { Suspense } from 'react'

export function Header() {
return (
<div className="container sticky top-0 z-50 flex items-center justify-between h-16 p-10 bg-background">
<div className="flex items-center h-full">
<Link shallow href="/">
<IconBitlauncher />
</Link>
<div className="flex gap-5 pl-10">
{links.map(link => {
return (
<Link
shallow
key={link.href}
className="header-link"
href={link.href}
>
{link.text}
</Link>
)
})}
<div className="sticky top-0 z-50 flex h-16 p-10 bg-background">
<div className="container flex items-center justify-between">
<div className="flex items-center h-full">
<Link shallow href="/">
<IconBitlauncher />
</Link>
<div className="flex gap-5 pl-10">
{links.map(link => {
return (
<Link
shallow
key={link.href}
className="header-link"
href={link.href}
>
{link.text}
</Link>
)
})}
</div>
</div>
</div>

<div className="flex items-center gap-5">
<Link
href="https://discord.gg/a4gwhT9G"
target="_blank"
rel="noopener noreferrer"
className={cn(
buttonVariants({
variant: 'outline',
radius: 'full'
}),
'min-w-[32px] border-transparent px-2.5 md:min-w-[120px] md:border-accent md:px-8 lg:min-w-[175px]'
)}
>
<IconDiscord className={'block size-7 fill-accent md:hidden'} />
<span className="hidden md:block">Discord</span>
</Link>
<div className="flex items-center gap-5">
<Link
href="https://discord.gg/a4gwhT9G"
target="_blank"
rel="noopener noreferrer"
className={cn(
buttonVariants({
variant: 'outline',
radius: 'full'
}),
'min-w-[32px] border-transparent px-2.5 md:min-w-[120px] md:border-accent md:px-8 lg:min-w-[175px]'
)}
>
<IconDiscord className={'block size-7 fill-accent md:hidden'} />
<span className="hidden md:block">Discord</span>
</Link>

{/* <Suspense fallback={<div className="flex">Login</div>}>
<HeaderButtons />
</Suspense> */}
<Suspense fallback={<div className="flex">Login</div>}>
<HeaderButtons />
</Suspense>
</div>
</div>
</div>
)
Expand Down
47 changes: 47 additions & 0 deletions apps/webapp/components/routes/auction/copy-shorlink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
'use client'
import React, { useState } from 'react'
import { AnimatePresence } from 'framer-motion'
import { LucideCheck, LucideLoader2, LucideShare, LucideX } from 'lucide-react'

import { generateShortLink } from '@/actions'

export function CopyShortlinkIcon() {
const [status, setStatus] = useState<
'default' | 'loading' | 'copied' | 'error'
>('default')

const copyToClipboard = async () => {
setStatus('loading')
try {
const { data, error } = await generateShortLink(location.href)
if (error || !data) throw new Error(error?.message || 'Unknown error')
navigator.clipboard.writeText(data.shortLink)
setStatus('copied')
setTimeout(() => setStatus('default'), 5000)
} catch (error) {
console.error('Failed to copy share link:', error)
setStatus('error')
setTimeout(() => setStatus('default'), 5000)
}
}

return (
<button
onClick={copyToClipboard}
className="relative size-[58px] rounded-full"
>
<AnimatePresence>{iconsMap[status]}</AnimatePresence>
</button>
)
}

interface CopyShortlinkIconProps {
linkPath: string
}

const iconsMap = {
loading: <LucideLoader2 size={26} className="animate-spin stroke-accent" />,
copied: <LucideCheck size={26} className="stroke-success" />,
error: <LucideX size={26} className="stroke-destructive" />,
default: <LucideShare size={26} className="stroke-accent" />
}
63 changes: 63 additions & 0 deletions apps/webapp/components/routes/auction/project-data-card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import Link from 'next/link'
import { AuctionInfo } from '@/components/routes/auction/auction-info'
import { buttonVariants } from '@/components/ui/button'
import { IconDiscord, IconTelegram, IconTwitterX } from '@/components/ui/icons'
import { Project, ProjectWithAuction } from '@/lib/projects'
import { cn } from '@/lib/utils'
import { CopyShortlinkIcon } from './copy-shorlink'

export function ProjectDataCard({ project }: { project: Project }) {
return (
<div className="container relative z-10 flex flex-col items-center justify-between h-full gap-16 px-4 md:px-10 lg:flex-row lg:gap-20">
<div className="flex size-full max-h-[560px] max-w-screen-sm flex-col justify-between rounded-xl border border-card/30 bg-card/60 px-8 py-6 backdrop-blur-lg md:px-11 md:py-8">
<h1 className="text-3xl font-bold leading-loose tracking-tighter md:text-5xl">
{project.title}
<span className="text-xl leading-tight tracking-wide">
{project.pitch}
</span>
</h1>
<div className="flex flex-col w-full gap-3">
<h2 className="text-xl font-semibold">Media & Share</h2>
<div className="flex items-center gap-3 md:gap-6">
<Link
href={`https://twitter.com/${project.twitterUsername}`}
className={cn(
buttonVariants({ variant: 'outline', size: 'icon' }),
'p-3.5'
)}
target="_blank"
rel="noopener noreferrer"
>
<IconTwitterX className="size-6 fill-accent" />
</Link>
<Link
href={`https://discord.gg/${project.discordServer}`}
className={cn(
buttonVariants({ variant: 'outline', size: 'icon' }),
'p-3.5'
)}
target="_blank"
rel="noopener noreferrer"
>
<IconDiscord className="size-7 fill-accent" />
</Link>
<Link
href={`https://t.me/${project.telegramGroup}`}
className={cn(
buttonVariants({ variant: 'outline', size: 'icon' }),
'p-3.5'
)}
target="_blank"
rel="noopener noreferrer"
>
<IconTelegram className="size-7 fill-accent" />
</Link>

<CopyShortlinkIcon />
</div>
</div>
<AuctionInfo project={project as ProjectWithAuction} />
</div>
</div>
)
}
Loading

0 comments on commit 0eaf6fa

Please sign in to comment.