feat: 首页支持风景图与纯色背景随滑动自动切换,优化点赞图标样式与交互

This commit is contained in:
1
2026-02-02 16:50:38 +08:00
parent 868c5cac40
commit 228fd7fd84
27 changed files with 144 additions and 23 deletions

View File

@@ -70,6 +70,7 @@ export async function setReaction(contentId: string, reaction: Reaction): Promis
}
export type FavoriteItem = {
favId: string; // 唯一标识,支持重复点赞同一文案
id: string;
date: string;
themeMode: ThemeMode;
@@ -82,15 +83,15 @@ export async function getFavorites(): Promise<FavoriteItem[]> {
export async function addFavorite(item: FavoriteItem): Promise<void> {
const list = await getFavorites();
if (list.some(i => i.id === item.id)) return;
// 允许重复点赞,不再根据 id 去重
const newList = [item, ...list];
console.log('Adding to favorites, new list size:', newList.length);
await setJson(KEY_FAVORITES_ITEMS, newList);
}
export async function removeFavorite(contentId: string): Promise<void> {
export async function removeFavorite(favId: string): Promise<void> {
const list = await getFavorites();
const next = list.filter(item => item.id !== contentId);
const next = list.filter(item => item.favId !== favId);
await setJson(KEY_FAVORITES_ITEMS, next);
}