Skip to content

Commit c6c3bc1

Browse files
authored
Merge pull request #54 from rbqks529/ui/#53-group_qa
[UI] 모임방 페이지 QA
2 parents 1d57638 + a55f7c1 commit c6c3bc1

41 files changed

Lines changed: 671 additions & 303 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/src/main/java/com/texthip/thip/ui/common/cards/CardItemRoom.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fun CardItemRoom(
6161
)
6262
.clickable { onClick() },
6363
colors = CardDefaults.cardColors(
64-
containerColor = colors.DarkGrey50
64+
containerColor = colors.DarkGrey
6565
),
6666
shape = RoundedCornerShape(12.dp)
6767
) {
@@ -88,7 +88,7 @@ fun CardItemRoom(
8888
}
8989
}
9090

91-
Spacer(modifier = Modifier.width(16.dp))
91+
Spacer(modifier = Modifier.width(12.dp))
9292

9393
Column(
9494
modifier = Modifier
@@ -148,8 +148,6 @@ fun CardItemRoom(
148148
style = typography.menu_sb600_s12,
149149
color = colors.White
150150
)
151-
Spacer(modifier = Modifier.width(2.dp))
152-
153151
Text(
154152
text = stringResource(R.string.card_item_participant_string),
155153
style = typography.info_m500_s12,

app/src/main/java/com/texthip/thip/ui/common/cards/CardItemRoomSmall.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fun CardItemRoomSmall(
5252
modifier
5353
.width(232.dp)
5454
}
55-
val bgColor = if (isWide) colors.Black else colors.DarkGrey50
55+
val bgColor = if (isWide) colors.Black else colors.DarkGrey
5656

5757
Card(
5858
modifier = cardModifier
@@ -100,8 +100,9 @@ fun CardItemRoomSmall(
100100
Column(
101101
modifier = Modifier.fillMaxWidth()
102102
) {
103-
Spacer(modifier = Modifier.height(4.dp))
103+
104104
Text(
105+
modifier = Modifier.padding(top = 4.dp),
105106
text = title,
106107
color = colors.White,
107108
style = if (isWide) typography.smalltitle_sb600_s18_h24 else typography.menu_sb600_s14_h24,
@@ -142,7 +143,7 @@ fun CardItemRoomSmall(
142143
)
143144
}
144145
}
145-
Spacer(modifier = Modifier.height(4.dp))
146+
Spacer(modifier = Modifier.height(7.dp))
146147

147148
endDate?.let {
148149
Text(

app/src/main/java/com/texthip/thip/ui/common/cards/CardRoomBook.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ fun CardRoomBook(
134134
)
135135

136136
}
137-
Spacer(modifier = Modifier.height(21.dp))
138137

139138
Text(
139+
modifier = Modifier.padding(top = 21.dp),
140140
text = stringResource(R.string.card_book_explain),
141141
color = colors.White,
142142
style = typography.info_m500_s12,

app/src/main/java/com/texthip/thip/ui/common/forms/SearchBookTextField.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fun SearchBookTextField(
8989

9090
if (text.isNotEmpty()) {
9191
Icon(
92-
painter = painterResource(id = R.drawable.ic_x_circle_grey),
92+
painter = painterResource(id = R.drawable.ic_x_circle_grey02),
9393
contentDescription = "Clear text",
9494
modifier = Modifier
9595
.clickable { onValueChange("") },

app/src/main/java/com/texthip/thip/ui/common/forms/WarningTextField.kt

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,12 @@ fun WarningTextField(
8282
),
8383
trailingIcon = {
8484
if (showIcon) {
85-
if (value.isNotEmpty()) {
86-
Icon(
87-
painter = painterResource(id = R.drawable.ic_x_circle_white),
88-
contentDescription = "Clear text",
89-
modifier = Modifier.clickable { onValueChange("")},
90-
tint = Color.Unspecified
91-
)
92-
} else {
93-
Icon(
94-
painter = painterResource(id = R.drawable.ic_x_circle),
95-
contentDescription = "Clear text"
96-
)
97-
}
85+
Icon(
86+
painter = painterResource(id = R.drawable.ic_x_circle_grey),
87+
contentDescription = "Clear text",
88+
modifier = Modifier.clickable { onValueChange("") },
89+
tint = Color.Unspecified
90+
)
9891
}
9992
},
10093
singleLine = true,
@@ -159,9 +152,8 @@ fun WarningTextFieldPreviewNormal() {
159152
contentAlignment = Alignment.Center
160153
) {
161154
WarningTextField(
162-
163155
value = text,
164-
onValueChange = { text = it },
156+
onValueChange = { text = it },
165157
hint = "인풋 텍스트",
166158
showWarning = false,
167159
showIcon = true,

app/src/main/java/com/texthip/thip/ui/group/makeroom/component/GroupBookListWithScrollbar.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,23 @@ fun GroupBookListWithScrollbar(
3939
.verticalScroll(scrollState)
4040
.drawVerticalScrollbar(scrollState)
4141
) {
42-
books.forEach { book ->
42+
books.forEachIndexed { index, book ->
4343
CardBookSearch(
4444
title = book.title,
4545
imageRes = book.imageRes,
4646
onClick = { onBookClick(book) }
4747
)
4848

49-
Spacer(modifier = Modifier.height(12.dp))
50-
Spacer(modifier = Modifier
51-
.fillMaxWidth()
52-
.padding(end = 6.dp)
53-
.height(1.dp)
54-
.background(color = colors.Grey02)
55-
)
56-
Spacer(modifier = Modifier.height(12.dp))
49+
if (index < books.size - 1) {
50+
Spacer(modifier = Modifier.height(12.dp))
51+
Spacer(modifier = Modifier
52+
.fillMaxWidth()
53+
.padding(end = 6.dp)
54+
.height(1.dp)
55+
.background(color = colors.Grey02)
56+
)
57+
Spacer(modifier = Modifier.height(12.dp))
58+
}
5759
}
5860
}
5961
}

app/src/main/java/com/texthip/thip/ui/group/makeroom/component/GroupBookSearchBottomSheet.kt

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
66
import androidx.compose.foundation.layout.height
77
import androidx.compose.foundation.layout.padding
88
import androidx.compose.runtime.Composable
9+
import androidx.compose.runtime.derivedStateOf
910
import androidx.compose.runtime.getValue
1011
import androidx.compose.runtime.mutableIntStateOf
1112
import androidx.compose.runtime.mutableStateOf
@@ -33,15 +34,29 @@ fun GroupBookSearchBottomSheet(
3334
savedBooks: List<BookData> = emptyList(),
3435
groupBooks: List<BookData> = emptyList()
3536
) {
36-
// 책이 있는지 여부 체크
3737
val hasBooks = savedBooks.isNotEmpty() || groupBooks.isNotEmpty()
3838
var selectedTab by rememberSaveable { mutableIntStateOf(0) }
3939
val tabs = listOf(
4040
stringResource(R.string.group_saved_book), stringResource(R.string.group_book)
4141
)
42-
val books = if (selectedTab == 0) savedBooks else groupBooks
42+
4343
var searchText by rememberSaveable { mutableStateOf("") }
4444

45+
val currentBooks = if (selectedTab == 0) savedBooks else groupBooks
46+
47+
val filteredBooks by remember(currentBooks, searchText) {
48+
derivedStateOf {
49+
if (searchText.isEmpty()) {
50+
currentBooks
51+
} else {
52+
currentBooks.filter { book ->
53+
book.title.contains(searchText, ignoreCase = true) ||
54+
(book.author?.contains(searchText, ignoreCase = true) == true)
55+
}
56+
}
57+
}
58+
}
59+
4560
CustomBottomSheet(
4661
onDismiss = onDismiss
4762
) {
@@ -55,7 +70,7 @@ fun GroupBookSearchBottomSheet(
5570
hint = stringResource(R.string.group_book_search_hint),
5671
text = searchText,
5772
onValueChange = { searchText = it },
58-
onSearch = { /* 검색 구현 */ },
73+
onSearch = { /* 이미 실시간으로 필터링됨 */ },
5974
)
6075
Spacer(Modifier.height(20.dp))
6176
}
@@ -64,7 +79,10 @@ fun GroupBookSearchBottomSheet(
6479
HeaderMenuBarTab(
6580
titles = tabs,
6681
selectedTabIndex = selectedTab,
67-
onTabSelected = { selectedTab = it },
82+
onTabSelected = {
83+
selectedTab = it
84+
// searchText = ""
85+
},
6886
indicatorColor = ThipTheme.colors.White,
6987
modifier = Modifier.fillMaxWidth()
7088
)
@@ -75,13 +93,23 @@ fun GroupBookSearchBottomSheet(
7593
.padding(start = 20.dp, end = 20.dp, bottom = 20.dp)
7694
) {
7795
Spacer(Modifier.height(20.dp))
78-
if (books.isEmpty()) {
79-
EmptyBookSheetContent(onRequestBook = onRequestBook)
80-
} else {
81-
GroupBookListWithScrollbar(
82-
books = books,
83-
onBookClick = onBookSelect
84-
)
96+
97+
when {
98+
currentBooks.isEmpty() -> {
99+
EmptyBookSheetContent(onRequestBook = onRequestBook)
100+
}
101+
filteredBooks.isEmpty() && searchText.isNotEmpty() -> {
102+
SearchEmptyContent(
103+
searchText = searchText,
104+
onRequestBook = onRequestBook
105+
)
106+
}
107+
else -> {
108+
GroupBookListWithScrollbar(
109+
books = filteredBooks,
110+
onBookClick = onBookSelect
111+
)
112+
}
85113
}
86114
}
87115
} else {
@@ -97,7 +125,16 @@ fun GroupBookSearchBottomSheet(
97125
}
98126
}
99127

100-
128+
// 검색 결과가 없을 때 표시할 컴포넌트 (필요시 구현)
129+
@Composable
130+
private fun SearchEmptyContent(
131+
searchText: String,
132+
onRequestBook: () -> Unit
133+
) {
134+
// 검색 결과가 없을 때의 UI
135+
// 예: "'{searchText}'에 대한 검색 결과가 없습니다" 메시지와 책 요청 버튼
136+
EmptyBookSheetContent(onRequestBook = onRequestBook)
137+
}
101138

102139
@Preview(showBackground = true)
103140
@Composable

app/src/main/java/com/texthip/thip/ui/group/makeroom/component/GroupDatePicker.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@ fun GroupDatePicker(
3939
val month = selectedDate.monthValue
4040
val day = selectedDate.dayOfMonth
4141

42-
// 유효한 범위 계산
43-
val years = (minDate.year..maxDate.year).toList()
44-
val months = (1..12).toList()
45-
val days = (1..selectedDate.lengthOfMonth()).toList()
42+
// 유효한 범위 계산 - 날짜 변경 시 안정성을 위해 remember 사용
43+
val years = remember(minDate.year, maxDate.year) {
44+
(minDate.year..maxDate.year).toList()
45+
}
46+
val months = remember { (1..12).toList() }
47+
val days = remember(year, month) {
48+
(1..LocalDate.of(year, month, 1).lengthOfMonth()).toList()
49+
}
4650

4751
Row(
4852
modifier = modifier.fillMaxWidth(),
@@ -105,7 +109,7 @@ fun GroupDatePicker(
105109
GroupWheelPicker(
106110
modifier = Modifier.width(32.dp),
107111
items = days,
108-
selectedItem = day,
112+
selectedItem = day.coerceAtMost(days.max()),
109113
onItemSelected = { newDay ->
110114
val newDate = LocalDate.of(year, month, newDay)
111115
onDateSelected(newDate)

app/src/main/java/com/texthip/thip/ui/group/makeroom/component/GroupEmptyBookSheetContent.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import com.texthip.thip.R
1919
import com.texthip.thip.ui.common.buttons.ActionMediumButton
2020
import com.texthip.thip.ui.theme.ThipTheme
2121
import com.texthip.thip.ui.theme.ThipTheme.colors
22+
import com.texthip.thip.ui.theme.ThipTheme.typography
2223

2324
@Composable
2425
fun EmptyBookSheetContent(
@@ -30,16 +31,16 @@ fun EmptyBookSheetContent(
3031
.padding(bottom = 30.dp),
3132
horizontalAlignment = Alignment.CenterHorizontally
3233
) {
33-
Icon(
34-
painter = painterResource(id = R.drawable.ic_notification),
35-
contentDescription = null,
36-
tint = colors.Grey02
34+
Text(
35+
text = stringResource(R.string.group_register_book_comment_1),
36+
color = colors.Grey,
37+
style = typography.copy_m500_s14_h20
3738
)
38-
Spacer(Modifier.height(12.dp))
39+
3940
Text(
40-
text = stringResource(R.string.group_register_book_comment),
41-
color = ThipTheme.colors.Grey02,
42-
style = ThipTheme.typography.copy_m500_s14_h20
41+
text = stringResource(R.string.group_register_book_comment_2),
42+
color = colors.Grey,
43+
style = typography.copy_m500_s14_h20
4344
)
4445
Spacer(Modifier.height(24.dp))
4546

app/src/main/java/com/texthip/thip/ui/group/makeroom/component/GroupMemberLimitPicker.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ import androidx.compose.material3.Text
1010
import androidx.compose.runtime.Composable
1111
import androidx.compose.runtime.getValue
1212
import androidx.compose.runtime.mutableIntStateOf
13-
import androidx.compose.runtime.mutableStateOf
1413
import androidx.compose.runtime.remember
1514
import androidx.compose.runtime.setValue
1615
import androidx.compose.ui.Alignment
1716
import androidx.compose.ui.Modifier
1817
import androidx.compose.ui.res.stringResource
19-
import androidx.compose.ui.text.style.TextAlign
2018
import androidx.compose.ui.tooling.preview.Preview
2119
import androidx.compose.ui.unit.dp
2220
import com.texthip.thip.R
@@ -25,7 +23,7 @@ import com.texthip.thip.ui.theme.ThipTheme.colors
2523
import com.texthip.thip.ui.theme.ThipTheme.typography
2624

2725
@Composable
28-
fun MemberLimitPicker(
26+
fun GroupMemberLimitPicker(
2927
modifier: Modifier = Modifier,
3028
selectedCount: Int = 30,
3129
onCountSelected: (Int) -> Unit = { }
@@ -76,7 +74,7 @@ fun MemberLimitPickerPreview() {
7674
ThipTheme {
7775
var selectedCount by remember { mutableIntStateOf(30) }
7876

79-
MemberLimitPicker(
77+
GroupMemberLimitPicker(
8078
selectedCount = selectedCount,
8179
onCountSelected = { selectedCount = it }
8280
)

0 commit comments

Comments
 (0)