fix edit profile

This commit is contained in:
cheykrym 2025-12-13 05:33:30 +03:00
parent c7f51b30cd
commit fa10e389cd

View File

@ -22,9 +22,10 @@ struct EditProfileView: View {
@State private var avatarViewerState: AvatarViewerState?
@State private var shareItems: [Any] = []
@State private var showShareSheet = false
private let profileService = ProfileService()
private let descriptionLimit = 1024
private let nameLimit = 32
var body: some View {
ZStack {
@ -75,13 +76,18 @@ struct EditProfileView: View {
Section(header: Text("Публичная информация")) {
TextField("Отображаемое имя", text: $displayName)
.onChange(of: displayName) { newValue in
if newValue.count > nameLimit {
displayName = String(newValue.prefix(nameLimit))
}
}
VStack(alignment: .leading, spacing: 5) {
Text("Описание")
.font(.caption)
.foregroundColor(.secondary)
TextEditor(text: $description)
.frame(height: 150)
Text("Описание")
.font(.caption)
.foregroundColor(.secondary)
TextEditor(text: $description)
.frame(height: 150)
.onChange(of: description) { newValue in
if newValue.count > descriptionLimit {
description = String(newValue.prefix(descriptionLimit))