Omit email digest UI if env variable is not set.
This commit is contained in:
parent
8047a4f084
commit
a7b948740c
1 changed files with 42 additions and 39 deletions
|
|
@ -17,6 +17,7 @@
|
|||
import {Mail} from "@app/mail"
|
||||
import {notificationSettings, publishSettings, userSettingsValues} from "@app/settings"
|
||||
import {emailNotificationState} from "@app/push/adapters/common"
|
||||
import {EMAIL_NOTIFICATION_SERVER} from "@app/env"
|
||||
|
||||
const clearError = () => {
|
||||
if ($emailNotificationState.error) {
|
||||
|
|
@ -185,51 +186,53 @@
|
|||
{/snippet}
|
||||
</FieldInline>
|
||||
</div>
|
||||
<div class="card bg-surface flex flex-col gap-4 shadow-md">
|
||||
<strong class="text-lg">Email Digest Settings</strong>
|
||||
<FieldInline>
|
||||
{#snippet label()}
|
||||
<p>Receive email digest of missed activity</p>
|
||||
{/snippet}
|
||||
{#snippet input()}
|
||||
<ToggleInput bind:checked={settings.email} />
|
||||
{/snippet}
|
||||
</FieldInline>
|
||||
{#if settings.email}
|
||||
{#if EMAIL_NOTIFICATION_SERVER}
|
||||
<div class="card bg-surface flex flex-col gap-4 shadow-md">
|
||||
<strong class="text-lg">Email Digest Settings</strong>
|
||||
<FieldInline>
|
||||
{#snippet label()}
|
||||
<p>Email address</p>
|
||||
<p>Receive email digest of missed activity</p>
|
||||
{/snippet}
|
||||
{#snippet input()}
|
||||
<input
|
||||
type="email"
|
||||
class="input input-bordered w-full"
|
||||
bind:value={settings.emailAddress}
|
||||
oninput={clearError}
|
||||
placeholder="you@example.com" />
|
||||
<ToggleInput bind:checked={settings.email} />
|
||||
{/snippet}
|
||||
</FieldInline>
|
||||
<FieldInline>
|
||||
{#snippet label()}
|
||||
<p>Frequency</p>
|
||||
{/snippet}
|
||||
{#snippet input()}
|
||||
<select
|
||||
class="select select-bordered"
|
||||
bind:value={settings.emailFrequency}
|
||||
onchange={clearError}>
|
||||
<option value="daily">Daily</option>
|
||||
<option value="weekly">Weekly</option>
|
||||
</select>
|
||||
{/snippet}
|
||||
</FieldInline>
|
||||
{/if}
|
||||
{#if $emailNotificationState.error}
|
||||
<div class="text-sm text-error p-3">
|
||||
{$emailNotificationState.error}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if settings.email}
|
||||
<FieldInline>
|
||||
{#snippet label()}
|
||||
<p>Email address</p>
|
||||
{/snippet}
|
||||
{#snippet input()}
|
||||
<input
|
||||
type="email"
|
||||
class="input input-bordered w-full"
|
||||
bind:value={settings.emailAddress}
|
||||
oninput={clearError}
|
||||
placeholder="you@example.com" />
|
||||
{/snippet}
|
||||
</FieldInline>
|
||||
<FieldInline>
|
||||
{#snippet label()}
|
||||
<p>Frequency</p>
|
||||
{/snippet}
|
||||
{#snippet input()}
|
||||
<select
|
||||
class="select select-bordered"
|
||||
bind:value={settings.emailFrequency}
|
||||
onchange={clearError}>
|
||||
<option value="daily">Daily</option>
|
||||
<option value="weekly">Weekly</option>
|
||||
</select>
|
||||
{/snippet}
|
||||
</FieldInline>
|
||||
{/if}
|
||||
{#if $emailNotificationState.error}
|
||||
<div class="text-sm text-error p-3">
|
||||
{$emailNotificationState.error}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="card sticky -bottom-3 shadow-md flex flex-row items-center justify-between gap-4">
|
||||
<Button class="button button-neutral" onclick={reset} disabled={loading}
|
||||
>Discard Changes</Button>
|
||||
|
|
|
|||
Loading…
Reference in a new issue