feat(client): i18n copy + reco lang refresh + home polish
This commit is contained in:
@@ -42,6 +42,12 @@ export type RecoFeedCacheItem = {
|
||||
|
||||
export type RecoFeedCache = {
|
||||
saved_at: string; // ISO8601
|
||||
/**
|
||||
* 缓存文案的语言(后端目前只区分 en / tc)
|
||||
* - en: English
|
||||
* - tc: 繁体中文
|
||||
*/
|
||||
lang?: 'en' | 'tc';
|
||||
items: RecoFeedCacheItem[];
|
||||
meta?: Record<string, unknown>;
|
||||
};
|
||||
@@ -107,6 +113,10 @@ export async function setReaction(contentId: string, reaction: Reaction): Promis
|
||||
export type FavoriteItem = {
|
||||
favId: string; // 唯一标识,支持重复点赞同一文案
|
||||
id: string;
|
||||
/**
|
||||
* 收藏时的文案快照(强烈建议写入,避免后续 cache 覆盖导致无法还原文案)
|
||||
*/
|
||||
text?: string;
|
||||
date: string;
|
||||
themeMode: ThemeMode;
|
||||
background: string; // 颜色值或图片路径
|
||||
@@ -120,7 +130,7 @@ export async function addFavorite(item: FavoriteItem): Promise<void> {
|
||||
const list = await getFavorites();
|
||||
// 允许重复点赞,不再根据 id 去重
|
||||
const newList = [item, ...list];
|
||||
console.log('Adding to favorites, new list size:', newList.length);
|
||||
console.log('Adding to favorites:', JSON.stringify(item));
|
||||
await setJson(KEY_FAVORITES_ITEMS, newList);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user