Skip to content

Commit

Permalink
⚗️ (ContentKit): Example - add real hmi and get details
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Feb 7, 2024
1 parent 9aec820 commit 3b9f42e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ locales:
- en_US
- fr_FR

hmi:
- robot
- magic_cards
- ipad_robot

l10n:
- locale: fr_FR
details:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ struct MainView: View {
}
}

DisclosureGroup("**HMI**") {
ForEach(self.activity?.hmi ?? [], id: \.self) { hmi in
let hmi = HMI.hmi(id: hmi)!
HStack {
Text(hmi.name)
Button {
self.selectedHMI = hmi
} label: {
Image(systemName: "info.circle")
}
}
}
}

DisclosureGroup("**Tags**") {
ForEach(self.activity?.tags ?? [], id: \.self) { skill in
Text(skill)
Expand All @@ -108,6 +122,13 @@ struct MainView: View {
Text(skill.description)
}
})
.sheet(item: self.$selectedHMI, onDismiss: { self.selectedHMI = nil }, content: { hmi in
VStack(alignment: .leading) {
Text(hmi.name)
.font(.headline)
Text(hmi.description)
}
})
.onAppear {
self.activity = ContentKit.decodeActivity("activity")
print(self.activity ?? "not working")
Expand All @@ -133,6 +154,7 @@ struct MainView: View {
// MARK: Private

@State private var selectedSkill: Skill?
@State private var selectedHMI: HMIDetails?

@State private var activity: Activity?
}
Expand Down

0 comments on commit 3b9f42e

Please sign in to comment.