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

[UI/#204] 홈 뷰 / UI 수정사항 반영 및 리팩토링 #232

Merged
merged 42 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3c3cdd5
[UI/#204] 홈 뷰 곧 마감되는 공고 아이템 수정
Hyobeen-Park Aug 28, 2024
2ae81c5
[UI/#204] 홈 뷰 곧 마감되는 공고 아이템 padding 값 수정
Hyobeen-Park Aug 30, 2024
879e51f
[UI/#204] 홈 뷰 필터링 버튼 수정
Hyobeen-Park Aug 30, 2024
11b4442
[UI/#204] 홈 뷰 필터링 정보 수정
Hyobeen-Park Aug 30, 2024
50ab00e
Merge remote-tracking branch 'origin/develop' into ui/#204-home-view
Hyobeen-Park Aug 30, 2024
85ccbe4
[CHORE/#204] 변수명 및 함수 파라미터 수정
Hyobeen-Park Aug 30, 2024
b5b99f0
[UI/#204] divider 삭제
Hyobeen-Park Aug 30, 2024
61496e0
[UI/#204] 정렬버튼 컴포넌트 패딩 수정
Hyobeen-Park Aug 30, 2024
e885a11
[UI/#204] 공고 개수 표시 UI 구현
Hyobeen-Park Aug 30, 2024
6318b9a
[UI/#204] theme 색상 추가
Hyobeen-Park Aug 30, 2024
edc307f
[UI/#204] domain/type에 enum class 추가
Hyobeen-Park Aug 30, 2024
f67afb8
[UI/#204] string 수정
Hyobeen-Park Aug 30, 2024
356d985
[UI/#204] 필터링 재설정 바텀시트 구현
Hyobeen-Park Aug 30, 2024
b329364
[UI/#204] 필터링 재설정 화면 버튼 색상 수정
Hyobeen-Park Aug 30, 2024
384fe8e
[UI/#204] 바텀시트 관련 로직 수정
Hyobeen-Park Aug 30, 2024
28f8b72
[DELETE/#204] 기존 필터링 재설정 뷰 삭제
Hyobeen-Park Aug 30, 2024
735354d
Merge remote-tracking branch 'origin/develop' into ui/#204-home-view
Hyobeen-Park Sep 6, 2024
ca9f314
[UI/#204] 필터링 정보 표시
Hyobeen-Park Sep 6, 2024
f0ae573
[MOD/#204] enum class 패키지 이동 및 파라미터 수정
Hyobeen-Park Sep 6, 2024
5327a86
[MOD/#204] 곧 마감되는 공고 서버통신 수정
Hyobeen-Park Sep 6, 2024
8a58059
[CHORE/#204] 패키지 이동
Hyobeen-Park Sep 7, 2024
91f8762
Merge remote-tracking branch 'origin/develop' into ui/#204-home-view
Hyobeen-Park Sep 7, 2024
33d3dd3
[REFACTOR/#204] 맞춤 공고 API 수정사항 반영
Hyobeen-Park Sep 7, 2024
76521ad
[CHORE/#204] 근무 기간 enum 수정
Hyobeen-Park Sep 8, 2024
f8718ff
Merge remote-tracking branch 'origin/develop' into ui/#204-home-view
Hyobeen-Park Sep 8, 2024
b3f3efb
[MOD/#204] enum 함수 추가
Hyobeen-Park Sep 8, 2024
a58d6b0
[REFACTOR/#204] 필터링 재설정 API 수정사항 반영
Hyobeen-Park Sep 8, 2024
8a72727
[REFACTOR/#204] 곧 마감 정보 리팩토링
Hyobeen-Park Sep 8, 2024
0907e8a
[CHORE/#204] test style 적용
Hyobeen-Park Sep 8, 2024
aaadc13
[REFACTOR/#204] 곧 마감 공고 로직 수정
Hyobeen-Park Sep 8, 2024
6a02360
[CHORE/#204] 코드 정리
Hyobeen-Park Sep 8, 2024
58b7425
[CHORE/#204] 필터링 인덱스 int로 수정
Hyobeen-Park Sep 9, 2024
631ec67
Merge remote-tracking branch 'origin/develop' into ui/#204-home-view
Hyobeen-Park Sep 9, 2024
1cfe864
[FEAT/#204] 맞춤 공고 스크랩 다이얼로그 연결
Hyobeen-Park Sep 9, 2024
e849735
[FEAT/#204] 곧 마감 공고 스크랩 다이얼로그 연결
Hyobeen-Park Sep 9, 2024
a4b1cab
[DELETE/#204] 기존 홈 뷰 다이얼로그 삭제
Hyobeen-Park Sep 9, 2024
f3ba7bc
[MOD/#204] 데이트피커 수정
Hyobeen-Park Sep 9, 2024
27adb74
[CHORE/#204] string 추출
Hyobeen-Park Sep 9, 2024
2c207d9
[CHORE/#204] 함수 전달 방식 수정
Hyobeen-Park Sep 9, 2024
34f73a8
[CHORE/#204] 색상 수정
Hyobeen-Park Sep 9, 2024
f103667
Merge remote-tracking branch 'origin/develop' into ui/#204-home-view
Hyobeen-Park Sep 9, 2024
ec25157
[FEAT/#204] 버튼 캘린더로 연결
Hyobeen-Park Sep 9, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
package com.terning.core.designsystem.component.bottomsheet

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.layout.wrapContentHeight
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.terning.core.R
import com.terning.core.designsystem.component.button.ChangeFilterButton
import com.terning.core.designsystem.component.button.RoundButton
import com.terning.core.designsystem.component.datepicker.DatePickerUI
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.currentMonth
import com.terning.core.extension.currentYear
import com.terning.core.type.Grade
import com.terning.core.type.WorkingPeriod
import java.util.Calendar

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomeFilteringBottomSheet(
modifier: Modifier = Modifier,
defaultGrade: Grade?,
defaultWorkingPeriod: WorkingPeriod?,
defaultStartYear: Int?,
defaultStartMonth: Int?,
onDismiss: () -> Unit,
onChangeButtonClick: (Int, Int, Int, Int) -> Unit,
) {
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)

var currentGrade by remember { mutableStateOf(defaultGrade) }
var currentPeriod by remember { mutableStateOf(defaultWorkingPeriod) }
var currentStartYear by remember {
mutableIntStateOf(
defaultStartYear ?: Calendar.getInstance().currentYear
)
}
var currentStartMonth by remember {
mutableIntStateOf(
defaultStartMonth ?: Calendar.getInstance().currentMonth
)
}

TerningBasicBottomSheet(
content = {
Column(
modifier = modifier
.padding(horizontal = 24.dp)
.fillMaxWidth(),
) {
Text(
text = stringResource(id = R.string.change_filter_top_bar_title),
style = TerningTheme.typography.title2,
color = Black,
modifier = Modifier
.padding(bottom = 16.dp),
)

HorizontalDivider(
thickness = 1.dp,
color = Grey200,
)

ChangeFilteringTitleText(
text = stringResource(id = R.string.change_filter_grade_title),
modifier = Modifier
.padding(top = 18.dp, bottom = 12.dp)
)

ChangeFilteringRadioGroup(
initOption = defaultGrade?.ordinal ?: -1,
optionList = listOf(
R.string.change_filter_grade_1,
R.string.change_filter_grade_2,
R.string.change_filter_grade_3,
R.string.change_filter_grade_4,
),
onButtonClick = { index ->
currentGrade = Grade.entries[index]
}
)

ChangeFilteringTitleText(
text = stringResource(id = R.string.change_filter_period_title),
modifier = Modifier
.padding(top = 32.dp, bottom = 12.dp)
)

ChangeFilteringRadioGroup(
initOption = defaultWorkingPeriod?.ordinal ?: -1,
optionList = listOf(
R.string.change_filter_period_1,
R.string.change_filter_period_2,
R.string.change_filter_period_3,
),
onButtonClick = { index ->
currentPeriod = WorkingPeriod.entries[index]
}
)

ChangeFilteringTitleText(
text = stringResource(id = R.string.change_filter_start_work_title),
modifier = Modifier
.padding(top = 32.dp, bottom = 49.dp)
)

DatePickerUI(
chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear,
chosenMonth = defaultStartMonth?.minus(1)
?: Calendar.getInstance().currentMonth.minus(1),
onYearChosen = { currentStartYear = it },
onMonthChosen = { currentStartMonth = it },
)
Copy link
Member

Choose a reason for hiding this comment

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

요거 제가 최근에 만든 YearMonthPicker 써주면 될 것 같아요!! (피그마에 나온 패딩값 적용하구, 앱 터지지 않게 만들었어요!)
feature.filtering.filteringthree.component파일에 써줬는데 확인해주시면 감사하겠습니당

Copy link
Member Author

Choose a reason for hiding this comment

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

웁씨 깜빡했네요 감사합니다 근데 진짜 데이트피커 수정된거 정말 짱이네요👍🏻


RoundButton(
style = TerningTheme.typography.button0,
paddingVertical = 19.dp,
text = R.string.change_filter_save,
cornerRadius = 10.dp,
modifier = Modifier
.padding(top = 51.dp),
onButtonClick = {
currentGrade?.let { grade ->
currentPeriod?.let { workingPeriod ->
onChangeButtonClick(
grade.ordinal,
workingPeriod.ordinal,
currentStartYear,
currentStartMonth,
)
}
}
},
isEnabled = currentGrade != null && currentPeriod != null
)
}

},
onDismissRequest = onDismiss,
sheetState = sheetState,
)
}

@Composable
fun ChangeFilteringTitleText(
text: String,
modifier: Modifier = Modifier,
) {
Text(
text = text,
style = TerningTheme.typography.title4,
color = Black,
modifier = modifier,
)
}

@Composable
fun ChangeFilteringRadioGroup(
optionList: List<Int>,
initOption: Int,
onButtonClick: (Int) -> Unit,
modifier: Modifier = Modifier,
) {
var selectedIndex by remember { mutableIntStateOf(initOption) }

LazyVerticalGrid(
columns = GridCells.Fixed(optionList.size),
horizontalArrangement = Arrangement.spacedBy(12.dp),
modifier = modifier
.fillMaxWidth()
.wrapContentHeight()

) {
itemsIndexed(optionList) { index, option ->
ChangeFilterButton(
isSelected = selectedIndex == index,
modifier = Modifier
.wrapContentHeight(),
text = option,
cornerRadius = 10.dp,
paddingVertical = 10.dp,
onButtonClick = {
selectedIndex = index
onButtonClick(index)
}
)
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.noRippleClickable
import com.terning.core.type.SortBy
import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -64,7 +65,7 @@ fun SortingBottomSheet(
) {
items(sortByCount) { sortIndex ->
Text(
text = stringResource(id = SortBy.entries[sortIndex].type),
text = stringResource(id = SortBy.entries[sortIndex].sortBy),
style = TerningTheme.typography.button3,
color = if (currentSortBy == sortIndex) TerningMain else Grey400,
textAlign = TextAlign.Start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.Grey150
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.Grey375
import com.terning.core.designsystem.theme.Grey50
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningSub1
import com.terning.core.designsystem.theme.TerningSub5
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.core.util.NoRippleTheme
Expand All @@ -42,16 +43,16 @@ fun ChangeFilterButton(
val isPressed by interactionSource.collectIsPressedAsState()
val backgroundColor = when {
!isSelected && !isPressed -> White
!isSelected && isPressed -> TerningSub5
else -> TerningMain
!isSelected && isPressed -> Grey50
else -> White
}
val textColor = when {
!isSelected -> Grey400
else -> White
!isSelected -> Grey375
else -> TerningMain
}
val borderColor = when {
!isSelected && !isPressed -> TerningMain
!isSelected && isPressed -> TerningSub1
!isSelected && !isPressed -> Grey150
!isSelected && isPressed -> Grey200
else -> TerningMain
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,43 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.terning.core.R
import com.terning.core.designsystem.component.bottomsheet.SortBy
import com.terning.core.type.SortBy
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.noRippleClickable

@Composable
fun SortingButton(
sortBy: Int = 0,
modifier: Modifier = Modifier,
sortBy: Int = 0,
onCLick: () -> Unit,
) {
Row(
modifier = modifier
.noRippleClickable { onCLick() }
.noRippleClickable { onCLick() },
Copy link
Member

Choose a reason for hiding this comment

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

ONclICK()

) {
Text(
text = stringResource(
id = SortBy.entries[sortBy].type
id = SortBy.entries[sortBy].sortBy
),
style = TerningTheme.typography.button3,
color = Black,
modifier = modifier
modifier = Modifier
.padding(
top = 6.dp,
bottom = 5.dp,
start = 12.dp,
bottom = 6.dp,
)
)
Image(
painter = painterResource(id = R.drawable.ic_down_18),
contentDescription = stringResource(id = R.string.sort_button_description),
modifier = modifier
.padding(vertical = 5.dp)
.padding(end = 2.dp)
modifier = Modifier
.padding(
start = 2.dp,
end = 2.dp,
top = 6.dp,
bottom = 4.dp,
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.ui.graphics.Color

// Grey Scale
val White = Color(0xFFFFFFFF)
val Grey50 = Color(0xFFFCFCFC)
val Grey100 = Color(0xFFF5F5F5)
val Grey150 = Color(0xFFE9E9E9)
val Grey200 = Color(0xFFDDDDDD)
Expand Down
24 changes: 24 additions & 0 deletions core/src/main/java/com/terning/core/type/Grade.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.terning.core.type

import androidx.annotation.StringRes
import com.terning.core.R

enum class Grade(
val stringValue: String,
@StringRes val stringResId: Int,
) {
FRESHMAN("freshman", R.string.change_filter_grade_1),
SOPHOMORE("sophomore", R.string.change_filter_grade_2),
JUNIOR("junior", R.string.change_filter_grade_3),
SENIOR("senior", R.string.change_filter_grade_4);

companion object {
fun fromString(value: String?): Grade = when (value) {
"freshman" -> FRESHMAN
"sophomore" -> SOPHOMORE
"junior" -> JUNIOR
"senior" -> SENIOR
else -> FRESHMAN
}
Comment on lines +15 to +22
Copy link
Member

Choose a reason for hiding this comment

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

단순 궁금증인데 value 값이 nullable인 이유가 궁금해요..!

Copy link
Member Author

Choose a reason for hiding this comment

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

사용자 필터링 정보가 없을 때 null로 저장이 돼서 nullable하게 만들었습니다!! null 처리를 screen에서 하니까 코드가 너무 복잡해지더라구요😅

}
}
15 changes: 15 additions & 0 deletions core/src/main/java/com/terning/core/type/SortBy.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.terning.core.type

import androidx.annotation.StringRes
import com.terning.core.R

enum class SortBy(
@StringRes val sortBy: Int,
val type: String,
) {
EARLIEST(R.string.sort_by_earliest, "deadlineSoon"),
SHORTEST(R.string.sort_by_shortest, "shortestDuration"),
LONGEST(R.string.sort_by_longest, "longestDuration"),
SCRAP(R.string.sort_by_scrap, "mostScrapped"),
VIEW_COUNT(R.string.sort_by_view_count, "mostViewed"),
}
Loading
Loading