From 7034503983d458cca090ea078b4c408e8fa22021 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Fri, 24 Oct 2025 00:21:39 +0300 Subject: [PATCH] change loading circle --- yobble/Components/TopBarView.swift | 14 +++++--- yobble/Resources/Localizable.xcstrings | 9 +++++ yobble/Views/Tab/ChatsTab.swift | 48 +++++++++++++++++--------- yobble/Views/Tab/ContactsTab.swift | 4 ++- yobble/Views/Tab/MainView.swift | 14 ++++---- 5 files changed, 60 insertions(+), 29 deletions(-) diff --git a/yobble/Components/TopBarView.swift b/yobble/Components/TopBarView.swift index bef338e..90fb433 100644 --- a/yobble/Components/TopBarView.swift +++ b/yobble/Components/TopBarView.swift @@ -19,19 +19,23 @@ struct TopBarView: View { @Binding var chatSearchText: String var isHomeTab: Bool { - return title == "Home" + return title == NSLocalizedString("Home", comment: "") } var isChatsTab: Bool { - return title == "Chats" + return title == NSLocalizedString("Чаты", comment: "") } var isProfileTab: Bool { - return title == "Profile" + return title == NSLocalizedString("Profile", comment: "") } var isContactsTab: Bool { - return title == "Contacts" + return title == NSLocalizedString("Контакты", comment: "") + } + + var isSettingsTab: Bool { + return title == NSLocalizedString("Настройки", comment: "") } private var statusMessage: String? { @@ -62,7 +66,7 @@ struct TopBarView: View { } // Spacer() - if let statusMessage { + if let statusMessage, !isContactsTab, !isSettingsTab { connectionStatusView(message: statusMessage) Spacer() } else if isHomeTab{ diff --git a/yobble/Resources/Localizable.xcstrings b/yobble/Resources/Localizable.xcstrings index ab87397..be23183 100644 --- a/yobble/Resources/Localizable.xcstrings +++ b/yobble/Resources/Localizable.xcstrings @@ -63,6 +63,9 @@ }, "Companion ID" : { "comment" : "Search placeholder companion title" + }, + "Concept" : { + }, "DEBUG UPDATE" : { "localizations" : { @@ -100,6 +103,9 @@ } } } + }, + "Home" : { + }, "OK" : { "comment" : "Common OK\nProfile update alert button", @@ -139,6 +145,9 @@ } } } + }, + "Profile" : { + }, "profile_down_text_1" : { diff --git a/yobble/Views/Tab/ChatsTab.swift b/yobble/Views/Tab/ChatsTab.swift index 37e5e73..5c37bb8 100644 --- a/yobble/Views/Tab/ChatsTab.swift +++ b/yobble/Views/Tab/ChatsTab.swift @@ -102,11 +102,11 @@ struct ChatsTab: View { @ViewBuilder private var content: some View { - if viewModel.isInitialLoading && viewModel.chats.isEmpty { - loadingState - } else { - chatList - } +// if viewModel.isInitialLoading && viewModel.chats.isEmpty { +// loadingState +// } + chatList + } private var chatList: some View { @@ -161,6 +161,10 @@ struct ChatsTab: View { // if let message = viewModel.errorMessage, viewModel.chats.isEmpty { // errorState(message: message) // } else + if viewModel.isInitialLoading && viewModel.chats.isEmpty { + loadingState + } + if viewModel.chats.isEmpty { emptyState } else { @@ -360,14 +364,26 @@ struct ChatsTab: View { .frame(maxWidth: .infinity) } +// private var loadingState: some View { +// VStack(spacing: 12) { +// ProgressView() +// Text(NSLocalizedString("Загружаем чаты…", comment: "")) +// .font(.subheadline) +// .foregroundColor(.secondary) +// } +// .frame(maxWidth: .infinity, maxHeight: .infinity) +// } + private var loadingState: some View { - VStack(spacing: 12) { + HStack { + Spacer() ProgressView() - Text(NSLocalizedString("Загружаем чаты…", comment: "")) - .font(.subheadline) - .foregroundColor(.secondary) + .progressViewStyle(CircularProgressViewStyle()) + Spacer() } - .frame(maxWidth: .infinity, maxHeight: .infinity) + .padding(.vertical, 18) + .listRowInsets(EdgeInsets(top: 18, leading: 12, bottom: 18, trailing: 12)) + .listRowSeparator(.hidden) } private func errorState(message: String) -> some View { @@ -391,15 +407,15 @@ struct ChatsTab: View { private var emptyState: some View { VStack(spacing: 12) { - Image(systemName: "bubble.left") - .font(.system(size: 48)) - .foregroundColor(.secondary) +// Image(systemName: "bubble.left") +// .font(.system(size: 48)) +// .foregroundColor(.secondary) Text(NSLocalizedString("Пока что у вас нет чатов", comment: "")) .font(.body) .foregroundColor(.secondary) - Button(action: triggerChatsReload) { - Text(NSLocalizedString("Обновить", comment: "")) - } +// Button(action: triggerChatsReload) { +// Text(NSLocalizedString("Обновить", comment: "")) +// } .buttonStyle(.bordered) } .padding() diff --git a/yobble/Views/Tab/ContactsTab.swift b/yobble/Views/Tab/ContactsTab.swift index 5097022..5aece24 100644 --- a/yobble/Views/Tab/ContactsTab.swift +++ b/yobble/Views/Tab/ContactsTab.swift @@ -13,7 +13,9 @@ struct ContactsTab: View { List { if isLoading && contacts.isEmpty { loadingState - } else if let loadError, contacts.isEmpty { + } + + if let loadError, contacts.isEmpty { errorState(loadError) } else if contacts.isEmpty { emptyState diff --git a/yobble/Views/Tab/MainView.swift b/yobble/Views/Tab/MainView.swift index bae11eb..bdde7df 100644 --- a/yobble/Views/Tab/MainView.swift +++ b/yobble/Views/Tab/MainView.swift @@ -24,13 +24,13 @@ struct MainView: View { private var tabTitle: String { switch selectedTab { - case 0: return "Home" - case 1: return "Concept" - case 2: return "Chats" - case 3: return "Profile" - case 4: return "Contacts" - case 5: return "Settings" - default: return "Home" + case 0: return NSLocalizedString("Home", comment: "") + case 1: return NSLocalizedString("Concept", comment: "") + case 2: return NSLocalizedString("Чаты", comment: "") + case 3: return NSLocalizedString("Profile", comment: "") + case 4: return NSLocalizedString("Контакты", comment: "") + case 5: return NSLocalizedString("Настройки", comment: "") + default: return NSLocalizedString("Home", comment: "") } }