feat: add option to hide total message count on folders (#498)

This commit is contained in:
Linus Rath
2026-06-28 20:31:35 +02:00
parent 1f4afe082b
commit e141abc849
4 changed files with 18 additions and 3 deletions
+3 -2
View File
@@ -184,8 +184,9 @@ function SidebarRowCounts({
isSelected: boolean;
onUnreadClick?: () => void;
}) {
const showFolderTotalCount = useSettingsStore(s => s.showFolderTotalCount);
const unreadCount = unread ?? 0;
const totalCount = total ?? 0;
const totalCount = showFolderTotalCount ? (total ?? 0) : 0;
if (unreadCount === 0 && totalCount === 0) return null;
@@ -219,7 +220,7 @@ function SidebarRowCounts({
) : null;
return (
<span className="ml-2 flex-shrink-0 flex items-baseline gap-1" title={`${unreadCount} unread / ${totalCount} total`}>
<span className="ml-2 flex-shrink-0 flex items-baseline gap-1" title={totalCount > 0 ? `${unreadCount} unread / ${totalCount} total` : `${unreadCount} unread`}>
{unreadNode}
{unreadCount > 0 && totalCount > 0 && (
<span className="text-xs text-muted-foreground/60">/</span>
+8 -1
View File
@@ -118,7 +118,7 @@ function MailLayoutPreview({
export function LayoutSettings() {
const t = useTranslations('settings.appearance');
const tEmail = useTranslations('settings.email_behavior');
const { toolbarPosition, showToolbarLabels, hideAccountSwitcher, showRailAccountList, enableUnifiedMailbox, includeGroupInUnified, enableAllMailView, allMailFolderIds, enableCrossUnreadView, enableCrossStarredView, enableCrossAllView, colorfulSidebarIcons, mailLayout, proInterface, updateSetting } = useSettingsStore();
const { toolbarPosition, showToolbarLabels, hideAccountSwitcher, showRailAccountList, enableUnifiedMailbox, includeGroupInUnified, enableAllMailView, allMailFolderIds, enableCrossUnreadView, enableCrossStarredView, enableCrossAllView, colorfulSidebarIcons, showFolderTotalCount, mailLayout, proInterface, updateSetting } = useSettingsStore();
const { isSettingLocked, isSettingHidden, isFeatureEnabled } = usePolicyStore();
const accounts = useAccountStore(s => s.accounts);
const activeAccountId = useAccountStore(s => s.activeAccountId);
@@ -217,6 +217,13 @@ export function LayoutSettings() {
/>
</SettingItem>
<SettingItem label={t('show_folder_total_count.label')} description={t('show_folder_total_count.description')}>
<ToggleSwitch
checked={showFolderTotalCount}
onChange={(checked) => updateSetting('showFolderTotalCount', checked)}
/>
</SettingItem>
{(accounts.length > 1 || hasGroupInboxes) && !isSettingHidden('enableUnifiedMailbox') && (
<SettingItem
label={t('unified_mailbox.label')}
+4
View File
@@ -936,6 +936,10 @@
"label": "Colorful Sidebar Icons",
"description": "Tint folder and tag icons by type (blue Inbox, red Junk, green Sent, etc.). Disable for a monochrome sidebar."
},
"show_folder_total_count": {
"label": "Show Total Message Count",
"description": "Show the total message count next to folders and tags, alongside the unread count. Disable to show only unread counts."
},
"pro_interface": {
"label": "Pro Interface (Experimental)",
"description": "Desktop-only power-user layout with multi-tab message browsing and cross-account workflows. The standard interface is unaffected; you can switch back at any time.",
+3
View File
@@ -252,6 +252,7 @@ interface SettingsState {
// Sidebar
colorfulSidebarIcons: boolean; // Tint folder icons by role (inbox blue, junk red, etc.)
showFolderTotalCount: boolean; // Show total message count next to folders/tags (alongside unread)
// Folders
folderIcons: Record<string, string>; // mailboxId -> icon name
@@ -447,6 +448,7 @@ const DEFAULT_SETTINGS = {
// Sidebar
colorfulSidebarIcons: true,
showFolderTotalCount: true,
// Folders
folderIcons: {} as Record<string, string>,
@@ -621,6 +623,7 @@ export const useSettingsStore = create<SettingsState>()(
senderFavicons: state.senderFavicons,
showAvatarsInJunk: state.showAvatarsInJunk,
colorfulSidebarIcons: state.colorfulSidebarIcons,
showFolderTotalCount: state.showFolderTotalCount,
folderIcons: state.folderIcons,
emailKeywords: state.emailKeywords,
attachmentReminderEnabled: state.attachmentReminderEnabled,