This commit is contained in:
fmodf 2024-09-19 17:24:56 +02:00
parent d0cbe63eb1
commit db66442393
2 changed files with 24 additions and 1 deletions

View file

@ -27,7 +27,9 @@ struct ConversationScreen: View {
router.dismissScreen()
}
),
centerText: .init(text: L10n.Conversation.title)
centerText: .init(text: centerText(), action: {
print("Center text tapped")
})
)
// Msg list
@ -106,4 +108,13 @@ struct ConversationScreen: View {
.environmentObject(attachments)
}
}
private func centerText() -> String {
let name = messagesStore.roster.name ?? JID(messagesStore.roster.contactBareJid).localPart
if let name = name {
return name
} else {
return L10n.Conversation.title
}
}
}

View file

@ -31,11 +31,23 @@ struct SharedNavBarButton: View {
struct SharedNavBarText: View {
let text: String
let action: (() -> Void)?
init(
text: String,
action: (() -> Void)? = nil
) {
self.text = text
self.action = action
}
var body: some View {
Text(text)
.font(.head2)
.foregroundColor(.Material.Text.main)
.tappablePadding(.init(top: 8, leading: 24, bottom: 8, trailing: 24)) {
action?()
}
}
}