-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mail: Msg list: Folder header and footer, to show login button, msg c…
…ount, and star/unread filters
- Loading branch information
1 parent
c014ea2
commit b9ef294
Showing
4 changed files
with
190 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,130 @@ | ||
<!-- Appears below the msg list --> | ||
{#if folder} | ||
<hbox class="folder-header"> | ||
<hbox class="buttons"> | ||
{#if $account?.isLoggedIn} | ||
<GetMailButton {folder} /> | ||
{/if} | ||
<hbox class="star button" class:starred={isShowStarred}> | ||
<Button | ||
icon={StarIcon} | ||
iconSize="16px" | ||
iconOnly | ||
label={$t`Show only starred messages`} | ||
onClick={toggleStarred} | ||
plain | ||
/> | ||
</hbox> | ||
<hbox class="unread-dot button" class:unread={isShowUnread}> | ||
<Button | ||
icon={CircleIcon} | ||
iconSize="7px" | ||
iconOnly | ||
label={$t`Show only unread messages`} | ||
onClick={toggleUnread} | ||
plain | ||
/> | ||
</hbox> | ||
</hbox> | ||
<hbox flex /> | ||
<hbox class="msg-count"> | ||
{#if searchMessages} | ||
{#if $searchMessages.hasItems} | ||
{$t`${$searchMessages.length} search results`} | ||
{:else} | ||
{$t`No search results`} | ||
{/if} | ||
{:else} | ||
{#if $folder.countTotal > 0} | ||
{$t`${$folder.countNewArrived} new, | ||
${$folder.countUnread} unread, | ||
${$folder.countTotal} total`} | ||
{/if} | ||
{#if $folder.countTotal > 0 && $folder.countTotal != $messages.length} | ||
{#if $messages.length == 0} | ||
{$t`Loading...`} | ||
{:else} | ||
{$t`${$messages.length} displayed.`} | ||
{/if} | ||
{/if} | ||
{/if} | ||
</hbox> | ||
<hbox flex /> | ||
</hbox> | ||
{/if} | ||
|
||
<script lang="ts"> | ||
import type { Folder } from '../../../logic/Mail/Folder'; | ||
import type { EMail } from '../../../logic/Mail/EMail'; | ||
import { newSearchEMail } from '../../../logic/Mail/Store/setStorage'; | ||
import GetMailButton from './GetMailButton.svelte'; | ||
import Button from '../../Shared/Button.svelte'; | ||
import StarIcon from "lucide-svelte/icons/star"; | ||
import CircleIcon from "lucide-svelte/icons/circle"; | ||
import type { ArrayColl } from 'svelte-collections'; | ||
import { t } from '../../../l10n/l10n'; | ||
export let folder: Folder; | ||
export let searchMessages: ArrayColl<EMail> | null; /** out */ | ||
$: account = folder?.account; | ||
$: messages = folder?.messages; | ||
let isShowStarred = false; | ||
async function toggleStarred() { | ||
isShowStarred = !isShowStarred; | ||
await startSearch(); | ||
} | ||
let isShowUnread = false; | ||
async function toggleUnread() { | ||
isShowUnread = !isShowUnread; | ||
await startSearch(); | ||
} | ||
async function startSearch() { | ||
if (!isShowStarred && !isShowUnread) { | ||
searchMessages = null; | ||
return; | ||
} | ||
let search = newSearchEMail(); | ||
if (isShowStarred) { // undefined != false | ||
search.isStarred = true; | ||
} | ||
if (isShowUnread) { | ||
search.isRead = false; | ||
} | ||
search.folder = folder; | ||
searchMessages = await search.startSearch(); | ||
} | ||
</script> | ||
|
||
<style> | ||
.folder-header { | ||
align-items: center; | ||
justify-content: center; | ||
height: 20px; | ||
font-size: 12px; | ||
padding-block-start: 2px; | ||
padding-block-end: 2px; | ||
padding-inline-start: 4px; | ||
padding-inline-end: 4px; | ||
color: var(--leftbar-fg); | ||
background-color: var(--leftbar-bg); | ||
} | ||
.folder-header :global(.get-mail button) { | ||
height: 20px; | ||
width: 20px; | ||
border: none; | ||
} | ||
.msg-count { | ||
padding-inline-start: 4px; | ||
padding-inline-end: 8px; | ||
} | ||
.star.starred :global(svg) { | ||
fill: orange; | ||
} | ||
.unread-dot.unread :global(svg) { | ||
fill: green; | ||
} | ||
</style> |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<!-- Appears above the msg list --> | ||
{#if account && !$account?.isLoggedIn || searchMessages} | ||
<hbox class="folder-header"> | ||
<hbox flex /> | ||
{#if account && !$account?.isLoggedIn} | ||
<Button plain | ||
label={$t`Login`} | ||
icon={DisconnectedIcon} | ||
onClick={login} | ||
iconSize="16px" /> | ||
{/if} | ||
{#if searchMessages} | ||
{$t(`Search results`)} | ||
{/if} | ||
<hbox flex /> | ||
</hbox> | ||
{/if} | ||
|
||
<script lang="ts"> | ||
import type { Folder } from '../../../logic/Mail/Folder'; | ||
import type { EMail } from '../../../logic/Mail/EMail'; | ||
import Button from '../../Shared/Button.svelte'; | ||
import DisconnectedIcon from "lucide-svelte/icons/unplug"; | ||
import { t } from '../../../l10n/l10n'; | ||
import type { ArrayColl } from 'svelte-collections'; | ||
export let folder: Folder; | ||
export let searchMessages: ArrayColl<EMail> | null; /** in */ | ||
$: account = folder?.account; | ||
async function login() { | ||
await account.login(true); | ||
} | ||
</script> | ||
|
||
<style> | ||
.folder-header { | ||
align-items: center; | ||
justify-content: center; | ||
padding-block-start: 2px; | ||
padding-block-end: 2px; | ||
padding-inline-start: 4px; | ||
padding-inline-end: 4px; | ||
font-size: 12px; | ||
color: var(--leftbar-fg); | ||
background-color: var(--leftbar-bg); | ||
box-shadow: 2px 0px 6px 0px rgba(0, 0, 0, 10%); | ||
} | ||
.folder-header :global(button) { | ||
margin-inline-end: 12px; | ||
} | ||
</style> |
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