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

[feature/#841] 마이페이지 compose 리팩토링 #854

Merged
merged 42 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b03d14f
feat #841: compose 추가
leeeyubin Sep 12, 2024
07713a9
feat #841: mypage UI 구현
leeeyubin Sep 16, 2024
cdf75aa
[feature/#841] mypage UI 구현
leeeyubin Sep 16, 2024
ee2778b
[feature/#841] mypage LaunchedEffect 구현
leeeyubin Sep 16, 2024
fac5ee1
[feature/#841] SignOut UI
leeeyubin Sep 17, 2024
bf9998e
[feature/#841] make MyPageButton
leeeyubin Sep 17, 2024
7d98a63
[feature/#841] make AdjustSentence UI
leeeyubin Sep 17, 2024
8edbe5a
[feature/#841] make AdjustSentence UI
leeeyubin Sep 17, 2024
4c4f66f
[feature/#841] fix fontStyle
leeeyubin Sep 17, 2024
3e8ba39
[feature/#841] make MyPage Dialog
leeeyubin Sep 17, 2024
e21ca0f
[feature/#841] make Soptamp Dialog
leeeyubin Sep 17, 2024
f008af8
[feature/#841] make MyPageTopBar Component
leeeyubin Sep 17, 2024
b019008
[feature/#841] make logout Dialog
leeeyubin Sep 17, 2024
56e8f78
[feature/#841] delete AlertDialogPositiveNegative.kt
leeeyubin Sep 17, 2024
8133da3
[feature/#841] delete color
leeeyubin Sep 17, 2024
9119127
[feature/#841] make MyPageSection
leeeyubin Sep 17, 2024
afb7488
[feature/#841] make MyPageSection
leeeyubin Sep 17, 2024
e71fcf6
[feature/#841] change Dialog logic
leeeyubin Sep 17, 2024
19794cd
[chore/#841] fix code
leeeyubin Sep 17, 2024
12a0d50
[feature/#841] MIT License
leeeyubin Sep 18, 2024
f13250f
[feature/#841] resolving conflict
leeeyubin Sep 18, 2024
1e3b4b4
[fix/#841] Fix build issues (due to conflicts)
l2hyunwoo Sep 18, 2024
ab0d1d0
[fix/#841] kspplugin 2.0.20-1.0.25 -> 2.0.20-1.0.24
leeeyubin Sep 18, 2024
f20195e
[fix/#841] kspplugin 2.0.20-1.0.24 -> 2.0.20-1.0.25
leeeyubin Sep 18, 2024
ca3b1e9
[fix/#841] resolving conflict
leeeyubin Sep 24, 2024
2b96203
[fix/#841] onButtonClick -> onClick
leeeyubin Sep 24, 2024
c6239ad
[fix/#841] onButtonClick -> onClick
leeeyubin Sep 24, 2024
9834a95
[fix/#841] paddingShape -> shape
leeeyubin Sep 24, 2024
96eba0f
[fix/#841] add vertical
leeeyubin Sep 24, 2024
eddf9a3
[fix/#841] slot API 적용
leeeyubin Sep 24, 2024
52dbd50
[fix/#841] remove MyPageButton fillMaxWidth()
leeeyubin Sep 25, 2024
a247848
[fix/#841] onIconClick -> onNavigationIconClick
leeeyubin Sep 25, 2024
bdb041a
[fix/#841] delete activity layout
leeeyubin Sep 25, 2024
524029c
[fix/#841] delete get()
leeeyubin Sep 25, 2024
1443f05
[fix/#841] resolving conflict
leeeyubin Sep 25, 2024
614f92a
[fix/#841] change List to ImmutableList
leeeyubin Sep 25, 2024
38dbedb
[fix/#841] delete StringResources
leeeyubin Sep 25, 2024
ec770b6
[fix/#841] fix dialog padding
leeeyubin Sep 25, 2024
c41961b
[fix/#841] fix section padding
leeeyubin Sep 25, 2024
8d76b7b
[fix/#841] delete dialog StringResources
leeeyubin Sep 25, 2024
e5e7f87
[fix/#841] delete ResultCode
leeeyubin Sep 25, 2024
b40e17b
[feature/#841] MIT License
leeeyubin Sep 25, 2024
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
4,076 changes: 1,934 additions & 2,142 deletions app/src/release/generated/baselineProfiles/baseline-prof.txt

Large diffs are not rendered by default.

4,076 changes: 1,934 additions & 2,142 deletions app/src/release/generated/baselineProfiles/startup-prof.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions feature/mypage/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

plugins {
sopt("feature")
sopt("compose")
}

android {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* MIT License
* Copyright 2024 SOPT - Shout Our Passion Together
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.sopt.official.feature.mypage.component

import androidx.annotation.StringRes
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp
import org.sopt.official.designsystem.Black
import org.sopt.official.designsystem.Gray300
import org.sopt.official.designsystem.Gray600
import org.sopt.official.designsystem.White

@Composable
fun MyPageButton(
paddingShape: Dp,
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
style: TextStyle,
paddingVertical: Dp,
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
@StringRes text: Int,
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
onButtonClick: () -> Unit,
modifier: Modifier = Modifier,
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
isEnabled: Boolean = true,
containerColor: Color = White,
contentColor: Color = Black
Copy link
Member

Choose a reason for hiding this comment

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

onButtonClick이라는 이름 보다는 개발자에게 익숙한 onClick을 하는건 어떨까요? 클릭되는 부분이 2개 이상이라면 이름을 지어주는게 좋지만, 하나만 있다면 익숙한 이름 네이밍이 사용하기 편할거같아요

Copy link
Member

Choose a reason for hiding this comment

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

저는 매개변수를 받을 때 "해당값이 없다면 컴포넌트가 목적에 맞는 형태를 가질 수 없는가?"를 기준으로 옵셔널과 필수를 결정해요. 그렇기 때문에 대부분의 값은 저라면 옵셔널로 할 것 같습니다.

그리고 text라는 value를 받아오기 보다 Composable을 받아오는건 어떨까요? 이 컴포넌트를 호출하는 곳에서 Text에 대한 설정을 해준다면 더욱 재사용성이 좋을 것 같아요

) {
Button(
contentPadding = PaddingValues(paddingVertical),
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
modifier = modifier.fillMaxWidth(),
enabled = isEnabled,
colors = ButtonDefaults.buttonColors(
containerColor = containerColor,
contentColor = contentColor,
disabledContainerColor = Gray600,
disabledContentColor = Gray300
),
shape = RoundedCornerShape(paddingShape),
onClick = onButtonClick
) {
Text(
text = stringResource(id = text),
style = style,
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/*
* MIT License
* Copyright 2024 SOPT - Shout Our Passion Together
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.sopt.official.feature.mypage.component

import androidx.annotation.StringRes
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import org.sopt.official.designsystem.Gray10
import org.sopt.official.designsystem.Gray100
import org.sopt.official.designsystem.Gray600
import org.sopt.official.designsystem.Gray700
import org.sopt.official.designsystem.SoptTheme
import org.sopt.official.designsystem.White
import org.sopt.official.feature.mypage.R

@Composable
fun MyPageDialog(
onDismissRequest: () -> Unit,
@StringRes title: Int,
@StringRes subTitle: Int,
@StringRes negativeText: Int,
@StringRes positiveText: Int,
modifier: Modifier = Modifier,
properties: DialogProperties = DialogProperties(usePlatformDefaultWidth = false),
onPositiveButtonClick: () -> Unit = {}
) {
Dialog(
onDismissRequest = onDismissRequest,
properties = properties,
) {
Column(
modifier = modifier
.wrapContentSize()
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
.padding(horizontal = 25.dp)
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
.background(
color = Gray700,
shape = RoundedCornerShape(10.dp)
),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Spacer(modifier = Modifier.height(26.dp))
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
Text(
text = stringResource(id = title),
color = White,
style = SoptTheme.typography.heading16B
)
Spacer(modifier = Modifier.height(28.dp))
Text(
text = stringResource(id = subTitle),
color = Gray100,
style = SoptTheme.typography.body14M,
textAlign = TextAlign.Center,
)
Spacer(modifier = Modifier.height(34.dp))
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 7.dp)
) {
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
MyPageButton(
modifier = Modifier.weight(1f),
paddingShape = 10.dp,
style = SoptTheme.typography.body14M,
paddingVertical = 9.dp,
text = negativeText,
onButtonClick = onDismissRequest,
containerColor = Gray600,
contentColor = Gray10
)
Spacer(modifier = Modifier.width(6.dp))
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
MyPageButton(
modifier = Modifier.weight(1f),
paddingShape = 10.dp,
style = SoptTheme.typography.body14M,
paddingVertical = 9.dp,
text = positiveText,
onButtonClick = onPositiveButtonClick,
)
}
Spacer(modifier = Modifier.height(12.dp))
leeeyubin marked this conversation as resolved.
Show resolved Hide resolved
}
}
}

@Preview(showBackground = true)
@Composable
fun MyPageDialogPreview() {
SoptTheme {
MyPageDialog(
onDismissRequest = {},
title = R.string.mypage_alert_soptamp_reset_title,
subTitle = R.string.mypage_alert_soptamp_reset_subtitle,
negativeText = R.string.mypage_alert_soptamp_reset_negative,
positiveText = R.string.mypage_alert_soptamp_reset_positive
)
}
}
Loading