This commit is contained in:
cheykrym 2025-12-03 09:05:16 +03:00
parent bbe6a8a3e4
commit cd67c350b4
3 changed files with 50 additions and 35 deletions

View File

@ -6,6 +6,9 @@
}, },
"(без текста)" : { "(без текста)" : {
},
"@" : {
}, },
"@%@" : { "@%@" : {
"localizations" : { "localizations" : {

View File

@ -148,18 +148,22 @@ struct PasswordLoginView: View {
} }
VStack(alignment: .leading, spacing: 12) { VStack(alignment: .leading, spacing: 12) {
TextField(NSLocalizedString("Введите логин", comment: ""), text: $viewModel.username) HStack(spacing: 8) {
.padding() Text("@")
.background(Color(.secondarySystemBackground)) .foregroundColor(.secondary)
.cornerRadius(12) TextField(NSLocalizedString("Введите логин", comment: ""), text: $viewModel.username)
.autocapitalization(.none) .autocapitalization(.none)
.disableAutocorrection(true) .disableAutocorrection(true)
.focused($focusedField, equals: .username) .focused($focusedField, equals: .username)
.onChange(of: viewModel.username) { newValue in .onChange(of: viewModel.username) { newValue in
if newValue.count > 32 { if newValue.count > 32 {
viewModel.username = String(newValue.prefix(32)) viewModel.username = String(newValue.prefix(32))
}
} }
} }
.padding()
.background(Color(.secondarySystemBackground))
.cornerRadius(12)
if !isUsernameValid && !viewModel.username.isEmpty { if !isUsernameValid && !viewModel.username.isEmpty {
Text(NSLocalizedString("Неверный логин", comment: "Неверный логин")) Text(NSLocalizedString("Неверный логин", comment: "Неверный логин"))
@ -412,20 +416,24 @@ private struct PasswordlessRequestView: View {
// Text(NSLocalizedString("Логин", comment: "")) // Text(NSLocalizedString("Логин", comment: ""))
// .font(.subheadline) // .font(.subheadline)
// .foregroundColor(.secondary) // .foregroundColor(.secondary)
TextField(NSLocalizedString("Введите логин", comment: ""), text: $viewModel.passwordlessLogin) HStack(spacing: 8) {
.textContentType(.username) Text("@")
.keyboardType(.default) .foregroundColor(.secondary)
.autocapitalization(.none) TextField(NSLocalizedString("Введите логин", comment: ""), text: $viewModel.passwordlessLogin)
.disableAutocorrection(true) .textContentType(.username)
.padding() .keyboardType(.default)
.background(Color(.secondarySystemBackground)) .autocapitalization(.none)
.cornerRadius(12) .disableAutocorrection(true)
.focused($isFieldFocused) .focused($isFieldFocused)
.onChange(of: viewModel.passwordlessLogin) { newValue in .onChange(of: viewModel.passwordlessLogin) { newValue in
if newValue.count > 32 { if newValue.count > 32 {
viewModel.passwordlessLogin = String(newValue.prefix(32)) viewModel.passwordlessLogin = String(newValue.prefix(32))
}
} }
} }
.padding()
.background(Color(.secondarySystemBackground))
.cornerRadius(12)
if !isLoginValid && !viewModel.passwordlessLogin.isEmpty { if !isLoginValid && !viewModel.passwordlessLogin.isEmpty {
Text(NSLocalizedString("Неверный логин", comment: "")) Text(NSLocalizedString("Неверный логин", comment: ""))
.foregroundColor(.red) .foregroundColor(.red)

View File

@ -75,18 +75,22 @@ struct RegistrationView: View {
Group { Group {
VStack(alignment: .leading, spacing: 4) { VStack(alignment: .leading, spacing: 4) {
TextField(NSLocalizedString("Введите логин", comment: "Логин"), text: $username) HStack(spacing: 8) {
.autocapitalization(.none) Text("@")
.disableAutocorrection(true) .foregroundColor(.secondary)
.focused($focusedField, equals: .username) TextField(NSLocalizedString("Введите логин", comment: "Логин"), text: $username)
.padding() .autocapitalization(.none)
.background(Color(.secondarySystemBackground)) .disableAutocorrection(true)
.cornerRadius(12) .focused($focusedField, equals: .username)
.onChange(of: username) { newValue in .onChange(of: username) { newValue in
if newValue.count > 32 { if newValue.count > 32 {
username = String(newValue.prefix(32)) username = String(newValue.prefix(32))
}
} }
} }
.padding()
.background(Color(.secondarySystemBackground))
.cornerRadius(12)
if !isUsernameValid && !username.isEmpty { if !isUsernameValid && !username.isEmpty {
Text(NSLocalizedString("Логин должен быть от 3 до 32 символов (английские буквы, цифры, _)", comment: "")) Text(NSLocalizedString("Логин должен быть от 3 до 32 символов (английские буквы, цифры, _)", comment: ""))