Skip to content

Commit

Permalink
🐛 Resolve GB-4
Browse files Browse the repository at this point in the history
Some events in the preview outline were left blank because the who
contents were missing. This is common for questions and refresh
events.

This commit adds a more robust solution to show various event
types.

Signed-off-by: Marquis Kurt <software@marquiskurt.net>
  • Loading branch information
alicerunsonfedora committed Dec 7, 2022
1 parent 9336700 commit e856322
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
26 changes: 22 additions & 4 deletions Gutenberg/Features/Preview/GutenbergPreviewOutline.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
//
// GutenbergPreviewOutline.swift
// Gutenberg
//
// Created by Marquis Kurt on 12/6/22.
// This file is part of Gutenberg.
//
// Gutenberg is non-violent software: you can use, redistribute, and/or modify it under the terms of the CNPLv7+ as
// found in the LICENSE file in the source code root directory or at <https://git.pixie.town/thufie/npl-builder>.
//
// Gutenberg comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. See the CNPL for details.
//

import SwiftUI
Expand All @@ -18,8 +22,22 @@ struct GutenbergPreviewOutline: View {
ForEach(Array(timeline.enumerated()), id: \.element.id) { (index, event) in
Label {
VStack(alignment: .leading) {
Text(event.what)
.font(.subheadline)
Group {
switch event.type {
case .refresh:
Label(
"Refresh \(event.refresh?.count ?? 0) triggers",
systemImage: "arrow.clockwise.circle"
)
case .question:
Label(event.question?.question ?? "Question", systemImage: "questionmark.circle")
case .dialogue, .comment:
Label(event.what, systemImage: "text.bubble")
default:
Text("Unknown event")
}
}
.font(.subheadline)
}
} icon: {
Text("\(index + 1)")
Expand Down
2 changes: 1 addition & 1 deletion Gutenberg/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<string>art.indexingyourhe.gutenberg</string>
<key>CFBundleURLSchemes</key>
<array>
<string>gutenberg://</string>
<string>gutenberg</string>
</array>
</dict>
</array>
Expand Down

0 comments on commit e856322

Please sign in to comment.