From 9c088604d9ded20e27062d352cda1bc530666859 Mon Sep 17 00:00:00 2001 From: Attilio Cianci Date: Tue, 15 Sep 2026 16:22:37 +0200 Subject: [PATCH] feat(sidebar): hide pinned section when empty Closes #158 The 'Pinned' header and its drop placeholder are always rendered, so users who never pin a tab still see a permanent empty block plus a divider between favorites and the tab list. The section is now built only when there are pinned tabs or a drag is in progress, so the drop target still appears exactly when it is actionable. The divider follows the same rule. Also tightens the sidebar spacing (16 -> 8) and the pinned list spacing (8 -> 4) now that the empty block no longer separates them. --- ora/Features/Sidebar/Views/ContainerView.swift | 6 +++--- .../Sidebar/Views/TabList/PinnedTabsList.swift | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ora/Features/Sidebar/Views/ContainerView.swift b/ora/Features/Sidebar/Views/ContainerView.swift index 55df9e83..2a386195 100644 --- a/ora/Features/Sidebar/Views/ContainerView.swift +++ b/ora/Features/Sidebar/Views/ContainerView.swift @@ -52,8 +52,8 @@ struct ContainerView: View { } ScrollView(.vertical, showsIndicators: false) { - VStack(alignment: .leading, spacing: 16) { - if !privacyMode.isPrivate { + VStack(alignment: .leading, spacing: 8) { + if !privacyMode.isPrivate, !pinnedTabs.isEmpty || draggedItem != nil { PinnedTabsList( tabs: pinnedTabs, draggedItem: $draggedItem, @@ -66,7 +66,7 @@ struct ContainerView: View { onMoveToContainer: moveTab, containers: containers ) - Divider() + if !pinnedTabs.isEmpty { Divider() } } NormalTabsList( tabs: normalTabs, diff --git a/ora/Features/Sidebar/Views/TabList/PinnedTabsList.swift b/ora/Features/Sidebar/Views/TabList/PinnedTabsList.swift index 63b16ab1..69ade078 100644 --- a/ora/Features/Sidebar/Views/TabList/PinnedTabsList.swift +++ b/ora/Features/Sidebar/Views/TabList/PinnedTabsList.swift @@ -16,14 +16,15 @@ struct PinnedTabsList: View { @Environment(\.theme) var theme var body: some View { - VStack(spacing: 8) { - Text("Pinned") - .font(.callout) - .foregroundColor(theme.mutedForeground) - .padding(.top, 8) - .frame(maxWidth: .infinity, alignment: .leading) + VStack(spacing: 4) { + if !tabs.isEmpty || draggedItem != nil { + Text("Pinned") + .font(.callout) + .foregroundColor(theme.mutedForeground) + .frame(maxWidth: .infinity, alignment: .leading) + } if tabs.isEmpty { - EmptyPinnedTabs() + if draggedItem != nil { EmptyPinnedTabs() } } else { ForEach(tabs) { tab in TabItem(