From 21dd8f01aff65e08ed77b7b6bab41216d8e8da39 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Mon, 6 Oct 2025 04:03:21 +0300 Subject: [PATCH] add ideas --- yobble/Resources/Localizable.xcstrings | 30 ++++++- yobble/Views/Tab/CustomTabBar.swift | 2 +- yobble/Views/Tab/FeedbackTab.swift | 118 +++++++++++++++++++++++++ yobble/Views/Tab/MainView.swift | 4 +- yobble/Views/Tab/SearchTab.swift | 14 --- 5 files changed, 148 insertions(+), 20 deletions(-) create mode 100644 yobble/Views/Tab/FeedbackTab.swift delete mode 100644 yobble/Views/Tab/SearchTab.swift diff --git a/yobble/Resources/Localizable.xcstrings b/yobble/Resources/Localizable.xcstrings index b81aaea..056a9c1 100644 --- a/yobble/Resources/Localizable.xcstrings +++ b/yobble/Resources/Localizable.xcstrings @@ -79,6 +79,9 @@ }, "Безопасность" : { + }, + "Ваше предложение" : { + }, "Войти" : { "localizations" : { @@ -89,6 +92,9 @@ } } } + }, + "Вы предложили: %@" : { + }, "Выйти из аккаунта" : { @@ -185,6 +191,9 @@ }, "Здесь не будут чаты" : { + }, + "Идеи" : { + }, "Инвайт-код (необязательно)" : { "comment" : "Инвайт-код", @@ -213,6 +222,9 @@ }, "Как связаться с поддержкой?" : { "comment" : "FAQ question: support" + }, + "Какая вкладка вам нужна?" : { + }, "Корзина" : { "comment" : "Cart", @@ -302,9 +314,15 @@ }, "Мой профиль" : { + }, + "Мы планируем заменить вкладку. Поделитесь, что бы вы хотели видеть здесь чаще всего." : { + }, "Напишите нам через форму обратной связи в разделе \"Поддержка\"." : { "comment" : "FAQ answer: support" + }, + "Например: закладки, друзья, активность..." : { + }, "Настройки" : { "comment" : "Settings", @@ -361,6 +379,12 @@ }, "Отображаемое имя" : { + }, + "Отправить предложение" : { + + }, + "Отправляем..." : { + }, "Ошибка авторизации" : { @@ -394,9 +418,6 @@ }, "Подтверждение пароля" : { "comment" : "Подтверждение пароля" - }, - "Поиск" : { - }, "Помощь" : { "comment" : "Help Center", @@ -470,6 +491,9 @@ }, "Сменить пароль" : { + }, + "Спасибо!" : { + }, "Тёмная тема" : { diff --git a/yobble/Views/Tab/CustomTabBar.swift b/yobble/Views/Tab/CustomTabBar.swift index a4f914b..b942188 100644 --- a/yobble/Views/Tab/CustomTabBar.swift +++ b/yobble/Views/Tab/CustomTabBar.swift @@ -12,7 +12,7 @@ struct CustomTabBar: View { } // Tab 2: Search - TabBarButton(systemName: "magnifyingglass", text: NSLocalizedString("Поиск", comment: ""), isSelected: selectedTab == 1) { + TabBarButton(systemName: "lightbulb", text: NSLocalizedString("Идеи", comment: ""), isSelected: selectedTab == 1) { selectedTab = 1 } diff --git a/yobble/Views/Tab/FeedbackTab.swift b/yobble/Views/Tab/FeedbackTab.swift new file mode 100644 index 0000000..705c3fb --- /dev/null +++ b/yobble/Views/Tab/FeedbackTab.swift @@ -0,0 +1,118 @@ +import SwiftUI + +struct FeedbackTab: View { + @State private var suggestion: String = "" + @State private var submittedSuggestion: String? = nil + @State private var isSubmitting: Bool = false + @State private var showSubmissionMessage: Bool = false + + var body: some View { + ScrollView { + VStack(alignment: .leading, spacing: 20) { + Text(NSLocalizedString("Какая вкладка вам нужна?", comment: "")) + .font(.title2) + .fontWeight(.semibold) + + Text(NSLocalizedString( + "Мы планируем заменить вкладку. Поделитесь, что бы вы хотели видеть здесь чаще всего.", + comment: "" + )) + .foregroundColor(.secondary) + + VStack(alignment: .leading, spacing: 12) { + Text(NSLocalizedString("Ваше предложение", comment: "")) + .font(.headline) + + TextEditor(text: $suggestion) + .frame(minHeight: 120) + .padding(12) + .background( + RoundedRectangle(cornerRadius: 12) + .fill(Color(.systemGray6)) + ) + .overlay( + RoundedRectangle(cornerRadius: 12) + .stroke(Color(.systemGray4)) + ) + .overlay( + Group { + if suggestion.isEmpty { + Text(NSLocalizedString("Например: закладки, друзья, активность...", comment: "")) + .foregroundColor(.secondary) + .padding(18) + .allowsHitTesting(false) + } + } + ) + .disableAutocorrection(true) + } + + Button(action: submitSuggestion) { + HStack { + if isSubmitting { + ProgressView() + .progressViewStyle(CircularProgressViewStyle()) + } + Text(isSubmitting + ? NSLocalizedString("Отправляем...", comment: "") + : NSLocalizedString("Отправить предложение", comment: "")) + .fontWeight(.semibold) + } + .frame(maxWidth: .infinity) + .padding() + .background(suggestionIsValid ? Color.accentColor : Color(.systemGray4)) + .foregroundColor(.white) + .cornerRadius(14) + } + .disabled(!suggestionIsValid || isSubmitting) + + if let submittedSuggestion, showSubmissionMessage { + VStack(alignment: .leading, spacing: 8) { + Text(NSLocalizedString("Спасибо!", comment: "")) + .font(.headline) + Text(String(format: NSLocalizedString("Вы предложили: %@", comment: ""), submittedSuggestion)) + .foregroundColor(.secondary) + } + .transition(.opacity) + } + + Spacer(minLength: 24) + +// Text(NSLocalizedString( +// "Позже мы добавим отправку на сервер, чтобы собрать статистику, и расскажем о результатах в обновлениях.", +// comment: "" +// )) +// .font(.footnote) +// .foregroundColor(.secondary) + } + .padding(.horizontal, 20) + .padding(.vertical, 32) + } + } + + private var suggestionIsValid: Bool { + !suggestion.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + } + + private func submitSuggestion() { + guard suggestionIsValid else { return } + let trimmed = suggestion.trimmingCharacters(in: .whitespacesAndNewlines) + + isSubmitting = true + DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { // имитируем сетевой вызов + submittedSuggestion = trimmed + suggestion = "" + withAnimation { + showSubmissionMessage = true + } + isSubmitting = false + } + } +} + +struct FeedbackTab_Previews: PreviewProvider { + static var previews: some View { + FeedbackTab() + .environmentObject(ThemeManager()) + } +} diff --git a/yobble/Views/Tab/MainView.swift b/yobble/Views/Tab/MainView.swift index 84ad797..dfda7db 100644 --- a/yobble/Views/Tab/MainView.swift +++ b/yobble/Views/Tab/MainView.swift @@ -17,7 +17,7 @@ struct MainView: View { private var tabTitle: String { switch selectedTab { case 0: return "Home" - case 1: return "Search" + case 1: return "Ideas" case 2: return "Chats" case 3: return "Profile" default: return "Home" @@ -45,7 +45,7 @@ struct MainView: View { NewHomeTab() .opacity(selectedTab == 0 ? 1 : 0) - SearchTab() + FeedbackTab() .opacity(selectedTab == 1 ? 1 : 0) ChatsTab() diff --git a/yobble/Views/Tab/SearchTab.swift b/yobble/Views/Tab/SearchTab.swift deleted file mode 100644 index 1638074..0000000 --- a/yobble/Views/Tab/SearchTab.swift +++ /dev/null @@ -1,14 +0,0 @@ -import SwiftUI - -struct SearchTab: View { - - var body: some View { - VStack { - Text("Здесь не будут чаты") - .font(.title) - .foregroundColor(.gray) - - Spacer() - } - } -}