mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 13:00:13 +02:00
Adjust album/song types
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { api } from '../lib';
|
||||
import { AlbumsResponse, BasePaginationRequest } from './types';
|
||||
import { AlbumResponse, AlbumsResponse, BasePaginationRequest } from './types';
|
||||
|
||||
export interface AlbumsRequest extends BasePaginationRequest {
|
||||
orderBy: string;
|
||||
@@ -8,7 +8,7 @@ export interface AlbumsRequest extends BasePaginationRequest {
|
||||
}
|
||||
|
||||
const getAlbum = async (params: { id: number }, signal?: AbortSignal) => {
|
||||
const { data } = await api.get<AlbumsResponse>(`/albums/${params.id}`, {
|
||||
const { data } = await api.get<AlbumResponse>(`/albums/${params.id}`, {
|
||||
signal,
|
||||
});
|
||||
return data;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { Album } from '../../types';
|
||||
|
||||
export interface BaseResponse<T> {
|
||||
data: T;
|
||||
error?: string | any;
|
||||
@@ -112,45 +114,6 @@ export type AlbumResponse = BaseResponse<Album>;
|
||||
|
||||
export type AlbumsResponse = BasePaginatedResponse<Album[]>;
|
||||
|
||||
export interface Album {
|
||||
_count: Count;
|
||||
albumArtistId: number;
|
||||
createdAt: string;
|
||||
date: string;
|
||||
genres: GenreResponse[];
|
||||
id: number;
|
||||
name: string;
|
||||
remoteCreatedAt: string;
|
||||
remoteId: string;
|
||||
serverFolderId: number;
|
||||
songs: Song[];
|
||||
updatedAt: string;
|
||||
year: number;
|
||||
}
|
||||
|
||||
export interface Song {
|
||||
album?: Partial<Album>;
|
||||
albumId: number;
|
||||
artistName: null;
|
||||
artists?: ArtistResponse[];
|
||||
bitRate: number;
|
||||
container: string;
|
||||
createdAt: string;
|
||||
date: string;
|
||||
disc: number;
|
||||
duration: number;
|
||||
externals?: ExternalResponse[];
|
||||
id: number;
|
||||
images?: ImageResponse[];
|
||||
name: string;
|
||||
remoteCreatedAt: string;
|
||||
remoteId: string;
|
||||
serverFolderId: number;
|
||||
track: number;
|
||||
updatedAt: string;
|
||||
year: number;
|
||||
}
|
||||
|
||||
export type Count = {
|
||||
artists?: number;
|
||||
externals?: number;
|
||||
|
||||
@@ -27,14 +27,14 @@ const MetadataStack = styled.div`
|
||||
|
||||
export const LeftControls = () => {
|
||||
const song = usePlayerStore((state) => state.current.song);
|
||||
const title = song?.title;
|
||||
const artists = song?.artist?.map((artist) => artist?.title).join(', ');
|
||||
const title = song?.name;
|
||||
const artists = song?.artists?.map((artist) => artist?.name).join(', ');
|
||||
const album = song?.album;
|
||||
|
||||
return (
|
||||
<LeftControlsContainer>
|
||||
<ImageWrapper>
|
||||
<img alt="img" height={60} src={song?.image} width={60} />
|
||||
<img alt="img" height={60} src={song?.imageUrl} width={60} />
|
||||
</ImageWrapper>
|
||||
<MetadataStack>
|
||||
<Text
|
||||
|
||||
@@ -56,25 +56,12 @@ export const usePlayQueueHandler = () => {
|
||||
: getSubsonicStreamUrl(auth, song, deviceId);
|
||||
|
||||
return {
|
||||
albumId: song.albumId,
|
||||
artistName: song.artistName,
|
||||
duration: song.duration,
|
||||
id: song.id,
|
||||
...song,
|
||||
streamUrl,
|
||||
title: song.name,
|
||||
year: song.year,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
albumId: song.albumId,
|
||||
artistName: song.artistName,
|
||||
duration: song.duration,
|
||||
id: song.id,
|
||||
streamUrl: song.streamUrl,
|
||||
title: song.name,
|
||||
year: song.year,
|
||||
};
|
||||
return song;
|
||||
});
|
||||
|
||||
const playerData = addToQueue(songs, options.play);
|
||||
|
||||
Reference in New Issue
Block a user