i18n and empty view #29

Merged
lucas.delanier merged 2 commits from fix/empty-ranking into master 11 months ago

@ -179,4 +179,12 @@
/// Notification /// Notification
"notification_title_end_bet_date" = "Who will be the winners?"; "notification_title_end_bet_date" = "Who will be the winners?";
"notification_subtitle_end_bet_date %@" = "The %@ bet has reached its deadline. Go to the app to enter the winning answer."; "notification_subtitle_end_bet_date %@" = "The %@ bet has reached its deadline. Go to the app to enter the winning answer.";`
/// Empty Views
"empty_ranking_title" = "It's a bit empty around here";
"empty_ranking_explain" = "Add some friends to display them in the leaderboard";
"empty_bets_title"= "No bet matches your search";
"empty_friends_title" = "You don't have any friends yet";
"empty_friends_explain" = "Add them from this screen";

@ -180,3 +180,11 @@
"notification_title_end_bet_date" = "Qui seront les vainqueurs ?"; "notification_title_end_bet_date" = "Qui seront les vainqueurs ?";
"notification_subtitle_end_bet_date %@" = "Le pari %@ a atteint sa date limite. Rendez-vous dans l'application pour renseigner la réponse gagnante."; "notification_subtitle_end_bet_date %@" = "Le pari %@ a atteint sa date limite. Rendez-vous dans l'application pour renseigner la réponse gagnante.";
/// Empty Views
"empty_ranking_title" = "Cest un peu vide par ici";
"empty_ranking_explain" = "Ajoutez des amis pour les afficher dans le classement";
"empty_bets_title"= "Aucun Bet ne correspond à votre recherche";
"empty_friends_title" = "Vous navez pas encore damis";
"empty_friends_explain" = "Ajoutez les depuis cet écran";

@ -29,7 +29,7 @@ struct BetView: View {
Section { Section {
VStack(spacing: 20){ VStack(spacing: 20){
if(viewModel.bets.isEmpty){ if(viewModel.bets.isEmpty){
EmptyInfo(emoji:"🎮", title: "Aucun Bet ne correspond à votre recherche", explain: "") EmptyInfo(emoji:"🎮", title: String(localized: "empty_bets_title"), explain: "")
} }
else{ else{
ForEach(viewModel.bets, id: \.id) { (bet: Bet) in ForEach(viewModel.bets, id: \.id) { (bet: Bet) in

@ -47,7 +47,7 @@ struct FriendsView: View {
.padding(.horizontal, 10) .padding(.horizontal, 10)
} }
if(viewModel.users.isEmpty){ if(viewModel.users.isEmpty){
EmptyInfo(emoji:"👥", title: "Vous navez pas encore damis", explain: "Ajoutez les depuis cet écran").padding(.top, 40) EmptyInfo(emoji:"👥", title: String(localized: "empty_friends_title"), explain: String(localized: "empty_friends_explain")).padding(.top, 40)
} }
else{ else{

@ -20,7 +20,6 @@ struct RankingView: View {
.textStyle(weight: .bold, color: AllInColors.grey500Color, size: 25) .textStyle(weight: .bold, color: AllInColors.grey500Color, size: 25)
.padding([.top,.bottom], 15) .padding([.top,.bottom], 15)
if !viewModel.friends.isEmpty {
HStack { HStack {
if viewModel.friends.indices.contains(0) { if viewModel.friends.indices.contains(0) {
ZStack { ZStack {
@ -121,8 +120,12 @@ struct RankingView: View {
} }
} }
.padding([.leading, .trailing, .top], 20) .padding([.leading, .trailing, .top], 20)
}
if viewModel.friends.count == 1 {
EmptyInfo(emoji:"👀", title: String(localized: "empty_ranking_title"), explain: String(localized: "empty_ranking_explain")).padding(.top, 40)
}
else{
ScrollView(showsIndicators: false) { ScrollView(showsIndicators: false) {
ForEach(viewModel.friends.indices.dropFirst(2), id: \.self) { index in ForEach(viewModel.friends.indices.dropFirst(2), id: \.self) { index in
let friend = viewModel.friends[index] let friend = viewModel.friends[index]
@ -135,6 +138,7 @@ struct RankingView: View {
} }
} }
.padding(.top, 10) .padding(.top, 10)
}
Spacer() Spacer()
} }
.edgesIgnoringSafeArea(.bottom).background(AllInColors.backgroundColor) .edgesIgnoringSafeArea(.bottom).background(AllInColors.backgroundColor)

Loading…
Cancel
Save