fix top bar in msg
This commit is contained in:
parent
f47181877e
commit
98de0eb313
@ -21,6 +21,7 @@ struct PrivateChatView: View {
|
||||
@State private var legacyComposerHeight: CGFloat = 40
|
||||
@FocusState private var isComposerFocused: Bool
|
||||
@EnvironmentObject private var messageCenter: IncomingMessageCenter
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
init(chat: PrivateChatListItem, currentUserId: String?) {
|
||||
self.chat = chat
|
||||
@ -49,6 +50,7 @@ struct PrivateChatView: View {
|
||||
}
|
||||
.navigationTitle(toolbarTitle)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarBackButtonHidden(true)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .principal) {
|
||||
chatToolbarContent
|
||||
@ -567,8 +569,22 @@ struct PrivateChatView: View {
|
||||
|
||||
private var chatToolbarContent: some View {
|
||||
HStack(spacing: 12) {
|
||||
backButton
|
||||
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Spacer(minLength: 0)
|
||||
|
||||
nameStatusView
|
||||
|
||||
Spacer(minLength: 0)
|
||||
|
||||
avatarView
|
||||
}
|
||||
.frame(maxWidth: .infinity, minHeight: headerAvatarSize, alignment: .center)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var nameStatusView: some View {
|
||||
VStack(spacing: 2) {
|
||||
if let officialName = officialDisplayName {
|
||||
HStack(spacing: 4) {
|
||||
nameText(officialName, weight: .semibold)
|
||||
@ -585,7 +601,11 @@ struct PrivateChatView: View {
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var avatarView: some View {
|
||||
if let url = avatarUrl,
|
||||
let fileId = chat.chatData?.avatars?.current?.fileId,
|
||||
let userId = currentUserId {
|
||||
@ -598,9 +618,6 @@ struct PrivateChatView: View {
|
||||
} else {
|
||||
headerPlaceholderAvatar
|
||||
}
|
||||
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
}
|
||||
|
||||
private func nameText(_ text: String, weight: Font.Weight) -> some View {
|
||||
@ -624,6 +641,16 @@ struct PrivateChatView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var backButton: some View {
|
||||
Button(action: { dismiss() }) {
|
||||
Image(systemName: "chevron.left")
|
||||
.font(.system(size: 17, weight: .semibold))
|
||||
.foregroundColor(.accentColor)
|
||||
}
|
||||
.frame(width: headerAvatarSize, height: headerAvatarSize)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
|
||||
private var headerPlaceholderAvatar: some View {
|
||||
Circle()
|
||||
.fill(avatarBackgroundColor)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user