Skip to content

Commit

Permalink
Revert "Remove short descriptions"
Browse files Browse the repository at this point in the history
This reverts commit 7eb06e8ab845b9cda3975989456614df5b221c29.
  • Loading branch information
jameskoster authored and ntsekouras committed Jun 23, 2023
1 parent 36f3a3b commit 63018ee
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@wordpress/components';
import { decodeEntities } from '@wordpress/html-entities';
import { useState } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import {
archive,
Expand Down Expand Up @@ -162,6 +162,25 @@ export default function NewTemplate( {
useDispatch( noticesStore );
const { setTemplate } = unlock( useDispatch( editSiteStore ) );

const { homeUrl } = useSelect( ( select ) => {
const {
getUnstableBase, // Site index.
} = select( coreStore );

return {
homeUrl: getUnstableBase()?.home,
};
}, [] );

const TEMPLATE_SHORT_DESCRIPTIONS = {
'front-page': homeUrl,
date: sprintf(
// translators: %s: The homepage url.
__( 'E.g. %s' ),
homeUrl + '/' + new Date().getFullYear()
),
};

async function createTemplate( template, isWPSuggestion = true ) {
if ( isCreatingTemplate ) {
return;
Expand Down Expand Up @@ -291,6 +310,9 @@ export default function NewTemplate( {
title={ title }
direction="column"
className="edit-site-add-new-template__template-button"
description={
TEMPLATE_SHORT_DESCRIPTIONS[ slug ]
}
icon={
TEMPLATE_ICONS[ slug ] || layout
}
Expand Down

0 comments on commit 63018ee

Please sign in to comment.