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