## Bug Fixes ### Note Card Actions - Fix broken size change functionality (missing state declaration) - Implement React 19 useOptimistic for instant UI feedback - Add startTransition for non-blocking updates - Ensure smooth animations without page refresh - All note actions now work: pin, archive, color, size, checklist ### Markdown LaTeX Rendering - Add remark-math and rehype-katex plugins - Support inline equations with dollar sign syntax - Support block equations with double dollar sign syntax - Import KaTeX CSS for proper styling - Equations now render correctly instead of showing raw LaTeX ## Technical Details - Replace undefined currentNote references with optimistic state - Add optimistic updates before server actions for instant feedback - Use router.refresh() in transitions for smart cache invalidation - Install remark-math, rehype-katex, and katex packages ## Testing - Build passes successfully with no TypeScript errors - Dev server hot-reloads changes correctly
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { getUsers } from '@/app/actions/admin'
|
|
import { UserList } from './user-list'
|
|
import { CreateUserDialog } from './create-user-dialog'
|
|
import { auth } from '@/auth'
|
|
import { redirect } from 'next/navigation'
|
|
import Link from 'next/link'
|
|
import { Button } from '@/components/ui/button'
|
|
import { Settings } from 'lucide-react'
|
|
|
|
export default async function AdminPage() {
|
|
const session = await auth()
|
|
|
|
if ((session?.user as any)?.role !== 'ADMIN') {
|
|
redirect('/')
|
|
}
|
|
|
|
const users = await getUsers()
|
|
|
|
return (
|
|
<div className="container mx-auto py-10 px-4">
|
|
<div className="flex justify-between items-center mb-8">
|
|
<h1 className="text-3xl font-bold">User Management</h1>
|
|
<div className="flex gap-2">
|
|
<Link href="/admin/settings">
|
|
<Button variant="outline">
|
|
<Settings className="mr-2 h-4 w-4" />
|
|
Settings
|
|
</Button>
|
|
</Link>
|
|
<CreateUserDialog />
|
|
</div>
|
|
</div>
|
|
|
|
<div className="bg-white dark:bg-zinc-900 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-800">
|
|
<UserList initialUsers={users} />
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|