|
|
@@ -31,8 +31,8 @@ struct LanguageTranslatorView: View {
|
|
|
.padding(.bottom, dynamicBottomPadding)
|
|
|
}
|
|
|
.onChange(of: viewModel.sourceText) { newValue in
|
|
|
- if newValue.count > LanguageTranslatorViewModel.maxCharacters {
|
|
|
- viewModel.sourceText = String(newValue.prefix(LanguageTranslatorViewModel.maxCharacters))
|
|
|
+ if newValue.wordCount > LanguageTranslatorViewModel.maxWords {
|
|
|
+ viewModel.sourceText = newValue.truncated(toMaxWords: LanguageTranslatorViewModel.maxWords)
|
|
|
}
|
|
|
}
|
|
|
.onChange(of: viewModel.sourceLanguage) { _ in
|
|
|
@@ -149,7 +149,7 @@ struct LanguageTranslatorView: View {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- ZStack(alignment: .bottomTrailing) {
|
|
|
+ VStack(alignment: .leading, spacing: 6) {
|
|
|
ThinCaretTextEditor(
|
|
|
text: $viewModel.sourceText,
|
|
|
placeholder: "Start writing...",
|
|
|
@@ -166,11 +166,10 @@ struct LanguageTranslatorView: View {
|
|
|
.stroke(AppTheme.inputBorder, lineWidth: 1)
|
|
|
)
|
|
|
|
|
|
- Text(viewModel.characterCountLabel)
|
|
|
+ Text(viewModel.wordCountLimitLabel)
|
|
|
.font(.system(size: 11))
|
|
|
.foregroundStyle(AppTheme.textMuted)
|
|
|
- .padding(.trailing, 16)
|
|
|
- .padding(.bottom, 12)
|
|
|
+ .frame(maxWidth: .infinity, alignment: .trailing)
|
|
|
}
|
|
|
.frame(maxHeight: .infinity)
|
|
|
}
|