From 4be2797bd0e3a178d32d5bb5336589322b8e97c2 Mon Sep 17 00:00:00 2001 From: AmzBG Date: Tue, 11 Aug 2026 19:08:42 +0300 Subject: [PATCH] fix: make admin panel responsive --- .../(authenticated)/admin/accounts/page.tsx | 257 +++++++++++++----- apps/web/app/(authenticated)/admin/layout.tsx | 2 +- .../app/(authenticated)/admin/logs/page.tsx | 148 +++++++--- apps/web/app/(authenticated)/admin/page.tsx | 17 +- .../(authenticated)/admin/projects/page.tsx | 251 +++++++++++------ apps/web/app/(authenticated)/layout.tsx | 2 +- apps/web/components/admin/admin-ui.tsx | 20 +- apps/web/components/top-navbar.tsx | 2 +- 8 files changed, 486 insertions(+), 213 deletions(-) diff --git a/apps/web/app/(authenticated)/admin/accounts/page.tsx b/apps/web/app/(authenticated)/admin/accounts/page.tsx index 9b79a05f..a29351b9 100644 --- a/apps/web/app/(authenticated)/admin/accounts/page.tsx +++ b/apps/web/app/(authenticated)/admin/accounts/page.tsx @@ -102,16 +102,23 @@ export default function AdminAccountsPage() { description="Track developer and hiring accounts, connections, activity, and access status." /> - +
-
+ setSearchInput(event.target.value)} placeholder="Search email, name, organization, or GitHub username" aria-label="Search accounts" /> -
@@ -159,89 +166,189 @@ export default function AdminAccountsPage() { No accounts match these filters.

) : ( -
- - - - Account - Type - Status - Activity - Joined - Action - - - - {response.data.map((account) => ( - - -
{account.displayName}
-
+ <> +
+ {response.data.map((account) => ( +
+
+
+
+ {account.displayName} +
+
{account.email}
{account.githubUsername && ( -
+
@{account.githubUsername}
)} - - - +
+ + {account.status} + +
+ +
+
+
Type
+
{account.accountType.replace('_', ' ')} - - - -
- - {account.status} - - {!account.isConfirmed && ( - - Unconfirmed - - )}
-
- -
{account.counts.ownedProjects} owned projects
-
- {account.counts.projectMemberships} collaborations +
+
+
Joined
+
+ {new Date(account.createdAt).toLocaleDateString()}
-
- {account.counts.activeSessions} active sessions +
+
+ +
+
+
+ {account.counts.ownedProjects}
- - - {new Date(account.createdAt).toLocaleDateString()} - - - {account.accountType === 'SUPER_ADMIN' ? ( - Protected - ) : ( - - )} - +
Owned
+
+
+
+ {account.counts.projectMemberships} +
+
Teams
+
+
+
+ {account.counts.activeSessions} +
+
Sessions
+
+
+ + {!account.isConfirmed && ( +

+ Email unconfirmed +

+ )} + +
+ {account.accountType === 'SUPER_ADMIN' ? ( + Protected + ) : ( + + )} +
+
+ ))} +
+ +
+
+ + + Account + Type + Status + Activity + Joined + Action - ))} - -
-
+ + + {response.data.map((account) => ( + + +
+ {account.displayName} +
+
+ {account.email} +
+ {account.githubUsername && ( +
+ @{account.githubUsername} +
+ )} +
+ + + {account.accountType.replace('_', ' ')} + + + +
+ + {account.status} + + {!account.isConfirmed && ( + + Unconfirmed + + )} +
+
+ +
+ {account.counts.ownedProjects} owned projects +
+
+ {account.counts.projectMemberships} collaborations +
+
+ {account.counts.activeSessions} active sessions +
+
+ + {new Date(account.createdAt).toLocaleDateString()} + + + {account.accountType === 'SUPER_ADMIN' ? ( + Protected + ) : ( + + )} + +
+ ))} +
+ +
+ )} {response && ( ; } - return children; + return
{children}
; } diff --git a/apps/web/app/(authenticated)/admin/logs/page.tsx b/apps/web/app/(authenticated)/admin/logs/page.tsx index 0a67f753..5287bbbd 100644 --- a/apps/web/app/(authenticated)/admin/logs/page.tsx +++ b/apps/web/app/(authenticated)/admin/logs/page.tsx @@ -73,16 +73,23 @@ export default function AdminLogsPage() { description="Immutable records of sensitive administrative actions. Secrets and raw server output are intentionally excluded." /> - +
-
+ setSearchInput(event.target.value)} placeholder="Search target ID, administrator email, or reason" aria-label="Search audit logs" /> -
@@ -133,50 +140,101 @@ export default function AdminLogsPage() { No administrative actions match these filters.
) : ( -
- - - - Action - Administrator - Target - Reason - Time - - - - {response.data.map((log) => ( - - + <> +
+ {response.data.map((log) => ( +
+
+ {ACTION_LABELS[log.action]} - - -
- {log.actor?.displayName ?? 'Deleted administrator'} -
-
- {log.actor?.email ?? 'Actor retained by ID only'} -
-
- - {log.targetType} -
- {log.targetId} -
-
- -

- {log.reason ?? '—'} -

-
- - {new Date(log.createdAt).toLocaleString()} - +
+ {log.targetType} +
+ +
+
+ Administrator +
+
+ {log.actor?.displayName ?? 'Deleted administrator'} +
+
+ {log.actor?.email ?? 'Actor retained by ID only'} +
+
+ +
+
+ Target ID +
+
+ {log.targetId} +
+
+ +
+
+ Reason +
+

+ {log.reason ?? '—'} +

+
+ +
+ {new Date(log.createdAt).toLocaleString()} +
+
+ ))} +
+ +
+
+ + + Action + Administrator + Target + Reason + Time - ))} - -
-
+ + + {response.data.map((log) => ( + + + {ACTION_LABELS[log.action]} + + +
+ {log.actor?.displayName ?? 'Deleted administrator'} +
+
+ {log.actor?.email ?? 'Actor retained by ID only'} +
+
+ + + {log.targetType} + +
+ {log.targetId} +
+
+ +

+ {log.reason ?? '—'} +

+
+ + {new Date(log.createdAt).toLocaleString()} + +
+ ))} +
+ + + )} {response && ( -
- +
+ Recent moderation activity -
@@ -194,8 +199,8 @@ export default function AdminOverviewPage() { className="border-border flex flex-col gap-2 border-b py-3 last:border-0 sm:flex-row sm:items-center sm:justify-between" >
-
- +
+ {ACTION_LABELS[log.action]} {log.targetType} @@ -204,7 +209,7 @@ export default function AdminOverviewPage() { {log.reason ?? 'No reason supplied'}

-
+
{log.actor?.displayName ?? 'Deleted administrator'}
{new Date(log.createdAt).toLocaleString()}
diff --git a/apps/web/app/(authenticated)/admin/projects/page.tsx b/apps/web/app/(authenticated)/admin/projects/page.tsx index 17f4a33a..3158f979 100644 --- a/apps/web/app/(authenticated)/admin/projects/page.tsx +++ b/apps/web/app/(authenticated)/admin/projects/page.tsx @@ -100,16 +100,23 @@ export default function AdminProjectsPage() { description="Review project ownership, publication state, collaborators, and moderation history." /> - +
-
+ setSearchInput(event.target.value)} placeholder="Search title, slug, repository, or owner email" aria-label="Search projects" /> -
@@ -158,94 +165,182 @@ export default function AdminProjectsPage() { No projects match these filters.

) : ( -
- - - - Project - Owner - Status - Members - Updated - Action - - - - {response.data.map((project) => { - const canRestore = project.status === 'SUSPENDED'; - const ownerArchived = - project.status === 'ARCHIVED' && !project.moderatedAt; - return ( - - + <> +
+ {response.data.map((project) => { + const canRestore = project.status === 'SUSPENDED'; + const ownerArchived = + project.status === 'ARCHIVED' && !project.moderatedAt; + return ( +
+
+
{project.title} - + -
+
{project.repositoryFullName}
- {project.moderationReason && ( -
- {project.moderationReason} -
- )} - - -
+
+ + {project.status} + +
+ +
+
+
Owner
+
{project.owner.displayName}
-
+
{project.owner.email}
- - - +
+
Activity
+
+ {project.memberCount} members +
+
+ Updated{' '} + {new Date(project.updatedAt).toLocaleDateString()} +
+
+
+ + {project.moderationReason && ( +

+ {project.moderationReason} +

+ )} + +
+ {ownerArchived ? ( + Owner archived + ) : ( + + )} +
+
+ ); + })} +
+ +
+
+ + + Project + Owner + Status + Members + Updated + Action + + + + {response.data.map((project) => { + const canRestore = project.status === 'SUSPENDED'; + const ownerArchived = + project.status === 'ARCHIVED' && !project.moderatedAt; + return ( + + + + {project.title} + + +
+ {project.repositoryFullName} +
+ {project.moderationReason && ( +
+ {project.moderationReason} +
+ )} +
+ +
+ {project.owner.displayName} +
+
+ {project.owner.email} +
+
+ + - {canRestore ? ( - - ) : ( - - )} - {canRestore ? 'Restore' : 'Suspend'} - - )} - -
- ); - })} -
-
-
+ {project.status} + + + + {project.memberCount} + + + {new Date(project.updatedAt).toLocaleDateString()} + + + {ownerArchived ? ( + Owner archived + ) : ( + + )} + + + ); + })} + + +
+ )} {response && ( -
+
{children}
diff --git a/apps/web/components/admin/admin-ui.tsx b/apps/web/components/admin/admin-ui.tsx index 1712e48b..10d47fef 100644 --- a/apps/web/components/admin/admin-ui.tsx +++ b/apps/web/components/admin/admin-ui.tsx @@ -12,12 +12,18 @@ export function AdminPageHeader({ actions?: ReactNode; }) { return ( -
-
-

{title}

+
+
+

+ {title} +

{description}

- {actions} + {actions && ( +
+ {actions} +
+ )}
); } @@ -64,11 +70,12 @@ export function Pagination({ }) { if (totalPages <= 1) return null; return ( -
- +
+ Page {page} of {totalPages}