Skip to content

Commit

Permalink
partial feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Dec 4, 2023
1 parent 43c3d85 commit 6c28d98
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const trashPostAction = {
variant="primary"
onClick={ async () => {
try {
await Promise.all(
await Promise.allSettled(
posts.map( async ( post ) => {
deleteEntityRecord(
'postType',
Expand Down
4 changes: 2 additions & 2 deletions packages/edit-site/src/components/dataviews/dataviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function DataViews( {
supportedLayouts,
selection,
setSelection,
getSelectionLabel,
labels,
} ) {
const ViewComponent = VIEW_LAYOUTS.find(
( v ) => v.type === view.type
Expand Down Expand Up @@ -78,7 +78,7 @@ export default function DataViews( {
isLoading={ isLoading }
selection={ selection }
setSelection={ setSelection }
getSelectionLabel={ getSelectionLabel }
labels={ labels }
/>

<div>
Expand Down
13 changes: 7 additions & 6 deletions packages/edit-site/src/components/dataviews/view-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function ViewTable( {
paginationInfo,
selection,
setSelection,
getSelectionLabel,
labels,
} ) {
const areAllSelected = selection && selection.length === data.length;
const columns = useMemo( () => {
Expand Down Expand Up @@ -288,13 +288,14 @@ function ViewTable( {
//console.log({ props });
const item = props.row.original;
const isSelected = selection.includes( item.id );
//console.log({ item, isSelected });
let selectionLabel;
if ( getSelectionLabel ) {
selectionLabel = getSelectionLabel( isSelected, item );
if ( isSelected ) {
selectionLabel = labels?.getDeselectLabel
? labels?.getDeselectLabel( item )
: __( 'Deselect item' );
} else {
selectionLabel = isSelected
? __( 'Deselect item' )
selectionLabel = labels?.getSelectLabel
? labels?.getSelectLabel( item )
: __( 'Select a new item' );
}
return (
Expand Down
29 changes: 16 additions & 13 deletions packages/edit-site/src/components/page-pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,19 +334,22 @@ export default function PagePages() {
onChangeView={ onChangeView }
selection={ selection }
setSelection={ setSelection }
getSelectionLabel={ ( isSelected, item ) =>
isSelected
? sprintf(
// translators: %s: The title of the page.
__( 'Deselect page: %s' ),
item.title?.rendered || item.slug
)
: sprintf(
// translators: %s: The title of the page.
__( 'Select page: %s' ),
item.title?.rendered || item.slug
)
}
labels={ {
getSelectLabel: ( item ) => {
return sprintf(
// translators: %s: The title of the page.
__( 'Select page: %s' ),
item.title?.rendered || item.slug
);
},
getDeselectLabel: ( item ) => {
return sprintf(
// translators: %s: The title of the page.
__( 'Deselect page: %s' ),
item.title?.rendered || item.slug
);
},
} }
/>
</Page>
{ VIEW_LAYOUTS.find( ( v ) => v.type === view.type )?.supports
Expand Down

0 comments on commit 6c28d98

Please sign in to comment.