-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #378 from 6QuizOnTheBlock/and/feat#373-matching_gr…
…oup_invite And/feat#373 matching group invite
- Loading branch information
Showing
19 changed files
with
772 additions
and
18 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
android/core/model/src/main/java/com/sixkids/model/MemberSimple.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
...dent/challenge/src/main/kotlin/com/sixkids/student/group/component/MatchedGroupWaiting.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
package com.sixkids.student.group.component | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyRow | ||
import androidx.compose.foundation.lazy.items | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.sixkids.designsystem.component.button.UlbanFilledButton | ||
import com.sixkids.designsystem.theme.Cream | ||
import com.sixkids.designsystem.theme.UlbanTypography | ||
import com.sixkids.model.MemberSimple | ||
import com.sixkids.student.challenge.R | ||
|
||
@Composable | ||
fun MatchedGroupWaiting( | ||
leader: MemberSimple = MemberSimple(), | ||
memberList: List<MemberSimple> = emptyList(), | ||
waitingMemberList: List<MemberSimple> = emptyList(), | ||
onDoneClick: () -> Unit = {}, | ||
onRemoveClick: (Long) -> Unit = {}, | ||
groupSize: Int = 0, | ||
) { | ||
Card( | ||
modifier = Modifier | ||
.padding(top = 16.dp) | ||
.fillMaxWidth(), | ||
shape = RoundedCornerShape( | ||
topStart = 12.dp, | ||
topEnd = 12.dp, | ||
bottomStart = 0.dp, | ||
bottomEnd = 0.dp | ||
), | ||
elevation = CardDefaults.cardElevation(16.dp), | ||
colors = CardDefaults.cardColors( | ||
containerColor = Cream | ||
) | ||
) { | ||
val remainingMember = groupSize - memberList.size - 1 | ||
Column( | ||
modifier = Modifier.padding(16.dp), | ||
verticalArrangement = Arrangement.spacedBy(16.dp) | ||
) { | ||
Text( | ||
modifier = Modifier.padding(top = 16.dp), | ||
text = if (remainingMember != 0) { | ||
stringResource(R.string.need_to_waiting_friend_message, remainingMember) | ||
} else { | ||
stringResource(R.string.can_create_group) | ||
}, | ||
style = UlbanTypography.bodyMedium | ||
) | ||
|
||
LazyRow( | ||
horizontalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
if (leader.id != 0L) { | ||
item { | ||
MemberIcon( | ||
memberIconItem = MemberIconItem( | ||
member = leader, | ||
showX = false, | ||
isActive = true | ||
), | ||
onRemoveClick = {} | ||
) | ||
} | ||
} | ||
items(memberList){ | ||
MemberIcon( | ||
memberIconItem = MemberIconItem( | ||
member = it, | ||
showX = false, | ||
isActive = true | ||
), | ||
onRemoveClick = onRemoveClick | ||
) | ||
} | ||
items(waitingMemberList){ | ||
MemberIcon( | ||
memberIconItem = MemberIconItem( | ||
member = it, | ||
showX = false, | ||
isActive = false | ||
) | ||
) | ||
} | ||
} | ||
UlbanFilledButton( | ||
modifier = Modifier.fillMaxWidth(), | ||
text = stringResource(R.string.done), | ||
onClick = onDoneClick, | ||
enabled = remainingMember == 0 | ||
) | ||
} | ||
} | ||
} | ||
|
||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun MatchedGroupWaitingPreview() { | ||
MatchedGroupWaiting( | ||
leader = MemberSimple( | ||
id = 1, | ||
name = "leader", | ||
photo = "" | ||
), | ||
waitingMemberList = List(4) { | ||
MemberSimple( | ||
id = it.toLong(), | ||
name = "member $it", | ||
photo = "", | ||
) | ||
}, | ||
groupSize = 5 | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...udent/group/create/CreateGroupContract.kt → .../group/create/free/CreateGroupContract.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../student/group/create/CreateGroupRoute.kt → ...ent/group/create/free/CreateGroupRoute.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...dent/group/create/CreateGroupViewModel.kt → ...group/create/free/CreateGroupViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ge/src/main/kotlin/com/sixkids/student/group/create/matched/MatchedCreateGroupContract.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.sixkids.student.group.create.matched | ||
|
||
import com.sixkids.model.MemberSimple | ||
import com.sixkids.ui.base.SideEffect | ||
import com.sixkids.ui.base.UiState | ||
|
||
data class MatchedCreateGroupState( | ||
val isLoading: Boolean = false, | ||
val isScanning: Boolean = false, | ||
val foundMembers: List<MemberSimple> = emptyList(), | ||
val showMembers: Array<MemberSimple?> = Array(5) { null }, | ||
val selectedMembers: List<MemberSimple> = emptyList(), | ||
val waitingMembers: List<MemberSimple> = emptyList(), | ||
val groupSize: Int = 0, | ||
val leader: MemberSimple = MemberSimple(), | ||
val roomKey: String = "", | ||
) : UiState | ||
|
||
|
||
sealed interface MatchedCreateGroupEffect : SideEffect { | ||
data object NavigateToChallengeHistory : | ||
MatchedCreateGroupEffect | ||
data class HandleException( | ||
val throwable: Throwable, | ||
val retryAction: () -> Unit | ||
) : MatchedCreateGroupEffect | ||
|
||
} |
Oops, something went wrong.