feishin/src/renderer/types.ts

188 lines
3.9 KiB
TypeScript
Raw Normal View History

2023-07-16 13:30:28 -07:00
import {
Album,
AlbumArtist,
Artist,
LibraryItem,
Playlist,
QueueSong,
Song,
} from '/@/renderer/api/types';
2022-12-19 15:59:14 -08:00
import { AppRoute } from '/@/renderer/router/routes';
2022-12-27 13:13:12 -08:00
export type TablePagination = {
2023-07-01 19:10:05 -07:00
currentPage: number;
itemsPerPage: number;
totalItems: number;
totalPages: number;
2022-12-27 13:13:12 -08:00
};
2022-12-19 15:59:14 -08:00
export type RouteSlug = {
2023-07-01 19:10:05 -07:00
idProperty: string;
slugProperty: string;
2022-12-19 15:59:14 -08:00
};
export type CardRoute = {
2023-07-01 19:10:05 -07:00
route: AppRoute | string;
slugs?: RouteSlug[];
2022-12-19 15:59:14 -08:00
};
export type TableType = 'nowPlaying' | 'sideQueue' | 'sideDrawerQueue' | 'songs' | 'fullScreen';
2022-12-19 15:59:14 -08:00
export type CardRow<T> = {
2023-07-01 19:10:05 -07:00
arrayProperty?: string;
property: keyof T;
route?: CardRoute;
2022-12-19 15:59:14 -08:00
};
export enum ListDisplayType {
2023-07-01 19:10:05 -07:00
CARD = 'card',
POSTER = 'poster',
TABLE = 'table',
TABLE_PAGINATED = 'paginatedTable',
2022-12-19 15:59:14 -08:00
}
export enum Platform {
2023-07-01 19:10:05 -07:00
LINUX = 'linux',
MACOS = 'macos',
WEB = 'web',
WINDOWS = 'windows',
2022-12-19 15:59:14 -08:00
}
export enum ServerType {
2023-07-01 19:10:05 -07:00
JELLYFIN = 'jellyfin',
NAVIDROME = 'navidrome',
SUBSONIC = 'subsonic',
2022-12-19 15:59:14 -08:00
}
export type ServerListItem = {
2023-07-01 19:10:05 -07:00
credential: string;
id: string;
name: string;
ndCredential?: string;
savePassword?: boolean;
type: ServerType;
url: string;
userId: string | null;
username: string;
2022-12-19 15:59:14 -08:00
};
export enum PlayerStatus {
2023-07-01 19:10:05 -07:00
PAUSED = 'paused',
PLAYING = 'playing',
2022-12-19 15:59:14 -08:00
}
export enum PlayerRepeat {
2023-07-01 19:10:05 -07:00
ALL = 'all',
NONE = 'none',
ONE = 'one',
2022-12-19 15:59:14 -08:00
}
export enum PlayerShuffle {
2023-07-01 19:10:05 -07:00
ALBUM = 'album',
NONE = 'none',
TRACK = 'track',
2022-12-19 15:59:14 -08:00
}
export enum Play {
2023-07-01 19:10:05 -07:00
LAST = 'last',
NEXT = 'next',
NOW = 'now',
2022-12-19 15:59:14 -08:00
}
export enum CrossfadeStyle {
2023-07-01 19:10:05 -07:00
CONSTANT_POWER = 'constantPower',
CONSTANT_POWER_SLOW_CUT = 'constantPowerSlowCut',
CONSTANT_POWER_SLOW_FADE = 'constantPowerSlowFade',
DIPPED = 'dipped',
EQUALPOWER = 'equalPower',
LINEAR = 'linear',
2022-12-19 15:59:14 -08:00
}
export enum PlaybackStyle {
2023-07-01 19:10:05 -07:00
CROSSFADE = 'crossfade',
GAPLESS = 'gapless',
2022-12-19 15:59:14 -08:00
}
export enum PlaybackType {
2023-07-01 19:10:05 -07:00
LOCAL = 'local',
WEB = 'web',
2022-12-19 15:59:14 -08:00
}
export interface UniqueId {
2023-07-01 19:10:05 -07:00
uniqueId: string;
2022-12-19 15:59:14 -08:00
}
export type QueryBuilderRule = {
2023-07-01 19:10:05 -07:00
field?: string | null;
operator?: string | null;
uniqueId: string;
value?: string | number | Date | undefined | null | any;
2022-12-19 15:59:14 -08:00
};
export type QueryBuilderGroup = {
2023-07-01 19:10:05 -07:00
group: QueryBuilderGroup[];
rules: QueryBuilderRule[];
type: 'any' | 'all';
uniqueId: string;
2022-12-19 15:59:14 -08:00
};
export enum TableColumn {
2023-07-01 19:10:05 -07:00
ALBUM = 'album',
ALBUM_ARTIST = 'albumArtist',
ALBUM_COUNT = 'albumCount',
ARTIST = 'artist',
BIOGRAPHY = 'biography',
BIT_RATE = 'bitRate',
BPM = 'bpm',
CHANNELS = 'channels',
COMMENT = 'comment',
DATE_ADDED = 'dateAdded',
DISC_NUMBER = 'discNumber',
DURATION = 'duration',
GENRE = 'genre',
LAST_PLAYED = 'lastPlayedAt',
OWNER = 'username',
PATH = 'path',
PLAY_COUNT = 'playCount',
RELEASE_DATE = 'releaseDate',
ROW_INDEX = 'rowIndex',
SIZE = 'size',
SKIP = 'skip',
SONG_COUNT = 'songCount',
TITLE = 'title',
TITLE_COMBINED = 'titleCombined',
TRACK_NUMBER = 'trackNumber',
USER_FAVORITE = 'userFavorite',
USER_RATING = 'userRating',
YEAR = 'releaseYear',
2022-12-19 15:59:14 -08:00
}
export type PlayQueueAddOptions = {
2023-07-01 19:10:05 -07:00
byData?: QueueSong[];
byItemType?: {
id: string[];
type: LibraryItem;
};
initialIndex?: number;
initialSongId?: string;
playType: Play;
query?: Record<string, any>;
2022-12-19 15:59:14 -08:00
};
export type GridCardData = {
2023-07-01 19:10:05 -07:00
cardControls: any;
2023-07-16 13:30:28 -07:00
cardRows: CardRow<Album | AlbumArtist | Artist | Playlist | Song>[];
2023-07-01 19:10:05 -07:00
columnCount: number;
display: ListDisplayType;
handleFavorite: (options: { id: string[]; isFavorite: boolean; itemType: LibraryItem }) => void;
handlePlayQueueAdd: (options: PlayQueueAddOptions) => void;
itemCount: number;
itemData: any[];
itemGap: number;
itemHeight: number;
itemType: LibraryItem;
itemWidth: number;
playButtonBehavior: Play;
route: CardRoute;
2022-12-19 15:59:14 -08:00
};