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 @@ -18,6 +18,7 @@ data class JoinedRoomResponse(
@SerialName("bookImageUrl") val bookImageUrl: String?,
@SerialName("roomTitle") val roomTitle: String,
@SerialName("memberCount") val memberCount: Int,
@SerialName("userPercentage") val userPercentage: Int
@SerialName("userPercentage") val userPercentage: Int,
@SerialName("deadlineDate") val deadlineDate: String? = null,
)

Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ data class RoomMainResponse(
@Serializable
data class RoomMainList(
@SerialName("deadlineRoomList") val deadlineRoomList: List<RoomMainResponse> = emptyList(),
@SerialName("popularRoomList") val popularRoomList: List<RoomMainResponse> = emptyList()
@SerialName("popularRoomList") val popularRoomList: List<RoomMainResponse> = emptyList(),
@SerialName("recentRoomList") val recentRoomList: List<RoomMainResponse> = emptyList()
)
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class RoomsRepository @Inject constructor(
response
}

/** 카테고리별 모임방 섹션 조회 (마감임박/인기) */
/** 카테고리별 모임방 섹션 조회 (마감임박/인기/최근 생성) */
suspend fun getRoomSections(
genre: Genre? = null
): Result<RoomMainList?> = runCatching {
Expand Down Expand Up @@ -141,11 +141,12 @@ class RoomsRepository @Inject constructor(
suspend fun searchRooms(
keyword: String,
category: String,
isAllCategory: Boolean = false,
sort: String = "deadline",
isFinalized: Boolean = false,
cursor: String? = null
): Result<RoomsSearchResponse?> = runCatching {
roomsService.searchRooms(keyword, category, sort, isFinalized, cursor)
roomsService.searchRooms(keyword, category, isAllCategory, sort, isFinalized, cursor)
.handleBaseResponse()
.getOrThrow()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ interface RoomsService {
@Query("cursor") cursor: String? = null
): BaseResponse<JoinedRoomListResponse>

/** 카테고리별 모임방 목록 조회 (마감임박/인기) */
/** 카테고리별 모임방 목록 조회 (마감임박/인기/최근 생성) */
@GET("rooms")
suspend fun getRooms(
@Query("category") category: String = "문학"
Expand Down Expand Up @@ -100,6 +100,7 @@ interface RoomsService {
suspend fun searchRooms(
@Query("keyword") keyword: String,
@Query("category") category: String,
@Query("isAllCategory") isAllCategory: Boolean = false,
@Query("sort") sort: String = "deadline",
@Query("isFinalized") isFinalized: Boolean = false,
@Query("cursor") cursor: String? = null
Expand All @@ -108,7 +109,7 @@ interface RoomsService {


/** 기록장 API들 */
@GET("rooms/{roomId}/playing")
@GET("rooms/{roomId}")
suspend fun getRoomsPlaying(
@Path("roomId") roomId: Int
): BaseResponse<RoomsPlayingResponse>
Expand Down
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기는 어떤 수정 사항이 있나요?

Copy link
Member Author

Choose a reason for hiding this comment

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

전체 모임방을 볼 수 있는 버튼이 생겼는데 이 컴포넌트와 동일해서 string을 받을 수 있도록 했고, onClick을 추가했습니다 !

Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,25 @@ fun MySubscribeBarlist(
}

@Composable
private fun EmptyMySubscriptionBar() {
fun EmptyMySubscriptionBar(
modifier: Modifier = Modifier,
text: String = stringResource(R.string.find_thip_mate),
onClick: () -> Unit = {}
) {
Comment on lines +134 to +138
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Composable 기본값에 stringResource 사용은 컴파일 오류를 유발합니다.

stringResource(...)@composable 컨텍스트에서만 호출 가능하므로 기본 파라미터 값에서 호출하면 빌드가 실패합니다. 리소스 ID를 기본으로 받고 본문에서 문자열을 해석하세요.

다음 수정안을 적용해 주세요:

 @Composable
 fun EmptyMySubscriptionBar(
-    modifier: Modifier = Modifier,
-    text: String = stringResource(R.string.find_thip_mate),
-    onClick: () -> Unit = {}
+    modifier: Modifier = Modifier,
+    @StringRes textResId: Int = R.string.find_thip_mate,
+    onClick: () -> Unit = {}
 ) {
+    val displayText = stringResource(textResId)
@@
-            text = text,
+            text = displayText,

파일 상단에 import 추가:

import androidx.annotation.StringRes

Also applies to: 152-153

🤖 Prompt for AI Agents
In app/src/main/java/com/texthip/thip/ui/feed/component/MySubscribelistBar.kt
around lines 134-138 (and similarly at 152-153), the composable currently uses
stringResource(...) as a default parameter which causes a compile error because
stringResource is only valid in a @Composable context; change the parameter to
accept a @StringRes Int resource ID (add import androidx.annotation.StringRes at
the top), give it a default resource ID (e.g. R.string.find_thip_mate), and
inside the composable body call stringResource(resId) to obtain the actual
String; apply the same pattern for the other affected composable at lines
152-153.

Box(
modifier = Modifier
modifier = modifier
.padding(top = 8.dp)
.fillMaxWidth()
.height(42.dp)
.clip(RoundedCornerShape(12.dp))
.background(colors.DarkGrey02)
.clickable { }
.clickable { onClick() }
) {
Text(
modifier = Modifier
.align(Alignment.CenterStart)
.padding(start = 12.dp),
text = stringResource(R.string.find_thip_mate),
text = text,
color = colors.White,
style = typography.view_m500_s12_h20
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ import com.texthip.thip.utils.rooms.RoomUtils
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun GroupDoneScreen(
onRoomClick: (Int) -> Unit = {},
onNavigateBack: () -> Unit = {},
viewModel: GroupDoneViewModel = hiltViewModel()
) {
val uiState by viewModel.uiState.collectAsState()

GroupDoneContent(
uiState = uiState,
onRoomClick = onRoomClick,
onNavigateBack = onNavigateBack,
onRefresh = { viewModel.refreshData() },
onLoadMore = { viewModel.loadMoreExpiredRooms() }
Expand All @@ -54,6 +56,7 @@ fun GroupDoneScreen(
@Composable
fun GroupDoneContent(
uiState: GroupDoneUiState,
onRoomClick: (Int) -> Unit = {},
onNavigateBack: () -> Unit = {},
onRefresh: () -> Unit = {},
onLoadMore: () -> Unit = {}
Expand Down Expand Up @@ -118,7 +121,7 @@ fun GroupDoneContent(
maxParticipants = room.recruitCount, // 모집 인원 수 사용
isRecruiting = RoomUtils.isRecruitingByType(room.type),
isSecret = !room.isPublic,
onClick = { /* 완료된 모임방은 클릭 불가 */ }
onClick = { onRoomClick(room.roomId) }
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fun GroupRoomDeadlineSection(
// Genre enum을 현지화된 문자열로 변환
val genreStrings = Genre.entries.toDisplayStrings()

// 마감 임박 방 목록과 인기 방 목록을 섹션으로 구성
// 마감 임박 방 목록, 인기 방 목록, 최신 생성 모임방을 섹션으로 구성
val roomSections = listOf(
Pair(
stringResource(R.string.room_section_deadline),
Expand All @@ -77,12 +77,18 @@ fun GroupRoomDeadlineSection(
Pair(
stringResource(R.string.room_section_popular),
roomMainList?.popularRoomList ?: emptyList()
)
),
Pair(
stringResource(R.string.room_section_recent),
roomMainList?.recentRoomList ?: emptyList()
),
)

val actualPageCount = roomSections.size

val effectivePagerState = rememberPagerState(
initialPage = 0,
pageCount = { roomSections.size }
initialPage = 2,
pageCount = { Int.MAX_VALUE }
)
Comment on lines +87 to 92
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

"무한 스와이프" 구현 불완전 — 초기 페이지가 2면 좌측(이전) 방향이 막힙니다

pageCount를 Int.MAX_VALUE로 두면서 initialPage=2는 시작점이 너무 앞쪽이라 0 이하로는 이동 불가합니다. 가운데 근처에서 시작하고 섹션 개수에 정렬되도록 초기 페이지를 계산하세요.

적용 제안:

-            val actualPageCount = roomSections.size
+            val actualPageCount = roomSections.size

-            val effectivePagerState = rememberPagerState(
-                initialPage = 2,
-                pageCount = { Int.MAX_VALUE }
-            )
+            val startPage = remember(actualPageCount) {
+                if (actualPageCount > 0) {
+                    val mid = Int.MAX_VALUE / 2
+                    mid - (mid % actualPageCount)
+                } else 0
+            }
+            val effectivePagerState = rememberPagerState(
+                initialPage = startPage,
+                pageCount = { if (actualPageCount > 0) Int.MAX_VALUE else 1 }
+            )
@@
-                val actualPage = page % actualPageCount
+                val actualPage = if (actualPageCount > 0) page % actualPageCount else 0

Also applies to: 100-102

🤖 Prompt for AI Agents
In
app/src/main/java/com/texthip/thip/ui/group/myroom/component/GroupDeadlineRoomSection.kt
around lines 87-92 (and also apply same change at lines ~100-102), the pager
uses pageCount = Int.MAX_VALUE with a fixed initialPage = 2 which prevents
swiping left past 0; compute an initial page positioned near the middle of the
Int.MAX_VALUE range but aligned to the actual number of sections: take center =
Int.MAX_VALUE / 2, subtract center % actualPageCount to align to a multiple of
actualPageCount, then add the desired small offset (e.g., 2) to get the
initialPage; replace the hardcoded initialPage with this computed value and
reuse the same logic for the other occurrence.


HorizontalPager(
Expand All @@ -91,7 +97,8 @@ fun GroupRoomDeadlineSection(
pageSpacing = pageSpacing,
modifier = Modifier.fillMaxWidth()
) { page ->
val (sectionTitle, rooms) = roomSections[page]
val actualPage = page % actualPageCount
val (sectionTitle, rooms) = roomSections[actualPage]

val isCurrent = effectivePagerState.currentPage == page
val scale = if (isCurrent) 1f else 0.94f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fun GroupMainCard(
)
Spacer(Modifier.width(2.dp))

Row (
Row(
verticalAlignment = Alignment.CenterVertically
) {
Text(
Expand All @@ -122,23 +122,39 @@ fun GroupMainCard(
}
Spacer(Modifier.height(16.dp))
// 닉네임 + 진행도
Row(verticalAlignment = Alignment.Bottom) {
Text(
text = stringResource(R.string.group_progress, userName),
color = colors.Grey02,
style = typography.view_m500_s14
)
Spacer(Modifier.width(4.dp))
Text(
text = "${data.userPercentage}",
color = colors.Purple,
style = typography.smalltitle_sb600_s16_h20
)
Text(
text = "%",
color = colors.Purple,
style = typography.menu_sb600_s12,
)
if (data.deadlineDate == null) {
Row(verticalAlignment = Alignment.Bottom) {
Text(
text = stringResource(R.string.group_progress, userName),
color = colors.Grey02,
style = typography.view_m500_s14
)
Spacer(Modifier.width(4.dp))
Text(
text = "${data.userPercentage}",
color = colors.Purple,
style = typography.smalltitle_sb600_s16_h20
)
Text(
text = "%",
color = colors.Purple,
style = typography.menu_sb600_s12,
)
}
} else {
Row(verticalAlignment = Alignment.Bottom) {
Text(
text = stringResource(R.string.until_start),
color = colors.Grey02,
style = typography.view_m500_s14
)
Spacer(Modifier.width(4.dp))
Text(
text = data.deadlineDate,
color = colors.Purple,
style = typography.smalltitle_sb600_s16_h20
)
}
}
Spacer(Modifier.height(10.dp))

Expand All @@ -153,7 +169,10 @@ fun GroupMainCard(
modifier = Modifier
.fillMaxWidth(fraction = percentage / 100f)
.fillMaxHeight()
.background(color = colors.Purple, shape = RoundedCornerShape(12.dp))
.background(
color = colors.Purple,
shape = RoundedCornerShape(12.dp)
)
)
}
Spacer(Modifier.height(2.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import com.texthip.thip.utils.rooms.advancedImePadding
@Composable
fun CommentBottomSheet(
uiState: CommentsUiState,
isExpired: Boolean = false,
onDismiss: () -> Unit,
onProfileClick: (userId: Long) -> Unit = {},
onShowToast: (String) -> Unit = {},
Expand Down Expand Up @@ -122,6 +123,7 @@ fun CommentBottomSheet(
} else {
CommentLazyList(
listState = listState,
isExpired = isExpired,
commentList = uiState.comments,
isLoadingMore = uiState.isLoadingMore,
isLastPage = uiState.isLast,
Expand All @@ -137,37 +139,40 @@ fun CommentBottomSheet(
selectedCommentForMenu = comment
},
onReplyLongPress = { reply -> selectedReplyForMenu = reply },
onProfileClick = onProfileClick
onProfileClick = onProfileClick,
onShowToast = onShowToast
)
}
}
}

CommentTextField(
modifier = Modifier
.fillMaxWidth()
.focusRequester(focusRequester),
hint = stringResource(R.string.reply_to),
input = inputText,
onInputChange = { inputText = it },
onSendClick = {
viewModel.onEvent(
CommentsEvent.CreateComment(
content = inputText,
parentId = replyingToCommentId
if (!isExpired) {
CommentTextField(
modifier = Modifier
.fillMaxWidth()
.focusRequester(focusRequester),
hint = stringResource(R.string.reply_to),
input = inputText,
onInputChange = { inputText = it },
onSendClick = {
viewModel.onEvent(
CommentsEvent.CreateComment(
content = inputText,
parentId = replyingToCommentId
)
)
)
inputText = ""
replyingToCommentId = null
replyingToNickname = null
focusManager.clearFocus()
},
replyTo = replyingToNickname,
onCancelReply = {
replyingToCommentId = null
replyingToNickname = null
}
)
inputText = ""
replyingToCommentId = null
replyingToNickname = null
focusManager.clearFocus()
},
replyTo = replyingToNickname,
onCancelReply = {
replyingToCommentId = null
replyingToNickname = null
}
)
}
}
}
}
Expand Down Expand Up @@ -224,6 +229,7 @@ fun CommentBottomSheet(
@Composable
private fun CommentLazyList(
listState: LazyListState,
isExpired: Boolean = false,
commentList: List<CommentList>,
isLoadingMore: Boolean,
isLastPage: Boolean,
Expand All @@ -232,7 +238,8 @@ private fun CommentLazyList(
onEvent: (CommentsEvent) -> Unit,
onCommentLongPress: (CommentList) -> Unit,
onReplyLongPress: (ReplyList) -> Unit,
onProfileClick: (userId: Long) -> Unit
onProfileClick: (userId: Long) -> Unit,
onShowToast: (String) -> Unit
) {
val isScrolledToEnd by remember {
derivedStateOf {
Expand Down Expand Up @@ -263,11 +270,13 @@ private fun CommentLazyList(
) { comment ->
CommentSection(
commentItem = comment,
isExpired = isExpired,
onReplyClick = onReplyClick,
onEvent = onEvent,
onCommentLongPress = onCommentLongPress,
onReplyLongPress = onReplyLongPress,
onProfileClick = onProfileClick
onProfileClick = onProfileClick,
onShowToast = onShowToast
)
}

Expand Down
Loading