-
Notifications
You must be signed in to change notification settings - Fork 8
PRF Changes #409
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
Merged
Merged
PRF Changes #409
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
91a52f1
chore: change plugin name [ref Codeinwp/templates-cloud#91]
abaicus 32fd29b
feat: disable TC when there's no active license & at least one templa…
abaicus 2dbea87
chore: only show TPC old block and integrations on license tier 3 & …
abaicus a1361e5
Update templates-patterns-collection.php
ineagu c30a8c7
Merge branch 'development' into prf
abaicus c92d858
chore: remove stray console.log
abaicus 51d8199
fix: flagging plugin for new users happening too late
abaicus 59da57e
chore: remove the Page Templates page for all users
abaicus 3500e47
chore: add notice for old users that had TC
abaicus b1602f3
chore: run e2e dashboard spec on old legacy TC
abaicus 6c6ae5b
Merge branch 'prf' of https://github.com/Codeinwp/templates-patterns-…
abaicus dac8bf1
chore: remove e2e changes
abaicus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import {__} from '@wordpress/i18n'; | ||
| import {Button} from '@wordpress/components'; | ||
| import {close} from '@wordpress/icons'; | ||
| import {useState} from '@wordpress/element'; | ||
| import {ajaxAction} from '../utils/rest'; | ||
|
|
||
| export default function () { | ||
| const [isVisible, setIsVisible] = useState(true); | ||
|
|
||
| const { | ||
| show, | ||
| ajaxURL, | ||
| nonce | ||
| } = window.tiobDash.newTCNotice; | ||
|
|
||
| const dismissNotice = () => { | ||
| ajaxAction( | ||
| ajaxURL, | ||
| 'dismiss_new_tc_notice', | ||
| nonce | ||
| ).then( (r) => { | ||
| console.log(r); | ||
| setIsVisible(false); | ||
| } ).catch(e => { | ||
| console.error(e); | ||
| } ); | ||
| }; | ||
|
|
||
| if (!show || ! isVisible) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <div className="tiob-new-tc-notice"> | ||
| <div> | ||
| <p> | ||
| {__('We\'ve launched a dedicated Templates Cloud plugin that offers advanced permission controls and additional features. Try it out from your Themeisle account.', 'templates-patterns-collection')} | ||
| </p> | ||
|
|
||
| <p className="description"> | ||
| {__('If you already have templates saved in the cloud, you can still use them in this plugin.', 'templates-patterns-collection')} | ||
| </p> | ||
| </div> | ||
|
|
||
| <Button | ||
| size="compact" | ||
| className="dismiss" | ||
| icon={close} | ||
| iconSize={20} | ||
| label={__('Dismiss', 'templates-patterns-collection')} | ||
| onClick={dismissNotice} | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| .tiob-new-tc-notice { | ||
| padding: 10px 20px; | ||
| background: #fff; | ||
| border: 1px solid #e5e5e5; | ||
| display: flex; | ||
| margin-top: 20px; | ||
| width: 100%; | ||
| gap: 20px; | ||
| box-sizing: border-box; | ||
| align-items: center; | ||
| border-left: 5px solid var(--wp-admin-theme-color, #3858e9); | ||
|
|
||
| p { | ||
| margin: 0 0 10px; | ||
| font-size: 14px; | ||
| } | ||
|
|
||
| .description { | ||
| font-size: 12px; | ||
| margin: 0; | ||
| } | ||
|
|
||
| .dismiss { | ||
| flex-shrink: 0; | ||
| margin-left: auto; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,63 +1,61 @@ | ||
| /* global FLBuilder */ | ||
|
|
||
| if ( parseInt( window.tiTpc.tier ) === 3 ) { | ||
| const contextMenu = document.getElementById( 'tmpl-fl-row-overlay' ); | ||
|
|
||
| const tpcExport = ( e ) => { | ||
| const row = e.closest( '.fl-row' ); | ||
| const node = row.dataset.node; | ||
|
|
||
| const message = `<div class="tpc-template-cloud-export-modal"> | ||
| <h1>${ window.tiTpc.exporter.modalLabel }</h1> | ||
| <label for="tpc-${ node }">${ window.tiTpc.exporter.textLabel }</label> | ||
| <input id="tpc-${ node }" type="text" placeholder="${ window.tiTpc.exporter.textPlaceholder }" /> | ||
| </div>`; | ||
|
|
||
| FLBuilder.confirm( { | ||
| message, | ||
| ok: () => { | ||
| const input = document.getElementById( `tpc-${ node }` ); | ||
| const title = input.value || 'Template'; | ||
| setTimeout( function () { | ||
| FLBuilder.showAjaxLoader(); | ||
| FLBuilder.ajax( | ||
| { | ||
| action: 'ti_export_template', | ||
| node, | ||
| title, | ||
| }, | ||
| ( res ) => { | ||
| if ( undefined !== res.success && ! res.success ) { | ||
| FLBuilder.alert( | ||
| `<h1>${ window.tiTpc.exporter.exportFailed }</h1> ${ res.data }` | ||
| ); | ||
| } | ||
|
|
||
| FLBuilder.hideAjaxLoader(); | ||
| const contextMenu = document.getElementById( 'tmpl-fl-row-overlay' ); | ||
|
|
||
| const tpcExport = ( e ) => { | ||
| const row = e.closest( '.fl-row' ); | ||
| const node = row.dataset.node; | ||
|
|
||
| const message = `<div class="tpc-template-cloud-export-modal"> | ||
| <h1>${ window.tiTpc.exporter.modalLabel }</h1> | ||
| <label for="tpc-${ node }">${ window.tiTpc.exporter.textLabel }</label> | ||
| <input id="tpc-${ node }" type="text" placeholder="${ window.tiTpc.exporter.textPlaceholder }" /> | ||
| </div>`; | ||
|
|
||
| FLBuilder.confirm( { | ||
| message, | ||
| ok: () => { | ||
| const input = document.getElementById( `tpc-${ node }` ); | ||
| const title = input.value || 'Template'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also have this default value as a translatable string via |
||
| setTimeout( function () { | ||
| FLBuilder.showAjaxLoader(); | ||
| FLBuilder.ajax( | ||
| { | ||
| action: 'ti_export_template', | ||
| node, | ||
| title, | ||
| }, | ||
| ( res ) => { | ||
| if ( undefined !== res.success && ! res.success ) { | ||
| FLBuilder.alert( | ||
| `<h1>${ window.tiTpc.exporter.exportFailed }</h1> ${ res.data }` | ||
| ); | ||
| } | ||
| ); | ||
| }, 1000 ); | ||
| }, | ||
| strings: { | ||
| ok: window.tiTpc.exporter.buttonLabel, | ||
| cancel: window.tiTpc.exporter.cancelLabel, | ||
| }, | ||
| } ); | ||
| }; | ||
|
|
||
| window.tiTpc.tpcExport = tpcExport; | ||
|
|
||
| if ( contextMenu ) { | ||
| const text = contextMenu.textContent; | ||
| contextMenu.textContent = text.replace( | ||
| // eslint-disable-next-line prettier/prettier | ||
| '<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li>', | ||
| // eslint-disable-next-line prettier/prettier | ||
| '<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li><li><a class="fl-block-row-tpc-export" onclick="window.tiTpc.tpcExport(this)" href="javascript:void(0);">Save to Templates Cloud</a></li>' | ||
| ); | ||
| } | ||
|
|
||
| FLBuilder.addHook( 'tiTpcExport', () => { | ||
| window.tiTpc.initModalExport(); | ||
|
|
||
| FLBuilder.hideAjaxLoader(); | ||
| } | ||
| ); | ||
| }, 1000 ); | ||
| }, | ||
| strings: { | ||
| ok: window.tiTpc.exporter.buttonLabel, | ||
| cancel: window.tiTpc.exporter.cancelLabel, | ||
| }, | ||
| } ); | ||
| }; | ||
|
|
||
| window.tiTpc.tpcExport = tpcExport; | ||
|
|
||
| if ( contextMenu ) { | ||
| const text = contextMenu.textContent; | ||
| contextMenu.textContent = text.replace( | ||
| // eslint-disable-next-line prettier/prettier | ||
| '<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li>', | ||
| // eslint-disable-next-line prettier/prettier | ||
| '<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li><li><a class="fl-block-row-tpc-export" onclick="window.tiTpc.tpcExport(this)" href="javascript:void(0);">Save to Templates Cloud</a></li>' | ||
| ); | ||
| } | ||
|
|
||
| FLBuilder.addHook( 'tiTpcExport', () => { | ||
| window.tiTpc.initModalExport(); | ||
| } ); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
One small suggestion here: you can declare this as a constant outside the component with a name like
isPostTypeCompatibleto highlight the compatibility check.