mirror of
https://github.com/austinried/subtracks.git
synced 2026-02-10 06:52:43 +01:00
rename to remove "Library" from methods
This commit is contained in:
@@ -54,7 +54,7 @@ export const useCoverArtFile = (coverArt = '-1') => {
|
||||
|
||||
export const useArtistArtFile = (artistId: string) => {
|
||||
const type: CacheItemTypeKey = 'artistArt'
|
||||
const fetchArtistInfo = useStore(store => store.fetchLibraryArtistInfo)
|
||||
const fetchArtistInfo = useStore(store => store.fetchArtistInfo)
|
||||
const artistInfo = useStoreDeep(store => store.entities.artistInfo[artistId])
|
||||
const { file, request } = useFileRequest(type, artistId)
|
||||
const cacheItem = useStore(selectCache.cacheItem)
|
||||
|
||||
@@ -18,9 +18,9 @@ function starParams(id: string, type: StarrableItem): StarParams {
|
||||
}
|
||||
|
||||
export const useStar = (id: string, type: StarrableItem) => {
|
||||
const fetchAlbum = useStore(store => store.fetchLibraryAlbum)
|
||||
const fetchArtist = useStore(store => store.fetchLibraryArtist)
|
||||
const fetchSong = useStore(store => store.fetchLibrarySong)
|
||||
const fetchAlbum = useStore(store => store.fetchAlbum)
|
||||
const fetchArtist = useStore(store => store.fetchArtist)
|
||||
const fetchSong = useStore(store => store.fetchSong)
|
||||
|
||||
const _starred = useStore(
|
||||
useCallback(
|
||||
|
||||
@@ -107,8 +107,8 @@ const ArtistView = React.memo<{ id: string; title: string }>(({ id, title }) =>
|
||||
useCallback(store => (albumIds ? mapById(store.entities.albums, albumIds) : undefined), [albumIds]),
|
||||
)
|
||||
|
||||
const fetchArtist = useStore(store => store.fetchLibraryArtist)
|
||||
const fetchTopSongs = useStore(store => store.fetchLibraryArtistTopSongs)
|
||||
const fetchArtist = useStore(store => store.fetchArtist)
|
||||
const fetchTopSongs = useStore(store => store.fetchArtistTopSongs)
|
||||
|
||||
const coverLayout = useLayout()
|
||||
const headerOpacity = useSharedValue(0)
|
||||
|
||||
@@ -108,7 +108,7 @@ function useHomeStoreDeep<U>(stateSelector: StateSelector<HomeState, U>) {
|
||||
const Home = () => {
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const types = useStore(selectSettings.homeLists)
|
||||
const fetchAlbumList = useStore(store => store.fetchLibraryAlbumList)
|
||||
const fetchAlbumList = useStore(store => store.fetchAlbumList)
|
||||
const setList = useHomeStore(store => store.setList)
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
|
||||
@@ -60,7 +60,7 @@ const AlbumsList = () => {
|
||||
const filter = useStore(selectSettings.libraryAlbumFilter)
|
||||
const setFilter = useStore(selectSettings.setLibraryAlbumFilter)
|
||||
|
||||
const fetchAlbumList = useStore(store => store.fetchLibraryAlbumList)
|
||||
const fetchAlbumList = useStore(store => store.fetchAlbumList)
|
||||
const fetchPage = useCallback(
|
||||
(size: number, offset: number) => {
|
||||
let params: GetAlbumList2Params
|
||||
|
||||
@@ -20,7 +20,7 @@ const filterOptions: OptionData[] = [
|
||||
]
|
||||
|
||||
const ArtistsList = () => {
|
||||
const fetchArtists = useStore(store => store.fetchLibraryArtists)
|
||||
const fetchArtists = useStore(store => store.fetchArtists)
|
||||
const { refreshing, refresh } = useFetchList2(fetchArtists)
|
||||
const artists = useStoreDeep(store => store.entities.artists)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ const PlaylistRenderItem: React.FC<{ item: Playlist }> = ({ item }) => (
|
||||
)
|
||||
|
||||
const PlaylistsList = () => {
|
||||
const fetchPlaylists = useStore(store => store.fetchLibraryPlaylists)
|
||||
const fetchPlaylists = useStore(store => store.fetchPlaylists)
|
||||
const { refreshing, refresh } = useFetchList2(fetchPlaylists)
|
||||
const playlists = useStoreDeep(store => store.entities.playlists)
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ const Results = React.memo<{
|
||||
})
|
||||
|
||||
const Search = () => {
|
||||
const fetchSearchResults = useStore(store => store.fetchLibrarySearchResults)
|
||||
const fetchSearchResults = useStore(store => store.fetchSearchResults)
|
||||
const [results, setResults] = useState<SearchResults>({ artists: [], albums: [], songs: [] })
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const [text, setText] = useState('')
|
||||
|
||||
@@ -41,7 +41,7 @@ const SearchResultsView: React.FC<{
|
||||
type: 'album' | 'artist' | 'song'
|
||||
}> = ({ query, type }) => {
|
||||
const navigation = useNavigation()
|
||||
const fetchSearchResults = useStore(store => store.fetchLibrarySearchResults)
|
||||
const fetchSearchResults = useStore(store => store.fetchSearchResults)
|
||||
const { list, refreshing, refresh, fetchNextPage } = useFetchPaginatedList(
|
||||
useCallback(
|
||||
async (size, offset) => {
|
||||
|
||||
@@ -144,7 +144,7 @@ const PlaylistView = React.memo<{
|
||||
),
|
||||
)
|
||||
|
||||
const fetchPlaylist = useStore(store => store.fetchLibraryPlaylist)
|
||||
const fetchPlaylist = useStore(store => store.fetchPlaylist)
|
||||
|
||||
useEffect(() => {
|
||||
if (!playlist || !songs) {
|
||||
@@ -172,7 +172,7 @@ const AlbumView = React.memo<{
|
||||
),
|
||||
)
|
||||
|
||||
const fetchAlbum = useStore(store => store.fetchLibraryAlbum)
|
||||
const fetchAlbum = useStore(store => store.fetchAlbum)
|
||||
|
||||
useEffect(() => {
|
||||
if (!album || !songs) {
|
||||
|
||||
@@ -49,20 +49,20 @@ export type LibrarySlice = {
|
||||
|
||||
resetLibrary: (state?: WritableDraft<Store>) => void
|
||||
|
||||
fetchLibraryArtists: () => Promise<void>
|
||||
fetchLibraryArtist: (id: string) => Promise<void>
|
||||
fetchLibraryArtistInfo: (artistId: string) => Promise<void>
|
||||
fetchLibraryArtistTopSongs: (artistName: string) => Promise<void>
|
||||
fetchArtists: () => Promise<void>
|
||||
fetchArtist: (id: string) => Promise<void>
|
||||
fetchArtistInfo: (artistId: string) => Promise<void>
|
||||
fetchArtistTopSongs: (artistName: string) => Promise<void>
|
||||
|
||||
fetchLibraryAlbum: (id: string) => Promise<void>
|
||||
fetchAlbum: (id: string) => Promise<void>
|
||||
|
||||
fetchLibraryPlaylists: () => Promise<void>
|
||||
fetchLibraryPlaylist: (id: string) => Promise<void>
|
||||
fetchPlaylists: () => Promise<void>
|
||||
fetchPlaylist: (id: string) => Promise<void>
|
||||
|
||||
fetchLibrarySong: (id: string) => Promise<void>
|
||||
fetchSong: (id: string) => Promise<void>
|
||||
|
||||
fetchLibraryAlbumList: (params: GetAlbumList2Params) => Promise<string[]>
|
||||
fetchLibrarySearchResults: (params: Search3Params) => Promise<SearchResults>
|
||||
fetchAlbumList: (params: GetAlbumList2Params) => Promise<string[]>
|
||||
fetchSearchResults: (params: Search3Params) => Promise<SearchResults>
|
||||
star: (params: StarParams) => Promise<void>
|
||||
unstar: (params: StarParams) => Promise<void>
|
||||
|
||||
@@ -97,7 +97,7 @@ export const createLibrarySlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
})
|
||||
},
|
||||
|
||||
fetchLibraryArtists: async () => {
|
||||
fetchArtists: async () => {
|
||||
const client = get().client
|
||||
if (!client) {
|
||||
return
|
||||
@@ -121,7 +121,7 @@ export const createLibrarySlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
)
|
||||
},
|
||||
|
||||
fetchLibraryArtist: async id => {
|
||||
fetchArtist: async id => {
|
||||
const client = get().client
|
||||
if (!client) {
|
||||
return
|
||||
@@ -147,7 +147,7 @@ export const createLibrarySlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
)
|
||||
},
|
||||
|
||||
fetchLibraryArtistInfo: async id => {
|
||||
fetchArtistInfo: async id => {
|
||||
const client = get().client
|
||||
if (!client) {
|
||||
return
|
||||
@@ -169,7 +169,7 @@ export const createLibrarySlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
)
|
||||
},
|
||||
|
||||
fetchLibraryArtistTopSongs: async artistName => {
|
||||
fetchArtistTopSongs: async artistName => {
|
||||
const client = get().client
|
||||
if (!client) {
|
||||
return
|
||||
@@ -195,7 +195,7 @@ export const createLibrarySlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
)
|
||||
},
|
||||
|
||||
fetchLibraryAlbum: async id => {
|
||||
fetchAlbum: async id => {
|
||||
const client = get().client
|
||||
if (!client) {
|
||||
return
|
||||
@@ -223,7 +223,7 @@ export const createLibrarySlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
)
|
||||
},
|
||||
|
||||
fetchLibraryPlaylists: async () => {
|
||||
fetchPlaylists: async () => {
|
||||
const client = get().client
|
||||
if (!client) {
|
||||
return
|
||||
@@ -247,7 +247,7 @@ export const createLibrarySlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
)
|
||||
},
|
||||
|
||||
fetchLibraryPlaylist: async id => {
|
||||
fetchPlaylist: async id => {
|
||||
const client = get().client
|
||||
if (!client) {
|
||||
return
|
||||
@@ -275,7 +275,7 @@ export const createLibrarySlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
)
|
||||
},
|
||||
|
||||
fetchLibrarySong: async id => {
|
||||
fetchSong: async id => {
|
||||
const client = get().client
|
||||
if (!client) {
|
||||
return
|
||||
@@ -299,7 +299,7 @@ export const createLibrarySlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
)
|
||||
},
|
||||
|
||||
fetchLibraryAlbumList: async params => {
|
||||
fetchAlbumList: async params => {
|
||||
const client = get().client
|
||||
if (!client) {
|
||||
return []
|
||||
@@ -324,7 +324,7 @@ export const createLibrarySlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
return mapId(albums)
|
||||
},
|
||||
|
||||
fetchLibrarySearchResults: async params => {
|
||||
fetchSearchResults: async params => {
|
||||
const empty = { artists: [], albums: [], songs: [] }
|
||||
|
||||
const client = get().client
|
||||
|
||||
Reference in New Issue
Block a user