diff --git a/frontend/components/mail/MailFolderTree.vue b/frontend/components/mail/MailFolderTree.vue index e015a7f..604aaba 100644 --- a/frontend/components/mail/MailFolderTree.vue +++ b/frontend/components/mail/MailFolderTree.vue @@ -19,14 +19,34 @@ const { t } = useI18n() const currentDepth = computed(() => props.depth ?? 0) +// Dossiers dépliés (repliés par défaut → seuls les dossiers racine sont visibles). +const expanded = ref>(new Set()) + +function isExpanded(path: string): boolean { + return expanded.value.has(path) +} + +function toggleExpanded(path: string): void { + const next = new Set(expanded.value) + if (next.has(path)) { + next.delete(path) + } else { + next.add(path) + } + expanded.value = next +} + +function hasChildren(folder: MailFolderDto): boolean { + return !!folder.children && folder.children.length > 0 +} + function handleSelect(path: string): void { emit('select', path) } function paddingStyle(): Record { const depth = currentDepth.value - if (depth <= 0) return {} - return { paddingLeft: `${0.75 + depth * 0.75}rem` } + return { paddingLeft: `${0.5 + depth * 0.75}rem` } } @@ -41,19 +61,34 @@ function paddingStyle(): Record {