Skip to content

Commit

Permalink
♻️ :: meal & teacher
Browse files Browse the repository at this point in the history
  • Loading branch information
rladmsdh committed Sep 18, 2023
1 parent 8a573ff commit 290f24a
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.xquare.xquare_android.feature.allmeal

import MealDetail
import android.util.Log
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
Expand All @@ -10,7 +8,6 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.xquare.xquare_android.feature.allmeal

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -56,51 +58,46 @@ fun MealDetail(
fontWeight = FontWeight.Medium
)
if (breakfast.isNotEmpty()) {
Spacer(Modifier.size(8.dp))
Row(verticalAlignment = Alignment.CenterVertically) {
Body1(text = "아침", color = gray800)
Spacer(Modifier.size(8.dp))
Body3(
text = mealWithDateEntity.caloriesOfBreakfast,
color = gray700,
modifier = Modifier
.fillMaxWidth()
.padding(3.dp)
.wrapContentWidth(align = Alignment.End)
)
}
Body2(text = breakfast, color = gray900)
Meal(
mealWithDateEntity = mealWithDateEntity,
meal = breakfast,
time = "아침",
)
}
if (lunch.isNotEmpty()) {
Spacer(Modifier.size(8.dp))
Row(verticalAlignment = Alignment.CenterVertically) {
Body1(text = "점심", color = gray800)
Body3(
text = mealWithDateEntity.caloriesOfLunch,
color = gray700,
modifier = Modifier
.fillMaxWidth()
.padding(3.dp)
.wrapContentWidth(align = Alignment.End)
)
}
Body2(text = lunch, color = gray900)
Meal(
mealWithDateEntity = mealWithDateEntity,
meal = lunch,
time = "점심",
)
}
if (dinner.isNotEmpty()) {
Spacer(Modifier.size(8.dp))
Row(verticalAlignment = Alignment.CenterVertically) {
Body1(text = "저녁", color = gray800)
Body3(
text = mealWithDateEntity.caloriesOfDinner,
color = gray700,
modifier = Modifier
.fillMaxWidth()
.padding(3.dp)
.wrapContentWidth(align = Alignment.End),
)
}
Body2(text = dinner, color = gray900)
Meal(
mealWithDateEntity = mealWithDateEntity,
meal = dinner,
time = "저녁",
)
}
}
}

@Composable
fun Meal(
mealWithDateEntity: AllMealEntity.MealWithDateEntity,
meal: String,
time: String,
) {
Spacer(Modifier.size(8.dp))
Row(verticalAlignment = Alignment.CenterVertically) {
Body1(text = time, color = gray800)
Body3(
text = mealWithDateEntity.caloriesOfLunch,
color = gray700,
modifier = Modifier
.fillMaxWidth()
.padding(3.dp)
.wrapContentWidth(align = Alignment.End)
)
}
Body2(text = meal, color = gray900)
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package com.xquare.xquare_android.feature.pick

import android.os.Build
import android.text.TextUtils
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.TextView
import androidx.annotation.RequiresApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -26,7 +22,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.scale
import androidx.compose.ui.graphics.painter.ColorPainter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
Expand All @@ -37,12 +32,10 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import coil.compose.rememberAsyncImagePainter
import coil.compose.AsyncImage
import com.semicolon.design.Body1
import com.semicolon.design.Subtitle2
import com.semicolon.design.Subtitle4
import com.semicolon.design.color.primary.gray.gray200
import com.semicolon.design.color.primary.gray.gray300
import com.semicolon.design.color.primary.gray.gray50
import com.semicolon.design.color.primary.gray.gray700
import com.semicolon.design.color.primary.gray.gray800
Expand Down Expand Up @@ -95,15 +88,12 @@ fun PassScreen(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
) {
Image(
AsyncImage(
modifier = Modifier
.size(60.dp)
.clip(CircleShape),
painter = rememberAsyncImagePainter(
model = passData.profile_file_name,
placeholder = ColorPainter(gray200),
error = painterResource(id = R.drawable.ic_profile_default)
),
model = passData.profile_file_name,
error = painterResource(id = R.drawable.ic_profile_default),
contentScale = ContentScale.Crop,
contentDescription = null,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
package com.xquare.xquare_android.feature.pick

import android.os.Build
import androidx.annotation.RequiresApi
import com.xquare.domain.entity.pick.PassDataEntity
import com.xquare.domain.usecase.pick.FetchPassDataUseCase
import com.xquare.xquare_android.base.BaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import javax.inject.Inject

@HiltViewModel
class PassViewModel @Inject constructor(
private val fetchPassDataUseCase: FetchPassDataUseCase
): BaseViewModel<PassViewModel.Event>() {
) : BaseViewModel<PassViewModel.Event>() {


private val _passData = MutableStateFlow(
PassDataEntity(
"","","","","","","", picnic_date = ""
"", "", "", "", "", "", "", picnic_date = ""
)
)
val passData: StateFlow<PassDataEntity> = _passData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.compose.ui.unit.dp
import com.semicolon.design.Body1
import com.semicolon.design.Body3
import com.semicolon.design.Subtitle4
import com.semicolon.design.color.primary.black.black
import com.semicolon.design.color.primary.gray.gray50
import com.xquare.domain.entity.point.PointHistoriesEntity
import org.threeten.bp.LocalDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ import androidx.compose.ui.unit.dp
import com.semicolon.design.Body1
import com.semicolon.design.Body2
import com.semicolon.design.color.primary.gray.gray50
import com.semicolon.design.color.primary.gray.gray700
import com.semicolon.design.color.primary.gray.gray800
import com.semicolon.design.color.primary.gray.gray900
import com.semicolon.design.color.primary.purple.purple200
import com.xquare.domain.entity.meal.AllMealEntity
import com.xquare.domain.entity.reports.ReleaseEntity
import com.xquare.xquare_android.util.toKorean


@Stable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ fun TodayTeacherDetail(
.background(color = gray50, shape = RoundedCornerShape(16.dp))
) {
for (floor in 0..4) {
if (teacherEntity.teacher[floor].isNotEmpty()) JunJaBoy(teacher = teacherEntity, floor = floor)
if (teacherEntity.teacher[floor].isNotEmpty()) TeacherFloor(teacher = teacherEntity, floor = floor)
}
}
}
}

@Composable
fun JunJaBoy(
fun TeacherFloor(
teacher: TodaySelfStudyTeacherEntity.TeacherEntity,
floor: Int
) {
Expand Down

0 comments on commit 290f24a

Please sign in to comment.