Repository navigation
iPhone: the car view with the node view's header, the glass bar and the receipt log (WP12) #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3efc993
iPhone: the receipt log, four slots lit on their evidence, on the Liv…
frahlg 5c2a1c6
iPhone car: MEASURED for the car view's receipt, on lane 0's evidence
frahlg 603af0f
iPhone car: the node view's header, the car's plan, the glass bar and…
frahlg 8511803
iPhone car: cap the status line and the plan's labels at the node vie…
frahlg a9cb0dc
iPhone car: the hint and the receipt fade in place, never swap
frahlg 3a4b22d
Merge origin/main (WP14 #54) into the car view
frahlg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| import FTWKit | ||
| import SwiftUI | ||
|
|
||
| /// The room a receipt takes, its marks and two lines of text, laid out as | ||
| /// `ReceiptView` lays them out and left empty, so a receipt that arrives | ||
| /// moves nothing. | ||
| struct ReceiptRoom: View { | ||
| var body: some View { | ||
| VStack(alignment: .leading, spacing: 6) { | ||
| ViewThatFits(in: .horizontal) { | ||
| HStack(spacing: 12) { marks } | ||
| VStack(alignment: .leading, spacing: 4) { marks } | ||
| } | ||
| Text(verbatim: "\n") | ||
| .font(.footnote.weight(.medium)) | ||
| } | ||
| .padding(.vertical, 4) | ||
| .hidden() | ||
| .accessibilityHidden(true) | ||
| } | ||
|
|
||
| @ViewBuilder private var marks: some View { | ||
| ForEach([L("Sent"), L("Received"), L("Done")], id: \.self) { label in | ||
| HStack(spacing: 4) { | ||
| Image(systemName: "checkmark.circle.fill") | ||
| Text(label).font(.caption.weight(.semibold)) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// The receipt under a control: sent, received, done, and one sentence. | ||
| struct ReceiptView: View { | ||
| let outcome: EVText.Outcome | ||
|
|
||
| var body: some View { | ||
| VStack(alignment: .leading, spacing: 6) { | ||
| ViewThatFits(in: .horizontal) { | ||
| HStack(spacing: 12) { marks } | ||
| VStack(alignment: .leading, spacing: 4) { marks } | ||
| } | ||
| Text(outcome.text) | ||
| .font(.footnote.weight(.medium)) | ||
| .foregroundStyle(color) | ||
| .contentTransition(.opacity) | ||
| .fixedSize(horizontal: false, vertical: true) | ||
| } | ||
| .padding(.vertical, 4) | ||
| .animation(Theme.spring, value: outcome) | ||
| .accessibilityElement(children: .combine) | ||
| } | ||
|
|
||
| @ViewBuilder private var marks: some View { | ||
| mark(L("Sent"), outcome.sent) | ||
| mark(L("Received"), outcome.received) | ||
| mark(L("Done"), outcome.done) | ||
| } | ||
|
|
||
| private func mark(_ label: String, _ state: EVText.Outcome.Mark) -> some View { | ||
| HStack(spacing: 4) { | ||
| Image(systemName: symbol(state)) | ||
| .foregroundStyle(tint(state)) | ||
| .contentTransition(.symbolEffect(.replace)) | ||
| .symbolEffect(.pulse, options: .repeating, isActive: state == .active) | ||
| Text(label) | ||
| .font(.caption.weight(.semibold)) | ||
| .foregroundStyle(state == .waiting ? Theme.fgMuted : Theme.fg) | ||
| } | ||
| } | ||
|
|
||
| private func symbol(_ state: EVText.Outcome.Mark) -> String { | ||
| switch state { | ||
| case .done: return "checkmark.circle.fill" | ||
| case .active: return "circle.dotted.circle" | ||
| case .waiting: return "circle" | ||
| case .failed: return "xmark.circle.fill" | ||
| } | ||
| } | ||
|
|
||
| private func tint(_ state: EVText.Outcome.Mark) -> Color { | ||
| switch state { | ||
| case .done: return Theme.live | ||
| case .active: return Theme.accent | ||
| case .waiting: return Theme.fgMuted | ||
| case .failed: return Theme.alarm | ||
| } | ||
| } | ||
|
|
||
| private var color: Color { | ||
| switch outcome.tone { | ||
| case .working: return Theme.fgDim | ||
| case .done: return Theme.live | ||
| case .warning: return Theme.alarm | ||
| case .failed: return Theme.alarm | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a home has multiple chargers but only one Charge now Live Activity,
ids.count == 1is still true even though lane 0 contains aggregate car power. Power drawn by another charger can therefore mark this activity as MEASURED while its own car remains idle. Check the home's charger count, as the car-view receipt does below, rather than the number of active Live Activities.Useful? React with 👍 / 👎.