feat(Issuers): add , edit, delete , toggle ,capability and currencies functionality
This commit is contained in:
@@ -2,8 +2,19 @@ import React, { useState } from 'react';
|
||||
import { Menu, Sun, Moon, User, LogOut, ChevronDown } from 'lucide-react';
|
||||
import { signOut } from '../services/api';
|
||||
import { useAuthStore } from '../store/authStore';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
|
||||
const Navbar = ({ onSidebarToggle }) => {
|
||||
let user = null;
|
||||
try {
|
||||
const authContext = useAuth();
|
||||
user = authContext?.user || null;
|
||||
} catch (e) {
|
||||
// useAuth not available, will use localStorage
|
||||
}
|
||||
const userData = user || JSON.parse(localStorage.getItem('user') || '{}') || {};
|
||||
const userName = userData.name && userData.name !== '...' ? userData.name : (userData.email || '...');
|
||||
const userEmail = userData.email || '';
|
||||
const isLoggedIn = useAuthStore((s) => s.isLoggedIn);
|
||||
const [isDarkMode, setIsDarkMode] = useState(() => {
|
||||
return localStorage.getItem('theme') === 'dark' ||
|
||||
@@ -77,7 +88,7 @@ const Navbar = ({ onSidebarToggle }) => {
|
||||
<User className="h-4 w-4 text-blue-600 dark:text-blue-400" />
|
||||
</div>
|
||||
<span className="hidden sm:block text-sm font-medium">
|
||||
{isLoggedIn ? 'Admin' : 'Guest'}
|
||||
{isLoggedIn ? userName : 'Guest'}
|
||||
</span>
|
||||
<ChevronDown className="h-4 w-4" />
|
||||
</button>
|
||||
@@ -87,10 +98,10 @@ const Navbar = ({ onSidebarToggle }) => {
|
||||
<div className="absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 py-1 z-50">
|
||||
<div className="px-4 py-2 border-b border-gray-200 dark:border-gray-700">
|
||||
<p className="text-sm font-medium text-gray-900 dark:text-white">
|
||||
{isLoggedIn ? 'Admin User' : 'Guest'}
|
||||
{isLoggedIn ? userName : 'Guest'}
|
||||
</p>
|
||||
<p className="text-xs text-gray-500 dark:text-gray-400">
|
||||
{isLoggedIn ? 'admin@example.com' : ''}
|
||||
{isLoggedIn ? userEmail : ''}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user