Skip to content

Commit

Permalink
feat: subscribe url progress
Browse files Browse the repository at this point in the history
  • Loading branch information
lovegaoshi committed Nov 12, 2023
1 parent ffd1fd7 commit d145807
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
7 changes: 3 additions & 4 deletions src/components/FavList.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const FavList = memo(
playerSettings,
}) => {
const StorageManager = useContext(StorageManagerCtx);
const [
const {
favLists,
setFavLists,
searchList,
Expand All @@ -95,8 +95,7 @@ export const FavList = memo(
onAddFav,
onDragEnd,
updateSubscribeFavList,
] = useFavList();

} = useFavList();
const handleSearch = useCallback(
(list) => {
setSearchList(list);
Expand Down Expand Up @@ -353,7 +352,7 @@ export const FavList = memo(
onSongIndexChange={onPlayOneFromFav}
handleDeleteFromSearchList={handleDeleteFromSearchList}
handleAddToFavClick={handleAddToFavClick}
rssUpdate={async (subscribeUrls) =>
rssUpdate={(subscribeUrls) =>
updateSubscribeFavList({
playlist: selectedList,
StorageManager,
Expand Down
4 changes: 2 additions & 2 deletions src/components/FavListMobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default memo(
const [open, setOpen] = useState(false);
const StorageManager = useContext(StorageManagerCtx);
const confirm = useConfirm();
const [
const {
favLists,
setFavLists,
searchList,
Expand All @@ -115,7 +115,7 @@ export default memo(
handleAddToFavClick,
onAddFav,
onDragEnd,
] = useFavList();
} = useFavList();

useEffect(() => {
if (!selectedList) {
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/useFavList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ const useFavList = () => {
for (let i = 0, n = subscribeUrls.length; i < n; i++) {
playlist.songList = (
await searchBiliURLs({
progressEmitter: setPlaylistRefreshProgress,
input: subscribeUrls[i],
favList: [
...playlist.songList.map((val) => val.bvid),
Expand Down Expand Up @@ -211,7 +212,7 @@ const useFavList = () => {
}
};

return [
return {
favLists,
setFavLists,
searchList,
Expand All @@ -233,7 +234,7 @@ const useFavList = () => {
handleAddToFavClick,
onAddFav,
onDragEnd,
];
};
};

export default useFavList;
8 changes: 4 additions & 4 deletions src/hooks/useStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ interface NoxStore {

const useNoxStore = create<NoxStore>((set, get) => ({
playlistRefreshProgress: 100,
setPlaylistRefreshProgress: (val: number) =>
set({
playlistRefreshProgress: val,
}),
setPlaylistRefreshProgress: (playlistRefreshProgress: number) => {
console.log('debug', playlistRefreshProgress);
set({ playlistRefreshProgress });
},
}));

export default useNoxStore;

0 comments on commit d145807

Please sign in to comment.