Skip to content

Commit

Permalink
refactor: GroupListScreen 개선(#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheonilyeong committed Jan 16, 2025
1 parent 02dbd23 commit 9e7fe96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ internal fun StudyGroupMemberItem(
ownerId: String?,
groupId: String?,
user: User,
isOwner: Boolean,
removeButtonClick: (String, String) -> Unit,
) {
Row(
Expand All @@ -46,7 +47,7 @@ internal fun StudyGroupMemberItem(
text = user.name,
style = MaterialTheme.typography.bodyLarge,
)
if (ownerId != user.id) {
if (isOwner && ownerId != user.id) {
Button(
onClick = {
if (groupId != null) {
Expand Down Expand Up @@ -76,6 +77,7 @@ private fun StudyGroupMemberItemPreview() {
ownerId = "user1",
groupId = "study1",
removeButtonClick = { _, _ -> },
isOwner = true,
user = User(
id = "user1",
name = "user1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import kr.boostcamp_2024.course.study.component.CustomPropertyTab
import kr.boostcamp_2024.course.study.component.StudyGroupMemberItem

@Composable
fun GroupListScreen(
internal fun GroupListScreen(
currentGroup: StudyGroup,
owner: User,
curUserId: String?,
Expand All @@ -35,6 +35,7 @@ fun GroupListScreen(
removeClick: (String, String) -> Unit,
) {
var showDialog by remember { mutableStateOf(false) }
val isOwner: Boolean = owner?.id == curUserId

Column(
modifier = Modifier
Expand Down Expand Up @@ -62,15 +63,17 @@ fun GroupListScreen(
groupId = currentGroup.id,
users = users,
removeClick = removeClick,
isOwner = isOwner,
)
}
}

@Composable
fun StudyGroupMemberLazyColumn(
private fun StudyGroupMemberLazyColumn(
owner: User,
groupId: String?,
users: List<User>,
isOwner: Boolean,
removeClick: (String, String) -> Unit,
) {
LazyColumn(
Expand All @@ -84,6 +87,7 @@ fun StudyGroupMemberLazyColumn(
groupId = groupId,
user = user,
removeButtonClick = removeClick,
isOwner = isOwner,
)
if (index < 9) {
HorizontalDivider()
Expand All @@ -94,7 +98,7 @@ fun StudyGroupMemberLazyColumn(

@Preview(showBackground = true, locale = "ko")
@Composable
fun GroupListScreenPreview() {
private fun GroupListScreenPreview() {
WeQuizTheme {
GroupListScreen(
currentGroup = StudyGroup(
Expand Down

0 comments on commit 9e7fe96

Please sign in to comment.