From 7e1a7679c8cfaea4d9e0ccde0b2008b14ba3a174 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 23 Jun 2026 21:34:02 -0400 Subject: [PATCH] feat: message list density Signed-off-by: Sebastian --- src/components/MessageList.vue | 39 +++++++++++++++++---- src/components/settings/DisplaySettings.vue | 24 +++++++++++-- src/stores/mailSettingsStore.ts | 34 ++++++++++++++++++ 3 files changed, 89 insertions(+), 8 deletions(-) diff --git a/src/components/MessageList.vue b/src/components/MessageList.vue index 6c76702..eaba1fd 100644 --- a/src/components/MessageList.vue +++ b/src/components/MessageList.vue @@ -1,8 +1,10 @@ + + + Message list density + Control row height and how much detail is shown + + diff --git a/src/stores/mailSettingsStore.ts b/src/stores/mailSettingsStore.ts index 63dfe4d..35e1af6 100644 --- a/src/stores/mailSettingsStore.ts +++ b/src/stores/mailSettingsStore.ts @@ -5,13 +5,34 @@ import { useUserStore } from '@KTXC' const MESSAGE_READ_ENABLED_KEY = 'mail.behaviour.messageReadEnabled' const MESSAGE_READ_DELAY_KEY = 'mail.behaviour.messageReadDelay' const FOLDER_VIEW_MODE_KEY = 'mail.folderViewMode' +const MESSAGE_LIST_DENSITY_KEY = 'mail.messageListDensity' const DEFAULT_MESSAGE_READ_ENABLED = false const DEFAULT_MESSAGE_READ_DELAY = 5 const DEFAULT_FOLDER_VIEW_MODE = 'tree' +const DEFAULT_MESSAGE_LIST_DENSITY = 'cozy' export type FolderViewMode = 'tree' | 'page' +export type MessageListDensity = 'compact' | 'cozy' | 'comfortable' + +export const messageListDensityOptions = [ + { value: 'compact', title: 'Compact' }, + { value: 'cozy', title: 'Cozy' }, + { value: 'comfortable', title: 'Comfortable' }, +] + +export const messageListDensityConfig: Record = { + compact: { itemHeight: 56, lines: 'one', showSubjectLine: false, showThirdLine: false }, + cozy: { itemHeight: 72, lines: 'two', showSubjectLine: true, showThirdLine: false }, + comfortable: { itemHeight: 96, lines: 'three', showSubjectLine: true, showThirdLine: true }, +} + export const messageReadDelayOptions = [ { value: 2, title: '2 seconds' }, { value: 5, title: '5 seconds' }, @@ -42,6 +63,10 @@ function normalizeFolderViewMode(value: unknown, fallback: FolderViewMode): Fold return value === 'tree' || value === 'page' ? value : fallback } +function normalizeMessageListDensity(value: unknown, fallback: MessageListDensity): MessageListDensity { + return value === 'compact' || value === 'cozy' || value === 'comfortable' ? value : fallback +} + export const useMailSettingsStore = defineStore('mailSettingsStore', () => { const userStore = useUserStore() @@ -66,8 +91,17 @@ export const useMailSettingsStore = defineStore('mailSettingsStore', () => { ), }) + const messageListDensity = computed({ + get: () => normalizeMessageListDensity(userStore.getSetting(MESSAGE_LIST_DENSITY_KEY), DEFAULT_MESSAGE_LIST_DENSITY), + set: (value: MessageListDensity) => userStore.setSetting( + MESSAGE_LIST_DENSITY_KEY, + normalizeMessageListDensity(value, DEFAULT_MESSAGE_LIST_DENSITY), + ), + }) + return { folderViewMode, + messageListDensity, messageReadEnabled, messageReadDelay, }