diff --git a/public/fonts/Inter.otf b/public/fonts/Inter.otf new file mode 100644 index 0000000..6604db3 Binary files /dev/null and b/public/fonts/Inter.otf differ diff --git a/src/App.tsx b/src/App.tsx index 560da9f..1f62543 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -39,6 +39,7 @@ function App() { if (!is_admin) { try { const voter = await contractInstance.getVoterdetails(account); + if (voter?.votername) { is_voter = false; } @@ -47,6 +48,8 @@ function App() { } } + console.log('is_admin', is_admin); + dispatch({ type: 'LOGIN', payload: { account, instance: contractInstance, is_admin, flag: is_voter }, @@ -74,6 +77,7 @@ function App() { active election} /> }> + admin dashboard} /> } /> } /> diff --git a/src/components/shared/Navbar.tsx b/src/components/shared/Navbar.tsx index 485806e..36a5093 100644 --- a/src/components/shared/Navbar.tsx +++ b/src/components/shared/Navbar.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { useState } from 'react'; import { Link } from 'react-router'; -import { Vote, Menu } from 'lucide-react'; +import { Vote, Menu, Shield } from 'lucide-react'; import { cn } from '@/lib/utils'; import { Button } from '@/components/ui/button'; @@ -16,9 +16,11 @@ import { } from '@/components/ui/navigation-menu'; import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet'; import { getCurrentConnection } from '@/config'; +import AuthContext from '@/context/AuthContext'; export default function Navbar() { const [isOpen, setIsOpen] = useState(false); + const { state } = React.useContext(AuthContext); const is_connected = !!getCurrentConnection(); return ( @@ -82,6 +84,14 @@ export default function Navbar() {
+ {state.is_admin ? ( + + ) : null} @@ -281,11 +275,11 @@ export default function AdminVerifyVotersPage() {
Name: - {selectedVoter.name} + {selectedVoter.votername}
Wallet: - {selectedVoter.walletAddress} + {selectedVoter.address}
@@ -295,7 +289,7 @@ export default function AdminVerifyVotersPage() {
- +
@@ -307,7 +301,7 @@ export default function AdminVerifyVotersPage() { Cancel