Convert admin pages to new Tailwind design pattern
- Replace 'card' class with 'admin-card' (gradient cards, dark mode support) - Replace 'muted' class with consistent Tailwind muted states - Standardize page headers with gradient backgrounds and Lucide icons - Convert all inline styles to Tailwind classes - Add admin-page CSS helpers (admin-card, admin-filter-bar, admin-section-title) - Apply pattern to all 42 admin pages (was only 6 before) - Zero TypeScript errors, production builds successfully Co-authored-by: openhands <[email protected]>
This commit is contained in:
1 parent
b621ec79a3
commit
928544100b
46 files changed
+790
-635
No files matched your search
+23
-20
@@ -1,3 +1,4 @@
|
||||
import { ScrollText } from "lucide-react";
|
||||
import { StatusCard } from "@/components/admin/dashboard";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
@@ -81,10 +82,15 @@ export default async function AdminStaffActivities({
|
||||
|
||||
return (
|
||||
<main>
|
||||
<h1>Staff Activities</h1>
|
||||
<p className="muted" style={{ marginTop: "-0.4rem" }}>
|
||||
Auditor trail of all staff actions in the hotel.
|
||||
</p>
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-[var(--color-primary)]/20 to-[var(--color-primary)]/5 grid place-items-center">
|
||||
<ScrollText size={20} className="text-[var(--color-primary)]" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="m-0 text-xl font-extrabold text-[var(--color-text)]">Staff Activities</h1>
|
||||
<p className="m-0 text-xs text-[var(--color-text-muted)] mt-0.5">Auditor trail of all staff actions in the hotel.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3.5 mb-6">
|
||||
<StatusCard label="Total activities" value={total} icon="📋" />
|
||||
@@ -97,27 +103,24 @@ export default async function AdminStaffActivities({
|
||||
/>
|
||||
</div>
|
||||
|
||||
<form
|
||||
className="card"
|
||||
style={{ display: "flex", gap: "0.5rem", marginBottom: "1.5rem", flexWrap: "wrap" }}
|
||||
>
|
||||
<form className="admin-card flex gap-2 mb-6 flex-wrap">
|
||||
<input
|
||||
name="q"
|
||||
defaultValue={q}
|
||||
placeholder="Search action, description, IP..."
|
||||
style={{ flex: 1, minWidth: 200 }}
|
||||
className="flex-1 min-w-[200px]"
|
||||
/>
|
||||
<input
|
||||
name="staffId"
|
||||
defaultValue={staffId?.toString()}
|
||||
placeholder="Staff ID"
|
||||
style={{ width: 120 }}
|
||||
className="w-[120px]"
|
||||
/>
|
||||
<input
|
||||
name="action"
|
||||
defaultValue={action ?? ""}
|
||||
placeholder="Action type (e.g., rank_change)"
|
||||
style={{ width: 160 }}
|
||||
className="w-[160px]"
|
||||
/>
|
||||
|
||||
<button type="submit" className="btn btn-primary">
|
||||
@@ -131,11 +134,11 @@ export default async function AdminStaffActivities({
|
||||
</form>
|
||||
|
||||
<section className="mt-6">
|
||||
<h2>Activities ({total})</h2>
|
||||
<h2 className="admin-section-title">Activities ({total})</h2>
|
||||
{activities.length === 0 ? (
|
||||
<p className="muted">No staff activities match this search.</p>
|
||||
<div className="admin-empty">No staff activities match this search.</div>
|
||||
) : (
|
||||
<div style={{ overflowX: "auto" }}>
|
||||
<div className="overflow-x-auto">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -150,20 +153,20 @@ export default async function AdminStaffActivities({
|
||||
<tbody>
|
||||
{activities.map((a) => (
|
||||
<tr key={String(a.id)}>
|
||||
<td className="muted" style={{ whiteSpace: "nowrap" }}>{fromDate(a.createdAt)}</td>
|
||||
<td className="muted">#{Number(a.userId)} ({nameById.get(Number(a.userId)) ?? "unknown"})</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">{fromDate(a.createdAt)}</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">#{Number(a.userId)} ({nameById.get(Number(a.userId)) ?? "unknown"})</td>
|
||||
<td>
|
||||
<span className="inline-block text-[0.72rem] font-bold px-2 py-0.5 rounded-full bg-[var(--color-primary)]/18 text-[var(--color-text)]">{a.action}</span>
|
||||
</td>
|
||||
<td>{a.description}</td>
|
||||
<td>
|
||||
{a.targetType && a.targetId ? (
|
||||
<span className="muted">{a.targetType === "user" ? "User " : ""}#{String(a.targetId)}</span>
|
||||
<span className="text-sm text-gray-500 dark:text-gray-400">{a.targetType === "user" ? "User " : ""}#{String(a.targetId)}</span>
|
||||
) : (
|
||||
<span className="muted">—</span>
|
||||
<span className="text-sm text-gray-500 dark:text-gray-400">—</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="muted">{a.ipAddress || "—"}</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">{a.ipAddress || "—"}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
@@ -172,7 +175,7 @@ export default async function AdminStaffActivities({
|
||||
)}
|
||||
</section>
|
||||
|
||||
<p className="muted">
|
||||
<p className="text-xs text-gray-500 dark:text-gray-400">
|
||||
Page {page} / {pages} · {total} activities
|
||||
{page < pages ? (
|
||||
<>
|
||||
|
||||
Reference in new issue
Block a user