-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Improved post preview design #22113
Open
sanne-san
wants to merge
7
commits into
main
Choose a base branch
from
updated-post-preview
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Improved post preview design #22113
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b433f65
Improved post preview design
sanne-san 0445b04
Updated email preview tab in post preview
sanne-san 0aa3385
Updated publish and update modals
sanne-san 59a38a6
Added tooltip component for shortcuts
sanne-san 2c5400c
Added label to Send test email button
sanne-san 28de394
Updated post-preview dark mode styles
sanne-san 0850756
Moved share actions into dropdown
sanne-san 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 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 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,29 +1,118 @@ | ||
<div class="flex flex-column h-100"> | ||
<div class="gh-post-preview-modal"> | ||
<header class="modal-header gh-post-preview-header" data-test-modal="preview-email"> | ||
<div class="left"> | ||
<button class="gh-btn-editor gh-editor-back-button" title="Close" type="button" {{on "click" @close}}> | ||
<span>{{svg-jar "arrow-left"}} Editor</span> | ||
</button> | ||
<h2>Preview</h2> | ||
</div> | ||
<div class="gh-post-preview-btn-group"> | ||
<div class="gh-contentfilter gh-btn-group"> | ||
<button type="button" class="gh-btn {{if (eq this.tab "browser") "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "browser")}}><span>{{svg-jar "desktop"}}</span></button> | ||
<button type="button" class="gh-btn {{if (eq this.tab "mobile") "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "mobile")}}><span>{{svg-jar "mobile-phone"}}</span></button> | ||
<button type="button" class="gh-btn gh-post-preview-mode {{if (or (eq this.tab "browser") (eq this.tab "mobile")) "gh-btn-group-selected"}}" {{on "click" (fn this.changeTab "browser")}}><span>Web</span></button> | ||
{{#if (and (not-eq this.settings.membersSignupAccess "none") (not-eq this.settings.editorDefaultEmailRecipients "disabled"))}} | ||
{{#if (and @data.publishOptions.post.isPost (not @data.publishOptions.user.isContributor))}} | ||
<button type="button" class="gh-btn {{if (eq this.tab "email") "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "email")}} data-test-button="email-preview"><span>{{svg-jar "email-unread"}}</span></button> | ||
<button type="button" class="gh-btn {{if (eq this.tab "email") "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "email")}} data-test-button="email-preview"><span>Email</span></button> | ||
{{/if}} | ||
{{/if}} | ||
<button type="button" class="gh-btn {{if (eq this.tab "social") "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "social")}}><span>{{svg-jar "facebook-logo"}}</span></button> | ||
</div> | ||
<div class="gh-contentfilter-divider"></div> | ||
<div class="gh-contentfilter gh-btn-group"> | ||
<button type="button" class="gh-btn {{if (or (eq this.tab "browser") (eq this.tab "email")) "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "browser")}}><span>{{svg-jar "laptop"}}</span></button> | ||
<button type="button" class="gh-btn {{if (eq this.tab "mobile") "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "mobile")}}><span>{{svg-jar "mobile-phone"}}</span></button> | ||
</div> | ||
<div class="gh-contentfilter-divider"></div> | ||
<span class="gh-select gh-web-preview-segment"> | ||
<PowerSelect | ||
@selected={{hash value="free" label="Free member"}} | ||
@options={{if (eq this.tab "email") | ||
(array | ||
(hash value="free" label="Free member") | ||
(hash value="paid" label="Paid member") | ||
) | ||
(array | ||
(hash value="anonymous" label="Anonymous") | ||
(hash value="free" label="Free member") | ||
(hash value="paid" label="Paid member") | ||
) | ||
}} | ||
@onChange={{this.noop}} | ||
@triggerComponent={{component "gh-power-select/trigger"}} | ||
@triggerClass="gh-preview-segment-trigger" | ||
@dropdownClass="gh-preview-segment-dropdown" | ||
as |option| | ||
> | ||
{{option.label}} | ||
</PowerSelect> | ||
</span> | ||
</div> | ||
<div class="right"> | ||
{{#if (eq this.tab "email")}} | ||
<div class="gh-post-test-email-group"> | ||
<GhDropdownButton | ||
@dropdownName="post-preview-test-email" | ||
@classNames="gh-btn gh-post-preview-email-trigger" | ||
data-test-button="post-preview-test-email" | ||
> | ||
<span>{{svg-jar "send-email"}}</span> | ||
</GhDropdownButton> | ||
<GhDropdown | ||
@name="post-preview-test-email" | ||
@classNames="dropdown-menu gh-post-preview-email-test-dropdown" | ||
@onOpen={{this.focusInput}} | ||
> | ||
<div class="gh-post-preview-email-test"> | ||
<form class="form-group"> | ||
<label for="post-preview-email-input">Send test email</label> | ||
<Input | ||
@value={{this.previewEmailAddress}} | ||
class="gh-input gh-input-x gh-post-preview-email-input" | ||
placeholder="[email protected]" | ||
aria-label="Email address to receive preview" | ||
aria-invalid={{if this.sendPreviewEmailError "true"}} | ||
aria-describedby={{if this.sendPreviewEmailError "sendError"}} | ||
data-post-preview-email-input | ||
autofocus="true" | ||
{{on-key "Enter" (perform this.sendPreviewEmailTask)}} | ||
/> | ||
<p class="description">You'll receive this as a free member.</p> | ||
<GhTaskButton | ||
@task={{this.sendPreviewEmailTask}} | ||
@buttonText="Send" | ||
@successText="Sent" | ||
@runningText="Sending..." | ||
@class="gh-btn gh-btn-icon gh-btn-primary" | ||
data-test-button="send-test-email" | ||
/> | ||
</form> | ||
</div> | ||
|
||
{{#if this.sendPreviewEmailError}} | ||
<div class="gh-post-preview-email-error"> | ||
<span class="response" id="sendError">{{this.sendPreviewEmailError}}</span> | ||
</div> | ||
{{/if}} | ||
</GhDropdown> | ||
</div> | ||
{{else}} | ||
<button type="button" {{on "click" (perform this.copyPreviewUrl)}} class="gh-btn gh-post-preview-url gh-tooltip-trigger tooltip-bottom no-shortcut"> | ||
<span> | ||
{{#if this.copyPreviewUrl.isRunning}} | ||
{{svg-jar "check-circle" class="check v-mid mr1 ml2"}} Copied | ||
{{else}} | ||
{{svg-jar "link"}} | ||
{{/if}} | ||
</span> | ||
<GhTooltip @text="Copy preview link" /> | ||
</button> | ||
<a href={{@post.previewUrl}} target="_blank" rel="noopener noreferrer" class="gh-btn gh-publish-preview-newtab gh-tooltip-trigger tooltip-bottom no-shortcut"> | ||
<span>{{svg-jar "external"}}</span> | ||
<GhTooltip @text="Open in new tab" /> | ||
</a> | ||
{{/if}} | ||
<div class="gh-contentfilter-divider"></div> | ||
<button | ||
type="button" | ||
class="gh-btn gh-btn-editor gh-editor-preview-trigger active" | ||
{{on "click" @close}} | ||
> | ||
<span>Preview</span> | ||
<span>Close</span> | ||
</button> | ||
|
||
{{#if @data.publishOptions.user.isContributor}} | ||
|
@@ -36,14 +125,12 @@ | |
{{else}} | ||
<button | ||
type="button" | ||
class="gh-btn gh-btn-editor darkgrey gh-publish-trigger" | ||
class="gh-btn gh-btn-primary" | ||
{{on "click" @data.togglePreviewPublish}} | ||
> | ||
<span>Publish</span> | ||
</button> | ||
{{/if}} | ||
|
||
<div class="settings-menu-toggle-spacer"></div> | ||
</div> | ||
</header> | ||
|
||
|
@@ -74,12 +161,5 @@ | |
/> | ||
{{/if}} | ||
{{/unless}} | ||
|
||
{{#if (eq this.tab "social")}} | ||
<Editor::Modals::Preview::Social | ||
@post={{@data.publishOptions.post}} | ||
@skipAnimation={{this.skipAnimation}} | ||
/> | ||
{{/if}} | ||
{{/if}} | ||
</div> |
This file contains 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
25 changes: 0 additions & 25 deletions
25
ghost/admin/app/components/editor/modals/preview/browser.hbs
This file contains 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 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 |
---|---|---|
|
@@ -3,17 +3,16 @@ | |
<div class="gh-post-preview-email-header"> | ||
<div class="gh-post-preview-email-columns"> | ||
<div class="gh-post-preview-email-group"> | ||
<div class="gh-email-preview-newsletter-select" data-test-email-preview-newsletter-select-section> | ||
<p>From:</p> | ||
<form class="gh-email-preview-newsletter-select" data-test-email-preview-newsletter-select-section> | ||
<label for="email-preview-newsletter-select">From</label> | ||
{{#if (gt this.newslettersList.length 1)}} | ||
<PowerSelect | ||
@selected={{this.newsletter}} | ||
@options={{this.newslettersList}} | ||
@onChange={{this.setNewsletter}} | ||
@triggerComponent={{component "gh-power-select/trigger"}} | ||
@triggerClass="gh-preview-newsletter-trigger" | ||
@dropdownClass="gh-publish-newsletter-dropdown gh-preview-newsletter-dropdown" | ||
@extra={{concat "<" (sender-email-address this.newsletter.senderEmail) ">"}} | ||
@triggerClass="gh-preview-newsletter-trigger gh-input-x" | ||
@dropdownClass="gh-dropdown-x gh-publish-newsletter-dropdown gh-preview-newsletter-dropdown" | ||
@selectedItemComponent={{component "editor/modals/preview/selected-newsletter-label"}} | ||
data-test-email-preview-newsletter-select | ||
as |option| | ||
|
@@ -24,80 +23,19 @@ | |
<p class="gh-preview-newsletter-name">{{this.newsletter.name}} <span | ||
class="gh-preview-email-address"><{{sender-email-address this.newsletter.senderEmail}}></span></p> | ||
{{/if}} | ||
</div> | ||
<div class="gh-email-preview-newsletter-select" data-test-email-preview-segment-select-section> | ||
<p>To:</p> | ||
{{#if this.paidMembersEnabled}} | ||
<PowerSelect | ||
@selected={{this.selectedSegment}} | ||
@options={{this.segments}} | ||
@onChange={{this.setSegment}} | ||
@triggerComponent={{component "gh-power-select/trigger"}} | ||
@triggerClass="gh-preview-newsletter-trigger" | ||
@dropdownClass="gh-publish-newsletter-dropdown gh-preview-newsletter-dropdown" | ||
data-test-email-preview-segment-select | ||
as |option| | ||
> | ||
<span>{{option.name}}</span> | ||
</PowerSelect> | ||
{{else}} | ||
<p class="gh-preview-newsletter-name">Jamie Larson <span class="gh-preview-email-address"><[email protected]></span> | ||
</p> | ||
{{/if}} | ||
</div> | ||
</div> | ||
|
||
<div class="gh-post-test-email-group"> | ||
<GhDropdownButton | ||
@dropdownName="post-preview-test-email" | ||
@classNames="gh-btn gh-btn-text gh-btn-icon gh-post-preview-email-trigger" | ||
data-test-button="post-preview-test-email" | ||
> | ||
<span>Send test email {{svg-jar "arrow-down-small"}}</span> | ||
</GhDropdownButton> | ||
|
||
<GhDropdown | ||
@name="post-preview-test-email" | ||
@classNames="dropdown-menu dropdown-align-right gh-post-preview-email-test-dropdown" | ||
> | ||
<div class="gh-post-preview-email-test"> | ||
<Input | ||
@value={{this.previewEmailAddress}} | ||
class="gh-input gh-post-preview-email-input" | ||
placeholder="[email protected]" | ||
aria-label="Email address to receive preview" | ||
aria-invalid={{if this.sendPreviewEmailError "true"}} | ||
aria-describedby={{if this.sendPreviewEmailError "sendError"}} | ||
data-post-preview-email-input | ||
{{on-key "Enter" (perform this.sendPreviewEmailTask)}} | ||
/> | ||
|
||
<GhTaskButton | ||
@task={{this.sendPreviewEmailTask}} | ||
@buttonText="Send" | ||
@successText="Sent" | ||
@runningText="Sending..." | ||
@class="gh-btn gh-btn-icon gh-btn-primary" | ||
data-test-button="send-test-email" | ||
/> | ||
</div> | ||
|
||
{{#if this.sendPreviewEmailError}} | ||
<div class="gh-post-preview-email-error"> | ||
<span class="response" id="sendError">{{this.sendPreviewEmailError}}</span> | ||
</div> | ||
{{/if}} | ||
</GhDropdown> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
<div class="gh-email-preview-newsletter-select" data-test-email-preview-segment-select-section> | ||
<p>Subject:</p> | ||
<hr> | ||
|
||
<form class="gh-email-preview-newsletter-select" data-test-email-preview-segment-select-section> | ||
<label for="email-preview-newsletter-select">Subject</label> | ||
<Editor::Modals::Preview::Email::EmailSubject | ||
@post={{@post}} | ||
@savePostTask={{@savePostTask}} | ||
/> | ||
</div> | ||
</form> | ||
</div> | ||
<iframe class="gh-pe-iframe" {{did-insert this.renderEmailPreview}} title="Email preview" | ||
sandbox="allow-same-origin allow-popups allow-popups-to-escape-sandbox"></iframe> | ||
|
25 changes: 9 additions & 16 deletions
25
ghost/admin/app/components/editor/modals/preview/email/email-subject.hbs
This file contains 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.
💡 Verification agent
🧩 Analysis chain
Verify error handling in email preview.
The email preview form includes error handling but ensure:
🏁 Script executed:
Length of output: 2959
Email Preview Error Handling Verification
ghost/admin/app/components/editor/modals/preview.hbs
properly renders the error state via thesendPreviewEmailError
property.sendPreviewEmailTask
inemail.js
uses a try-catch block to capture errors and assigns the error message tosendPreviewEmailError
, ensuring that network issues are communicated.