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