Skip to content

Commit

Permalink
Data views: Update template actions (#60075)
Browse files Browse the repository at this point in the history
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
  • Loading branch information
4 people authored Mar 22, 2024
1 parent df274b3 commit 1955260
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* WordPress dependencies
*/
import { backup, trash } from '@wordpress/icons';
import { __, sprintf, _n } from '@wordpress/i18n';
import { useDispatch } from '@wordpress/data';
import { useMemo, useState } from '@wordpress/element';
Expand Down Expand Up @@ -33,9 +32,7 @@ export function useResetTemplateAction() {
return useMemo(
() => ( {
id: 'reset-template',
label: __( 'Reset' ),
isPrimary: true,
icon: backup,
label: __( 'Clear customizations' ),
isEligible: isTemplateRevertable,
supportsBulk: true,
async callback( templates ) {
Expand Down Expand Up @@ -112,8 +109,6 @@ export function useResetTemplateAction() {
export const deleteTemplateAction = {
id: 'delete-template',
label: __( 'Delete' ),
isPrimary: true,
icon: trash,
isEligible: isTemplateRemovable,
supportsBulk: true,
hideModalHeader: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
deleteTemplateAction,
renameTemplateAction,
} from './actions';
import { postRevisionsAction } from '../actions';
import { postRevisionsAction, useEditPostAction } from '../actions';
import usePatternSettings from '../page-patterns/use-pattern-settings';
import { unlock } from '../../lock-unlock';
import AddNewTemplatePart from './add-new-template-part';
Expand Down Expand Up @@ -339,8 +339,10 @@ export default function PageTemplatesTemplateParts( { postType } ) {
}, [ records, view, fields ] );

const resetTemplateAction = useResetTemplateAction();
const editTemplateAction = useEditPostAction();
const actions = useMemo(
() => [
editTemplateAction,
resetTemplateAction,
renameTemplateAction,
postRevisionsAction,
Expand Down

0 comments on commit 1955260

Please sign in to comment.