refactor: remove unused methods from HistoryStore interface and implementation

This commit is contained in:
kuekhaoyang
2025-11-18 16:57:14 +08:00
parent 88f14290b5
commit ab75156071
2 changed files with 3 additions and 39 deletions
+3
View File
@@ -2,6 +2,9 @@
* useMediaQuery Hook
* 媒体查询 Hook - 监听浏览器媒体查询状态变化
*
* Note: Ready-to-use utility hook for responsive features.
* Currently not in active use but available for future enhancements.
*
* 遵循 Liquid Glass 设计系统原则:
* - 响应式设计优先
* - 性能优化(使用 matchMedia API
-39
View File
@@ -25,16 +25,6 @@ interface HistoryStore {
episodes?: Episode[]
) => void;
updateProgress: (
videoId: string | number,
source: string,
episodeIndex: number,
position: number,
duration: number
) => void;
getHistory: () => VideoHistoryItem[];
getHistoryItem: (videoId: string | number, source: string) => VideoHistoryItem | undefined;
removeFromHistory: (videoId: string | number, source: string) => void;
clearHistory: () => void;
}
@@ -121,35 +111,6 @@ export const useHistoryStore = create<HistoryStore>()(
});
},
updateProgress: (videoId, source, episodeIndex, position, duration) => {
set((state) => {
const newHistory = state.viewingHistory.map((item) => {
if (item.videoId === videoId && item.source === source) {
return {
...item,
episodeIndex,
playbackPosition: position,
duration,
timestamp: Date.now(),
};
}
return item;
});
return { viewingHistory: newHistory };
});
},
getHistory: () => {
return get().viewingHistory;
},
getHistoryItem: (videoId, source) => {
return get().viewingHistory.find(
(item) => item.videoId === videoId && item.source === source
);
},
removeFromHistory: (videoId, source) => {
set((state) => ({
viewingHistory: state.viewingHistory.filter(