feat: enhance API response handling and add new components for module management
This commit is contained in:
@@ -16,6 +16,7 @@ import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
import { Badge } from '@kit/ui/badge';
|
||||
import { Button } from '@kit/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@kit/ui/card';
|
||||
import { ListToolbar } from '@kit/ui/list-toolbar';
|
||||
|
||||
import { AccountNotFound } from '~/components/account-not-found';
|
||||
import { CmsPageShell } from '~/components/cms-page-shell';
|
||||
@@ -50,7 +51,12 @@ export default async function CoursesPage({ params, searchParams }: PageProps) {
|
||||
const page = Number(search.page) || 1;
|
||||
|
||||
const [courses, stats] = await Promise.all([
|
||||
api.listCourses(acct.id, { page, pageSize: PAGE_SIZE }),
|
||||
api.listCourses(acct.id, {
|
||||
search: search.q as string,
|
||||
status: search.status as string,
|
||||
page,
|
||||
pageSize: PAGE_SIZE,
|
||||
}),
|
||||
api.getStatistics(acct.id),
|
||||
]);
|
||||
|
||||
@@ -95,6 +101,25 @@ export default async function CoursesPage({ params, searchParams }: PageProps) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Search & Filters */}
|
||||
<ListToolbar
|
||||
searchPlaceholder="Kurs suchen..."
|
||||
filters={[
|
||||
{
|
||||
param: 'status',
|
||||
label: 'Status',
|
||||
options: [
|
||||
{ value: '', label: 'Alle' },
|
||||
{ value: 'planned', label: 'Geplant' },
|
||||
{ value: 'open', label: 'Offen' },
|
||||
{ value: 'running', label: 'Laufend' },
|
||||
{ value: 'completed', label: 'Abgeschlossen' },
|
||||
{ value: 'cancelled', label: 'Abgesagt' },
|
||||
],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
{/* Table or Empty State */}
|
||||
{courses.data.length === 0 ? (
|
||||
<EmptyState
|
||||
|
||||
Reference in New Issue
Block a user