diff --git a/Sources/AllInApp/AllIn/Ressources/en.lproj/Localizable.strings b/Sources/AllInApp/AllIn/Ressources/en.lproj/Localizable.strings index eadccb7..bbe1d1f 100644 --- a/Sources/AllInApp/AllIn/Ressources/en.lproj/Localizable.strings +++ b/Sources/AllInApp/AllIn/Ressources/en.lproj/Localizable.strings @@ -179,4 +179,12 @@ /// Notification "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"; diff --git a/Sources/AllInApp/AllIn/Ressources/fr.lproj/Localizable.strings b/Sources/AllInApp/AllIn/Ressources/fr.lproj/Localizable.strings index 1ccb9ba..c93b188 100644 --- a/Sources/AllInApp/AllIn/Ressources/fr.lproj/Localizable.strings +++ b/Sources/AllInApp/AllIn/Ressources/fr.lproj/Localizable.strings @@ -180,3 +180,11 @@ "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."; + +/// Empty Views + +"empty_ranking_title" = "C’est 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 n’avez pas encore d’amis"; +"empty_friends_explain" = "Ajoutez les depuis cet écran"; diff --git a/Sources/AllInApp/AllIn/Views/BetView.swift b/Sources/AllInApp/AllIn/Views/BetView.swift index 6e4dea9..dcf093a 100644 --- a/Sources/AllInApp/AllIn/Views/BetView.swift +++ b/Sources/AllInApp/AllIn/Views/BetView.swift @@ -29,7 +29,7 @@ struct BetView: View { Section { VStack(spacing: 20){ if(viewModel.bets.isEmpty){ - EmptyInfo(emoji:"🎮", title: "Aucun Bet ne correspond à votre recherche", explain: "") + EmptyInfo(emoji:"🎮", title: String(localized: "empty_bets_title"), explain: "") } else{ ForEach(viewModel.bets, id: \.id) { (bet: Bet) in diff --git a/Sources/AllInApp/AllIn/Views/FriendsView.swift b/Sources/AllInApp/AllIn/Views/FriendsView.swift index 405db82..a32a211 100644 --- a/Sources/AllInApp/AllIn/Views/FriendsView.swift +++ b/Sources/AllInApp/AllIn/Views/FriendsView.swift @@ -47,7 +47,7 @@ struct FriendsView: View { .padding(.horizontal, 10) } if(viewModel.users.isEmpty){ - EmptyInfo(emoji:"👥", title: "Vous n’avez pas encore d’amis", 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{ diff --git a/Sources/AllInApp/AllIn/Views/RankingView.swift b/Sources/AllInApp/AllIn/Views/RankingView.swift index ea58507..b9e98d7 100644 --- a/Sources/AllInApp/AllIn/Views/RankingView.swift +++ b/Sources/AllInApp/AllIn/Views/RankingView.swift @@ -20,121 +20,125 @@ struct RankingView: View { .textStyle(weight: .bold, color: AllInColors.grey500Color, size: 25) .padding([.top,.bottom], 15) - if !viewModel.friends.isEmpty { - HStack { - if viewModel.friends.indices.contains(0) { - ZStack { - VStack(spacing: 0) { + HStack { + if viewModel.friends.indices.contains(0) { + ZStack { + VStack(spacing: 0) { + Spacer() + Text(viewModel.friends[0].username) + .fontWeight(.bold) + .padding(.bottom, 4) + .font(.system(size: 16)) + .lineLimit(1) + Divider() + .background(AllInColors.lightGrey100Color) + HStack { + Spacer() + Image("allcoinIcon") + .resizable() + .frame(width: 18, height: 18, alignment: .leading) + .padding([.top, .bottom], 10) + Text(String(viewModel.friends[0].nbCoins)) + .textStyle(weight: .black, color: AllInColors.lightPurpleColor, size: 16) + .padding(.trailing, 18) Spacer() - Text(viewModel.friends[0].username) - .fontWeight(.bold) - .padding(.bottom, 4) - .font(.system(size: 16)) - .lineLimit(1) - Divider() - .background(AllInColors.lightGrey100Color) - HStack { - Spacer() - Image("allcoinIcon") - .resizable() - .frame(width: 18, height: 18, alignment: .leading) - .padding([.top, .bottom], 10) - Text(String(viewModel.friends[0].nbCoins)) - .textStyle(weight: .black, color: AllInColors.lightPurpleColor, size: 16) - .padding(.trailing, 18) - Spacer() - } - .frame(width: geometry.size.width * 0.43) - .background(AllInColors.underComponentBackgroundColor) } - .frame(width: geometry.size.width * 0.43, height: 120) - .background(AllInColors.componentBackgroundColor) - .cornerRadius(41.5, corners: .topLeft) - .cornerRadius(8, corners: .topRight) - .cornerRadius(15, corners: [.bottomLeft, .bottomRight]) - - Image("defaultUserImage") - .resizable() - .frame(width: 70, height: 70) - .scaledToFit() - .cornerRadius(180) - .offset(x: 0, y: -55) - - Text("1") - .frame(width: 28, height: 28) - .foregroundColor(.white) - .background(AllInColors.lightPurpleColor) - .cornerRadius(30) - .font(.system(size: 18)) - .fontWeight(.bold) - .offset(x: 0, y: -23) + .frame(width: geometry.size.width * 0.43) + .background(AllInColors.underComponentBackgroundColor) } + .frame(width: geometry.size.width * 0.43, height: 120) + .background(AllInColors.componentBackgroundColor) + .cornerRadius(41.5, corners: .topLeft) + .cornerRadius(8, corners: .topRight) + .cornerRadius(15, corners: [.bottomLeft, .bottomRight]) + + Image("defaultUserImage") + .resizable() + .frame(width: 70, height: 70) + .scaledToFit() + .cornerRadius(180) + .offset(x: 0, y: -55) + + Text("1") + .frame(width: 28, height: 28) + .foregroundColor(.white) + .background(AllInColors.lightPurpleColor) + .cornerRadius(30) + .font(.system(size: 18)) + .fontWeight(.bold) + .offset(x: 0, y: -23) } - if viewModel.friends.indices.contains(1) { - ZStack { - VStack(spacing: 0) { + } + if viewModel.friends.indices.contains(1) { + ZStack { + VStack(spacing: 0) { + Spacer() + Text(viewModel.friends[1].username) + .fontWeight(.bold) + .padding(.bottom, 4) + .font(.system(size: 15)) + .lineLimit(1) + Divider() + .background(AllInColors.lightGrey100Color) + HStack { + Spacer() + Image("allcoinIcon") + .resizable() + .frame(width: 18, height: 18, alignment: .leading) + .padding([.top, .bottom], 10) + Text(String(viewModel.friends[1].nbCoins)) + .textStyle(weight: .black, color: AllInColors.lightPurpleColor, size: 16) + .padding(.trailing, 18) Spacer() - Text(viewModel.friends[1].username) - .fontWeight(.bold) - .padding(.bottom, 4) - .font(.system(size: 15)) - .lineLimit(1) - Divider() - .background(AllInColors.lightGrey100Color) - HStack { - Spacer() - Image("allcoinIcon") - .resizable() - .frame(width: 18, height: 18, alignment: .leading) - .padding([.top, .bottom], 10) - Text(String(viewModel.friends[1].nbCoins)) - .textStyle(weight: .black, color: AllInColors.lightPurpleColor, size: 16) - .padding(.trailing, 18) - Spacer() - } - .frame(width: geometry.size.width * 0.43) - .background(AllInColors.underComponentBackgroundColor) } - .frame(width: geometry.size.width * 0.43, height: 90) - .background(AllInColors.componentBackgroundColor) - .cornerRadius(27.5, corners: .topRight) - .cornerRadius(8, corners: .topLeft) - .cornerRadius(15, corners: [.bottomLeft, .bottomRight]) - - Image("defaultUserImage") - .resizable() - .frame(width: 50, height: 50) - .scaledToFit() - .cornerRadius(180) - .offset(x: 0, y: -50) - - Text("2") - .frame(width: 20, height: 20) - .foregroundColor(.white) - .background(AllInColors.lightPurpleColor) - .cornerRadius(30) - .font(.system(size: 14)) - .fontWeight(.bold) - .offset(x: 0, y: -28) + .frame(width: geometry.size.width * 0.43) + .background(AllInColors.underComponentBackgroundColor) } - .padding(.top, 28) + .frame(width: geometry.size.width * 0.43, height: 90) + .background(AllInColors.componentBackgroundColor) + .cornerRadius(27.5, corners: .topRight) + .cornerRadius(8, corners: .topLeft) + .cornerRadius(15, corners: [.bottomLeft, .bottomRight]) + + Image("defaultUserImage") + .resizable() + .frame(width: 50, height: 50) + .scaledToFit() + .cornerRadius(180) + .offset(x: 0, y: -50) + + Text("2") + .frame(width: 20, height: 20) + .foregroundColor(.white) + .background(AllInColors.lightPurpleColor) + .cornerRadius(30) + .font(.system(size: 14)) + .fontWeight(.bold) + .offset(x: 0, y: -28) } + .padding(.top, 28) } - .padding([.leading, .trailing, .top], 20) } + .padding([.leading, .trailing, .top], 20) - ScrollView(showsIndicators: false) { - ForEach(viewModel.friends.indices.dropFirst(2), id: \.self) { index in - let friend = viewModel.friends[index] - RankingRow( - number: index + 1, - image: "defaultUserImage", - pseudo: friend.username, - allCoins: friend.nbCoins - ) + 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) { + ForEach(viewModel.friends.indices.dropFirst(2), id: \.self) { index in + let friend = viewModel.friends[index] + RankingRow( + number: index + 1, + image: "defaultUserImage", + pseudo: friend.username, + allCoins: friend.nbCoins + ) + } } + .padding(.top, 10) } - .padding(.top, 10) Spacer() } .edgesIgnoringSafeArea(.bottom).background(AllInColors.backgroundColor)