/**
* NewTopicButton - Link to create a new topic.
* Header variant: shown in site header when authenticated.
* Category variant: shown in category pages, pre-fills category.
*/
'use client'
import Link from 'next/link'
import { PencilSimpleLine } from '@phosphor-icons/react'
import { useAuth } from '@/hooks/use-auth'
import { cn } from '@/lib/utils'
interface NewTopicButtonProps {
variant: 'header' | 'category'
categorySlug?: string
categoryName?: string
className?: string
}
export function NewTopicButton({
variant,
categorySlug,
categoryName,
className,
}: NewTopicButtonProps) {
const { isAuthenticated, isLoading } = useAuth()
if (isLoading || !isAuthenticated) {
return null
}
if (variant === 'category' && categorySlug && categoryName) {
return (
New in {categoryName}
)
}
return (
New Discussion
)
}