feat: improve previous imports list with status borders and pill badges

This commit is contained in:
Varun committed 2026-04-08 19:30:11 +05:30
1 parent d7f19d8813
commit 6c310eb07c
1 file changed
+26 -9
+26 -9
View File
@@ -471,7 +471,7 @@ export default function ImportSharedPage() {
<div className="space-y-2">
<h1 className="text-2xl font-bold tracking-tight">Import a shared album</h1>
<p className="text-sm text-muted-foreground">
Paste a public shared link from Immich or Nextcloud to import its assets into your Immich instance.
Paste a public shared link from <strong className="font-medium">Immich</strong> or <strong className="font-medium">Nextcloud</strong> to import its assets into your Immich instance.
</p>
</div>
@@ -524,24 +524,31 @@ export default function ImportSharedPage() {
<h2 className="text-sm font-medium text-muted-foreground uppercase tracking-wider">
Previous imports
</h2>
<div className="space-y-1">
<div className="space-y-1.5">
{importHistory.jobs.map((job) => {
let jobImportData: Record<string, unknown> = {};
try { jobImportData = JSON.parse(job.importData); } catch { /* ignore */ }
const albumOpts = jobImportData.albumOptions as { albumName?: string } | undefined;
const albumName = albumOpts?.albumName;
const borderColor = job.status === "completed"
? "border-l-emerald-500"
: job.status === "failed"
? "border-l-destructive"
: "border-l-amber-400";
const statusIcon = job.status === "completed" ? (
<CheckCircle2 className="h-4 w-4 text-emerald-500 shrink-0" />
) : job.status === "failed" ? (
<XCircle className="h-4 w-4 text-destructive shrink-0" />
) : (
<Clock3 className="h-4 w-4 text-muted-foreground shrink-0 animate-pulse" />
<Clock3 className="h-4 w-4 text-amber-400 shrink-0 animate-pulse" />
);
return (
<div
key={job.id}
className="flex items-center gap-3 px-3 py-2.5 rounded-lg cursor-pointer hover:bg-muted/60 transition-colors"
className={`flex items-center gap-3 px-3 py-3 rounded-lg cursor-pointer border border-l-[3px] ${borderColor} bg-muted/30 hover:bg-muted/60 transition-colors`}
onClick={() => setDetailJobId(job.id)}
>
{statusIcon}
@@ -549,11 +556,21 @@ export default function ImportSharedPage() {
<p className="text-sm font-medium truncate">
{albumName || job.url}
</p>
<p className="text-xs text-muted-foreground">
{job.uploadedCount} imported
{job.skippedCount > 0 && ` · ${job.skippedCount} skipped`}
{job.failedCount > 0 && ` · ${job.failedCount} failed`}
</p>
<div className="flex items-center gap-1.5 mt-1">
<span className="inline-flex items-center rounded-full bg-emerald-500/15 px-2 py-0.5 text-[11px] font-medium text-emerald-600 dark:text-emerald-400">
{job.uploadedCount} imported
</span>
{job.skippedCount > 0 && (
<span className="inline-flex items-center rounded-full bg-amber-500/15 px-2 py-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400">
{job.skippedCount} skipped
</span>
)}
{job.failedCount > 0 && (
<span className="inline-flex items-center rounded-full bg-destructive/15 px-2 py-0.5 text-[11px] font-medium text-destructive">
{job.failedCount} failed
</span>
)}
</div>
</div>
<span className="text-xs text-muted-foreground whitespace-nowrap">
{formatDateOnly(job.createdAt)}