Fix modules

This commit is contained in:
Logan Cusano
2025-07-13 19:53:36 -04:00
parent 7d3f08cae9
commit e7498a9f8b
5 changed files with 101 additions and 69 deletions

View File

@@ -1,8 +1,14 @@
const MainLayout = ({ children }) => {
'use client';
import React from 'react';
import { useAuth } from '@/lib/auth';
import LoginPage from '@/app/auth/login/page';
import { Button } from '@/components/ui/button';
const MainLayout = ({ children }: { children: React.ReactNode }) => {
const auth = useAuth();
if (!auth.isAuthenticated) {
// This would be a redirect in a real Next.js app
return <LoginPage />;
}
@@ -13,7 +19,7 @@ const MainLayout = ({ children }) => {
<h1 className="text-xl font-bold">Video Voter</h1>
<div>
{auth.user?.role === 'admin' && (
<a href="#admin" className="text-gray-600 hover:text-gray-900 mr-4">Admin</a>
<a href="/main/admin" className="text-gray-600 hover:text-gray-900 mr-4">Admin</a>
)}
<Button onClick={auth.logout}>Logout</Button>
</div>
@@ -24,4 +30,6 @@ const MainLayout = ({ children }) => {
</main>
</div>
);
};
};
export default MainLayout;