Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
679f937
[feat]: 진행중인 방 상세보기 response 생성 (#66)
Nico1eKim Aug 6, 2025
26dffbd
[feat]: 진행중인 방 상세보기 service 생성 (#66)
Nico1eKim Aug 6, 2025
e3be5a6
[feat]: 진행중인 방 상세보기 repository 생성 (#66)
Nico1eKim Aug 6, 2025
184c9ed
[feat]: 진행중인 방 상세보기 service module 작성 (#66)
Nico1eKim Aug 6, 2025
7544a52
[feat]: 진행중인 방 상세보기 viewmodel 작성 (#66)
Nico1eKim Aug 6, 2025
d91f077
[refactor]: query에서 userId 제거 (#66)
Nico1eKim Aug 7, 2025
a4eafc5
[feat]: 진행중인 방 서버 데이터로 변경 (#66)
Nico1eKim Aug 7, 2025
53028d9
[refactor]: 장르 색상에 따라 컬러 수정 (#66)
Nico1eKim Aug 7, 2025
47b10f4
[feat]: 장르에 따라 배경 이미지, 색상 받아오는 enum 생성 (#66)
Nico1eKim Aug 7, 2025
b7b29bb
[refactor]: 장르에 맞는 배경 이미지 적용되도록 수정 (#66)
Nico1eKim Aug 7, 2025
a0eef55
[refactor]: mock data 안쓰도록 수정 (#66)
Nico1eKim Aug 7, 2025
546f8ba
[refactor]: 장르에 따라 색상 받아오도록 enum 생성하고 적용 (#66)
Nico1eKim Aug 7, 2025
606c6ba
[feat]: 독서메이트 response 생성 (#66)
Nico1eKim Aug 7, 2025
8cde610
[feat]: 독서메이트 service 작성 (#66)
Nico1eKim Aug 7, 2025
08b1cef
[feat]: 독서메이트 repository 작성 (#66)
Nico1eKim Aug 7, 2025
a2bb570
[feat]: 독서메이트 viewmodel 생성 (#66)
Nico1eKim Aug 7, 2025
e9cf5d6
[feat]: 서버에서 데이터 받아오기, 독서메이트로 navigation 구현 (#66)
Nico1eKim Aug 7, 2025
e1d6636
[refactor]: 프로필 이미지 string으로 수정 (#66)
Nico1eKim Aug 7, 2025
dabe5de
[ui]: action book button 배경색 수정 (#66)
Nico1eKim Aug 7, 2025
ea25c51
[chore]: 필요없는 mockup 삭제 (#66)
Nico1eKim Aug 7, 2025
b3b118c
[refactor]: pr리뷰 반영 (#66)
Nico1eKim Aug 8, 2025
7ca734f
Merge branch 'develop' into api/#66-rooms_playing
Nico1eKim Aug 8, 2025
d1bbea6
[refactor]: string 추출 (#66)
Nico1eKim Aug 8, 2025
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
10 changes: 8 additions & 2 deletions app/src/main/java/com/texthip/thip/data/di/ServiceModule.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package com.texthip.thip.data.di

import com.texthip.thip.data.service.RoomsService
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object ServiceModule {
// @Provides
// @Singleton
@Provides
@Singleton
fun providesRoomsService(retrofit: Retrofit): RoomsService =
retrofit.create(RoomsService::class.java)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.texthip.thip.data.model.rooms.response

import kotlinx.serialization.Serializable

@Serializable
data class RoomsPlayingResponse(
val isHost: Boolean,
val roomId: Int,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pk 값에 대한 대응을 한다면 Int 대신 Long 이 어떨까요 ??

val roomName: String,
val roomImageUrl: String,
val isPublic: Boolean,
val progressStartDate: String,
val progressEndDate: String,
val category: String,
val roomDescription: String,
val memberCount: Int,
val recruitCount: Int,
val isbn: String,
val bookTitle: String,
val authorName: String,
val currentPage: Int,
val userPercentage: Double,
val currentVotes: List<CurrentVote>
)

@Serializable
data class CurrentVote(
val content: String,
val page: Int,
val isOverview: Boolean,
val voteItems: List<VoteItem>
)

@Serializable
data class VoteItem(
val itemName: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.texthip.thip.data.model.rooms.response

import kotlinx.serialization.Serializable

@Serializable
data class RoomsUsersResponse(
val userList: List<UserList>
)

@Serializable
data class UserList(
val userId: Int,
val nickname: String,
val imageUrl: String,
val alias: String,
val followerCount: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.texthip.thip.data.repository

import com.texthip.thip.data.model.base.handleBaseResponse
import com.texthip.thip.data.service.RoomsService
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class RoomsRepository @Inject constructor(
private val roomsService: RoomsService,
) {
suspend fun getRoomsPlaying(
roomId: Int
) = runCatching {
roomsService.getRoomsPlaying(
roomId = roomId
).handleBaseResponse().getOrThrow()
}

suspend fun getRoomsUsers(
roomId: Int
) = runCatching {
roomsService.getRoomsUsers(
roomId = roomId
).handleBaseResponse().getOrThrow()
}
}
19 changes: 19 additions & 0 deletions app/src/main/java/com/texthip/thip/data/service/RoomsService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.texthip.thip.data.service

import com.texthip.thip.data.model.base.BaseResponse
import com.texthip.thip.data.model.rooms.response.RoomsPlayingResponse
import com.texthip.thip.data.model.rooms.response.RoomsUsersResponse
import retrofit2.http.GET
import retrofit2.http.Path

interface RoomsService {
@GET("rooms/{roomId}/playing")
suspend fun getRoomsPlaying(
@Path("roomId") roomId: Int
): BaseResponse<RoomsPlayingResponse>

@GET("rooms/{roomId}/users")
suspend fun getRoomsUsers(
@Path("roomId") roomId: Int
): BaseResponse<RoomsUsersResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fun ActionBookButton(
) {
Box(
modifier = Modifier
.background(color = colors.DarkGrey, shape = RoundedCornerShape(12.dp))
.background(color = colors.DarkGrey02, shape = RoundedCornerShape(12.dp))
.clickable {
onClick()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import com.texthip.thip.ui.theme.ThipTheme.typography
@Composable
fun CardNote(
currentPage: Int,
percentage: Int,
percentage: Double,
onClick: () -> Unit = { }
) {
Column(
Expand Down Expand Up @@ -85,7 +85,7 @@ fun CardNote(
) {
Box(
modifier = Modifier
.fillMaxWidth(fraction = percentage / 100f)
.fillMaxWidth(fraction = (percentage / 100f).toFloat())
.fillMaxHeight()
.background(color = colors.Purple, shape = RoundedCornerShape(12.dp))
)
Expand All @@ -98,7 +98,7 @@ fun CardNote(
private fun CardNotePreview() {
CardNote(
currentPage = 50,
percentage = 30,
percentage = 30.0,
onClick = { }
)
}
103 changes: 73 additions & 30 deletions app/src/main/java/com/texthip/thip/ui/common/cards/CardVote.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand All @@ -22,16 +23,15 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.texthip.thip.R
import com.texthip.thip.ui.common.buttons.GroupVoteButton
import com.texthip.thip.ui.group.room.mock.VoteData
import com.texthip.thip.ui.group.room.mock.mockVoteData
import com.texthip.thip.data.model.rooms.response.CurrentVote
import com.texthip.thip.data.model.rooms.response.VoteItem
import com.texthip.thip.ui.theme.ThipTheme.colors
import com.texthip.thip.ui.theme.ThipTheme.typography

@Composable
fun CardVote(
voteData: List<VoteData>,
onVoteClick: (VoteData) -> Unit = {}
voteData: List<CurrentVote>,
onVoteClick: (CurrentVote) -> Unit = {}
) {
val pageCount = voteData.size
val pagerState = rememberPagerState(pageCount = { pageCount })
Expand Down Expand Up @@ -70,7 +70,6 @@ fun CardVote(
modifier = Modifier.fillMaxWidth()
) { page ->
val vote = voteData[page]
val voteItems = vote.voteItems.take(3) // 최대 3개만

Column(
modifier = Modifier
Expand All @@ -80,35 +79,58 @@ fun CardVote(
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
Text(
text = vote.description,
text = vote.content,
style = typography.info_m500_s12,
color = colors.White,
)

GroupVoteButton(
voteItems = voteItems,
selectedIndex = null, // 표시용이므로 선택 없음
hasVoted = false, // 투표 상태 없음
onOptionSelected = { onVoteClick(vote) } // 어떤 항목을 눌러도 이동
)
vote.voteItems.forEachIndexed { index, item ->
Box(
modifier = Modifier
.fillMaxWidth()
.background(
color = colors.DarkGrey,
shape = RoundedCornerShape(12.dp)
)
.height(44.dp)
) {
Row(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
// text = "${index + 1}. ${item.itemName}",
text = stringResource(
R.string.numbering,
index + 1,
item.itemName
),
color = colors.White,
style = typography.feedcopy_r400_s14_h20
)
}
}
}
}
}
}

Row(
Modifier
.fillMaxWidth(),
horizontalArrangement = Arrangement.Center
) {
repeat(pageCount) { iteration ->
val color =
if (pagerState.currentPage == iteration) colors.White else colors.Grey02
Box(
modifier = Modifier
.padding(horizontal = 12.dp)
.background(color, CircleShape)
.size(4.dp)
)
}
Row(
Modifier
.fillMaxWidth(),
horizontalArrangement = Arrangement.Center
) {
repeat(pageCount) { iteration ->
val color =
if (pagerState.currentPage == iteration) colors.White else colors.Grey02
Box(
modifier = Modifier
.padding(horizontal = 12.dp)
.background(color, CircleShape)
.size(4.dp)
)
}
}
}
Expand All @@ -123,7 +145,28 @@ private fun CardVotePreview() {
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
CardVote(voteData = mockVoteData)
CardVote(voteData = emptyList())
CardVote(
voteData = listOf(
CurrentVote(
content = "3연에 나오는 심장은 무엇을 의미하는 걸까요?",
page = 12,
isOverview = false,
voteItems = listOf(
VoteItem("사랑"),
VoteItem("희생"),
VoteItem("고통"),
)
),
CurrentVote(
content = "가장 인상 깊었던 구절은 무엇인가요?",
page = 25,
isOverview = false,
voteItems = listOf(
VoteItem("1연 1행"),
VoteItem("2연 3행"),
)
)
)
)
}
}
35 changes: 11 additions & 24 deletions app/src/main/java/com/texthip/thip/ui/common/header/ProfileBar.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package com.texthip.thip.ui.common.header

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand All @@ -19,21 +16,20 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.texthip.thip.R
import com.texthip.thip.ui.theme.Grey
import com.texthip.thip.ui.theme.ThipTheme
import com.texthip.thip.ui.theme.ThipTheme.colors
import com.texthip.thip.ui.theme.ThipTheme.typography

@Composable
fun ProfileBar(
modifier: Modifier = Modifier,
profileImage: Painter?,
profileImage: String,
topText: String,
bottomText: String,
bottomTextColor: Color = colors.NeonGreen, // todo: 서버에서 색 보내주는걸로 받기?
Expand All @@ -48,22 +44,13 @@ fun ProfileBar(
.clickable { onClick() },
verticalAlignment = Alignment.CenterVertically
) {
if (profileImage != null) {
Image(
painter = profileImage,
contentDescription = "프로필 이미지",
modifier = Modifier
.size(36.dp)
.clip(CircleShape)
)
} else {
Box(
modifier = Modifier
.size(36.dp)
.clip(CircleShape)
.background(Grey)
)
}
AsyncImage(
model = profileImage,
contentDescription = "프로필 이미지",
modifier = Modifier
.size(36.dp)
.clip(CircleShape)
)
Spacer(modifier = Modifier.width(8.dp))
Column(
modifier = Modifier.weight(1f),
Expand Down Expand Up @@ -119,14 +106,14 @@ fun PreviewProfileBar() {
ThipTheme {
Column {
ProfileBar(
profileImage = null,
profileImage = "문학_image",
topText = "user.01",
bottomText = stringResource(R.string.influencer),
showSubscriberInfo = true,
subscriberCount = 77
)
ProfileBar(
profileImage = null,
profileImage = "문학_image",
topText = "user.04",
bottomText = stringResource(R.string.influencer),
showSubscriberInfo = false,
Expand Down
Loading