mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-22 10:26:33 +02:00
add additional album group metadata rows
This commit is contained in:
@@ -76,6 +76,17 @@ const HomeItemSchema = z.enum([
|
||||
'recentlyReleased',
|
||||
]);
|
||||
|
||||
const AlbumGroupItemSchema = z.enum([
|
||||
'albumArtists',
|
||||
'duration',
|
||||
'genres',
|
||||
'releaseDate',
|
||||
'releaseYear',
|
||||
'releaseType',
|
||||
'size',
|
||||
'songCount',
|
||||
]);
|
||||
|
||||
const PlayerItemSchema = z.enum([
|
||||
'bit_depth',
|
||||
'bit_rate',
|
||||
@@ -475,6 +486,8 @@ export const GeneralSettingsSchema = z.object({
|
||||
albumBackground: z.boolean(),
|
||||
albumBackgroundBlur: z.number(),
|
||||
albumGroupImageSize: z.number(),
|
||||
albumGroupItems: z.array(SortableItemSchema(AlbumGroupItemSchema)),
|
||||
albumGroupShowFavoriteRating: z.boolean(),
|
||||
artistBackground: z.boolean(),
|
||||
artistBackgroundBlur: z.number(),
|
||||
artistItems: z.array(SortableItemSchema(ArtistItemSchema)),
|
||||
@@ -767,6 +780,17 @@ export const SettingsStateSchema = ValidationSettingsStateSchema.merge(
|
||||
NonValidatedSettingsStateSchema,
|
||||
);
|
||||
|
||||
export enum AlbumGroupItem {
|
||||
ALBUM_ARTISTS = 'albumArtists',
|
||||
DURATION = 'duration',
|
||||
GENRES = 'genres',
|
||||
RELEASE_DATE = 'releaseDate',
|
||||
RELEASE_TYPE = 'releaseType',
|
||||
RELEASE_YEAR = 'releaseYear',
|
||||
SIZE = 'size',
|
||||
SONG_COUNT = 'songCount',
|
||||
}
|
||||
|
||||
export enum ArtistItem {
|
||||
BIOGRAPHY = 'biography',
|
||||
FAVORITE_SONGS = 'favoriteSongs',
|
||||
@@ -944,6 +968,7 @@ export interface SettingsSlice extends z.infer<typeof SettingsStateSchema> {
|
||||
removeCollection: (id: string) => void;
|
||||
reset: () => void;
|
||||
resetSampleRate: () => void;
|
||||
setAlbumGroupItems: (items: SortableItem<AlbumGroupItem>[]) => void;
|
||||
setArtistItems: (item: SortableItem<ArtistItem>[]) => void;
|
||||
setArtistReleaseTypeItems: (item: SortableItem<ArtistReleaseTypeItem>[]) => void;
|
||||
setGenreBehavior: (target: GenreTarget) => void;
|
||||
@@ -1120,6 +1145,17 @@ const artistReleaseTypeItems = Object.values(ArtistReleaseTypeItem).map((item) =
|
||||
id: item,
|
||||
}));
|
||||
|
||||
const albumGroupItems: SortableItem<AlbumGroupItem>[] = [
|
||||
{ disabled: false, id: AlbumGroupItem.ALBUM_ARTISTS },
|
||||
{ disabled: true, id: AlbumGroupItem.RELEASE_DATE },
|
||||
{ disabled: true, id: AlbumGroupItem.RELEASE_YEAR },
|
||||
{ disabled: true, id: AlbumGroupItem.SONG_COUNT },
|
||||
{ disabled: true, id: AlbumGroupItem.DURATION },
|
||||
{ disabled: true, id: AlbumGroupItem.RELEASE_TYPE },
|
||||
{ disabled: true, id: AlbumGroupItem.GENRES },
|
||||
{ disabled: true, id: AlbumGroupItem.SIZE },
|
||||
];
|
||||
|
||||
// Determines the default/initial windowBarStyle value based on the current platform.
|
||||
const getPlatformDefaultWindowBarStyle = (): Platform => {
|
||||
if (utils?.isWindows()) {
|
||||
@@ -1173,6 +1209,8 @@ const initialState: SettingsState = {
|
||||
albumBackground: false,
|
||||
albumBackgroundBlur: 3,
|
||||
albumGroupImageSize: 0,
|
||||
albumGroupItems,
|
||||
albumGroupShowFavoriteRating: true,
|
||||
artistBackground: true,
|
||||
artistBackgroundBlur: 3,
|
||||
artistItems,
|
||||
@@ -2063,6 +2101,11 @@ export const useSettingsStore = createWithEqualityFn<SettingsSlice>()(
|
||||
state.playback.mpvProperties.audioSampleRateHz = 0;
|
||||
});
|
||||
},
|
||||
setAlbumGroupItems: (items: SortableItem<AlbumGroupItem>[]) => {
|
||||
set((state) => {
|
||||
state.general.albumGroupItems = items;
|
||||
});
|
||||
},
|
||||
setArtistItems: (items) => {
|
||||
set((state) => {
|
||||
state.general.artistItems = items;
|
||||
@@ -2681,6 +2724,9 @@ export const useImageRes = () => useSettingsStore((state) => state.general.image
|
||||
export const useAlbumGroupImageSize = () =>
|
||||
useSettingsStore((state) => state.general.albumGroupImageSize);
|
||||
|
||||
export const useAlbumGroupShowFavoriteRating = () =>
|
||||
useSettingsStore((state) => state.general.albumGroupShowFavoriteRating);
|
||||
|
||||
export const useVolumeWidth = () => useSettingsStore((state) => state.general.volumeWidth, shallow);
|
||||
|
||||
export const useFollowCurrentSong = () =>
|
||||
@@ -2800,6 +2846,9 @@ export const useHomeFeatureStyle = () =>
|
||||
|
||||
export const useHomeItems = () => useSettingsStore((state) => state.general.homeItems, shallow);
|
||||
|
||||
export const useAlbumGroupItems = () =>
|
||||
useSettingsStore((state) => state.general.albumGroupItems, shallow);
|
||||
|
||||
export const useArtistItems = () => useSettingsStore((state) => state.general.artistItems, shallow);
|
||||
|
||||
export const useArtistReleaseTypeItems = () =>
|
||||
|
||||
Reference in New Issue
Block a user