'use client'; import * as React from 'react'; import { signOut, useSession } from 'next-auth/react'; import { navLinks, statickNavlinks } from '@/lib/constants/navlinks'; import Link from 'next/link'; import { PeopleIcon } from '@/components/icons/people'; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from '@/components/ui/accordion'; import { ScrollArea } from '@/components/ui/scroll-area'; import { LogIn, Power } from 'lucide-react'; import { useToast } from '@/components/ui/use-toast'; import { pathNames } from '@/lib/constants/routes'; export function NavbarAccordion() { const { toast } = useToast(); const { data, status } = useSession(); const isAuthenticated = status === 'authenticated'; const handleSignOut = async () => { try { await signOut({ redirect: true }); toast({ title: 'Başarılı bir şekilde çıkış yapılıyor.', variant: 'success' }); } catch (err) { toast({ title: `Çıkış yapılırken bir hata oluştu. ${JSON.stringify(err)}`, variant: 'destructive', }); } }; return (
    {statickNavlinks.map(({ label, path }, idx) => (
  • {label}
  • ))} {isAuthenticated ? (
  • handleSignOut()} className='flex gap-2 items-center'> Çıkış Yap
  • ) : (
  • Giriş yap
  • )}
{navLinks.map((item) => (
    {statickNavlinks.map(({ label, path }, idx) => (
  • {label}
  • ))}
))}
); }