-
Notifications
You must be signed in to change notification settings - Fork 0
π ::(#55) Mypageμ ν΅μ ν κ²μ μ μ©νκΈ°μν 리νν λ§μ νμ΅λλ€. #61
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
a2bef59
:recycle: :: Component ν
kimjeakwan ed2e9bf
:recycle: :: onErrorToast μΆκ°
kimjeakwan b83c572
:recycle: :: typography μΆκ°
kimjeakwan 7be860e
:recycle: :: typography μΆκ°
kimjeakwan da8c735
:recycle: :: down νμ¬ν μΆκ°
kimjeakwan 33b969f
:recycle: :: List μμ
kimjeakwan 9e592b7
:recycle: :: List μμ
kimjeakwan eb8e3bf
:recycle: :: List μμ
kimjeakwan 309d1e1
:recycle: :: List μμ
kimjeakwan 8216bc5
:recycle: :: List μμ
kimjeakwan e7eb368
:recycle: :: List μμ
kimjeakwan dca1cc4
:recycle: :: fail μ dataclass λ‘ λ³κ²½
kimjeakwan b6d8b16
:recycle: :: Component ν
kimjeakwan b2f26d8
:recycle: :: Component ν
kimjeakwan e3b8c20
:recycle: :: Component ν
kimjeakwan 7632cc5
:recycle: :: onErrorToast λ³κ²½
kimjeakwan 13ffa41
:recycle: :: roomNum μΆκ°
kimjeakwan 9319785
:recycle: :: roomNum μΆκ°
kimjeakwan 2495c19
:recycle: :: roomNum μΆκ°
kimjeakwan 44532c1
:recycle: :: roomNum μΆκ°
kimjeakwan ff4b7a9
:recycle: :: roomNum μΆκ°
kimjeakwan 685574e
:recycle: :: roomNum μΆκ°
kimjeakwan 5508290
:recycle: :: uq νμ΄νμΆκ°
kimjeakwan 053c19d
:recycle: :: failμ exception μΆκ°
kimjeakwan f8deea6
:recycle: :: 곡백μμ
kimjeakwan 1c71ea9
Merge branch 'develop' into feature/55-mypage-network
kimjeakwan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -7,4 +7,5 @@ data class RankResponseModel( | |
| val rank: Int, | ||
| val name: String, | ||
| val penaltyPoint: Int, | ||
| val roomNum: Int, | ||
| ) | ||
This file contains hidden or 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 hidden or 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 hidden or 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
187 changes: 80 additions & 107 deletions
187
presentation/src/main/java/view/Mypage/Screen/MyPage.kt
This file contains hidden or 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 |
|---|---|---|
| @@ -1,140 +1,113 @@ | ||
| package view.Mypage.Screen | ||
|
|
||
| import androidx.activity.ComponentActivity | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.foundation.rememberScrollState | ||
| import androidx.compose.foundation.verticalScroll | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.LaunchedEffect | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableStateOf | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.text.AnnotatedString | ||
| import androidx.compose.ui.text.SpanStyle | ||
| import androidx.compose.ui.text.TextStyle | ||
| import androidx.compose.ui.text.font.FontWeight | ||
| import androidx.compose.ui.text.style.TextAlign | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.platform.LocalContext | ||
| import androidx.compose.ui.unit.dp | ||
| import androidx.compose.ui.unit.sp | ||
| import model.users.response.UsersResponseModel | ||
| import androidx.hilt.navigation.compose.hiltViewModel | ||
| import androidx.lifecycle.compose.collectAsStateWithLifecycle | ||
| import view.Mypage.component.DemeritList | ||
| import view.Mypage.component.MyDemeritList | ||
| import view.Mypage.component.MyClean | ||
| import viewmodel.users.UsersViewModel | ||
| import viewmodel.users.uistate.UsersUiState | ||
| import java.util.UUID | ||
|
|
||
| @Composable | ||
| internal fun MyPageRoute( | ||
| modifier: Modifier = Modifier, | ||
| onErrorToast: (throwable: Throwable?, message: Int?) -> Unit, | ||
| viewModel: UsersViewModel = hiltViewModel(LocalContext.current as ComponentActivity), | ||
| navigateToBack: () -> Unit, | ||
| ) { | ||
| val usersUiState by viewModel.usersUiState.collectAsStateWithLifecycle() | ||
|
|
||
| MyPage( | ||
| modifier = modifier, | ||
| onErrorToast = onErrorToast, | ||
| navigateToBack = navigateToBack, | ||
| usersUiState = usersUiState, | ||
| getUserCallBack = viewModel::getUsers, | ||
| ) | ||
|
|
||
| } | ||
|
|
||
| @Composable | ||
| fun MyPage( | ||
| modifier: Modifier = Modifier, | ||
| data:UsersResponseModel | ||
| onErrorToast: (throwable: Throwable?, message: Int?) -> Unit, | ||
| navigateToBack: () -> Unit, | ||
| usersUiState: UsersUiState, | ||
| getUserCallBack: (UUID) -> Unit, | ||
| ) { | ||
| val scrollState = rememberScrollState() | ||
| var uuid by remember { mutableStateOf(UUID.randomUUID()) } | ||
|
|
||
| ) { | ||
| LaunchedEffect(Unit) { | ||
| getUserCallBack(uuid) | ||
| } | ||
| Column( | ||
| modifier = modifier | ||
| .fillMaxSize() | ||
| .verticalScroll(scrollState) | ||
| .background(color = Color(0xFF1E1E1E)) | ||
| ) { | ||
| Column( | ||
| modifier = Modifier.fillMaxWidth(), | ||
| verticalArrangement = Arrangement.Top, | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .padding( | ||
| horizontal = 20.dp, | ||
| vertical = 16.dp, | ||
| ), | ||
| verticalArrangement = Arrangement.spacedBy(10.dp, Alignment.Top), | ||
| horizontalAlignment = Alignment.Start, | ||
| ) { | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .padding(start = 20.dp, end = 235.dp), | ||
| horizontalAlignment = Alignment.Start, | ||
| ) { | ||
| Text( | ||
| text = "μλ νμΈμ", style = TextStyle( | ||
| fontSize = 20.sp, | ||
| fontWeight = FontWeight(600), | ||
| color = Color(0xFFFFFFFF), | ||
| ) | ||
| ) | ||
| Text( | ||
| text = AnnotatedString.Builder("${data.name}λ").apply { | ||
| addStyle( | ||
| style = SpanStyle( | ||
| color = Color(0xFF9BFFA6), fontSize = 27.sp // μ΄μ° λΆλΆμ κΈμ ν¬κΈ° μ€μ | ||
| ), | ||
| start = 0, end = 2 | ||
| ) | ||
| }. | ||
| toAnnotatedString(), style = TextStyle( | ||
| fontSize = 22.sp, // κΈ°λ³Έ κΈμ ν¬κΈ° | ||
| fontWeight = FontWeight(900), | ||
| color = Color(0xFFFFFFFF), | ||
| textAlign = TextAlign.Start | ||
| ) | ||
| ) | ||
| } | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .padding( | ||
| horizontal = 20.dp, | ||
| vertical = 16.dp, | ||
| ), | ||
| verticalArrangement = Arrangement.spacedBy(10.dp, Alignment.Top), | ||
| horizontalAlignment = Alignment.Start, | ||
| ) { | ||
| MyClean( | ||
| modifier = modifier, | ||
| data.todayClean, | ||
| data.penaltyPoint, | ||
| data.cleanPoint, | ||
| ) | ||
|
|
||
| } | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .padding(start = 20.dp, end = 20.dp, bottom = 16.dp), | ||
| verticalArrangement = Arrangement.spacedBy(10.dp, Alignment.Top), | ||
| horizontalAlignment = Alignment.Start, | ||
| ) { | ||
| MyDemeritList( | ||
| modifier = modifier, | ||
| data.myBecause, | ||
| data.penaltyPoint, | ||
| ) | ||
| } | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .padding(start = 20.dp, end = 20.dp), | ||
| verticalArrangement = Arrangement.spacedBy(10.dp, Alignment.Top), | ||
| horizontalAlignment = Alignment.Start, | ||
| ) { | ||
| DemeritList( | ||
| modifier = modifier, | ||
| data.because, | ||
| data.pointList, | ||
| ) | ||
| } | ||
| MyClean( | ||
| usersUiState = usersUiState, | ||
| onErrorToast = onErrorToast, | ||
| modifier = modifier, | ||
| ) | ||
| } | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .padding(start = 20.dp, end = 20.dp, bottom = 16.dp), | ||
| verticalArrangement = Arrangement.spacedBy(10.dp, Alignment.Top), | ||
| horizontalAlignment = Alignment.Start, | ||
| ) { | ||
| MyDemeritList( | ||
| usersUiState = usersUiState, | ||
| onErrorToast = onErrorToast, | ||
| modifier = modifier, | ||
| ) | ||
| } | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .padding(start = 20.dp, end = 20.dp), | ||
| verticalArrangement = Arrangement.spacedBy(10.dp, Alignment.Top), | ||
| horizontalAlignment = Alignment.Start, | ||
| ) { | ||
| DemeritList( | ||
| usersUiState = usersUiState, | ||
| onErrorToast = onErrorToast, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| @Preview | ||
| fun PreviewMyPage() { | ||
| MyPage( | ||
| data = UsersResponseModel( | ||
| because = "λ ΈνΈλΆ", | ||
| cleanPoint = 3, | ||
| myBecause = "λ ΈνΈλΆ", | ||
| pointList = 3, | ||
| name = "μ΄μ°", | ||
| penaltyPoint = 1, | ||
| todayClean = "νμ₯μ€", | ||
| userId = UUID.randomUUID(), | ||
|
|
||
|
|
||
|
|
||
| ) | ||
| ) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
MyScreen μ»΄ν¬λνΈμ λ§€κ°λ³μκ° κ°μ λμμ΅λλ€.
μ€λ₯ μ²λ¦¬λ₯Ό μν
onErrorToastμ½λ°±μ΄ μΆκ°λμ΄ μ¬μ©μ κ²½νμ΄ ν₯μλμμ΅λλ€. νμ§λ§ νμ¬ κ΅¬νμμλ μ½λ°±μ΄ μ무 λμλ μννμ§ μμ΅λλ€.μ€μ μ€λ₯ λ©μμ§λ₯Ό νμνλ ν μ€νΈ ꡬνμ μΆκ°νλ κ²μ΄ μ’κ² μ΅λλ€. μμ ꡬνμ μνμλμ?