change loading circle
This commit is contained in:
parent
dd2abde5b8
commit
7034503983
@ -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{
|
||||
|
||||
@ -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" : {
|
||||
|
||||
|
||||
@ -102,11 +102,11 @@ struct ChatsTab: View {
|
||||
|
||||
@ViewBuilder
|
||||
private var content: some View {
|
||||
if viewModel.isInitialLoading && viewModel.chats.isEmpty {
|
||||
loadingState
|
||||
} else {
|
||||
// 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()
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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: "")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user