Disable unused columns by server type

This commit is contained in:
jeffvli
2021-12-13 14:47:24 -08:00
committed by Jeff
parent bba8b8504e
commit ff95a6c37c
7 changed files with 48 additions and 3 deletions

View File

@@ -257,6 +257,9 @@ const AlbumList = () => {
value={album.active.filter}
groupBy="role"
data={sortTypes}
disabledItemValues={
config.serverType === Server.Jellyfin ? ['frequent', 'recent'] : []
}
cleanable={false}
placeholder="Sort Type"
onChange={async (value: string) => {
@@ -317,6 +320,9 @@ const AlbumList = () => {
sortColumns={sortColumns}
sortColumn={album.advancedFilters.properties.sort.column}
sortType={album.advancedFilters.properties.sort.type}
disabledItemValues={
config.serverType === Server.Jellyfin ? ['playCount', 'userRating'] : []
}
clearSortType={() =>
dispatch(
setAdvancedFilters({

View File

@@ -161,6 +161,9 @@ const ArtistList = () => {
sortColumns={sortColumns}
sortColumn={artist.active.list.sort.column}
sortType={artist.active.list.sort.type}
disabledItemValues={
config.serverType === Server.Jellyfin ? ['albumCount', 'userRating'] : ['duration']
}
clearSortType={() =>
dispatch(
setSort({

View File

@@ -28,7 +28,7 @@ import {
} from '../../redux/multiSelectSlice';
import { apiController } from '../../api/controller';
import useColumnSort from '../../hooks/useColumnSort';
import { Item } from '../../types';
import { Item, Server } from '../../types';
import { setSort } from '../../redux/playlistSlice';
import ColumnSortPopover from '../shared/ColumnSortPopover';
@@ -124,6 +124,9 @@ const PlaylistList = () => {
sortColumns={sortColumns}
sortColumn={playlist.active.list.sort.column}
sortType={playlist.active.list.sort.type}
disabledItemValues={
config.serverType === Server.Jellyfin ? ['changed', 'owner', 'public'] : []
}
clearSortType={() =>
dispatch(
setSort({

View File

@@ -51,7 +51,13 @@ const columnSelectorColumns = [
},
];
const ListViewConfig = ({ defaultColumns, columnPicker, columnList, settingsConfig }: any) => {
const ListViewConfig = ({
defaultColumns,
columnPicker,
columnList,
settingsConfig,
disabledItemValues,
}: any) => {
const dispatch = useAppDispatch();
const playQueue = useAppSelector((state) => state.playQueue);
const multiSelect = useAppSelector((state) => state.multiSelect);
@@ -112,6 +118,7 @@ const ListViewConfig = ({ defaultColumns, columnPicker, columnList, settingsConf
data={columnPicker}
defaultValue={defaultColumns}
value={selectedColumns}
disabledItemValues={disabledItemValues}
style={{ width: '100%' }}
onChange={(e: any) => {
const columns: any[] = [];

View File

@@ -37,6 +37,7 @@ import {
setGridCardSize,
setGridGapSize,
} from '../../../redux/configSlice';
import { Server } from '../../../types';
export const ListViewConfigPanel = ({ bordered }: any) => {
const dispatch = useAppDispatch();
@@ -84,6 +85,7 @@ export const ListViewConfigPanel = ({ bordered }: any) => {
rowHeight: 'musicListRowHeight',
fontSize: 'musicListFontSize',
}}
disabledItemValues={config.serverType === Server.Jellyfin ? ['Path'] : []}
/>
)}
@@ -98,6 +100,7 @@ export const ListViewConfigPanel = ({ bordered }: any) => {
rowHeight: 'albumListRowHeight',
fontSize: 'albumListFontSize',
}}
disabledItemValues={config.serverType === Server.Jellyfin ? ['Rating'] : []}
/>
)}
@@ -112,6 +115,11 @@ export const ListViewConfigPanel = ({ bordered }: any) => {
rowHeight: 'playlistListRowHeight',
fontSize: 'playlistListFontSize',
}}
disabledItemValues={
config.serverType === Server.Jellyfin
? ['Modified', 'Owner', 'Track Count', 'Visibility']
: []
}
/>
)}
@@ -126,6 +134,9 @@ export const ListViewConfigPanel = ({ bordered }: any) => {
rowHeight: 'artistListRowHeight',
fontSize: 'artistListFontSize',
}}
disabledItemValues={
config.serverType === Server.Jellyfin ? ['Album Count', 'Rating'] : ['Duration']
}
/>
)}
@@ -140,6 +151,9 @@ export const ListViewConfigPanel = ({ bordered }: any) => {
rowHeight: 'genreListRowHeight',
fontSize: 'genreListFontSize',
}}
disabledItemValues={
config.serverType === Server.Jellyfin ? ['Album Count', 'Track Count'] : []
}
/>
)}
@@ -154,6 +168,7 @@ export const ListViewConfigPanel = ({ bordered }: any) => {
rowHeight: 'miniListRowHeight',
fontSize: 'miniListFontSize',
}}
disabledItemValues={config.serverType === Server.Jellyfin ? ['Path'] : []}
/>
)}

View File

@@ -10,6 +10,7 @@ const ColumnSort = ({
setSortType,
setSortColumn,
clearSortType,
disabledItemValues,
}: any) => {
const sortFilterPickerContainerRef = useRef<any>();
@@ -42,6 +43,7 @@ const ColumnSort = ({
value={sortColumn}
labelKey="label"
valueKey="dataKey"
disabledItemValues={disabledItemValues}
virtualized
cleanable={false}
style={{ width: '250px' }}

View File

@@ -28,7 +28,7 @@ import { setActive, setSort } from '../../redux/favoriteSlice';
import { apiController } from '../../api/controller';
import { setPlaylistRate } from '../../redux/playlistSlice';
import useColumnSort from '../../hooks/useColumnSort';
import { Item } from '../../types';
import { Item, Server } from '../../types';
import { FilterButton } from '../shared/ToolbarButtons';
import ColumnSortPopover from '../shared/ColumnSortPopover';
@@ -199,6 +199,15 @@ const StarredView = () => {
? favorite.active.album.sort.type
: favorite.active.artist.sort.type
}
disabledItemValues={
config.serverType === Server.Jellyfin
? favorite.active.tab === 'albums'
? ['playCount', 'userRating']
: ['albumCount', 'userRating']
: favorite.active.tab === 'albums'
? []
: ['duration']
}
clearSortType={() =>
dispatch(
setSort({