Skip to content

Commit

Permalink
Merge pull request #133 from GSM-MSG/feature/#130_publishing_my_page
Browse files Browse the repository at this point in the history
🔀 :: (#130) - Publishing my page
  • Loading branch information
wjdcksdn authored Dec 6, 2023
2 parents b5c7932 + 60b1b1f commit 061a827
Show file tree
Hide file tree
Showing 16 changed files with 615 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,15 @@ fun PickerArrowIcon(
.width(24.dp)
.height(24.dp)
)
}

@Composable
fun SuccessIcon(
modifier: Modifier = Modifier
) {
Image(
painter = painterResource(id = R.drawable.ic_success),
contentDescription = "Success Icon",
modifier = modifier
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.msg.design_system.component.screen

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.msg.design_system.component.button.BitgoeulButton
import com.msg.design_system.component.icon.SuccessIcon
import com.msg.design_system.theme.BitgoeulAndroidTheme

@Composable
fun SuccessScreen(
modifier: Modifier,
title: String,
content: String,
buttonText: String,
buttonAction: () -> Unit
) {
BitgoeulAndroidTheme { colors, typography ->
Column(
modifier = modifier
.fillMaxSize()
.background(color = colors.WHITE)
.padding(horizontal = 28.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Spacer(modifier = modifier.height(228.dp))
SuccessIcon()
Spacer(modifier = modifier.height(24.dp))
Text(
text = title,
style = typography.titleMedium,
color = colors.BLACK
)
Text(
text = content,
style = typography.bodySmall,
color = colors.G2
)
Spacer(modifier = modifier.weight(1f))
BitgoeulButton(
modifier = modifier.fillMaxWidth(),
text = buttonText
) {
buttonAction()
}
Spacer(modifier = modifier.height(56.dp))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.msg.design_system.util

import androidx.compose.foundation.Indication
import androidx.compose.foundation.IndicationInstance
import androidx.compose.foundation.interaction.InteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.State
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.ContentDrawScope

object BitgoeulIndication : Indication {
private class DefaultDebugIndicationInstance(
private val isPressed: State<Boolean>
) : IndicationInstance {
override fun ContentDrawScope.drawIndication() {
drawContent()
if (isPressed.value) {
drawRect(color = Color.Gray.copy(alpha = 0.1f), size = size)
}
}
}

@Composable
override fun rememberUpdatedInstance(interactionSource: InteractionSource): IndicationInstance {
val isPressed = interactionSource.collectIsPressedAsState()
return remember(interactionSource) {
DefaultDebugIndicationInstance(isPressed)
}
}
}
18 changes: 18 additions & 0 deletions core/design-system/src/main/res/drawable/ic_success.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="120dp"
android:height="120dp"
android:viewportWidth="120"
android:viewportHeight="120">
<group>
<clip-path
android:pathData="M0,0h120v120h-120z"/>
<path
android:pathData="M60,60m-55,0a55,55 0,1 1,110 0a55,55 0,1 1,-110 0"
android:strokeWidth="10"
android:fillColor="#00000000"
android:strokeColor="#288BE1"/>
<path
android:pathData="M52.5,85C55.26,85 57.5,82.5 57.5,82.5L92.5,47.5C94.45,45.55 94.45,42.38 92.5,40.43C90.55,38.48 87.38,38.48 85.43,40.43L52.5,73.36L34.57,55.43C32.62,53.48 29.45,53.48 27.5,55.43C25.55,57.38 25.55,60.55 27.5,62.5L47.5,82.5C47.5,82.5 49.74,85 52.5,85Z"
android:fillColor="#288BE1"/>
</group>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ enum class Authority {
ROLE_STUDENT,
ROLE_TEACHER,
ROLE_BBOZZAK,
ROLE_PROFESSOR,
ROLE_COMPANY_INSTRUCTOR,
ROLE_GOVERNMENT
}
1 change: 1 addition & 0 deletions feature/my-page/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
8 changes: 8 additions & 0 deletions feature/my-page/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
id("bitgoeul.android.feature")
id("bitgoeul.android.hilt")
}

android {
namespace = "com.msg.my_page"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.my_page

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.my_page.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions feature/my-page/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
98 changes: 98 additions & 0 deletions feature/my-page/src/main/java/com/example/my_page/MyPageScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package com.example.my_page

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
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.example.my_page.component.AccountInfoView
import com.example.my_page.component.AccountSettingView
import com.example.my_page.component.MyInfoView
import com.msg.design_system.component.dialog.NegativeActionDialog
import com.msg.design_system.theme.BitgoeulAndroidTheme
import com.msg.model.remote.enumdatatype.Authority
import com.msg.model.remote.response.user.InquiryMyPageResponse

@Composable
fun MyPageScreen(
onPasswordChangeClicked: () -> Unit,
onLogOutClicked: () -> Unit,
onWithdrawClicked: () -> Unit,
data: InquiryMyPageResponse,
modifier: Modifier = Modifier
) {
val showDialog = remember { mutableStateOf(false) }

BitgoeulAndroidTheme { colors, typography ->
Column(
modifier = modifier
.fillMaxSize()
.background(color = colors.WHITE)
.padding(horizontal = 28.dp),
verticalArrangement = Arrangement.SpaceBetween
) {
Spacer(modifier = modifier.height(20.dp))
Text(
text = "내 정보",
style = typography.titleMedium,
color = colors.BLACK
)
Spacer(modifier = modifier.height(32.dp))
MyInfoView(
data = data,
modifier = modifier
)
Spacer(modifier = modifier.height(40.dp))
AccountInfoView(
data = data,
modifier = modifier
)
Spacer(modifier = modifier.height(68.dp))
AccountSettingView(
modifier = modifier,
onPasswordChangeClicked = onPasswordChangeClicked,
onLogOutClicked = onLogOutClicked,
onWithdrawClicked = {
showDialog.value = true
}
)
Spacer(modifier = modifier.height(24.dp))
}
NegativeActionDialog(
title = "회원 탈퇴하시겠습니까?",
negativeAction = "탈퇴",
content = "회원 탈퇴하면 계정을 복구할 수 없으며,\n회원가입을 다시 진행해야 합니다!",
isVisible = showDialog.value,
onQuit = { showDialog.value = false }
) {
onWithdrawClicked()
}
}
}

@Preview
@Composable
fun MyPageScreenPre() {
MyPageScreen(
onPasswordChangeClicked = {},
onLogOutClicked = {},
onWithdrawClicked = {},
data = InquiryMyPageResponse(
name = "채종인",
email = "bitgoeul@gmail.com",
phoneNumber = "010-0000-0000",
authority = Authority.ROLE_STUDENT,
organization = "광주소프트웨어마이스터고등학교/dev.GSM/2학년 3반 16번"
)
)
}
Loading

0 comments on commit 061a827

Please sign in to comment.