blob: 38f248d2c3e2b9ff92aec1bd1fe042bd4e6a9a27 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
"use client";
import { Card, CardContent } from "@/components/ui/card";
import { useListImportSessions } from "@/lib/hooks/useImportSessions";
import { useTranslation } from "@/lib/i18n/client";
import { Package } from "lucide-react";
import { FullPageSpinner } from "../ui/full-page-spinner";
import { ImportSessionCard } from "./ImportSessionCard";
export function ImportSessionsSection() {
const { t } = useTranslation();
const { data: sessions, isLoading, error } = useListImportSessions();
if (isLoading) {
return (
<div className="flex w-full flex-col gap-4">
<div className="flex items-center justify-between">
<h3 className="text-lg font-medium">
{t("settings.import_sessions.title")}
</h3>
</div>
<FullPageSpinner />
</div>
);
}
if (error) {
return (
<div className="flex w-full flex-col gap-4">
<div className="flex items-center justify-between">
<h3 className="text-lg font-medium">
{t("settings.import_sessions.title")}
</h3>
</div>
<Card>
<CardContent className="flex items-center justify-center py-8">
<p className="text-gray-600">
{t("settings.import_sessions.load_error")}
</p>
</CardContent>
</Card>
</div>
);
}
return (
<div className="flex w-full flex-col gap-4">
<div>
<h3 className="text-lg font-medium">
{t("settings.import_sessions.title")}
</h3>
<p className="mt-1 text-sm text-accent-foreground">
{t("settings.import_sessions.description")}
</p>
</div>
{sessions && sessions.length > 0 ? (
<div className="space-y-4">
{sessions.map((session) => (
<ImportSessionCard key={session.id} session={session} />
))}
</div>
) : (
<Card>
<CardContent className="flex flex-col items-center justify-center py-12">
<Package className="mb-4 h-12 w-12 text-gray-400" />
<p className="mb-2 text-center text-gray-600">
{t("settings.import_sessions.no_sessions")}
</p>
<p className="text-center text-sm text-gray-500">
{t("settings.import_sessions.no_sessions_detail")}
</p>
</CardContent>
</Card>
)}
</div>
);
}
|