mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
add Title (artist) column (#1496)
This commit is contained in:
@@ -1958,10 +1958,52 @@ export const useSettingsStore = createWithEqualityFn<SettingsSlice>()(
|
||||
}
|
||||
}
|
||||
|
||||
if (version <= 20) {
|
||||
// Add TITLE_ARTIST column to SONG and ALBUM table configs
|
||||
const titleArtistColumn: ItemTableListColumnConfig = {
|
||||
align: 'start',
|
||||
autoSize: false,
|
||||
id: TableColumn.TITLE_ARTIST,
|
||||
isEnabled: false,
|
||||
pinned: null,
|
||||
width: 300,
|
||||
};
|
||||
|
||||
const listKeysToUpdate: (LibraryItem | string)[] = [
|
||||
LibraryItem.SONG,
|
||||
LibraryItem.ALBUM,
|
||||
LibraryItem.PLAYLIST_SONG,
|
||||
LibraryItem.QUEUE_SONG,
|
||||
ItemListKey.ALBUM_DETAIL,
|
||||
ItemListKey.FULL_SCREEN,
|
||||
ItemListKey.SIDE_QUEUE,
|
||||
];
|
||||
|
||||
listKeysToUpdate.forEach((listKey) => {
|
||||
const listConfig = state.lists[listKey];
|
||||
if (listConfig?.table?.columns) {
|
||||
const columns = listConfig.table.columns;
|
||||
const hasTitleArtist = columns.some(
|
||||
(col) => col.id === TableColumn.TITLE_ARTIST,
|
||||
);
|
||||
if (!hasTitleArtist) {
|
||||
const titleCombinedIndex = columns.findIndex(
|
||||
(col) => col.id === TableColumn.TITLE_COMBINED,
|
||||
);
|
||||
if (titleCombinedIndex >= 0) {
|
||||
columns.splice(titleCombinedIndex + 1, 0, titleArtistColumn);
|
||||
} else {
|
||||
columns.push(titleArtistColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return persistedState;
|
||||
},
|
||||
name: 'store_settings',
|
||||
version: 20,
|
||||
version: 21,
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user