payment method over

This commit is contained in:
nabijonovdavronbek619@gmail.com
2026-04-02 20:59:31 +05:00
parent e9c73c42e2
commit 0b125d05ee
8 changed files with 82 additions and 40 deletions

View File

@@ -14,9 +14,15 @@ import { useLoginModal, useRegisterModal } from '@/shared/zustand/auth';
import { useTranslations } from 'next-intl';
import { useUserPlagiatStore } from '@/shared/zustand/user';
import { LogOut } from 'lucide-react';
import { useEffect, useState } from 'react';
function AuthButtons() {
const t = useTranslations('Navbar');
const [localUser, setLocalUser] = useState<{
id: number;
name: string;
surname: string;
} | null>(null);
const auth = {
login: { title: t('login'), url: '#' },
@@ -38,7 +44,17 @@ function AuthButtons() {
};
console.log('Current user:', user);
if (user) {
useEffect(() => {
const data = localStorage.getItem('user');
if (data) {
setLocalUser(JSON.parse(data));
} else {
setLocalUser(null);
}
}, [user]);
if (localUser) {
return (
<div className="flex flex-row max-sm:items-center max-sm:justify-around gap-3">
<div className="sm:flex hidden">
@@ -47,7 +63,7 @@ function AuthButtons() {
<NavigationMenu>
<NavigationMenuItem>
<NavigationMenuTrigger className="text-xl">
{user.name} {user.surname}
{localUser.name} {localUser.surname}
</NavigationMenuTrigger>
<NavigationMenuContent className="bg-popover text-popover-foreground">
{userItem.map((subItem) => (