From 30b450cdb643ffb7da2fb7a63436ac101fd45c34 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Wed, 25 Feb 2026 22:02:53 +0100 Subject: [PATCH] Fix admin dashboard build: remove date-fns, replace Card with native divs, fix Button props Made-with: Cursor --- app/admin/orgs/[id]/page.tsx | 60 +++++++++++++++++++----------------- app/admin/orgs/page.tsx | 25 ++++++++------- app/admin/page.tsx | 22 ++++++------- 3 files changed, 53 insertions(+), 54 deletions(-) diff --git a/app/admin/orgs/[id]/page.tsx b/app/admin/orgs/[id]/page.tsx index 741ad30..3039798 100644 --- a/app/admin/orgs/[id]/page.tsx +++ b/app/admin/orgs/[id]/page.tsx @@ -3,8 +3,24 @@ import { useEffect, useState } from 'react' import { useParams, useRouter } from 'next/navigation' import { getAdminOrg, grantPlan, type AdminOrgDetail } from '@/lib/api/admin' -import { Card, CardHeader, CardTitle, CardContent, Button, LoadingOverlay, Select, toast } from '@ciphera-net/ui' -import { format, addMonths, addYears } from 'date-fns' +import { Button, LoadingOverlay, Select, toast } from '@ciphera-net/ui' + +function formatDate(d: Date) { + return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }) +} +function formatDateTime(d: Date) { + return d.toLocaleDateString('en-US', { dateStyle: 'long' }) + ' ' + d.toLocaleTimeString('en-US', { hour: 'numeric', minute: 'numeric' }) +} +function addMonths(d: Date, months: number) { + const out = new Date(d) + out.setMonth(out.getMonth() + months) + return out +} +function addYears(d: Date, years: number) { + const out = new Date(d) + out.setFullYear(out.getFullYear() + years) + return out +} const PLAN_OPTIONS = [ { value: 'free', label: 'Free' }, @@ -105,12 +121,9 @@ export default function AdminOrgDetailPage() {
{/* Current Status */} - - - Current Status - - -
+
+

Current Status

+
Plan: {org.plan_id} @@ -125,7 +138,7 @@ export default function AdminOrgDetailPage() { Period End: - {org.current_period_end ? format(new Date(org.current_period_end), 'PPP p') : '-'} + {org.current_period_end ? formatDateTime(new Date(org.current_period_end)) : '-'} Stripe Cust: @@ -133,35 +146,27 @@ export default function AdminOrgDetailPage() { Stripe Sub: {org.stripe_subscription_id || '-'} -
- - +
+
{/* Sites */} - - - Sites ({org.sites.length}) - - +
+

Sites ({org.sites.length})

    {org.sites.map((site) => (
  • {site.domain} - {format(new Date(site.created_at), 'MMM d, yyyy')} + {formatDate(new Date(site.created_at))}
  • ))} {org.sites.length === 0 &&
  • No sites found
  • } -
- - + +
{/* Grant Plan Form */} - - - Grant Plan (Manual Override) - - +
+

Grant Plan (Manual Override)

@@ -232,8 +237,7 @@ export default function AdminOrgDetailPage() {
- - +
) } diff --git a/app/admin/orgs/page.tsx b/app/admin/orgs/page.tsx index 06bff18..01ac987 100644 --- a/app/admin/orgs/page.tsx +++ b/app/admin/orgs/page.tsx @@ -3,8 +3,11 @@ import { useEffect, useState } from 'react' import Link from 'next/link' import { listAdminOrgs, type AdminOrgSummary } from '@/lib/api/admin' -import { Card, CardHeader, CardTitle, CardContent, Button, LoadingOverlay } from '@ciphera-net/ui' -import { format } from 'date-fns' +import { Button, LoadingOverlay } from '@ciphera-net/ui' + +function formatDate(d: Date) { + return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }) +} export default function AdminOrgsPage() { const [orgs, setOrgs] = useState([]) @@ -26,12 +29,9 @@ export default function AdminOrgsPage() {

Organizations

- - - All Organizations - - -
+
+

All Organizations

+
@@ -70,20 +70,19 @@ export default function AdminOrgsPage() { {new Intl.NumberFormat().format(org.pageview_limit)} ))}
- {format(new Date(org.updated_at), 'MMM d, yyyy')} + {formatDate(new Date(org.updated_at))} - +
-
- - +
+
) } diff --git a/app/admin/page.tsx b/app/admin/page.tsx index 5bcefab..02050a0 100644 --- a/app/admin/page.tsx +++ b/app/admin/page.tsx @@ -1,23 +1,19 @@ 'use client' import Link from 'next/link' -import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '@ciphera-net/ui' export default function AdminDashboard() { return (
- - - - Organizations - Manage organization plans and limits - - -

- View all organizations, check billing status, and manually grant plans. -

-
-
+ +

Organizations

+

Manage organization plans and limits

+

+ View all organizations, check billing status, and manually grant plans. +

)