diff --git a/Application/Sources/Scene/Home/Meal/MealListCell.swift b/Application/Sources/Scene/Home/Meal/MealListCell.swift index 0b03560c..7d8d0c26 100644 --- a/Application/Sources/Scene/Home/Meal/MealListCell.swift +++ b/Application/Sources/Scene/Home/Meal/MealListCell.swift @@ -12,12 +12,13 @@ struct MealListCell: View { HStack(spacing: 0) { Text(entity.mealTime.toString()) .sdText( - type: .body2, - textColor: .GrayScale.gray800 + type: .body1, + textColor: entity.mealTime.checkIsNow() ? .Primary.purple300 : .GrayScale.gray800 ) .padding(.trailing, 10) + Spacer() Text(entity.kcal ?? "") - .sdText(type: .body4) + .sdText(type: .caption) } Spacer().frame(height: 8) ForEach( @@ -31,6 +32,11 @@ struct MealListCell: View { } .padding(EdgeInsets(top: 12, leading: 16, bottom: 0, trailing: 16)) .frame(width: 148, height: 198, alignment: .leading) + .overlay { + RoundedRectangle(cornerRadius: 8) + .stroke(lineWidth: 3) + .foregroundColor(entity.mealTime.checkIsNow() ? .Primary.purple100 : .clear) + } .background(Color.GrayScale.gray50) .cornerRadius(8) } diff --git a/Application/Sources/Scene/Home/Meal/MealMenuView.swift b/Application/Sources/Scene/Home/Meal/MealMenuView.swift index 9552aeb3..57c898de 100644 --- a/Application/Sources/Scene/Home/Meal/MealMenuView.swift +++ b/Application/Sources/Scene/Home/Meal/MealMenuView.swift @@ -15,32 +15,30 @@ struct MealMenuView: View { Spacer().frame(width: 12) Text("오늘의 메뉴").sdText(type: .body1) Spacer() - Button { - self.xquareRouter.navigateTo(.mealDetail) - } label: { - Image.viewMoreIcon - .resizable() - .frame(width: 24, height: 24) - .tint(.GrayScale.gray200) - } + Image.viewMoreIcon + .resizable() + .frame(width: 24, height: 24) + .tint(.GrayScale.gray200) Spacer().frame(width: 16) } Spacer().frame(height: 14) ScrollView(.horizontal, showsIndicators: false) { HStack(spacing: 8) { - Spacer().frame(width: 8) ForEach(menu, id: \.mealTime) { MealListCell( entity: $0 ) } - Spacer().frame(width: 8) } } + .padding(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16)) Spacer().frame(height: 16) } .background(Color.GrayScale.gray0) .cornerRadius(16) + .onTapGesture { + self.xquareRouter.navigateTo(.mealDetail) + } } } diff --git a/Application/Sources/Scene/MealDetail/Cell/MealMenuPerMealTimeView.swift b/Application/Sources/Scene/MealDetail/Cell/MealMenuPerMealTimeView.swift index 6d606d87..b23d6e77 100644 --- a/Application/Sources/Scene/MealDetail/Cell/MealMenuPerMealTimeView.swift +++ b/Application/Sources/Scene/MealDetail/Cell/MealMenuPerMealTimeView.swift @@ -18,8 +18,9 @@ struct MealMenuPerMealTimeView: View { type: .body2, textColor: .GrayScale.gray800 ) + Spacer() Text(entity.kcal ?? "") - .sdText(type: .body4) + .sdText(type: .body2) } .padding(.bottom, 4) Text(entity.menu?.joined(separator: ", ") ?? "") @@ -29,6 +30,7 @@ struct MealMenuPerMealTimeView: View { ) } .padding(.leading, 16) + .padding(.trailing, 14) } } } diff --git a/Services/MealDataService/Sources/Data/Local/DataSource/LocalDataSourceImpl.swift b/Services/MealDataService/Sources/Data/Local/DataSource/LocalDataSourceImpl.swift index 1b63dbbb..1465d197 100644 --- a/Services/MealDataService/Sources/Data/Local/DataSource/LocalDataSourceImpl.swift +++ b/Services/MealDataService/Sources/Data/Local/DataSource/LocalDataSourceImpl.swift @@ -51,7 +51,6 @@ class LocalDataSourceImpl: LocalDataSource { } catch { print("Error inserting meal menu: \(error.localizedDescription)") } - } } } diff --git a/Services/MealDataService/Sources/Domain/Enum/MealTime.swift b/Services/MealDataService/Sources/Domain/Enum/MealTime.swift index 0a36a4cf..25308f00 100644 --- a/Services/MealDataService/Sources/Domain/Enum/MealTime.swift +++ b/Services/MealDataService/Sources/Domain/Enum/MealTime.swift @@ -17,4 +17,17 @@ public extension MealTime { return "저녁" } } + + func checkIsNow() -> Bool { + let nowTime = Date() + var nowMeal: MealTime = .breakfast + if Int(nowTime.toString(format: "HH")) ?? 0 >= 13 && Int(nowTime.toString(format: "mm")) ?? 0 >= 30 { + nowMeal = .dinner + } else if Int(nowTime.toString(format: "HH")) ?? 0 >= 9 && Int(nowTime.toString(format: "mm")) ?? 0 >= 40 { + nowMeal = .lunch + } else { + nowMeal = .breakfast + } + return nowMeal == self + } }