Skip to content

Commit

Permalink
hide author column if there is only 1 author in the list
Browse files Browse the repository at this point in the history
  • Loading branch information
3ll3d00d committed May 21, 2023
1 parent 617a09f commit d146f0f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ui/src/components/main/Catalogue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const Catalogue = ({entries, setSelectedEntryId, selectedEntryId, useWide, hasMu
// console.debug(`numerator: ${window.innerHeight} - ${upperNavHeight} - ${bottomNavHeight} = ${window.innerHeight - upperNavHeight - bottomNavHeight}`);
// console.debug(`denominator: ${halfHeight ? 2 : 1}`);
// console.debug(`Grid Height: ${gridHeight}`);
const authors = new Set(entries.map(e => e.author));
const grid =
<Grid item style={{
height: `${gridHeight}px`,
Expand All @@ -109,7 +110,7 @@ const Catalogue = ({entries, setSelectedEntryId, selectedEntryId, useWide, hasMu
density={'compact'}
initialState={{sorting: {sortModel: [{field: 'sortTitle', sort: 'asc'}]}}}
onRowSelectionModelChange={e => setSelectedEntryId(e[0])}
columnVisibilityModel={{sortTitle: false, edition: useWide}}
columnVisibilityModel={{sortTitle: false, edition: useWide, author: authors.size > 1}}
sx={{p: 0, '& .avatar': { paddingLeft: '0px', paddingRight: '0px' }}}
disableColumnMenu={true}
getCellClassName={(params) => params.field === 'author' ? 'avatar' : ''}
Expand Down

0 comments on commit d146f0f

Please sign in to comment.