-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature/#79] 캘린더 팝업 약속 조회 API 연결 #2
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
e4497b9
#79 [RENAME] CalculateTimeFromString 파일 rename
Eonji-sw 0978b37
#79 [MOD] appointmentName 필드 추가
Eonji-sw cf69dcf
#79 [DEL] 불필요한 파일 제거
Eonji-sw c92ff89
#79 [FEAT] CalculateTimeFromLocalDate 구현
Eonji-sw f495fc5
#79 [MOD] onItemClick 로직 변경
Eonji-sw 0810c6a
#79 [MOD] 필드 타입 변경
Eonji-sw e82fa1a
#79 [MOD] 필드 타입 변경
Eonji-sw 5b82e22
#79 [MOD] 필드 타입 변경
Eonji-sw 4e4956d
#79 [MOD] getOptionDetail 구현
Eonji-sw 203f668
#79 [MOD] getOptionDetail 적용 및 필드 타입 변경
Eonji-sw 4e2b0d1
Merge remote-tracking branch 'origin/develop' into feature/#79-calend…
Eonji-sw d1c751d
#79 [MOD] ktlint 적용
Eonji-sw a175893
#79 [MOD] ktlint 적용
Eonji-sw cdb41b4
#79 [FEAT] getConfirmedDetail, DataErrorDialog 적용
Eonji-sw 8c9cf41
#79 [FEAT] ShowDataErrorDialog 구현
Eonji-sw e4ebb72
#79 [MOD] ConfirmedDetailEntity appointmentName 필드 추가
Eonji-sw 7046b2c
#79 [MOD] ConfirmedDetailEntity appointmentName 필드 추가
Eonji-sw 3cf55db
#79 [MOD] 시간 형식 변경
Eonji-sw b8e4f1a
#79 [MOD] 시간 형식 변경
Eonji-sw 90c66c9
#79 [MOD] 시간 형식 변경
Eonji-sw 1863ef4
#79 [MOD] ktlint 적용
Eonji-sw b14994f
#79 [MOD] ktlint 적용
Eonji-sw 2d64327
#79 [MOD] ktlint 적용, getConfirmedDetail, DataErrorDialog 구현
Eonji-sw d3ab49b
#79 [MOD] GroupCreate name 조건 추가
Eonji-sw ab2bfe3
Merge remote-tracking branch 'origin/develop' into feature/#79-calend…
Eonji-sw e8a49ca
#79 [MOD] fold 적용
Eonji-sw 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
16 changes: 16 additions & 0 deletions
16
core/src/main/java/com/sopt/core/util/time/CalculateTimeFromLocalDate.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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package com.sopt.core.util.time | ||
|
|
||
| import java.time.LocalDate | ||
| import java.time.format.TextStyle | ||
| import java.util.Locale | ||
|
|
||
| class CalculateTimeFromLocalDate { | ||
| // ex) 1월 1일 (월) | ||
| fun formatLocalDateWithDay(localDate: LocalDate): String { | ||
| val month = localDate.monthValue | ||
| val day = localDate.dayOfMonth | ||
| val dayOfWeek = localDate.dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN) | ||
|
|
||
| return "${month}월 ${day}일 ($dayOfWeek)" | ||
| } | ||
| } | ||
4 changes: 2 additions & 2 deletions
4
.../java/com/sopt/core/util/CalculateTime.kt → ...core/util/time/CalculateTimeFromString.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
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
14 changes: 0 additions & 14 deletions
14
domain/src/main/java/com/sopt/domain/entity/ScheduleDetailEntity.kt
This file was deleted.
Oops, something went wrong.
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,7 +1,9 @@ | ||
| package com.sopt.domain.entity | ||
|
|
||
| import java.time.LocalDate | ||
|
|
||
| data class ScheduleEntity( | ||
| val groupId: Long = -1, | ||
| val date: String, // M월 D일 (E) - ex) 1월 13일 (월) | ||
| val date: LocalDate, | ||
| val scheduleList: List<CalendarAppointmentEntity> | ||
| ) |
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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||||||||||||||
| package com.sopt.presentation.calendar | ||||||||||||||||||
|
|
||||||||||||||||||
| import android.annotation.SuppressLint | ||||||||||||||||||
| import androidx.compose.foundation.background | ||||||||||||||||||
| import androidx.compose.foundation.layout.Column | ||||||||||||||||||
| import androidx.compose.foundation.layout.PaddingValues | ||||||||||||||||||
|
|
@@ -17,7 +18,10 @@ import androidx.compose.runtime.Composable | |||||||||||||||||
| import androidx.compose.runtime.LaunchedEffect | ||||||||||||||||||
| import androidx.compose.runtime.derivedStateOf | ||||||||||||||||||
| import androidx.compose.runtime.getValue | ||||||||||||||||||
| import androidx.compose.runtime.mutableLongStateOf | ||||||||||||||||||
| import androidx.compose.runtime.mutableStateOf | ||||||||||||||||||
| import androidx.compose.runtime.remember | ||||||||||||||||||
| import androidx.compose.runtime.setValue | ||||||||||||||||||
| import androidx.compose.runtime.snapshotFlow | ||||||||||||||||||
| import androidx.compose.ui.Alignment | ||||||||||||||||||
| import androidx.compose.ui.Modifier | ||||||||||||||||||
|
|
@@ -32,15 +36,20 @@ import androidx.navigation.compose.rememberNavController | |||||||||||||||||
| import com.sopt.core.designsystem.component.bottomsheet.NoostakBottomSheet | ||||||||||||||||||
| import com.sopt.core.designsystem.component.calendar.WeekDaysHeader | ||||||||||||||||||
| import com.sopt.core.designsystem.component.calendar.YearMonthHeader | ||||||||||||||||||
| import com.sopt.core.designsystem.component.dialog.NoostakDialog | ||||||||||||||||||
| import com.sopt.core.designsystem.component.topappbar.NoostakLogoAppBar | ||||||||||||||||||
| import com.sopt.core.designsystem.screen.NoostakLoadingScreen | ||||||||||||||||||
| import com.sopt.core.designsystem.theme.NoostakAndroidTheme | ||||||||||||||||||
| import com.sopt.core.designsystem.theme.NoostakTheme | ||||||||||||||||||
| import com.sopt.core.extension.getYearMonthByPage | ||||||||||||||||||
| import com.sopt.core.extension.initialPage | ||||||||||||||||||
| import com.sopt.core.extension.pageCount | ||||||||||||||||||
| import com.sopt.core.state.UiState | ||||||||||||||||||
| import com.sopt.core.type.DialogType | ||||||||||||||||||
| import com.sopt.domain.entity.CalendarAppointmentEntity | ||||||||||||||||||
| import com.sopt.domain.entity.CalendarSchedule | ||||||||||||||||||
| import com.sopt.domain.entity.GroupEntity | ||||||||||||||||||
| import com.sopt.domain.entity.ScheduleEntity | ||||||||||||||||||
| import com.sopt.presentation.R | ||||||||||||||||||
| import com.sopt.presentation.calendar.component.CalendarFloatingActionDialog | ||||||||||||||||||
| import com.sopt.presentation.calendar.component.CalendarGroup | ||||||||||||||||||
|
|
@@ -49,6 +58,7 @@ import com.sopt.presentation.calendar.component.bottomsheet.ScheduleListScreen | |||||||||||||||||
| import java.time.LocalDate | ||||||||||||||||||
| import java.time.YearMonth | ||||||||||||||||||
|
|
||||||||||||||||||
| @SuppressLint("StateFlowValueCalledInComposition") | ||||||||||||||||||
| @OptIn(ExperimentalMaterial3Api::class) | ||||||||||||||||||
| @Composable | ||||||||||||||||||
| fun CalendarRoute( | ||||||||||||||||||
|
|
@@ -58,10 +68,14 @@ fun CalendarRoute( | |||||||||||||||||
| navigateToGroupEnter: () -> Unit, | ||||||||||||||||||
| navigateToAppointmentCreate: (Long) -> Unit | ||||||||||||||||||
| ) { | ||||||||||||||||||
| val navController = rememberNavController() | ||||||||||||||||||
|
|
||||||||||||||||||
| val getGroupsState by calendarViewModel.getGroupsState.collectAsStateWithLifecycle() | ||||||||||||||||||
| val getConfirmedDetailState by calendarViewModel.getConfirmedDetailState.collectAsStateWithLifecycle() | ||||||||||||||||||
|
|
||||||||||||||||||
| val showAddDialog by calendarViewModel.showAddDialog.collectAsStateWithLifecycle() | ||||||||||||||||||
| val showBottomSheet by calendarViewModel.showBottomSheet.collectAsStateWithLifecycle() | ||||||||||||||||||
| val navController = rememberNavController() | ||||||||||||||||||
| val showDataErrorDialog by calendarViewModel.showDataErrorDialog.collectAsStateWithLifecycle() | ||||||||||||||||||
|
|
||||||||||||||||||
| val scheduleMap by calendarViewModel.scheduleMap.collectAsStateWithLifecycle() | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -72,6 +86,9 @@ fun CalendarRoute( | |||||||||||||||||
|
|
||||||||||||||||||
| val currentYearMonth by remember { derivedStateOf { getYearMonthByPage(pagerState.currentPage) } } | ||||||||||||||||||
|
|
||||||||||||||||||
| var clickDate by remember { mutableStateOf<LocalDate?>(null) } | ||||||||||||||||||
| var clickAppointmentId by remember { mutableLongStateOf(-1) } | ||||||||||||||||||
|
|
||||||||||||||||||
| LaunchedEffect(pagerState) { | ||||||||||||||||||
| snapshotFlow { pagerState.currentPage } | ||||||||||||||||||
| .collect { page -> | ||||||||||||||||||
|
|
@@ -85,15 +102,31 @@ fun CalendarRoute( | |||||||||||||||||
| is CalendarSideEffect.NavigateToGroupCreate -> navigateToGroupCreate() | ||||||||||||||||||
| is CalendarSideEffect.NavigateToGroupEnter -> navigateToGroupEnter() | ||||||||||||||||||
| is CalendarSideEffect.NavigateToAppointmentCreate -> navigateToAppointmentCreate( | ||||||||||||||||||
| calendarViewModel.getSelectedScheduleEntity().groupId | ||||||||||||||||||
| calendarViewModel.selectedGroupId.value ?: -1 | ||||||||||||||||||
| ) | ||||||||||||||||||
|
|
||||||||||||||||||
| is CalendarSideEffect.ShowAddDialog -> calendarViewModel.showAddDialog(true) | ||||||||||||||||||
| is CalendarSideEffect.ShowBottomSheet -> calendarViewModel.showBottomSheet(true) | ||||||||||||||||||
| is CalendarSideEffect.ShowDataErrorDialog -> calendarViewModel.showDataErrorDialog( | ||||||||||||||||||
| true | ||||||||||||||||||
| ) | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| if (showDataErrorDialog) { | ||||||||||||||||||
| NoostakDialog( | ||||||||||||||||||
| dialogType = DialogType.DATA_FAILURE, | ||||||||||||||||||
| onClick = { | ||||||||||||||||||
| calendarViewModel.getConfirmedDetail(clickAppointmentId) | ||||||||||||||||||
| }, | ||||||||||||||||||
| onDismissRequest = { | ||||||||||||||||||
| calendarViewModel.showDataErrorDialog(false) | ||||||||||||||||||
| navController.popBackStack() | ||||||||||||||||||
| } | ||||||||||||||||||
| ) | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| if (showAddDialog) { | ||||||||||||||||||
| CalendarFloatingActionDialog( | ||||||||||||||||||
| onClick = { calendarViewModel.showAddDialog(false) }, | ||||||||||||||||||
|
|
@@ -117,30 +150,47 @@ fun CalendarRoute( | |||||||||||||||||
| }, | ||||||||||||||||||
| content = { | ||||||||||||||||||
| NavHost(navController, startDestination = SCHEDULE_LIST) { | ||||||||||||||||||
| composable(SCHEDULE_LIST) { backStackEntry -> | ||||||||||||||||||
| ScheduleListScreen( | ||||||||||||||||||
| data = calendarViewModel.getSelectedScheduleEntity(), | ||||||||||||||||||
| onItemClick = { schedule -> | ||||||||||||||||||
| backStackEntry.savedStateHandle[SCHEDULE] = | ||||||||||||||||||
| schedule.id // 바꿔야 함 | ||||||||||||||||||
| navController.navigate(SCHEDULE_DETAIL) | ||||||||||||||||||
| }, | ||||||||||||||||||
| onCreateAppointmentBtnClick = { | ||||||||||||||||||
| calendarViewModel.navigateToAppointmentCreate() | ||||||||||||||||||
| calendarViewModel.showBottomSheet(false) | ||||||||||||||||||
| } | ||||||||||||||||||
| ) | ||||||||||||||||||
| composable(SCHEDULE_LIST) { | ||||||||||||||||||
| clickDate?.let { date -> | ||||||||||||||||||
| ScheduleListScreen( | ||||||||||||||||||
| data = ScheduleEntity( | ||||||||||||||||||
| groupId = calendarViewModel.selectedGroupId.value ?: -1, | ||||||||||||||||||
| date = date, | ||||||||||||||||||
| scheduleList = calendarViewModel.selectedDayAppointments.value.map { | ||||||||||||||||||
| CalendarAppointmentEntity( | ||||||||||||||||||
| id = it.id, | ||||||||||||||||||
| name = it.name, | ||||||||||||||||||
| category = it.category, | ||||||||||||||||||
| startTime = it.startTime, | ||||||||||||||||||
| endTime = it.endTime, | ||||||||||||||||||
| duration = it.duration, | ||||||||||||||||||
| date = it.date | ||||||||||||||||||
| ) | ||||||||||||||||||
| } | ||||||||||||||||||
| ), | ||||||||||||||||||
| onItemClick = { id -> | ||||||||||||||||||
| clickAppointmentId = id | ||||||||||||||||||
| calendarViewModel.getConfirmedDetail(clickAppointmentId) | ||||||||||||||||||
| navController.navigate(SCHEDULE_DETAIL) | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: 빈 화면 위에 다이얼로그 뜨는 것보다 그룹 아이템이 보이는 상태에서 뜨는게 나을 것같아서 이렇게 수정해주쇼!!
Suggested change
|
||||||||||||||||||
| }, | ||||||||||||||||||
| onCreateAppointmentBtnClick = { | ||||||||||||||||||
| calendarViewModel.navigateToAppointmentCreate() | ||||||||||||||||||
| calendarViewModel.showBottomSheet(false) | ||||||||||||||||||
| } | ||||||||||||||||||
| ) | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| composable(SCHEDULE_DETAIL) { | ||||||||||||||||||
| val schedule = | ||||||||||||||||||
| navController.previousBackStackEntry?.savedStateHandle?.get<Long>( | ||||||||||||||||||
| SCHEDULE | ||||||||||||||||||
| ) | ||||||||||||||||||
| schedule?.let { id -> | ||||||||||||||||||
| ScheduleDetailScreen( | ||||||||||||||||||
| data = calendarViewModel.mockScheduleDetail, | ||||||||||||||||||
| onBackBtnClick = { navController.popBackStack() } | ||||||||||||||||||
| ) | ||||||||||||||||||
| when (getConfirmedDetailState) { | ||||||||||||||||||
| is UiState.Loading -> NoostakLoadingScreen() | ||||||||||||||||||
| is UiState.Success -> { | ||||||||||||||||||
| ScheduleDetailScreen( | ||||||||||||||||||
| data = (getConfirmedDetailState as UiState.Success).data, | ||||||||||||||||||
| onBackBtnClick = { navController.popBackStack() } | ||||||||||||||||||
| ) | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| else -> Unit | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
@@ -157,6 +207,7 @@ fun CalendarRoute( | |||||||||||||||||
| showAddDialog = showAddDialog, | ||||||||||||||||||
| onAddBtnClick = { calendarViewModel.showAddDialog(true) }, | ||||||||||||||||||
| onItemClick = { clickedDate -> | ||||||||||||||||||
| clickDate = clickedDate | ||||||||||||||||||
| calendarViewModel.onDayClicked(clickedDate) | ||||||||||||||||||
| }, | ||||||||||||||||||
| onGroupClick = { groupId -> | ||||||||||||||||||
|
|
@@ -236,7 +287,6 @@ private fun CalendarContent( | |||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| const val SCHEDULE = "schedule" | ||||||||||||||||||
| const val SCHEDULE_LIST = "schedule_list" | ||||||||||||||||||
| const val SCHEDULE_DETAIL = "schedule_detail" | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
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
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.
Uh oh!
There was an error while loading. Please reload this page.