Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,36 @@ import coil.request.ImageRequest
import com.paw.key.R
import com.paw.key.core.designsystem.theme.PawKeyTheme
import com.paw.key.core.designsystem.theme.Gray100
import com.paw.key.domain.model.entity.walklist.CategoryTop3Entity

@Composable
fun CourseDetail(
title: String,
petName: String,
date: String,
location: String,
distance: String,
time: String,
option: List<String>,
onImageClick: () -> Unit,
title : String,
petName : String,
date : String,
location : String,
isLike : Boolean,
content : String,
petProfileImage : String,
routeMapImageUrl : String,
categorySummary : List<String>,
categoryTop3 : List<CategoryTop3Entity>,
totalReviewCount : Int,
walkingImageUrls : List<String>,


onImageClick: (String) -> Unit,
modifier: Modifier = Modifier
) {
val isLiked = remember { mutableStateOf(false) }

Column(
modifier = modifier
.fillMaxWidth()
) {
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data("https://pawkey-server.com/image.jpg")
.data(routeMapImageUrl)
.crossfade(true)
.build(),
contentDescription = null,
Expand All @@ -65,6 +75,7 @@ fun CourseDetail(
.fillMaxWidth()
.height(244.dp)
.background(color = Gray100)
.background(Color.Gray)
)

Column(
Expand All @@ -89,7 +100,6 @@ fun CourseDetail(
style = PawKeyTheme.typography.head20Sb,
color = PawKeyTheme.colors.black
)
val isLiked = remember { mutableStateOf(false) }

Icon(
imageVector = if (isLiked.value) {
Expand All @@ -111,11 +121,16 @@ fun CourseDetail(
.fillMaxWidth()
.padding(vertical = 12.dp)
) {
Box(
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data(petProfileImage)
.crossfade(true)
.build(),
contentDescription = null,
modifier = Modifier
.size(40.dp)
.background(Color.Gray, RoundedCornerShape(20.dp))
.size(44.dp)
)

Text(
text = petName,
style = PawKeyTheme.typography.body16Sb,
Expand Down Expand Up @@ -145,7 +160,7 @@ fun CourseDetail(
)
Spacer(modifier = Modifier.width(6.dp))
Text(
text = "$date | $time",
text = date,
style = PawKeyTheme.typography.body14M,
color = PawKeyTheme.colors.gray400
)
Expand All @@ -158,9 +173,11 @@ fun CourseDetail(
modifier = Modifier
.padding(vertical = 13.dp)
) {
SubChip(text = distance)
SubChip(text = time)
SubChip(text = location)
categorySummary.forEach {
SubChip(
text = it
)
}
}

Spacer(modifier = Modifier.height(12.dp))
Expand All @@ -171,19 +188,25 @@ fun CourseDetail(
.padding(vertical = 12.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
item {
Box(
items(walkingImageUrls.size) { index ->
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data(walkingImageUrls[index])
.crossfade(true)
.build(),
contentDescription = null,
modifier = Modifier
.width(100.dp)
.height(100.dp)
.background(Color.LightGray)
.clickable { onImageClick() }
.clip(RoundedCornerShape(8.dp))
.clickable { onImageClick(walkingImageUrls[index]) },
contentScale = ContentScale.Crop
)
}
}

Text(
text = "후기 글 본문 후기 글 본문 후기 글 본문",
text = content,
style = PawKeyTheme.typography.body14R
)
Spacer(modifier = Modifier.height(12.dp))
Expand All @@ -208,6 +231,8 @@ fun CourseDetail(

Column(modifier = Modifier.padding(horizontal = 16.dp)) {
Row(
modifier = Modifier
.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Text(
Expand All @@ -224,31 +249,27 @@ fun CourseDetail(
)
Spacer(modifier = Modifier.width(4.dp))
Text(
text = "후기숫자를 적으세요",
text = totalReviewCount.toString(),
style = PawKeyTheme.typography.caption12M,
color = PawKeyTheme.colors.gray200,
)
}

if (option.isEmpty()) {
if (categoryTop3.isEmpty()) {
Text(
text = "아직은 후기가 없어요.",
style = PawKeyTheme.typography.body16Sb,
color = PawKeyTheme.colors.gray400
color = PawKeyTheme.colors.gray400,
modifier = Modifier
.align(Alignment.CenterHorizontally)
)
} else {
option.forEachIndexed { index, tag ->
val percentage = when (index) {
0 -> 1f
1 -> 0.8f
2 -> 0.6f
else -> 1f
}

val backgroundColor = when (index) {
0 -> PawKeyTheme.colors.green300
1 -> PawKeyTheme.colors.green200
2 -> PawKeyTheme.colors.green100
categoryTop3.forEach { tag ->
val fillRatio = (tag.percentage.coerceIn(0, 100)) / 100f
val backgroundColor = when (tag.rank) {
1 -> PawKeyTheme.colors.green300
2 -> PawKeyTheme.colors.green200
3 -> PawKeyTheme.colors.green100
else -> PawKeyTheme.colors.green500
}

Expand All @@ -257,21 +278,21 @@ fun CourseDetail(
.fillMaxWidth()
.padding(vertical = 4.dp)
.height(37.dp)
.background(PawKeyTheme.colors.gray100, RoundedCornerShape(6.dp))
.background(PawKeyTheme.colors.white2, RoundedCornerShape(6.dp))
) {
Box(
modifier = Modifier
.fillMaxWidth(percentage)
.fillMaxWidth(fillRatio)
.fillMaxHeight()
.background(backgroundColor, RoundedCornerShape(6.dp))
) {
Text(
text = tag,
color = Color.Black,
text = tag.optionText,
color = PawKeyTheme.colors.black,
modifier = Modifier
.align(Alignment.CenterStart)
.padding(horizontal = 16.dp),
style = PawKeyTheme.typography.body16Sb
style = PawKeyTheme.typography.caption12Sb2
)
}
}
Expand All @@ -282,20 +303,28 @@ fun CourseDetail(
}



@Preview(showBackground = true)
@Composable
fun CourseDetailPreview() {
PawKeyTheme {
CourseDetail(
title = "홍대 주변 좋은 산책 코스",
petName = "반려견 이름",
date = "2025/05/17",
petName = "핑구",
date = "2025/06/30",
location = "홍대입구역",
distance = "3km",
time = "1시간 소요",
option = listOf("조용해요", "가로등 많아요", "산책로 깨끗해요"),
isLike = true,
content = "산책로가 깨끗하고 벚꽃이 예뻐요!",
petProfileImage = "https://pawkey-server.com/image/profile.png",
routeMapImageUrl = "https://pawkey-server.com/image/map.png",
categoryTop3 = listOf(
),
totalReviewCount = 42,
walkingImageUrls = listOf(
"https://pawkey-server.com/image/walk1.jpg",
"https://pawkey-server.com/image/walk2.jpg"
),
categorySummary = listOf("안전", "편리성"),
onImageClick = {},
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ fun ImageModal(
.padding(bottom = 8.dp)
.size(24.dp)
)

AsyncImage(
model = imageUrl,
contentDescription = null,
modifier = Modifier
)

// AsyncImage(
// model = ImageRequest.Builder(LocalContext.current)
// .data("https://pawkey-server.com/image.jpg") // ← 서버에서 받은 이미지 URL 넣깅
Expand All @@ -55,11 +62,11 @@ fun ImageModal(
// contentDescription = null,
// modifier = Modifier
// )
Image( //테스트용!!
/*Image( //테스트용!!
painter = painterResource(id = R.drawable.test),
contentDescription = null,
modifier = Modifier
)
)*/
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.paw.key.core.designsystem.theme.PawKeyTheme
import com.paw.key.core.util.noRippleClickable

@Preview
@Composable
Expand All @@ -34,7 +35,7 @@ fun SubChip(
color = if (isActionChip) PawKeyTheme.colors.white2 else PawKeyTheme.colors.green50,
shape = RoundedCornerShape(20.dp)
)
.clickable(onClick = onClick)
.noRippleClickable(onClick = onClick)
.padding(horizontal = 10.dp, vertical = 4.dp)
) {
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ data class FilterOptionResponse(
data class CategoryDto(
@SerialName("categoryId")
val categoryId: Int? = null,
@SerialName("categoryDescription")
val categoryDescription: String? = null,
@SerialName("categoryName")
val categoryName: String? = null,
@SerialName("categoryOptions")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ data class WalkReviewCategoryResponseDto(
@Serializable
data class CategoryResponseDto(
val categoryId : Int,
val categoryDescription : String,
val categoryName : String,
val categoryOptions : List<OptionsResponseDto>
) {
fun toEntity() = WalkReviewCategoryEntity(
categoryId = categoryId,
categoryDescription = categoryDescription,
categoryName = categoryName,
options = categoryOptions.map { it.toEntity() }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ class FilterOptionRepositoryImpl @Inject constructor(
val filterEntity = FilterEntity(
categoryList = try {
response.data.categoryList.map { categoryDto ->
println(" - Category: ${categoryDto.categoryName}")
Category(
categoryId = categoryDto.categoryId ?: 0,
categoryName = categoryDto.categoryName ?: "",
categoryOptions = categoryDto.categoryOptions?.map { optionDto ->
println(" - CategoryOption: ${optionDto.categoryOptionText}")
CategoryOption(
categoryOptionId = optionDto.categoryOptionId ?: 0,
categoryOptionText = optionDto.categoryOptionText ?: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ data class SelectOptionItem(
data class Category(
val categoryId: Int = 0,
val categoryName: String = "",
val categoryDescription: String? = null,
val categoryOptions: List<CategoryOption>? = null
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ data class WalkReviewCategoryListEntity(

data class WalkReviewCategoryEntity(
val categoryId : Int,
val categoryDescription : String,
val categoryName : String,
val options : List<WalkReviewOptionOptionsResponseEntity>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.paw.key.presentation.ui.community

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -34,10 +38,17 @@ fun CommunityScreen(
snackBarHostState: SnackbarHostState,
modifier: Modifier = Modifier,
) {
Text(
text = stringResource(R.string.ic_community_description),
modifier = modifier,
)
Column (
modifier = modifier
.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
){
Text(
text = stringResource(R.string.ic_community_description),
modifier = modifier
)
}
}

@Preview
Expand Down
Loading