Skip to content

Commit

Permalink
Improved DataViews usability: (#96465)
Browse files Browse the repository at this point in the history
- Column with min-width and fixed width
- Hide status filter by default
- Reset filter hides when necessary
  • Loading branch information
paulopmt1 authored Nov 15, 2024
1 parent cf4359b commit 5d3a768
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
20 changes: 18 additions & 2 deletions client/my-sites/plugins/plugins-list/plugins-list-dataviews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,23 @@ export default function PluginsListDataViews( {
perPage: 15,
search: initialSearch,
fields: [ 'plugins', 'sites', 'update' ],
layout: {
styles: {
plugins: {
width: '60%',
minWidth: '300px',
},
sites: {
width: '70px',
},
update: {
minWidth: '200px',
},
actions: {
width: '50px',
},
},
},
} ) );

const [ isFilteringUpdates, setIsFilteringUpdates ] = useState( false );
Expand Down Expand Up @@ -80,7 +97,6 @@ export default function PluginsListDataViews( {
</>
);

// When search changes, notify the parent component
useEffect( () => {
if ( dataViewsState.search !== initialSearch ) {
onSearch && onSearch( dataViewsState.search || '' );
Expand All @@ -91,7 +107,7 @@ export default function PluginsListDataViews( {
if (
dataViewsState.filters?.length === 1 &&
dataViewsState.filters[ 0 ].field === 'status' &&
dataViewsState.filters[ 0 ].value.includes( PLUGINS_STATUS.UPDATE )
dataViewsState.filters[ 0 ].value?.includes( PLUGINS_STATUS.UPDATE )
) {
setIsFilteringUpdates( true );
} else {
Expand Down
4 changes: 4 additions & 0 deletions client/my-sites/plugins/plugins-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ body.is-section-plugins .plugin-management-wrapper,
max-width: 35px;
max-height: 35px;
}

td:nth-child(2) {
white-space: break-spaces;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/my-sites/plugins/plugins-list/use-fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function useFields(
],
filterBy: {
operators: [ 'isAny' as Operator ],
isPrimary: true,
isPrimary: false,
},
enableHiding: false,
enableSorting: false,
Expand Down

0 comments on commit 5d3a768

Please sign in to comment.