feat: download & like count + UI tweaks and cleanup

This commit is contained in:
2026-02-20 18:29:11 +10:30
parent 889175f3de
commit d21ce90a5c
10 changed files with 395 additions and 106 deletions
+9 -2
View File
@@ -63,11 +63,18 @@
action: isFavorite ? 'favorite' : 'unfavorite',
})) as { success?: boolean };
if (result?.success) {
const delta = isFavorite ? 1 : -1;
themes = themes.map((t) =>
t.id === theme.id ? { ...t, is_favorited: isFavorite } : t
t.id === theme.id
? { ...t, is_favorited: isFavorite, favorite_count: Math.max(0, (t.favorite_count ?? 0) + delta) }
: t
);
if (displayTheme?.id === theme.id) {
displayTheme = { ...displayTheme, is_favorited: isFavorite };
displayTheme = {
...displayTheme,
is_favorited: isFavorite,
favorite_count: Math.max(0, (displayTheme.favorite_count ?? 0) + delta),
};
}
}
};