Updated email recipient filter design

Refs https://github.com/TryGhost/Team/issues/1544
This commit is contained in:
Sanne de Vries 2022-05-12 12:56:43 +01:00
parent 4c0c5dcac6
commit f6b06ef9bf
5 changed files with 193 additions and 115 deletions

View File

@ -40,7 +40,9 @@
{{svg-jar "member"}} {{svg-jar "member"}}
<div class="gh-publish-setting-trigger"> <div class="gh-publish-setting-trigger">
{{#let (members-count-fetcher query=(hash filter=@publishOptions.fullRecipientFilter)) as |countFetcher|}} {{#let (members-count-fetcher query=(hash filter=@publishOptions.fullRecipientFilter)) as |countFetcher|}}
{{if (eq @recipientType "all") "All"}} {{#if (gt countFetcher.count 1)}}
{{if (eq @recipientType "all") "All"}}
{{/if}}
{{countFetcher.count}} {{countFetcher.count}}
@ -48,7 +50,7 @@
{{if (not-eq @recipientType "all") @recipientType}} {{if (not-eq @recipientType "all") @recipientType}}
{{#if @publishOptions.onlyDefaultNewsletter}} {{#if @publishOptions.onlyDefaultNewsletter}}
{{gh-pluralize countFetcher.count "member" without-count=true}} {{gh-pluralize countFetcher.count "subscriber" without-count=true}}
{{else}} {{else}}
{{gh-pluralize countFetcher.count "subscriber" without-count=true}} {{gh-pluralize countFetcher.count "subscriber" without-count=true}}
of <span class="gh-selected-newsletter">{{@publishOptions.newsletter.name}}</span> of <span class="gh-selected-newsletter">{{@publishOptions.newsletter.name}}</span>
@ -66,7 +68,7 @@
> >
{{svg-jar "member"}} {{svg-jar "member"}}
<div class="gh-publish-setting-trigger"> <div class="gh-publish-setting-trigger">
Not sent to any members Not sent as newsletter
</div> </div>
<span> <span>
{{svg-jar "arrow-down" class="icon-expand"}} {{svg-jar "arrow-down" class="icon-expand"}}

View File

@ -1,6 +1,15 @@
<div class="form-group max-width mb0"> <div class="form-group max-width mb0">
<GhMembersRecipientSelect
@filter={{@publishOptions.recipientFilter}}
@newsletter={{@publishOptions.newsletter}}
@onChange={{@publishOptions.setRecipientFilter}}
@renderInPlace={{false}}
@dropdownClass="gh-publish-newsletter-dropdown"
/>
{{#if (gt @publishOptions.newsletters.length 1)}} {{#if (gt @publishOptions.newsletters.length 1)}}
<div class="mb4"> <div class="mt4">
<label class="gh-main-section-header small bn">Newsletter</label>
<PowerSelect <PowerSelect
@selected={{@publishOptions.newsletter}} @selected={{@publishOptions.newsletter}}
@options={{@publishOptions.newsletters}} @options={{@publishOptions.newsletters}}
@ -14,12 +23,4 @@
</PowerSelect> </PowerSelect>
</div> </div>
{{/if}} {{/if}}
<GhMembersRecipientSelect
@filter={{@publishOptions.recipientFilter}}
@newsletter={{@publishOptions.newsletter}}
@onChange={{@publishOptions.setRecipientFilter}}
@renderInPlace={{false}}
@dropdownClass="gh-publishmenu-newsletter-dropdown"
/>
</div> </div>

View File

@ -1,89 +1,97 @@
<div class="gh-publishmenu-send-to-option"> <div class="gh-publish-send-to">
<p> <div class="gh-publish-send-to-option">
Free subscribers <div class="for-checkbox {{if @disabled "disabled"}}">
{{#let (members-count-fetcher query=(hash filter=(concat @newsletter.recipientFilter "+status:free"))) as |countFetcher|}} <label class="checkbox" for="send-email-to-free">
{{#if (not (is-empty countFetcher.count))}}
<span class="gh-publishmenu-emailcount" data-test-email-count="free-members">({{countFetcher.count}})</span>
{{/if}}
{{/let}}
</p>
<div class="for-switch small {{if @disabled "disabled"}}">
<label class="switch" for="send-email-to-free">
<input
id="send-email-to-free"
type="checkbox"
class="gh-input post-settings-featured"
checked={{this.isFreeChecked}}
disabled={{@disabled}}
aria-label="Free members toggle"
{{on "change" (fn this.toggleFilter "status:free")}}
data-test-checkbox="free-members"
>
<span class="input-toggle-component"></span>
</label>
</div>
</div>
{{#if this.isPaidAvailable}}
<div class="gh-publishmenu-send-to-option">
<p>
Paid subscribers
{{#let (members-count-fetcher query=(hash filter=(concat @newsletter.recipientFilter "+status:-free"))) as |countFetcher|}}
{{#if (not (is-empty countFetcher.count))}}
<span class="gh-publishmenu-emailcount" data-test-email-count="paid-members">({{countFetcher.count}})</span>
{{/if}}
{{/let}}
</p>
<div class="for-switch small {{if @disabled "disabled"}}">
<label class="switch" for="send-email-to-paid">
<input <input
id="send-email-to-paid" id="send-email-to-free"
type="checkbox" type="checkbox"
class="gh-input post-settings-featured" class="gh-input post-settings-featured"
checked={{this.isPaidChecked}} checked={{this.isFreeChecked}}
disabled={{@disabled}} disabled={{@disabled}}
aria-label="Paid members toggle" aria-label="Free members toggle"
{{on "change" (fn this.toggleFilter "status:-free")}} {{on "change" (fn this.toggleFilter "status:free")}}
data-test-checkbox="paid-members" data-test-checkbox="free-members"
> >
<span class="input-toggle-component"></span> <div class="flex">
<span class="input-toggle-component"></span>
<p>
Free
{{#let (members-count-fetcher query=(hash filter=(concat @newsletter.recipientFilter "+status:free"))) as |countFetcher|}}
{{#if (not (is-empty countFetcher.count))}}
<span class="gh-publish-emailcount" data-test-email-count="free-members">({{countFetcher.count}})</span>
{{/if}}
{{/let}}
</p>
</div>
</label> </label>
</div> </div>
</div> </div>
{{/if}} {{#if this.isPaidAvailable}}
{{#if this.specificOptions}} <div class="gh-publish-send-to-option">
<div class="gh-publishmenu-send-to-option"> <div class="for-checkbox {{if @disabled "disabled"}}">
<p>Specific people</p> <label class="checkbox" for="send-email-to-paid">
<div class="for-switch small {{if @disabled "disabled"}}"> <input
<label class="switch" for="send-email-to-specific"> id="send-email-to-paid"
<input type="checkbox"
id="send-email-to-specific" class="gh-input post-settings-featured"
type="checkbox" checked={{this.isPaidChecked}}
class="gh-input post-settings-featured" disabled={{@disabled}}
checked={{this.isSpecificChecked}} aria-label="Paid members toggle"
disabled={{@disabled}} {{on "change" (fn this.toggleFilter "status:-free")}}
aria-label="Specific people toggle" data-test-checkbox="paid-members"
{{on "change" this.toggleSpecificFilter}} >
data-test-checkbox="paid-members" <div class="flex">
> <span class="input-toggle-component"></span>
<span class="input-toggle-component"></span> <p>
</label> Paid
{{#let (members-count-fetcher query=(hash filter=(concat @newsletter.recipientFilter "+status:-free"))) as |countFetcher|}}
{{#if (not (is-empty countFetcher.count))}}
<span class="gh-publish-emailcount" data-test-email-count="paid-members">({{countFetcher.count}})</span>
{{/if}}
{{/let}}
</p>
</div>
</label>
</div>
</div> </div>
</div>
{{#if this.isSpecificChecked}}
<GhTokenInput
@class="select-members select-members-recipient"
@dropdownClass={{@dropdownClass}}
@options={{this.specificOptions}}
@selected={{this.selectedSpecificOptions}}
@disabled={{@disabled}}
@searchMessage="All labels selected"
@optionsComponent="power-select/options"
@allowCreation={{false}}
@renderInPlace={{this.renderInPlace}}
@onChange={{this.selectSpecificOptions}}
as |option|
>
{{option.name}}
</GhTokenInput>
{{/if}} {{/if}}
{{/if}} {{#if this.specificOptions}}
<div class="gh-publish-send-to-option">
<div class="for-checkbox {{if @disabled "disabled"}}">
<label class="checkbox" for="send-email-to-specific">
<input
id="send-email-to-specific"
type="checkbox"
class="gh-input post-settings-featured"
checked={{this.isSpecificChecked}}
disabled={{@disabled}}
aria-label="Specific people toggle"
{{on "change" this.toggleSpecificFilter}}
data-test-checkbox="paid-members"
>
<div class="flex">
<span class="input-toggle-component"></span>
<p>Other</p>
</div>
</label>
</div>
</div>
{{#if this.isSpecificChecked}}
<GhTokenInput
@class="select-members select-members-recipient"
@dropdownClass={{@dropdownClass}}
@options={{this.specificOptions}}
@selected={{this.selectedSpecificOptions}}
@disabled={{@disabled}}
@searchMessage="All labels selected"
@optionsComponent="power-select/options"
@allowCreation={{false}}
@renderInPlace={{this.renderInPlace}}
@onChange={{this.selectSpecificOptions}}
as |option|
>
{{option.name}}
</GhTokenInput>
{{/if}}
{{/if}}
</div>

View File

@ -329,32 +329,91 @@
color: var(--midgrey); color: var(--midgrey);
} }
.gh-publishmenu-send-to-option { .gh-publish-send-to {
display: flex;
height: 38px;
}
.gh-publish-send-to-option {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; height: 40px;
margin-bottom: 8px; margin-right: 1.2rem;
} }
.gh-publishmenu-send-to-option p { .gh-publish-send-to-option p {
margin: 0; margin: 0;
color: var(--darkgrey); color: var(--darkgrey);
font-size: 1.45rem; font-size: 1.4rem;
font-weight: 400; font-weight: 500;
letter-spacing: .4px;
line-height: 36px;
white-space: nowrap;
} }
.gh-publishmenu-send-to-option .for-switch { .gh-publish-send-to-option .for-checkbox {
line-height: 1; height: 40px;
position: relative;
} }
.gh-publishmenu-send-to-option .for-switch label { .gh-publish-send-to-option .for-checkbox .input-toggle-component {
position: absolute;
top: calc(50%-9px);
left: 14px;
margin: 0; margin: 0;
width: 38px !important; border-color: var(--white);
height: 22px !important; background: var(--white);
} }
.gh-publishmenu-emailcount { .gh-publish-send-to-option label p {
color: var(--midlightgrey); display: flex;
align-items: center;
width: 100%;
height: 38px;
padding: 0 14px 0 38px;
border: 1px solid var(--lightgrey-l1);
color: var(--middarkgrey);
font-size: 1.4rem;
font-weight: 500;
line-height: 36px;
letter-spacing: .2px;
cursor: pointer;
background: none;
overflow: unset;
border-radius: 21px;
}
.gh-publish-send-to-option .for-checkbox input:checked + .flex p {
padding: 0 13px 0 37px;
border: 2px solid var(--black);
background: var(--whitegrey-l2);
color: var(--black);
line-height: 34px;
}
.gh-publish-send-to-option .for-checkbox input:checked + .flex .input-toggle-component {
border: 1px solid var(--white);
background: var(--white);
}
.gh-publish-send-to-option .for-checkbox .input-toggle-component::before {
opacity: 1 !important;
border-color: var(--midlightgrey);
}
.gh-publish-send-to-option .for-checkbox input:checked + .flex .input-toggle-component::before {
opacity: 1;
border-color: var(--black);
}
.gh-publish-send-to .ember-power-select-multiple-trigger {
flex-grow: 1;
padding: 3px;
}
.gh-publish-emailcount {
margin-left: 4px;
font-size: 1.3rem;
} }
.gh-publishmenu-checkbox-disabled { .gh-publishmenu-checkbox-disabled {
@ -381,11 +440,11 @@
right: 10px; right: 10px;
} }
.gh-publishmenu-newsletter-dropdown { .gh-publish-newsletter-dropdown {
z-index: 99999; z-index: 99999;
} }
.gh-publishmenu-newsletter-dropdown .ember-power-select-option[aria-selected="true"] { .gh-publish-newsletter-dropdown .ember-power-select-option[aria-selected="true"] {
color: var(--black); color: var(--black);
font-weight: 600; font-weight: 600;
} }
@ -572,14 +631,22 @@
} }
.gh-publish-newsletter-trigger { .gh-publish-newsletter-trigger {
margin-top: 2px;
padding: 8px 16px; padding: 8px 16px;
font-size: 1.45rem; font-size: 1.4rem;
line-height: 1.65;
} }
.gh-publish-newsletter-trigger svg { .gh-publish-newsletter-trigger svg {
position: absolute; position: absolute;
top: 50%; top: 50%;
right: 16px; right: 16px;
transform: scaleX(1.1);
}
.gh-publish-newsletter-trigger svg path {
stroke: var(--midlightgrey) !important;
stroke-width: 4;
} }
.gh-publish-newsletter-dropdown { .gh-publish-newsletter-dropdown {
@ -611,15 +678,15 @@
.gh-publish-types label, .gh-publish-types label,
.gh-publish-schedule label { .gh-publish-schedule label {
display: block; display: block;
height: 40px; height: 38px;
margin-right: 1.2rem; margin-right: 1.2rem;
padding: 0 20px; padding: 0 18px;
border: 1px solid var(--lightgrey-l1); border: 1px solid var(--lightgrey-l1);
color: var(--middarkgrey); color: var(--middarkgrey);
font-size: 1.4rem; font-size: 1.4rem;
font-weight: 500; font-weight: 500;
line-height: 38px; line-height: 36px;
letter-spacing: .4px; letter-spacing: .2px;
cursor: pointer; cursor: pointer;
background: none; background: none;
border-radius: 21px; border-radius: 21px;
@ -627,10 +694,10 @@
.gh-publish-types .gh-radio-button:checked + label, .gh-publish-types .gh-radio-button:checked + label,
.gh-publish-schedule .gh-radio.active label { .gh-publish-schedule .gh-radio.active label {
padding: 0 19px; padding: 0 17px;
border: 2px solid var(--black); border: 2px solid var(--black);
color: var(--black); color: var(--black);
line-height: 36px; line-height: 34px;
background: var(--whitegrey-l2); background: var(--whitegrey-l2);
} }
@ -656,7 +723,7 @@
} }
.gh-publish-setting-form .gh-date-time-picker-date { .gh-publish-setting-form .gh-date-time-picker-date {
height: 40px; height: 38px;
margin: 0; margin: 0;
padding: 8px 12px; padding: 8px 12px;
font-size: 1.4rem; font-size: 1.4rem;

View File

@ -6,7 +6,7 @@
as |editor| as |editor|
> >
<header class="gh-editor-header br2 pe-none"> <header class="gh-editor-header br2 pe-none">
<div class="flex items-center pe-auto"> <div class="flex items-center pe-auto h-100">
{{#if this.ui.isFullScreen}} {{#if this.ui.isFullScreen}}
<div class="ml3 mobile flex items-center"> <div class="ml3 mobile flex items-center">
<LinkTo @route={{pluralize this.post.displayName }} class="gh-editor-back-button" data-test-link={{pluralize this.post.displayName}}> <LinkTo @route={{pluralize this.post.displayName }} class="gh-editor-back-button" data-test-link={{pluralize this.post.displayName}}>