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
+28
-22
@@ -1,3 +1,4 @@
|
||||
import { Shield } from "lucide-react";
|
||||
import {
|
||||
addBlacklist,
|
||||
addWhitelist,
|
||||
@@ -44,10 +45,15 @@ export default async function AdminIp() {
|
||||
|
||||
return (
|
||||
<main>
|
||||
<h1>IP Management</h1>
|
||||
<p className="muted" style={{ marginTop: "-0.4rem" }}>
|
||||
Allow or block IP addresses (and ASNs) at the website edge.
|
||||
</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">
|
||||
<Shield size={20} className="text-[var(--color-primary)]" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="m-0 text-xl font-extrabold text-[var(--color-text)]">IP Management</h1>
|
||||
<p className="m-0 text-xs text-[var(--color-text-muted)] mt-0.5">Allow or block IP addresses (and ASNs) at the website edge.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3.5 mb-6">
|
||||
<StatusCard
|
||||
@@ -67,17 +73,17 @@ export default async function AdminIp() {
|
||||
<div className="grid cols-2">
|
||||
{/* ── Whitelist ──────────────────── */}
|
||||
<section className="mt-6">
|
||||
<h2>Whitelist</h2>
|
||||
<h2 className="admin-section-title">Whitelist</h2>
|
||||
|
||||
<form action={addWhitelist} className="card" style={{ marginBottom: "1rem" }}>
|
||||
<div style={{ display: "flex", gap: "0.5rem", flexWrap: "wrap" }}>
|
||||
<form action={addWhitelist} className="admin-card mb-4">
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
<input
|
||||
name="ipAddress"
|
||||
placeholder="IP address"
|
||||
required
|
||||
style={{ flex: 1, minWidth: 140 }}
|
||||
className="flex-1 min-w-[140px]"
|
||||
/>
|
||||
<input name="asn" placeholder="ASN (optional)" style={{ width: 140 }} />
|
||||
<input name="asn" placeholder="ASN (optional)" className="w-[140px]" />
|
||||
<button type="submit" className="btn btn-secondary">
|
||||
Add
|
||||
</button>
|
||||
@@ -85,9 +91,9 @@ export default async function AdminIp() {
|
||||
</form>
|
||||
|
||||
{whitelist.length === 0 ? (
|
||||
<p className="muted">No whitelisted IPs.</p>
|
||||
<div className="admin-empty">No whitelisted IPs.</div>
|
||||
) : (
|
||||
<div style={{ overflowX: "auto" }}>
|
||||
<div className="overflow-x-auto">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -101,8 +107,8 @@ export default async function AdminIp() {
|
||||
{whitelist.map((w) => (
|
||||
<tr key={String(w.id)}>
|
||||
<td>{w.ipAddress}</td>
|
||||
<td className="muted">{w.asn ?? "—"}</td>
|
||||
<td className="muted">{formatDate(w.createdAt)}</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">{w.asn ?? "—"}</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">{formatDate(w.createdAt)}</td>
|
||||
<td>
|
||||
<form action={deleteWhitelist}>
|
||||
<input type="hidden" name="id" value={String(w.id)} />
|
||||
@@ -121,17 +127,17 @@ export default async function AdminIp() {
|
||||
|
||||
{/* ── Blacklist ──────────────────── */}
|
||||
<section className="mt-6">
|
||||
<h2>Blacklist</h2>
|
||||
<h2 className="admin-section-title">Blacklist</h2>
|
||||
|
||||
<form action={addBlacklist} className="card" style={{ marginBottom: "1rem" }}>
|
||||
<div style={{ display: "flex", gap: "0.5rem", flexWrap: "wrap" }}>
|
||||
<form action={addBlacklist} className="admin-card mb-4">
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
<input
|
||||
name="ipAddress"
|
||||
placeholder="IP address"
|
||||
required
|
||||
style={{ flex: 1, minWidth: 140 }}
|
||||
className="flex-1 min-w-[140px]"
|
||||
/>
|
||||
<input name="asn" placeholder="ASN (optional)" style={{ width: 140 }} />
|
||||
<input name="asn" placeholder="ASN (optional)" className="w-[140px]" />
|
||||
<button type="submit" className="btn btn-danger">
|
||||
Add
|
||||
</button>
|
||||
@@ -139,9 +145,9 @@ export default async function AdminIp() {
|
||||
</form>
|
||||
|
||||
{blacklist.length === 0 ? (
|
||||
<p className="muted">No blacklisted IPs.</p>
|
||||
<div className="admin-empty">No blacklisted IPs.</div>
|
||||
) : (
|
||||
<div style={{ overflowX: "auto" }}>
|
||||
<div className="overflow-x-auto">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -155,8 +161,8 @@ export default async function AdminIp() {
|
||||
{blacklist.map((b) => (
|
||||
<tr key={String(b.id)}>
|
||||
<td>{b.ipAddress}</td>
|
||||
<td className="muted">{b.asn ?? "—"}</td>
|
||||
<td className="muted">{formatDate(b.createdAt)}</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">{b.asn ?? "—"}</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">{formatDate(b.createdAt)}</td>
|
||||
<td>
|
||||
<form action={deleteBlacklist}>
|
||||
<input type="hidden" name="id" value={String(b.id)} />
|
||||
|
||||
Reference in new issue
Block a user