feat: add option to hide total message count on folders (#498)
This commit is contained in:
@@ -184,8 +184,9 @@ function SidebarRowCounts({
|
|||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
onUnreadClick?: () => void;
|
onUnreadClick?: () => void;
|
||||||
}) {
|
}) {
|
||||||
|
const showFolderTotalCount = useSettingsStore(s => s.showFolderTotalCount);
|
||||||
const unreadCount = unread ?? 0;
|
const unreadCount = unread ?? 0;
|
||||||
const totalCount = total ?? 0;
|
const totalCount = showFolderTotalCount ? (total ?? 0) : 0;
|
||||||
|
|
||||||
if (unreadCount === 0 && totalCount === 0) return null;
|
if (unreadCount === 0 && totalCount === 0) return null;
|
||||||
|
|
||||||
@@ -219,7 +220,7 @@ function SidebarRowCounts({
|
|||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
return (
|
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}
|
{unreadNode}
|
||||||
{unreadCount > 0 && totalCount > 0 && (
|
{unreadCount > 0 && totalCount > 0 && (
|
||||||
<span className="text-xs text-muted-foreground/60">/</span>
|
<span className="text-xs text-muted-foreground/60">/</span>
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ function MailLayoutPreview({
|
|||||||
export function LayoutSettings() {
|
export function LayoutSettings() {
|
||||||
const t = useTranslations('settings.appearance');
|
const t = useTranslations('settings.appearance');
|
||||||
const tEmail = useTranslations('settings.email_behavior');
|
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 { isSettingLocked, isSettingHidden, isFeatureEnabled } = usePolicyStore();
|
||||||
const accounts = useAccountStore(s => s.accounts);
|
const accounts = useAccountStore(s => s.accounts);
|
||||||
const activeAccountId = useAccountStore(s => s.activeAccountId);
|
const activeAccountId = useAccountStore(s => s.activeAccountId);
|
||||||
@@ -217,6 +217,13 @@ export function LayoutSettings() {
|
|||||||
/>
|
/>
|
||||||
</SettingItem>
|
</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') && (
|
{(accounts.length > 1 || hasGroupInboxes) && !isSettingHidden('enableUnifiedMailbox') && (
|
||||||
<SettingItem
|
<SettingItem
|
||||||
label={t('unified_mailbox.label')}
|
label={t('unified_mailbox.label')}
|
||||||
|
|||||||
@@ -936,6 +936,10 @@
|
|||||||
"label": "Colorful Sidebar Icons",
|
"label": "Colorful Sidebar Icons",
|
||||||
"description": "Tint folder and tag icons by type (blue Inbox, red Junk, green Sent, etc.). Disable for a monochrome sidebar."
|
"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": {
|
"pro_interface": {
|
||||||
"label": "Pro Interface (Experimental)",
|
"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.",
|
"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.",
|
||||||
|
|||||||
@@ -252,6 +252,7 @@ interface SettingsState {
|
|||||||
|
|
||||||
// Sidebar
|
// Sidebar
|
||||||
colorfulSidebarIcons: boolean; // Tint folder icons by role (inbox blue, junk red, etc.)
|
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
|
// Folders
|
||||||
folderIcons: Record<string, string>; // mailboxId -> icon name
|
folderIcons: Record<string, string>; // mailboxId -> icon name
|
||||||
@@ -447,6 +448,7 @@ const DEFAULT_SETTINGS = {
|
|||||||
|
|
||||||
// Sidebar
|
// Sidebar
|
||||||
colorfulSidebarIcons: true,
|
colorfulSidebarIcons: true,
|
||||||
|
showFolderTotalCount: true,
|
||||||
|
|
||||||
// Folders
|
// Folders
|
||||||
folderIcons: {} as Record<string, string>,
|
folderIcons: {} as Record<string, string>,
|
||||||
@@ -621,6 +623,7 @@ export const useSettingsStore = create<SettingsState>()(
|
|||||||
senderFavicons: state.senderFavicons,
|
senderFavicons: state.senderFavicons,
|
||||||
showAvatarsInJunk: state.showAvatarsInJunk,
|
showAvatarsInJunk: state.showAvatarsInJunk,
|
||||||
colorfulSidebarIcons: state.colorfulSidebarIcons,
|
colorfulSidebarIcons: state.colorfulSidebarIcons,
|
||||||
|
showFolderTotalCount: state.showFolderTotalCount,
|
||||||
folderIcons: state.folderIcons,
|
folderIcons: state.folderIcons,
|
||||||
emailKeywords: state.emailKeywords,
|
emailKeywords: state.emailKeywords,
|
||||||
attachmentReminderEnabled: state.attachmentReminderEnabled,
|
attachmentReminderEnabled: state.attachmentReminderEnabled,
|
||||||
|
|||||||
Reference in New Issue
Block a user