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
|
@State private var legacyComposerHeight: CGFloat = 40
|
||||||
@FocusState private var isComposerFocused: Bool
|
@FocusState private var isComposerFocused: Bool
|
||||||
@EnvironmentObject private var messageCenter: IncomingMessageCenter
|
@EnvironmentObject private var messageCenter: IncomingMessageCenter
|
||||||
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
|
||||||
init(chat: PrivateChatListItem, currentUserId: String?) {
|
init(chat: PrivateChatListItem, currentUserId: String?) {
|
||||||
self.chat = chat
|
self.chat = chat
|
||||||
@ -49,6 +50,7 @@ struct PrivateChatView: View {
|
|||||||
}
|
}
|
||||||
.navigationTitle(toolbarTitle)
|
.navigationTitle(toolbarTitle)
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.navigationBarBackButtonHidden(true)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .principal) {
|
ToolbarItem(placement: .principal) {
|
||||||
chatToolbarContent
|
chatToolbarContent
|
||||||
@ -567,8 +569,22 @@ struct PrivateChatView: View {
|
|||||||
|
|
||||||
private var chatToolbarContent: some View {
|
private var chatToolbarContent: some View {
|
||||||
HStack(spacing: 12) {
|
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 {
|
if let officialName = officialDisplayName {
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
nameText(officialName, weight: .semibold)
|
nameText(officialName, weight: .semibold)
|
||||||
@ -585,7 +601,11 @@ struct PrivateChatView: View {
|
|||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var avatarView: some View {
|
||||||
if let url = avatarUrl,
|
if let url = avatarUrl,
|
||||||
let fileId = chat.chatData?.avatars?.current?.fileId,
|
let fileId = chat.chatData?.avatars?.current?.fileId,
|
||||||
let userId = currentUserId {
|
let userId = currentUserId {
|
||||||
@ -598,9 +618,6 @@ struct PrivateChatView: View {
|
|||||||
} else {
|
} else {
|
||||||
headerPlaceholderAvatar
|
headerPlaceholderAvatar
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func nameText(_ text: String, weight: Font.Weight) -> some View {
|
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 {
|
private var headerPlaceholderAvatar: some View {
|
||||||
Circle()
|
Circle()
|
||||||
.fill(avatarBackgroundColor)
|
.fill(avatarBackgroundColor)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user