change loading circle
This commit is contained in:
parent
dd2abde5b8
commit
7034503983
@ -19,19 +19,23 @@ struct TopBarView: View {
|
|||||||
@Binding var chatSearchText: String
|
@Binding var chatSearchText: String
|
||||||
|
|
||||||
var isHomeTab: Bool {
|
var isHomeTab: Bool {
|
||||||
return title == "Home"
|
return title == NSLocalizedString("Home", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
var isChatsTab: Bool {
|
var isChatsTab: Bool {
|
||||||
return title == "Chats"
|
return title == NSLocalizedString("Чаты", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
var isProfileTab: Bool {
|
var isProfileTab: Bool {
|
||||||
return title == "Profile"
|
return title == NSLocalizedString("Profile", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
var isContactsTab: Bool {
|
var isContactsTab: Bool {
|
||||||
return title == "Contacts"
|
return title == NSLocalizedString("Контакты", comment: "")
|
||||||
|
}
|
||||||
|
|
||||||
|
var isSettingsTab: Bool {
|
||||||
|
return title == NSLocalizedString("Настройки", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
private var statusMessage: String? {
|
private var statusMessage: String? {
|
||||||
@ -62,7 +66,7 @@ struct TopBarView: View {
|
|||||||
}
|
}
|
||||||
// Spacer()
|
// Spacer()
|
||||||
|
|
||||||
if let statusMessage {
|
if let statusMessage, !isContactsTab, !isSettingsTab {
|
||||||
connectionStatusView(message: statusMessage)
|
connectionStatusView(message: statusMessage)
|
||||||
Spacer()
|
Spacer()
|
||||||
} else if isHomeTab{
|
} else if isHomeTab{
|
||||||
|
|||||||
@ -63,6 +63,9 @@
|
|||||||
},
|
},
|
||||||
"Companion ID" : {
|
"Companion ID" : {
|
||||||
"comment" : "Search placeholder companion title"
|
"comment" : "Search placeholder companion title"
|
||||||
|
},
|
||||||
|
"Concept" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"DEBUG UPDATE" : {
|
"DEBUG UPDATE" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@ -100,6 +103,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Home" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"OK" : {
|
"OK" : {
|
||||||
"comment" : "Common OK\nProfile update alert button",
|
"comment" : "Common OK\nProfile update alert button",
|
||||||
@ -139,6 +145,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Profile" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"profile_down_text_1" : {
|
"profile_down_text_1" : {
|
||||||
|
|
||||||
|
|||||||
@ -102,11 +102,11 @@ struct ChatsTab: View {
|
|||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var content: some View {
|
private var content: some View {
|
||||||
if viewModel.isInitialLoading && viewModel.chats.isEmpty {
|
// if viewModel.isInitialLoading && viewModel.chats.isEmpty {
|
||||||
loadingState
|
// loadingState
|
||||||
} else {
|
// }
|
||||||
chatList
|
chatList
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var chatList: some View {
|
private var chatList: some View {
|
||||||
@ -161,6 +161,10 @@ struct ChatsTab: View {
|
|||||||
// if let message = viewModel.errorMessage, viewModel.chats.isEmpty {
|
// if let message = viewModel.errorMessage, viewModel.chats.isEmpty {
|
||||||
// errorState(message: message)
|
// errorState(message: message)
|
||||||
// } else
|
// } else
|
||||||
|
if viewModel.isInitialLoading && viewModel.chats.isEmpty {
|
||||||
|
loadingState
|
||||||
|
}
|
||||||
|
|
||||||
if viewModel.chats.isEmpty {
|
if viewModel.chats.isEmpty {
|
||||||
emptyState
|
emptyState
|
||||||
} else {
|
} else {
|
||||||
@ -360,14 +364,26 @@ struct ChatsTab: View {
|
|||||||
.frame(maxWidth: .infinity)
|
.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 {
|
private var loadingState: some View {
|
||||||
VStack(spacing: 12) {
|
HStack {
|
||||||
|
Spacer()
|
||||||
ProgressView()
|
ProgressView()
|
||||||
Text(NSLocalizedString("Загружаем чаты…", comment: ""))
|
.progressViewStyle(CircularProgressViewStyle())
|
||||||
.font(.subheadline)
|
Spacer()
|
||||||
.foregroundColor(.secondary)
|
|
||||||
}
|
}
|
||||||
.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 {
|
private func errorState(message: String) -> some View {
|
||||||
@ -391,15 +407,15 @@ struct ChatsTab: View {
|
|||||||
|
|
||||||
private var emptyState: some View {
|
private var emptyState: some View {
|
||||||
VStack(spacing: 12) {
|
VStack(spacing: 12) {
|
||||||
Image(systemName: "bubble.left")
|
// Image(systemName: "bubble.left")
|
||||||
.font(.system(size: 48))
|
// .font(.system(size: 48))
|
||||||
.foregroundColor(.secondary)
|
// .foregroundColor(.secondary)
|
||||||
Text(NSLocalizedString("Пока что у вас нет чатов", comment: ""))
|
Text(NSLocalizedString("Пока что у вас нет чатов", comment: ""))
|
||||||
.font(.body)
|
.font(.body)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
Button(action: triggerChatsReload) {
|
// Button(action: triggerChatsReload) {
|
||||||
Text(NSLocalizedString("Обновить", comment: ""))
|
// Text(NSLocalizedString("Обновить", comment: ""))
|
||||||
}
|
// }
|
||||||
.buttonStyle(.bordered)
|
.buttonStyle(.bordered)
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
|
|||||||
@ -13,7 +13,9 @@ struct ContactsTab: View {
|
|||||||
List {
|
List {
|
||||||
if isLoading && contacts.isEmpty {
|
if isLoading && contacts.isEmpty {
|
||||||
loadingState
|
loadingState
|
||||||
} else if let loadError, contacts.isEmpty {
|
}
|
||||||
|
|
||||||
|
if let loadError, contacts.isEmpty {
|
||||||
errorState(loadError)
|
errorState(loadError)
|
||||||
} else if contacts.isEmpty {
|
} else if contacts.isEmpty {
|
||||||
emptyState
|
emptyState
|
||||||
|
|||||||
@ -24,13 +24,13 @@ struct MainView: View {
|
|||||||
|
|
||||||
private var tabTitle: String {
|
private var tabTitle: String {
|
||||||
switch selectedTab {
|
switch selectedTab {
|
||||||
case 0: return "Home"
|
case 0: return NSLocalizedString("Home", comment: "")
|
||||||
case 1: return "Concept"
|
case 1: return NSLocalizedString("Concept", comment: "")
|
||||||
case 2: return "Chats"
|
case 2: return NSLocalizedString("Чаты", comment: "")
|
||||||
case 3: return "Profile"
|
case 3: return NSLocalizedString("Profile", comment: "")
|
||||||
case 4: return "Contacts"
|
case 4: return NSLocalizedString("Контакты", comment: "")
|
||||||
case 5: return "Settings"
|
case 5: return NSLocalizedString("Настройки", comment: "")
|
||||||
default: return "Home"
|
default: return NSLocalizedString("Home", comment: "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user