perf: optimize app startup and background lifecycles

This commit is contained in:
inman
2026-08-19 00:56:15 +08:00
parent 31332f6d76
commit 927e13349b
121 changed files with 4359 additions and 1400 deletions

View File

@@ -201,15 +201,15 @@ function PromptMuseumCardView({
data-testid={`image-prompt-card-${item.id}`}
aria-label={`查看 ${item.title}`}
onClick={() => onOpen(item)}
className="motion-press flex h-full w-full flex-col overflow-hidden rounded-2xl border border-border/70 bg-card text-left shadow-soft transition-[box-shadow,transform,border-color] hover:-translate-y-0.5 hover:border-brand/35 hover:shadow-float focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/35 focus-visible:ring-offset-2"
className="motion-press flex h-full w-full flex-col overflow-hidden rounded-2xl border border-border/70 bg-card text-left shadow-soft transition-colors duration-100 hover:border-brand/35 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/35 focus-visible:ring-offset-2"
>
<div className="relative aspect-[4/3] overflow-hidden bg-surface-subtle">
<MuseumImage
image={item.thumbnail}
sizes="(min-width: 1280px) 280px, (min-width: 768px) 30vw, 90vw"
className="h-full w-full object-cover transition-transform duration-500 ease-out group-hover:scale-[1.02]"
className="h-full w-full object-cover"
/>
<span className="absolute left-3 top-3 inline-flex items-center gap-1 rounded-full border border-white/70 bg-white/85 px-2 py-1 text-[10px] font-semibold text-foreground shadow-soft backdrop-blur">
<span className="absolute left-3 top-3 inline-flex items-center gap-1 rounded-full border border-white bg-white px-2 py-1 text-[10px] font-semibold text-foreground shadow-soft">
<BookOpen className="h-3 w-3 text-brand" aria-hidden="true" />
灵感样例
</span>
@@ -384,7 +384,7 @@ function DetailBody({
</p>
</div>
<div className="flex shrink-0 gap-2 border-t border-border/70 bg-background/95 px-6 py-4 backdrop-blur">
<div className="flex shrink-0 gap-2 border-t border-border/70 bg-background px-6 py-4">
<Button
type="button"
variant="outline"
@@ -552,7 +552,7 @@ export function ImagePromptMuseum() {
<div className="mx-auto w-full max-w-7xl px-5 py-4 sm:px-8 sm:py-6">
<section
data-testid="image-prompt-museum-filters"
className="sticky top-0 z-30 rounded-2xl border border-border/70 bg-card/95 p-3 shadow-soft backdrop-blur sm:p-3.5"
className="sticky top-0 z-30 rounded-2xl border border-border/70 bg-card p-3 shadow-soft sm:p-3.5"
>
<div className="flex flex-wrap items-end gap-2">
<label className="min-w-0 flex-[1_1_220px]">