1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix column visibility toggles

This commit is contained in:
Bill Thornton 2024-08-29 11:20:44 -04:00
parent bfc37b4171
commit ff18bedca7

View file

@ -82,6 +82,19 @@ const Activity = () => {
const isLoading = isUsersLoading || isLogEntriesLoading;
const userColumn: MRT_ColumnDef<ActivityLogEntry>[] = useMemo(() =>
(activityView === ActivityView.System) ? [] : [{
id: 'User',
accessorFn: row => row.UserId && users[row.UserId]?.Name,
header: globalize.translate('LabelUser'),
size: 75,
Cell: UserCell,
enableResizing: false,
muiTableBodyCellProps: {
align: 'center'
}
}], [ activityView, users, UserCell ]);
const columns = useMemo<MRT_ColumnDef<ActivityLogEntry>[]>(() => [
{
id: 'Date',
@ -100,18 +113,7 @@ const Activity = () => {
align: 'center'
}
},
{
id: 'User',
accessorFn: row => row.UserId && users[row.UserId]?.Name,
header: globalize.translate('LabelUser'),
size: 75,
Cell: UserCell,
enableResizing: false,
visibleInShowHideMenu: activityView !== ActivityView.System,
muiTableBodyCellProps: {
align: 'center'
}
},
...userColumn,
{
accessorKey: 'Name',
header: globalize.translate('LabelName'),
@ -140,7 +142,7 @@ const Activity = () => {
enableResizing: false,
enableSorting: false
}
], [ UserCell, activityView, users ]);
], [ userColumn ]);
const onViewChange = useCallback((_e: React.MouseEvent<HTMLElement, MouseEvent>, newView: ActivityView | null) => {
if (newView !== null) {
@ -183,10 +185,7 @@ const Activity = () => {
},
state: {
isLoading,
pagination,
columnVisibility: {
User: activityView !== ActivityView.System
}
pagination
},
// Server pagination