diff --git a/src/renderer/features/albums/components/album-list-header-filters.tsx b/src/renderer/features/albums/components/album-list-header-filters.tsx index 4a4f591d6..b3d2c165a 100644 --- a/src/renderer/features/albums/components/album-list-header-filters.tsx +++ b/src/renderer/features/albums/components/album-list-header-filters.tsx @@ -95,7 +95,7 @@ export const AlbumListHeaderFilters = ({ toggleGenreTarget }: { toggleGenreTarge - + { const { t } = useTranslation(); const isGrid = displayType === ListDisplayType.GRID; + const isDetail = displayType === ListDisplayType.DETAIL; return ( - + {i18n.t('table.config.view.detail', { postProcess: 'sentenceCase' }) as string} ), diff --git a/src/renderer/features/shared/components/list-display-type-toggle-button.tsx b/src/renderer/features/shared/components/list-display-type-toggle-button.tsx index 80cfadb24..cd24c6c18 100644 --- a/src/renderer/features/shared/components/list-display-type-toggle-button.tsx +++ b/src/renderer/features/shared/components/list-display-type-toggle-button.tsx @@ -3,21 +3,50 @@ import { useSettingsStore, useSettingsStoreActions } from '/@/renderer/store'; import { ItemListKey, ListDisplayType } from '/@/shared/types/types'; interface ListDisplayTypeToggleButtonProps { + enableDetail?: boolean; listKey: ItemListKey; } -export const ListDisplayTypeToggleButton = ({ listKey }: ListDisplayTypeToggleButtonProps) => { +export const ListDisplayTypeToggleButton = ({ + enableDetail = false, + listKey, +}: ListDisplayTypeToggleButtonProps) => { const displayType = useSettingsStore( (state) => state.lists[listKey]?.display, ) as ListDisplayType; const { setList } = useSettingsStoreActions(); const handleToggleDisplayType = () => { - const newDisplayType = - displayType === ListDisplayType.GRID ? ListDisplayType.TABLE : ListDisplayType.GRID; + console.log('enableDetail', enableDetail); + let newDisplayType: ListDisplayType; + + if (enableDetail) { + if (displayType === ListDisplayType.DETAIL) { + newDisplayType = ListDisplayType.TABLE; + } else if (displayType === ListDisplayType.TABLE) { + newDisplayType = ListDisplayType.GRID; + } else if (displayType === ListDisplayType.GRID) { + newDisplayType = ListDisplayType.DETAIL; + } else { + newDisplayType = ListDisplayType.GRID; + } + } else { + if (displayType === ListDisplayType.GRID) { + newDisplayType = ListDisplayType.TABLE; + } else if (displayType === ListDisplayType.TABLE) { + newDisplayType = ListDisplayType.GRID; + } else { + newDisplayType = ListDisplayType.GRID; + } + } + + console.log('newDisplayType', newDisplayType); + setList(listKey, { display: newDisplayType, }); + + return; }; return ; diff --git a/src/shared/components/icon/icon.tsx b/src/shared/components/icon/icon.tsx index 4097ea999..38415a192 100644 --- a/src/shared/components/icon/icon.tsx +++ b/src/shared/components/icon/icon.tsx @@ -58,6 +58,7 @@ import { LuInfo, LuKeyboard, LuLayoutGrid, + LuLayoutList, LuLibrary, LuList, LuListFilter, @@ -186,6 +187,7 @@ export const AppIcon = { itemSong: LuMusic, keyboard: LuKeyboard, lastPlayed: LuHeadphones, + layoutDetail: LuLayoutList, layoutGrid: LuLayoutGrid, layoutList: LuList, layoutTable: LuTable,