Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👍 参加者情報の表示をカイゼン #134

Merged
merged 1 commit into from
Dec 8, 2023
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
@@ -1,9 +1,12 @@
package club.nito.feature.schedule.detail

import club.nito.core.domain.model.ParticipantSchedule
import club.nito.core.domain.model.ParticipantUser
import club.nito.core.model.participant.ParticipantStatus

public sealed class ScheduleDetailIntent {
public data class ClickParticipantUser(val user: ParticipantUser) : ScheduleDetailIntent()

public sealed class ClickParticipantStatusChip : ScheduleDetailIntent() {
public abstract val schedule: ParticipantSchedule
public abstract val status: ParticipantStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ package club.nito.feature.schedule.detail
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
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.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.calculateEndPadding
import androidx.compose.foundation.layout.calculateStartPadding
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
Expand Down Expand Up @@ -51,8 +52,7 @@ import club.nito.core.designsystem.component.CenterAlignedTopAppBar
import club.nito.core.designsystem.component.Scaffold
import club.nito.core.designsystem.component.Text
import club.nito.core.domain.model.ParticipantSchedule
import club.nito.core.domain.model.filterIsAttendance
import club.nito.core.domain.model.toUserProfileList
import club.nito.core.domain.model.ParticipantUser
import club.nito.core.model.FetchSingleContentResult
import club.nito.core.model.participant.ParticipantStatus
import club.nito.core.model.schedule.ScheduleId
Expand Down Expand Up @@ -172,7 +172,9 @@ private fun ScheduleDetailScreen(

ParticipantSection(
schedule = schedule.data,
onClickParticipantUser = { dispatch(ScheduleDetailIntent.ClickParticipantUser(it)) },
modifier = containerModifier,
contentPadding = PaddingValues(horizontal = 8.dp),
)
}

Expand Down Expand Up @@ -335,28 +337,52 @@ private fun MeetSection(
@Composable
private fun ParticipantSection(
schedule: ParticipantSchedule,
onClickParticipantUser: (ParticipantUser) -> Unit,
modifier: Modifier = Modifier,
contentPadding: PaddingValues = PaddingValues(),
) {
Column(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(16.dp),
verticalArrangement = Arrangement.spacedBy(24.dp),
) {
Text(
text = "参加者",
text = "参加情報",
modifier = Modifier.padding(contentPadding),
fontSize = 20.sp,
)
LazyRow(

Column(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.Start),
verticalAlignment = Alignment.CenterVertically,
) {
items(
items = schedule.users.filterIsAttendance().toUserProfileList(),
key = { profile -> profile.id },
) { profile ->
ProfileImage(
profile = profile,
modifier = Modifier.size(48.dp),
)
schedule.users.forEach { user ->
Row(
modifier = Modifier
.fillMaxWidth()
.clickable { onClickParticipantUser(user) }
.padding(contentPadding)
.padding(vertical = 8.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
ProfileImage(
profile = user.profile,
modifier = Modifier.size(48.dp),
)
Spacer(Modifier.width(16.dp))
Text(
text = user.profile.displayName,
modifier = Modifier.weight(1f),
)
Spacer(Modifier.width(16.dp))
Text(
text = when (user.status) {
ParticipantStatus.NONE -> ""
ParticipantStatus.PENDING -> "未定"
ParticipantStatus.ATTENDANCE -> "参加"
ParticipantStatus.ABSENCE -> "欠席"
},
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public class ScheduleDetailStateMachine(
public fun dispatch(intent: ScheduleDetailIntent) {
viewModelScope.launch {
when (intent) {
is ScheduleDetailIntent.ClickParticipantUser -> {
// TODO: ユーザー詳細画面へ遷移する
Comment on lines +64 to +65
Copy link

Choose a reason for hiding this comment

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

ClickParticipantUser イベントの処理ロジックが未実装です。ユーザー詳細画面への遷移を実装する必要があります。

}

is ScheduleDetailIntent.ClickParticipantStatusChip -> {
// NOTE: 失敗時の復元用キャッシュ
val cachedParticipantStatus = myParticipantStatus.value
Expand Down