From 400c975797e92bd5fe16a2f22faca8fdfad78505 Mon Sep 17 00:00:00 2001 From: Michael Day Date: Fri, 2 Jun 2023 09:29:37 -0500 Subject: [PATCH 1/6] Add link to helper article in version control notice --- .../components/VersionControlNotice/index.tsx | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/wp-modules/app/js/src/components/VersionControlNotice/index.tsx b/wp-modules/app/js/src/components/VersionControlNotice/index.tsx index e1212509..efce65f5 100644 --- a/wp-modules/app/js/src/components/VersionControlNotice/index.tsx +++ b/wp-modules/app/js/src/components/VersionControlNotice/index.tsx @@ -1,5 +1,6 @@ // WP dependencies import { __ } from '@wordpress/i18n'; +import { createInterpolateElement } from '@wordpress/element'; import { Notice } from '@wordpress/components'; type Props = { @@ -19,9 +20,23 @@ export default function VersionControlNotice( { status="warning" onRemove={ handleDismiss } > - { __( - 'No version control detected for this theme. We recommend adding version control so you do not lose your patterns during theme updates.', - 'pattern-manager' + { createInterpolateElement( + __( + 'No version control detected for this theme. We recommend adding version control so you do not lose your patterns during theme updates.
Learn how to set up git for your theme in .', + 'pattern-manager' + ), + { + div:
, + a: ( + + { __( 'our Git Guide', 'pattern-manager' ) } + + ), + } ) } ) : null; From 95d56e11f6b64dc8baa4fc5bfa2b945b1289e50d Mon Sep 17 00:00:00 2001 From: Jen Baumann <1271053+dreamwhisper@users.noreply.github.com> Date: Mon, 5 Jun 2023 10:46:20 -0400 Subject: [PATCH 2/6] Add tooltip to lock (#191) --- .../src/blocks/pattern-block/PatternEdit.tsx | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/wp-modules/editor/js/src/blocks/pattern-block/PatternEdit.tsx b/wp-modules/editor/js/src/blocks/pattern-block/PatternEdit.tsx index 8ca49797..33213a83 100644 --- a/wp-modules/editor/js/src/blocks/pattern-block/PatternEdit.tsx +++ b/wp-modules/editor/js/src/blocks/pattern-block/PatternEdit.tsx @@ -9,6 +9,7 @@ import { Panel, PanelBody, Placeholder, + Tooltip, } from '@wordpress/components'; import { useState } from '@wordpress/element'; import { Icon, image, lock } from '@wordpress/icons'; @@ -120,34 +121,36 @@ export default function PatternEdit( { { __( 'Replace Pattern', 'pattern-manager' ) } -
- +
-
+ > + +
+ Date: Tue, 6 Jun 2023 15:18:16 -0500 Subject: [PATCH 3/6] Open the article in a new tab --- wp-modules/app/js/src/components/VersionControlNotice/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wp-modules/app/js/src/components/VersionControlNotice/index.tsx b/wp-modules/app/js/src/components/VersionControlNotice/index.tsx index efce65f5..aa095403 100644 --- a/wp-modules/app/js/src/components/VersionControlNotice/index.tsx +++ b/wp-modules/app/js/src/components/VersionControlNotice/index.tsx @@ -32,6 +32,8 @@ export default function VersionControlNotice( { href={ 'https://developer.wpengine.com/knowledge-base/using-git-with-a-wordpress-theme/' } + target="_blank" + rel="noopener noreferrer" > { __( 'our Git Guide', 'pattern-manager' ) } From 4ac45ce92551653477782e287644140e676d6eff Mon Sep 17 00:00:00 2001 From: Michael Day Date: Tue, 6 Jun 2023 15:50:26 -0500 Subject: [PATCH 4/6] Add aria-label for the anchor tag --- wp-modules/app/js/src/components/VersionControlNotice/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/wp-modules/app/js/src/components/VersionControlNotice/index.tsx b/wp-modules/app/js/src/components/VersionControlNotice/index.tsx index aa095403..2b451783 100644 --- a/wp-modules/app/js/src/components/VersionControlNotice/index.tsx +++ b/wp-modules/app/js/src/components/VersionControlNotice/index.tsx @@ -34,6 +34,7 @@ export default function VersionControlNotice( { } target="_blank" rel="noopener noreferrer" + aria-label="Link to our Git Guide (opens in new tab)" > { __( 'our Git Guide', 'pattern-manager' ) } From da4f3075dcd30e66ab1d18bb1f5894c7db3df867 Mon Sep 17 00:00:00 2001 From: Jen Baumann <1271053+dreamwhisper@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:51:03 -0400 Subject: [PATCH 5/6] Open Git article link in new tab (#195) --- wp-modules/app/js/src/components/App/index.scss | 3 ++- .../js/src/components/VersionControlNotice/index.tsx | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/wp-modules/app/js/src/components/App/index.scss b/wp-modules/app/js/src/components/App/index.scss index 4786f82b..a3974970 100644 --- a/wp-modules/app/js/src/components/App/index.scss +++ b/wp-modules/app/js/src/components/App/index.scss @@ -140,7 +140,8 @@ html body.toplevel_page_pattern-manager { margin-right: 0; span { - font-weight: 600; + margin-left: 2px; + text-decoration: none; } } } diff --git a/wp-modules/app/js/src/components/VersionControlNotice/index.tsx b/wp-modules/app/js/src/components/VersionControlNotice/index.tsx index 2b451783..d7a3657f 100644 --- a/wp-modules/app/js/src/components/VersionControlNotice/index.tsx +++ b/wp-modules/app/js/src/components/VersionControlNotice/index.tsx @@ -1,7 +1,7 @@ // WP dependencies import { __ } from '@wordpress/i18n'; import { createInterpolateElement } from '@wordpress/element'; -import { Notice } from '@wordpress/components'; +import { Notice, Dashicon } from '@wordpress/components'; type Props = { isVisible: boolean; @@ -29,6 +29,8 @@ export default function VersionControlNotice( { div:
, a: ( { __( 'our Git Guide', 'pattern-manager' ) } + + { __( + '(opens in a new tab)', + 'pattern-manager' + ) } + + ), } From bc81bfac3a92494650a91eb520fb80e36987428f Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Tue, 13 Jun 2023 13:00:06 -0600 Subject: [PATCH 6/6] Don't tree shake in `delete_pattern()` (#196) * Don't tree shake on a simple call to delete_pattern() * Fix linting --- wp-modules/api-data/api-data.php | 3 +++ .../app/js/src/components/VersionControlNotice/index.tsx | 2 -- wp-modules/pattern-data-handlers/pattern-data-handlers.php | 5 +---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/wp-modules/api-data/api-data.php b/wp-modules/api-data/api-data.php index 9f7f14be..59a5fc17 100644 --- a/wp-modules/api-data/api-data.php +++ b/wp-modules/api-data/api-data.php @@ -15,6 +15,8 @@ use WP_REST_Response; use function \PatternManager\GetVersionControl\get_dismissed_themes; use function \PatternManager\GetVersionControl\get_version_control_meta_key; +use function \PatternManager\GetWpFilesystem\get_wp_filesystem_api; +use function PatternManager\PatternDataHandlers\tree_shake_theme_images; // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { @@ -108,6 +110,7 @@ function get_pattern_names() { */ function delete_pattern( $request ) { $is_success = \PatternManager\PatternDataHandlers\delete_pattern( $request->get_params()['patternName'] ); + tree_shake_theme_images( get_wp_filesystem_api(), 'copy_dir' ); return $is_success ? new WP_REST_Response( diff --git a/wp-modules/app/js/src/components/VersionControlNotice/index.tsx b/wp-modules/app/js/src/components/VersionControlNotice/index.tsx index d7a3657f..6bd272a1 100644 --- a/wp-modules/app/js/src/components/VersionControlNotice/index.tsx +++ b/wp-modules/app/js/src/components/VersionControlNotice/index.tsx @@ -29,8 +29,6 @@ export default function VersionControlNotice( { div:
, a: ( exists( $pattern_path ) && $wp_filesystem->delete( $pattern_path ); - tree_shake_theme_images( $wp_filesystem, 'copy_dir' ); - - return $result; + return $wp_filesystem && $wp_filesystem->exists( $pattern_path ) && $wp_filesystem->delete( $pattern_path ); } /**