mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-16 09:13:42 +08:00
refactor: remove unused methods from HistoryStore interface and implementation
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user