mirror of
https://github.com/otaviocc/Triton.git
synced 2026-01-29 19:54:27 +00:00
Show status of weblog entry in list of posts
This commit is contained in:
parent
e6d378dfef
commit
6e7a2f09f9
3 changed files with 18 additions and 3 deletions
|
|
@ -12,7 +12,7 @@
|
|||
id: "blogpostID",
|
||||
title: "This is a test",
|
||||
body: "This is just a test post. ",
|
||||
status: isDraft ? "draft" : "published",
|
||||
status: isDraft ? "draft" : "live",
|
||||
timestamp: 12_312_312,
|
||||
address: "otaviocc",
|
||||
location: "/2022/12/my-weblog-post",
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ struct WeblogEntryView: View {
|
|||
VStack(alignment: .leading, spacing: 4) {
|
||||
makeHeaderView()
|
||||
makeContentView()
|
||||
|
||||
if viewModel.showStatus {
|
||||
makeStatusView()
|
||||
}
|
||||
}
|
||||
.frame(
|
||||
maxWidth: .infinity,
|
||||
|
|
@ -65,6 +69,17 @@ struct WeblogEntryView: View {
|
|||
.foregroundColor(.primary)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func makeStatusView() -> some View {
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(viewModel.status)
|
||||
.textCase(.uppercase)
|
||||
.font(.caption)
|
||||
.foregroundColor(.accentColor)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func makeContextualMenu() -> some View {
|
||||
makeEditEntryMenuItem()
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ final class WeblogEntryViewModel: Identifiable {
|
|||
)
|
||||
}
|
||||
|
||||
var isLive: Bool {
|
||||
status == "live"
|
||||
var showStatus: Bool {
|
||||
status.lowercased() != "live"
|
||||
}
|
||||
|
||||
private let repository: any WeblogRepositoryProtocol
|
||||
|
|
|
|||
Loading…
Reference in a new issue