-
Notifications
You must be signed in to change notification settings - Fork 6
Check for version control, display notice #145
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a light refactor to pass in versionControl
and themeName
as props, this component could be a good candidate for moving to common
if we do something like #141.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…into try/check-for-version-control
Cool, looking at this now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mike-day,
Really nice work, the notice works well, and you figured out how to test a filesystem lookup! 🚀
Some suggestions below to make this even simpler.
wp-modules/app/js/src/components/VersionControlNotice/index.tsx
Outdated
Show resolved
Hide resolved
Also, maybe the message:
…could also mention what it means for the user, that their patterns will be deleted if they update the theme. |
@kienstra UX helped tweak this message for the changes applied in 1463614! |
wp-modules/app/js/src/components/VersionControlNotice/index.tsx
Outdated
Show resolved
Hide resolved
wp-modules/app/js/src/components/VersionControlNotice/index.tsx
Outdated
Show resolved
Hide resolved
* @param string $version_control The version control directory to check. | ||
* @return boolean | ||
*/ | ||
function check_version_control_notice_should_show( $theme_name, $version_control = '/.git' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea for this, it's a very flat function.
This is your best PR yet. Very clean functions that are well tested. And data separate from presentation in the notice component. |
Thanks for your kind words, and thanks for the help with this PR as always, @kienstra! |
Of course! Great work on this. |
This PR adds a dismissible notice in
App
if a.git
folder is not found in the currently active theme directory:Initial spike questions:
Should the notice be dismissible? If so, should the dismissed state persist for a given theme?-> both items doneShould the notice should also be shown in-> notice only shown inEditor
?App
Should-> not for this version.svn
or.hg
be included in the check?What helper guide should the helper link point to?-> deferredNote about helper link deferral
While it would be a good idea to add a link to a basic guide for using git with a WordPress theme, finding a place to host that article will hold up the merging of this PR. A helper can link can be added in the future.
To-do
VersionControlNotice
stringsget-version-control
wp-moduleHow to test
.git
folder in the directory