fix: say what an empty folder list or a finished task is on the widgets #52

Folder counts showed only its "Folders" heading when there was no
folder to list, which looks broken; it now says there are no folders to
show. A finished task past its due date still read "Overdue" on the
Tasks widget; it shows its date instead.
This commit is contained in:
Linus Rath
2026-10-02 13:04:01 +02:00
parent ee20f9a06d
commit 80b57161ca
3 changed files with 11 additions and 1 deletions
+1
View File
@@ -1282,6 +1282,7 @@
"in_outbox_short": "{count} waiting",
"inbox": "Inbox",
"more_unread": "+{count} more unread",
"no_folders": "No folders to show",
"no_starred": "No starred mail",
"no_starred_body": "Star a message to keep it here.",
"no_subject": "(no subject)",
+7
View File
@@ -250,6 +250,13 @@ export const FolderCountsLayout: Layout = ({ s, p, f, height }) => {
const count = role === 'drafts' ? folder.total : folder.unread;
rows.push({ role, name: folder.name, count, strong: role !== 'drafts' && folder.unread > 0 });
}
if (rows.length === 0) {
return (
<Surface p={p}>
<Placeholder p={p} iconName="inbox" title={f.t('widgets.mail.no_folders', 'No folders to show')} click={open(links.inbox())} />
</Surface>
);
}
const fit = Math.max(1, Math.floor((height - 40) / 31));
const colors: Record<FolderCount['role'], string> = {
inbox: p.folder.inbox,
+3 -1
View File
@@ -206,7 +206,9 @@ export function TaskRow({
now: number;
last?: boolean;
}) {
const kind = dueKind(task, now);
// A finished task is not overdue: it shows its date.
const due = dueKind(task, now);
const kind = task.done && due === 'overdue' ? 'later' : due;
const dueColor = task.done
? p.muted
: kind === 'overdue'