Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site Editor: Update template details browse label #42350

Merged
merged 1 commit into from
Jul 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions packages/edit-site/src/components/template-details/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**
* WordPress dependencies
*/
import { useMemo } from '@wordpress/element';
import { sprintf, __ } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import {
Button,
MenuGroup,
Expand All @@ -17,10 +16,6 @@ import { store as editorStore } from '@wordpress/editor';
* Internal dependencies
*/
import isTemplateRevertable from '../../utils/is-template-revertable';
import {
MENU_TEMPLATES,
TEMPLATE_PARTS_SUB_MENUS,
} from '../navigation-sidebar/navigation-panel/constants';
import { store as editSiteStore } from '../../store';
import TemplateAreas from './template-areas';
import EditTemplateTitle from './edit-template-title';
Expand All @@ -34,16 +29,6 @@ export default function TemplateDetails( { template, onClose } ) {
);
const { revertTemplate } = useDispatch( editSiteStore );

const templateSubMenu = useMemo( () => {
if ( template?.type === 'wp_template' ) {
return { title: __( 'templates' ), menu: MENU_TEMPLATES };
}

return TEMPLATE_PARTS_SUB_MENUS.find(
( { area } ) => area === template?.area
);
}, [ template ] );

const browseAllLinkProps = useLink( {
// TODO: We should update this to filter by template part's areas as well.
postType: template.type,
Expand Down Expand Up @@ -106,11 +91,9 @@ export default function TemplateDetails( { template, onClose } ) {
className="edit-site-template-details__show-all-button"
{ ...browseAllLinkProps }
>
{ sprintf(
/* translators: the template part's area name ("Headers", "Sidebars") or "templates". */
__( 'Browse all %s' ),
templateSubMenu.title
) }
{ template?.type === 'wp_template'
? __( 'Browse all templates' )
: __( 'Browse all template parts' ) }
</Button>
</div>
);
Expand Down