diff --git a/Packages/Status/Sources/Status/Detail/StatusDetailView.swift b/Packages/Status/Sources/Status/Detail/StatusDetailView.swift index 7500b0f3..224ec483 100644 --- a/Packages/Status/Sources/Status/Detail/StatusDetailView.swift +++ b/Packages/Status/Sources/Status/Detail/StatusDetailView.swift @@ -12,6 +12,7 @@ public struct StatusDetailView: View { @Environment(StreamWatcher.self) private var watcher @Environment(Client.self) private var client @Environment(RouterPath.self) private var routerPath + @Environment(\.isCompact) private var isCompact: Bool @State private var viewModel: StatusDetailViewModel @@ -103,15 +104,15 @@ public struct StatusDetailView: View { private func makeStatusesListView(statuses: [Status]) -> some View { ForEach(statuses) { status in - let indentationLevel = viewModel.getIndentationLevel(id: status.id) + let (indentationLevel, extraInsets) = viewModel.getIndentationLevel(id: status.id) let viewModel: StatusRowViewModel = .init(status: status, client: client, routerPath: routerPath) let isFocused = self.viewModel.statusId == status.id StatusRowView(viewModel: viewModel) - .environment(\.extraLeadingInset, (indentationLevel > 0) ? 10 : 0) - .environment(\.indentationLevel, indentationLevel) + .environment(\.extraLeadingInset, !isCompact ? extraInsets : 0) + .environment(\.indentationLevel, !isCompact ? indentationLevel : 0) .environment(\.isStatusFocused, isFocused) .overlay { if isFocused { diff --git a/Packages/Status/Sources/Status/Detail/StatusDetailViewModel.swift b/Packages/Status/Sources/Status/Detail/StatusDetailViewModel.swift index eb6888df..701a8df2 100644 --- a/Packages/Status/Sources/Status/Detail/StatusDetailViewModel.swift +++ b/Packages/Status/Sources/Status/Detail/StatusDetailViewModel.swift @@ -139,7 +139,13 @@ import SwiftUI } } - func getIndentationLevel(id: String) -> UInt { - min(indentationLevelPreviousCache[id] ?? 0, Self.maxIndent) + func getIndentationLevel(id: String) -> (indentationLevel: UInt, extraInset: Double) { + let level = min(indentationLevelPreviousCache[id] ?? 0, Self.maxIndent) + + let barSize = Double(level) * 2 + let spaceBetween = (Double(level) - 1) * 3 + let size = barSize + spaceBetween + 8 + + return (level, size) } } diff --git a/Packages/Status/Sources/Status/Row/StatusRowView.swift b/Packages/Status/Sources/Status/Row/StatusRowView.swift index adda154f..2266b571 100644 --- a/Packages/Status/Sources/Status/Row/StatusRowView.swift +++ b/Packages/Status/Sources/Status/Row/StatusRowView.swift @@ -32,19 +32,17 @@ public struct StatusRowView: View { public var body: some View { HStack(spacing: 0) { - if !isCompact { - HStack(spacing: 3) { - ForEach(0.. 0 { - Spacer(minLength: 8) + HStack(spacing: 3) { + ForEach(0.. 0 { + Spacer(minLength: 8) + } VStack(alignment: .leading) { if viewModel.isFiltered, let filter = viewModel.filter { switch filter.filter.filterAction {