mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-23 14:28:15 +00:00
Show threading / reply to UI in post detail
This commit is contained in:
parent
ab0b207596
commit
f1919305ab
1 changed files with 30 additions and 6 deletions
|
@ -42,18 +42,14 @@ public struct StatusDetailView: View {
|
||||||
|
|
||||||
case let .display(status, context, date):
|
case let .display(status, context, date):
|
||||||
if !context.ancestors.isEmpty {
|
if !context.ancestors.isEmpty {
|
||||||
ForEach(context.ancestors) { ancestor in
|
makeStatusesListView(statuses: context.ancestors)
|
||||||
StatusRowView(viewModel: .init(status: ancestor, client: client, routerPath: routerPath, isCompact: false))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
makeCurrentStatusView(status: status)
|
makeCurrentStatusView(status: status)
|
||||||
.id(date)
|
.id(date)
|
||||||
|
|
||||||
if !context.descendants.isEmpty {
|
if !context.descendants.isEmpty {
|
||||||
ForEach(context.descendants) { descendant in
|
makeStatusesListView(statuses: context.descendants)
|
||||||
StatusRowView(viewModel: .init(status: descendant, client: client, routerPath: routerPath, isCompact: false))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isLoaded {
|
if !isLoaded {
|
||||||
|
@ -105,6 +101,34 @@ public struct StatusDetailView: View {
|
||||||
.navigationTitle(viewModel.title)
|
.navigationTitle(viewModel.title)
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func makeStatusesListView(statuses: [Status]) -> some View {
|
||||||
|
ForEach(statuses) { status in
|
||||||
|
var isReplyToPrevious: Bool = false
|
||||||
|
if let index = statuses.firstIndex(where: { $0.id == status.id }),
|
||||||
|
index > 0,
|
||||||
|
statuses[index - 1].inReplyToAccountId == status.account.id {
|
||||||
|
isReplyToPrevious = true
|
||||||
|
}
|
||||||
|
let viewModel: StatusRowViewModel = .init(status: status,
|
||||||
|
client: client,
|
||||||
|
routerPath: routerPath,
|
||||||
|
isCompact: false)
|
||||||
|
return HStack {
|
||||||
|
if isReplyToPrevious {
|
||||||
|
Rectangle()
|
||||||
|
.fill(theme.tintColor)
|
||||||
|
.frame(width: 2)
|
||||||
|
}
|
||||||
|
StatusRowView(viewModel: viewModel)
|
||||||
|
}
|
||||||
|
.listRowBackground(viewModel.highlightRowColor)
|
||||||
|
.listRowInsets(.init(top: 12,
|
||||||
|
leading: .layoutPadding,
|
||||||
|
bottom: 12,
|
||||||
|
trailing: .layoutPadding))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func makeCurrentStatusView(status: Status) -> some View {
|
private func makeCurrentStatusView(status: Status) -> some View {
|
||||||
StatusRowView(viewModel: .init(status: status,
|
StatusRowView(viewModel: .init(status: status,
|
||||||
|
|
Loading…
Reference in a new issue