auth-yes/ui/components/admin/AdminTable.tsx
google-labs-jules[bot] 4c7d8d4af7 feat(ui): decompose admin pages into reusable AdminTable and AdminModal components
Refactored AdminInvitesPage, AdminUserDetailsPage, AdminRolesPage, and AdminAppsPage to use the new pure Hono SSR JSX stateless components.
Fixed missing import definitions in AdminRolesPage.
Moved task file to complete state.

Co-authored-by: mrteye <1945243+mrteye@users.noreply.github.com>
2026-08-26 00:34:29 +00:00

68 lines
1.6 KiB
TypeScript

export interface AdminTableProps {
id: string;
headers: any[];
desktopRows: any;
mobileCards: any;
emptyState?: any;
colSpan?: number;
isEmpty?: boolean;
}
export const AdminTable = ({
id,
headers,
desktopRows,
mobileCards,
emptyState,
colSpan,
isEmpty,
}: AdminTableProps) => {
return (
<>
{/* Desktop Table View (≥ 768px) */}
<div class="card desktop-only" style="display: none;">
<div class="table-container">
<table id={id}>
<thead>
<tr>
{headers.map((header, i) => <th key={i}>{header}</th>)}
</tr>
</thead>
<tbody>
{isEmpty
? (
<tr>
<td
colSpan={colSpan || headers.length}
style="text-align: center; color: var(--text-muted); padding: 2rem;"
>
{emptyState}
</td>
</tr>
)
: desktopRows}
</tbody>
</table>
</div>
</div>
{/* Mobile Deck View (< 768px) */}
<div
id={`${id}MobileDeck`}
class="mobile-only"
style="display: flex; flex-direction: column; gap: 1rem;"
>
{isEmpty
? (
<div class="card" style="text-align: center; padding: 2rem;">
<p style="color: var(--text-muted); margin: 0;">
{emptyState}
</p>
</div>
)
: mobileCards}
</div>
</>
);
};