diff --git a/src/App.tsx b/src/App.tsx
index 386c405..ebcd676 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,6 +1,7 @@
import { AppLayout } from '@/components/AppLayout'
import { ProtectedRoute } from '@/components/ProtectedRoute'
import { AuthProvider } from '@/contexts/AuthContext'
+import { Button } from '@/components/ui/button'
import { ActivityPage } from '@/pages/ActivityPage'
import { AdminUsersPage } from '@/pages/AdminUsersPage'
import { DashboardPage } from '@/pages/DashboardPage'
@@ -22,7 +23,7 @@ function App() {
path="/dashboard"
element={
-
+
@@ -32,7 +33,7 @@ function App() {
path="/activity"
element={
-
+
@@ -42,7 +43,7 @@ function App() {
path="/settings"
element={
-
+
@@ -52,7 +53,13 @@ function App() {
path="/admin/users"
element={
-
+ Add User
+ }
+ >
diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx
index dbd55a0..0772cfd 100644
--- a/src/components/AppLayout.tsx
+++ b/src/components/AppLayout.tsx
@@ -1,19 +1,31 @@
import { type ReactNode } from 'react'
import { AppSidebar } from '@/components/AppSidebar'
+import { PageHeader } from '@/components/PageHeader'
+import { SidebarProvider } from '@/contexts/SidebarContext'
interface AppLayoutProps {
children: ReactNode
+ title: string
+ description?: string
+ headerActions?: ReactNode
}
-export function AppLayout({ children }: AppLayoutProps) {
+export function AppLayout({ children, title, description, headerActions }: AppLayoutProps) {
return (
-
-
-
-
- {children}
+
+
+
+
+
+ {headerActions}
+
+
+
+ {children}
+
+
-
-
+
+
)
}
\ No newline at end of file
diff --git a/src/components/AppSidebar.tsx b/src/components/AppSidebar.tsx
index c97bfa8..dc59164 100644
--- a/src/components/AppSidebar.tsx
+++ b/src/components/AppSidebar.tsx
@@ -9,6 +9,7 @@ import {
SidebarNavItem
} from '@/components/ui/sidebar'
import { useAuth } from '@/contexts/AuthContext'
+import { useSidebar } from '@/contexts/SidebarContext'
import {
Home,
Settings,
@@ -45,6 +46,7 @@ const adminNavigationItems = [
export function AppSidebar() {
const { user, logout } = useAuth()
+ const { isOpen } = useSidebar()
const location = useLocation()
const handleLogout = async () => {
@@ -63,16 +65,18 @@ export function AppSidebar() {
]
return (
-
+
SB
-
+ {isOpen && (
+
+ )}
@@ -84,9 +88,12 @@ export function AppSidebar() {
return (
-
+
- {item.title}
+ {isOpen && item.title}
)
@@ -103,19 +110,21 @@ export function AppSidebar() {
className="w-8 h-8 rounded-full"
/>
)}
-
-
{user.name}
-
{user.email}
-
+ {isOpen && (
+
+
{user.name}
+
{user.email}
+
+ )}
diff --git a/src/components/PageHeader.tsx b/src/components/PageHeader.tsx
new file mode 100644
index 0000000..868cd23
--- /dev/null
+++ b/src/components/PageHeader.tsx
@@ -0,0 +1,42 @@
+import { Button } from '@/components/ui/button'
+import { useSidebar } from '@/contexts/SidebarContext'
+import { Menu } from 'lucide-react'
+
+interface PageHeaderProps {
+ title: string
+ description?: string
+ children?: React.ReactNode
+}
+
+export function PageHeader({ title, description, children }: PageHeaderProps) {
+ const { toggle } = useSidebar()
+
+ return (
+
+
+
+
+
+
{title}
+ {description && (
+
{description}
+ )}
+
+
+ {children && (
+
+ {children}
+
+ )}
+
+
+ )
+}
\ No newline at end of file
diff --git a/src/contexts/SidebarContext.tsx b/src/contexts/SidebarContext.tsx
new file mode 100644
index 0000000..d000509
--- /dev/null
+++ b/src/contexts/SidebarContext.tsx
@@ -0,0 +1,35 @@
+import { createContext, useContext, useState, type ReactNode } from 'react'
+
+interface SidebarContextType {
+ isOpen: boolean
+ toggle: () => void
+ open: () => void
+ close: () => void
+}
+
+const SidebarContext = createContext(undefined)
+
+export function SidebarProvider({ children }: { children: ReactNode }) {
+ const [isOpen, setIsOpen] = useState(true)
+
+ const toggle = () => setIsOpen(prev => !prev)
+ const open = () => setIsOpen(true)
+ const close = () => setIsOpen(false)
+
+ const value = {
+ isOpen,
+ toggle,
+ open,
+ close,
+ }
+
+ return {children}
+}
+
+export function useSidebar() {
+ const context = useContext(SidebarContext)
+ if (context === undefined) {
+ throw new Error('useSidebar must be used within a SidebarProvider')
+ }
+ return context
+}
\ No newline at end of file
diff --git a/src/pages/ActivityPage.tsx b/src/pages/ActivityPage.tsx
index d870057..5cc9a14 100644
--- a/src/pages/ActivityPage.tsx
+++ b/src/pages/ActivityPage.tsx
@@ -3,11 +3,6 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/com
export function ActivityPage() {
return (
-
-
Activity
-
View recent activity and logs
-
-
diff --git a/src/pages/AdminUsersPage.tsx b/src/pages/AdminUsersPage.tsx
index c626572..1b6cffd 100644
--- a/src/pages/AdminUsersPage.tsx
+++ b/src/pages/AdminUsersPage.tsx
@@ -51,14 +51,6 @@ export function AdminUsersPage() {
return (
-
-
-
User Management
-
Manage users and their permissions
-
-
-
-
Users
diff --git a/src/pages/DashboardPage.tsx b/src/pages/DashboardPage.tsx
index 4197ce9..f92a879 100644
--- a/src/pages/DashboardPage.tsx
+++ b/src/pages/DashboardPage.tsx
@@ -10,11 +10,6 @@ export function DashboardPage() {
return (
-
-
Dashboard
-
Welcome back, {user.name}!
-
-
{/* User Profile Card */}
diff --git a/src/pages/LoginPage.tsx b/src/pages/LoginPage.tsx
index 687546d..8d0a97f 100644
--- a/src/pages/LoginPage.tsx
+++ b/src/pages/LoginPage.tsx
@@ -42,7 +42,9 @@ export function LoginPage() {
const loadProviders = async () => {
try {
const providers = await authService.getOAuthProviders()
- setOauthProviders(providers)
+ if (providers) {
+ setOauthProviders(providers)
+ }
} catch (error) {
console.error('Failed to load OAuth providers:', error)
}
diff --git a/src/pages/RegisterPage.tsx b/src/pages/RegisterPage.tsx
index 64f8486..d7b5c2e 100644
--- a/src/pages/RegisterPage.tsx
+++ b/src/pages/RegisterPage.tsx
@@ -33,7 +33,9 @@ export function RegisterPage() {
const loadProviders = async () => {
try {
const providers = await authService.getOAuthProviders()
- setOauthProviders(providers)
+ if (providers) {
+ setOauthProviders(providers)
+ }
} catch (error) {
console.error('Failed to load OAuth providers:', error)
}
diff --git a/src/pages/SettingsPage.tsx b/src/pages/SettingsPage.tsx
index f20f760..7702f87 100644
--- a/src/pages/SettingsPage.tsx
+++ b/src/pages/SettingsPage.tsx
@@ -39,11 +39,6 @@ export function SettingsPage() {
return (
-
-
Settings
-
Manage your account settings and preferences
-
-