diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift index 7473d8b25..96c859699 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift @@ -116,8 +116,16 @@ struct CreateLabelView: View { } .padding(.bottom, 8) - TextField("Label Name", text: $newLabelName) + TextField(LocalText.labelNamePlaceholder, text: $newLabelName) .textFieldStyle(StandardTextFieldStyle()) + .onChange(of: newLabelName) { inputLabelName in + newLabelName = String(inputLabelName.prefix(viewModel.labelNameMaxLength)) + } + + Text("\(newLabelName.count)/\(viewModel.labelNameMaxLength)") + .font(.caption) + .frame(maxWidth: .infinity, alignment: .trailing) + .foregroundColor(newLabelName.count < viewModel.labelNameMaxLength ? .gray : .red) ScrollView(.horizontal, showsIndicators: false) { LazyHGrid(rows: rows, alignment: .top, spacing: 20) { diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsViewModel.swift index 10525fa35..50b11ca6a 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsViewModel.swift @@ -5,6 +5,8 @@ import SwiftUI import Views @MainActor final class LabelsViewModel: ObservableObject { + let labelNameMaxLength = 64 + @Published var isLoading = false @Published var selectedLabels = Set() @Published var unselectedLabels = Set() diff --git a/apple/OmnivoreKit/Sources/Views/LocalText.swift b/apple/OmnivoreKit/Sources/Views/LocalText.swift index 13a5ba82c..2fc984a17 100644 --- a/apple/OmnivoreKit/Sources/Views/LocalText.swift +++ b/apple/OmnivoreKit/Sources/Views/LocalText.swift @@ -26,6 +26,7 @@ public enum LocalText { public static let labelsViewAssignNameColor = localText(key: "labelsViewAssignNameColor") public static let createLabelMessage = localText(key: "createLabelMessage") public static let labelsPurposeDescription = localText(key: "labelsPurposeDescription") + public static let labelNamePlaceholder = localText(key: "labelNamePlaceholder") // Manage Account View public static let manageAccountDelete = localText(key: "manageAccountDelete") diff --git a/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings index 127dd0811..d69e034ce 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings @@ -19,6 +19,7 @@ "labelsViewAssignNameColor" = "Assign a name and color."; "createLabelMessage" = "Create a new Label"; "labelsPurposeDescription" = "Use labels to create curated collections of links."; +"labelNamePlaceholder" = "Label Name"; // Manage Account View "manageAccountDelete" = "Delete Account"; diff --git a/apple/OmnivoreKit/Sources/Views/Resources/es.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/es.lproj/Localizable.strings index 848d343f5..dff64a42a 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/es.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/es.lproj/Localizable.strings @@ -19,6 +19,7 @@ "labelsViewAssignNameColor" = "Asigna un nombre y un color."; "createLabelMessage" = "Crea una nueva Etiqueta"; "labelsPurposeDescription" = "Usa Etiquetas para coleccione de enlaces organizadas."; +"labelNamePlaceholder" = "Nombre de la etiqueta"; // Manage Account View "manageAccountDelete" = "Borrar Cuenta"; diff --git a/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings index f8a5ca95c..7cee43c8d 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings @@ -20,6 +20,7 @@ "labelsViewAssignNameColor" = "指定名称和颜色。"; "createLabelMessage" = "创建新标签"; "labelsPurposeDescription" = "使用标签创建精选的链接集合。"; +"labelNamePlaceholder" = "标签名称"; // Manage Account View "manageAccountDelete" = "删除帐户";