From b6a923cb4884cd6c72bcbdefc602f12b11f65046 Mon Sep 17 00:00:00 2001 From: "jihun.lee" Date: Mon, 26 Aug 2024 10:52:47 +0900 Subject: [PATCH 1/4] refactor: light, dark preview merge --- .../core/designsystem/ComponentPreview.kt | 13 +- .../core/designsystem/DarkComponentPreview.kt | 10 -- .../designsystem/component/BoothFilterChip.kt | 25 ---- .../core/designsystem/component/Button.kt | 26 ---- .../core/designsystem/component/Dialog.kt | 91 ------------ .../component/HorizontalDivider.kt | 9 -- .../designsystem/component/LoadingWheel.kt | 9 -- .../designsystem/component/NetworkImage.kt | 12 -- .../designsystem/component/OutlinedButton.kt | 13 -- .../designsystem/component/SearchTextField.kt | 39 ----- .../core/designsystem/component/Tooltip.kt | 23 --- .../core/designsystem/component/TopAppBar.kt | 34 ----- .../android/core/ui/DarkDevicePreview.kt | 12 -- .../unifest/android/core/ui/DevicePreview.kt | 11 +- .../core/ui/component/BoothFilterChips.kt | 12 -- .../core/ui/component/EmptyLikedBoothItem.kt | 13 -- .../core/ui/component/LikedBoothItem.kt | 21 --- .../core/ui/component/LikedFestivalGrid.kt | 83 ----------- .../core/ui/component/PermissionDialog.kt | 15 -- .../android/core/ui/component/StarImage.kt | 29 ---- .../feature/booth/BoothDetailScreen.kt | 31 ---- .../feature/booth/BoothLocationScreen.kt | 35 ----- .../feature/festival/FestivalBottomSheet.kt | 140 ------------------ .../feature/festival/FestivalSearchResults.kt | 71 --------- .../unifest/android/feature/home/Calendar.kt | 15 -- .../android/feature/home/HomeScreen.kt | 75 ---------- .../feature/liked_booth/LikedBoothScreen.kt | 64 -------- .../feature/map/component/BoothItem.kt | 28 ---- .../feature/map/component/MapTopAppBar.kt | 16 -- .../android/feature/menu/MenuScreen.kt | 61 -------- 30 files changed, 22 insertions(+), 1014 deletions(-) delete mode 100644 core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/DarkComponentPreview.kt delete mode 100644 core/ui/src/main/kotlin/com/unifest/android/core/ui/DarkDevicePreview.kt diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/ComponentPreview.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/ComponentPreview.kt index b1d48b17..4d2a002b 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/ComponentPreview.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/ComponentPreview.kt @@ -1,6 +1,17 @@ package com.unifest.android.core.designsystem +import android.content.res.Configuration.UI_MODE_NIGHT_NO +import android.content.res.Configuration.UI_MODE_NIGHT_YES import androidx.compose.ui.tooling.preview.Preview -@Preview(showBackground = true) +@Preview( + name = "Light", + showBackground = true, + uiMode = UI_MODE_NIGHT_NO, +) +@Preview( + name = "Dark", + showBackground = true, + uiMode = UI_MODE_NIGHT_YES, +) annotation class ComponentPreview diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/DarkComponentPreview.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/DarkComponentPreview.kt deleted file mode 100644 index d65f1440..00000000 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/DarkComponentPreview.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.unifest.android.core.designsystem - -import android.content.res.Configuration -import androidx.compose.ui.tooling.preview.Preview - -@Preview( - showBackground = true, - uiMode = Configuration.UI_MODE_NIGHT_YES, -) -annotation class DarkComponentPreview diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/BoothFilterChip.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/BoothFilterChip.kt index 45bbfb75..005bb9c5 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/BoothFilterChip.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/BoothFilterChip.kt @@ -16,7 +16,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.theme.BoothLocation import com.unifest.android.core.designsystem.theme.UnifestTheme @@ -66,18 +65,6 @@ fun BoothFilterChipPreview() { } } -@DarkComponentPreview -@Composable -fun BoothFilterChipDarkPreview() { - UnifestTheme { - BoothFilterChip( - filterName = "주점", - onChipClick = {}, - isSelected = false, - ) - } -} - @ComponentPreview @Composable fun SelectedBoothFilterChipPreview() { @@ -89,15 +76,3 @@ fun SelectedBoothFilterChipPreview() { ) } } - -@DarkComponentPreview -@Composable -fun SelectedBoothFilterChipSelectedDarkPreview() { - UnifestTheme { - BoothFilterChip( - filterName = "주점", - onChipClick = {}, - isSelected = true, - ) - } -} diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Button.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Button.kt index 8da26a25..7d4a804a 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Button.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Button.kt @@ -15,7 +15,6 @@ import androidx.compose.ui.unit.dp import com.unifest.android.core.common.MultipleEventsCutter import com.unifest.android.core.common.get import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.theme.UnifestTheme @Composable @@ -59,18 +58,6 @@ fun UnifestButtonPreview() { } } -@DarkComponentPreview -@Composable -fun UnifestButtonDarkPreview() { - UnifestTheme { - UnifestButton( - onClick = {}, - ) { - Text("Button") - } - } -} - @ComponentPreview @Composable fun UnifestDisabledButtonPreview() { @@ -83,16 +70,3 @@ fun UnifestDisabledButtonPreview() { } } } - -@DarkComponentPreview -@Composable -fun UnifestDisabledDarkPreview() { - UnifestTheme { - UnifestButton( - onClick = {}, - enabled = false, - ) { - Text("Button") - } - } -} diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Dialog.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Dialog.kt index af51e39e..315db88f 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Dialog.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Dialog.kt @@ -45,7 +45,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.window.DialogProperties import com.unifest.android.core.common.utils.PhoneNumberVisualTransformation import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.theme.BoothLocation import com.unifest.android.core.designsystem.theme.BoothTitle2 @@ -714,15 +713,6 @@ fun ServerErrorDialogPreview() { ServerErrorDialog(onRetryClick = {}) } } - -@DarkComponentPreview -@Composable -fun ServerErrorDialogDarkPreview() { - UnifestTheme { - ServerErrorDialog(onRetryClick = {}) - } -} - @ComponentPreview @Composable fun NetworkErrorDialogPreview() { @@ -731,14 +721,6 @@ fun NetworkErrorDialogPreview() { } } -@DarkComponentPreview -@Composable -fun NetworkErrorDialogDarkPreview() { - UnifestTheme { - NetworkErrorDialog(onRetryClick = {}) - } -} - @ComponentPreview @Composable fun LikedFestivalDeleteDialogPreview() { @@ -750,17 +732,6 @@ fun LikedFestivalDeleteDialogPreview() { } } -@DarkComponentPreview -@Composable -fun LikedFestivalDeleteDialogDarkPreview() { - UnifestTheme { - LikedFestivalDeleteDialog( - onCancelClick = {}, - onConfirmClick = {}, - ) - } -} - @ComponentPreview @Composable fun AppUpdateDialogPreview() { @@ -772,17 +743,6 @@ fun AppUpdateDialogPreview() { } } -@DarkComponentPreview -@Composable -fun AppUpdateDialogDarkPreview() { - UnifestTheme { - AppUpdateDialog( - onDismissRequest = {}, - onUpdateClick = {}, - ) - } -} - @ComponentPreview @Composable fun WaitingPinDialogPreview() { @@ -798,21 +758,6 @@ fun WaitingPinDialogPreview() { } } -@DarkComponentPreview -@Composable -fun WaitingPinDialogDarkPreview() { - UnifestTheme { - WaitingPinDialog( - boothName = "컴공 주점", - pinNumber = "", - onDismissRequest = {}, - onDialogPinButtonClick = { }, - onPinNumberUpdated = { }, - isWrongPinInserted = true, - ) - } -} - @ComponentPreview @Composable fun WaitingDialogPreview() { @@ -835,28 +780,6 @@ fun WaitingDialogPreview() { } } -@DarkComponentPreview -@Composable -fun WaitingDialogDarkPreview() { - UnifestTheme { - WaitingDialog( - boothName = "컴공 주점", - onDismissRequest = {}, - phoneNumber = "", - waitingCount = 3, - partySize = 3, - onDialogWaitingButtonClick = { }, - onWaitingMinusClick = { }, - onWaitingPlusClick = { }, - onWaitingTelUpdated = { }, - isPrivacyClicked = false, - onPolicyCheckBoxClick = { }, - onPrivacyPolicyClick = { }, - onThirdPartyPolicyClick = { }, - ) - } -} - @ComponentPreview @Composable fun WaitingConfirmDialogPreview() { @@ -870,17 +793,3 @@ fun WaitingConfirmDialogPreview() { ) } } - -@DarkComponentPreview -@Composable -fun WaitingConfirmDialogDarkPreview() { - UnifestTheme { - WaitingConfirmDialog( - boothName = "컴공 주점", - waitingId = 1, - waitingPartySize = 3, - waitingTeamNumber = 3, - onConfirmClick = { }, - ) - } -} diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/HorizontalDivider.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/HorizontalDivider.kt index 1fa2322e..a17e989e 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/HorizontalDivider.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/HorizontalDivider.kt @@ -8,7 +8,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.theme.UnifestTheme @Composable @@ -31,11 +30,3 @@ fun UnifestHorizontalDividerPreview() { UnifestHorizontalDivider() } } - -@DarkComponentPreview -@Composable -fun UnifestHorizontalDividerDarkPreview() { - UnifestTheme { - UnifestHorizontalDivider() - } -} diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/LoadingWheel.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/LoadingWheel.kt index df3b7283..0e8e106f 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/LoadingWheel.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/LoadingWheel.kt @@ -8,7 +8,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import com.unifest.android.core.common.extension.noRippleClickable import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.theme.UnifestTheme @Composable @@ -30,11 +29,3 @@ fun LoadingWheelPreview() { LoadingWheel() } } - -@DarkComponentPreview -@Composable -fun LoadingWheelDarkPreview() { - UnifestTheme { - LoadingWheel() - } -} diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/NetworkImage.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/NetworkImage.kt index 54ebbb76..0c9811fb 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/NetworkImage.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/NetworkImage.kt @@ -13,7 +13,6 @@ import com.skydoves.landscapist.coil.CoilImage import com.skydoves.landscapist.components.rememberImageComponent import com.skydoves.landscapist.placeholder.placeholder.PlaceholderPlugin import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.theme.UnifestTheme @@ -58,14 +57,3 @@ fun NetworkImagePreview() { ) } } - -@DarkComponentPreview -@Composable -fun NetworkImageDarkPreview() { - UnifestTheme { - NetworkImage( - imgUrl = "", - contentDescription = "", - ) - } -} diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/OutlinedButton.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/OutlinedButton.kt index ebd9ff28..531c4d26 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/OutlinedButton.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/OutlinedButton.kt @@ -15,7 +15,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.theme.UnifestTheme @Composable @@ -56,15 +55,3 @@ fun UnifestOutlinedButtonPreview() { } } } - -@DarkComponentPreview -@Composable -fun UnifestOutlinedButtonDarkPreview() { - UnifestTheme { - UnifestOutlinedButton( - onClick = {}, - ) { - Text("Outlined Button") - } - } -} diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/SearchTextField.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/SearchTextField.kt index a91ac659..ce5dc60e 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/SearchTextField.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/SearchTextField.kt @@ -38,7 +38,6 @@ import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.theme.BoothLocation import com.unifest.android.core.designsystem.theme.LightPrimary100 @@ -232,24 +231,6 @@ fun SearchTextFieldPreview() { } } -@DarkComponentPreview -@Composable -fun SearchTextFieldDarkPreview() { - UnifestTheme { - SearchTextField( - searchText = TextFieldValue(), - updateSearchText = {}, - searchTextHintRes = R.string.intro_search_text_hint, - onSearch = {}, - clearSearchText = {}, - modifier = Modifier - .height(46.dp) - .fillMaxWidth() - .padding(horizontal = 20.dp), - ) - } -} - @ComponentPreview @Composable fun FestivalSearchTextFieldPreview() { @@ -269,23 +250,3 @@ fun FestivalSearchTextFieldPreview() { ) } } - -@DarkComponentPreview -@Composable -fun FestivalSearchTextFieldDarkPreview() { - UnifestTheme { - FestivalSearchTextField( - searchText = TextFieldValue("건국대학교"), - updateSearchText = {}, - searchTextHintRes = R.string.intro_search_text_hint, - onSearch = {}, - clearSearchText = {}, - setEnableSearchMode = {}, - isSearchMode = true, - modifier = Modifier - .height(46.dp) - .fillMaxWidth() - .padding(horizontal = 20.dp), - ) - } -} diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Tooltip.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Tooltip.kt index 34ee24dc..57eb5be9 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Tooltip.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Tooltip.kt @@ -27,7 +27,6 @@ import com.skydoves.balloon.compose.Balloon import com.skydoves.balloon.compose.rememberBalloonBuilder import com.unifest.android.core.common.extension.noRippleClickable import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.theme.Content5 import com.unifest.android.core.designsystem.theme.Title1 @@ -148,16 +147,6 @@ fun LikedFestivalToolTipPreview() { } } -@DarkComponentPreview -@Composable -fun LikedFestivalToolTipDarkPreview() { - UnifestTheme { - LikedFestivalToolTip( - completeOnboarding = {}, - ) - } -} - @ComponentPreview @Composable fun SchoolSearchTitleWithToolTipPreview() { @@ -169,15 +158,3 @@ fun SchoolSearchTitleWithToolTipPreview() { ) } } - -@DarkComponentPreview -@Composable -fun SchoolSearchTitleWithToolTipDarkPreview() { - UnifestTheme { - SchoolSearchTitleWithToolTip( - title = "건국대학교", - onTitleClick = {}, - completeOnboarding = {}, - ) - } -} diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/TopAppBar.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/TopAppBar.kt index b117d01d..01b1149f 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/TopAppBar.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/TopAppBar.kt @@ -28,7 +28,6 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.theme.Title1 import com.unifest.android.core.designsystem.theme.UnifestTheme @@ -147,17 +146,6 @@ fun UnifestTopAppBarPreview() { } } -@DarkComponentPreview -@Composable -fun UnifestTopAppBarDarkPreview() { - UnifestTheme { - UnifestTopAppBar( - navigationType = TopAppBarNavigationType.None, - title = "UniFest", - ) - } -} - @ComponentPreview @Composable fun SchoolSearchTitlePreview() { @@ -169,17 +157,6 @@ fun SchoolSearchTitlePreview() { } } -@DarkComponentPreview -@Composable -fun SchoolSearchTitleDarkPreview() { - UnifestTheme { - SchoolSearchTitle( - title = "건국대학교", - onTitleClick = {}, - ) - } -} - @ComponentPreview @Composable fun UnifestTopAppBarWithBackButtonPreview() { @@ -190,14 +167,3 @@ fun UnifestTopAppBarWithBackButtonPreview() { ) } } - -@DarkComponentPreview -@Composable -fun UnifestTopAppBarWithBackButtonDarkPreview() { - UnifestTheme { - UnifestTopAppBar( - navigationType = TopAppBarNavigationType.Back, - navigationIconContentDescription = "Navigation back icon", - ) - } -} diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/DarkDevicePreview.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/DarkDevicePreview.kt deleted file mode 100644 index f706036c..00000000 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/DarkDevicePreview.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.unifest.android.core.ui - -import android.content.res.Configuration -import androidx.compose.ui.tooling.preview.Preview - -@Preview( - name = "Portrait", - showBackground = true, - uiMode = Configuration.UI_MODE_NIGHT_YES, - device = "spec:width=360dp,height=800dp,dpi=411", -) -annotation class DarkDevicePreview diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/DevicePreview.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/DevicePreview.kt index 15e3c970..1f9192fb 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/DevicePreview.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/DevicePreview.kt @@ -1,10 +1,19 @@ package com.unifest.android.core.ui +import android.content.res.Configuration.UI_MODE_NIGHT_NO +import android.content.res.Configuration.UI_MODE_NIGHT_YES import androidx.compose.ui.tooling.preview.Preview @Preview( - name = "Portrait", + name = "Light", showBackground = true, + uiMode = UI_MODE_NIGHT_NO, + device = "spec:width=360dp,height=800dp,dpi=411", +) +@Preview( + name = "Dark", + showBackground = true, + uiMode = UI_MODE_NIGHT_YES, device = "spec:width=360dp,height=800dp,dpi=411", ) annotation class DevicePreview diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/BoothFilterChips.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/BoothFilterChips.kt index 21f2c3ba..a15758b6 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/BoothFilterChips.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/BoothFilterChips.kt @@ -7,7 +7,6 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.component.BoothFilterChip import com.unifest.android.core.designsystem.theme.UnifestTheme import kotlinx.collections.immutable.ImmutableList @@ -47,14 +46,3 @@ fun BoothFilterChipsPreview() { ) } } - -@DarkComponentPreview -@Composable -fun BoothFilterChipsDarkPreview() { - UnifestTheme { - BoothFilterChips( - onChipClick = {}, - selectedChips = persistentListOf("주점", "먹거리"), - ) - } -} diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/EmptyLikedBoothItem.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/EmptyLikedBoothItem.kt index 54abe65f..f5bf46d3 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/EmptyLikedBoothItem.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/EmptyLikedBoothItem.kt @@ -16,7 +16,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.theme.Content6 import com.unifest.android.core.designsystem.theme.Title2 @@ -62,15 +61,3 @@ fun EmptyLikedBoothItemPreview() { ) } } - -@DarkComponentPreview -@Composable -fun EmptyLikedBoothItemDarkPreview() { - UnifestTheme { - EmptyLikedBoothItem( - modifier = Modifier - .fillMaxWidth() - .height(248.dp), - ) - } -} diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedBoothItem.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedBoothItem.kt index 0ac998af..31d51dce 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedBoothItem.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedBoothItem.kt @@ -27,7 +27,6 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.unifest.android.core.common.extension.clickableSingle import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.component.NetworkImage import com.unifest.android.core.designsystem.theme.Title2 @@ -142,23 +141,3 @@ fun LikedBoothItemPreview() { ) } } - -@DarkComponentPreview -@Composable -fun LikedBoothItemDarkPreview() { - UnifestTheme { - LikedBoothItem( - booth = LikedBoothModel( - id = 1, - name = "부스 이름", - category = "부스 카테고리", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - index = 0, - totalCount = 1, - deleteLikedBooth = {}, - ) - } -} diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedFestivalGrid.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedFestivalGrid.kt index c846f8f3..1034f9ec 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedFestivalGrid.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedFestivalGrid.kt @@ -36,7 +36,6 @@ import androidx.compose.ui.unit.dp import com.unifest.android.core.common.utils.formatToString import com.unifest.android.core.common.utils.toLocalDate import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.component.NetworkImage import com.unifest.android.core.designsystem.theme.Content2 @@ -184,29 +183,6 @@ fun FestivalItemPreview() { } } -@DarkComponentPreview -@Composable -fun FestivalItemDarkPreview() { - val festival = FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ) - UnifestTheme { - FestivalItem( - festival = festival, - onFestivalSelected = {}, - ) - } -} - @ComponentPreview @Composable fun LikedFestivalsGridPreview() { @@ -236,35 +212,6 @@ fun LikedFestivalsGridPreview() { } } -@DarkComponentPreview -@Composable -fun LikedFestivalsGridDarkPreview() { - val selectedFestivals = persistentListOf() - repeat(5) { - selectedFestivals.add( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ) - } - UnifestTheme { - LikedFestivalsGrid( - selectedFestivals = selectedFestivals, - onFestivalSelected = {}, - onDeleteLikedFestivalClick = {}, - ) - } -} - @ComponentPreview @Composable fun LikedFestivalsGridEditModePreview() { @@ -294,33 +241,3 @@ fun LikedFestivalsGridEditModePreview() { ) } } - -@DarkComponentPreview -@Composable -fun LikedFestivalsGridEditModeDarkPreview() { - val selectedFestivals = persistentListOf() - repeat(5) { - selectedFestivals.add( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ) - } - UnifestTheme { - LikedFestivalsGrid( - selectedFestivals = selectedFestivals, - onFestivalSelected = {}, - onDeleteLikedFestivalClick = {}, - isEditMode = true, - ) - } -} diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/PermissionDialog.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/PermissionDialog.kt index e6a32741..9c183b7c 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/PermissionDialog.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/PermissionDialog.kt @@ -20,7 +20,6 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.unifest.android.core.common.extension.noRippleClickable import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.theme.Content2 import com.unifest.android.core.designsystem.theme.Title3 @@ -127,17 +126,3 @@ fun PermissionDialogPreview() { ) } } - -@DarkComponentPreview -@Composable -fun PermissionDialogDarkPreview() { - UnifestTheme { - PermissionDialog( - permissionTextProvider = LocationPermissionTextProvider(), - isPermanentlyDeclined = false, - onDismiss = {}, - navigateToAppSetting = {}, - onConfirm = {}, - ) - } -} diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/StarImage.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/StarImage.kt index 8427245e..682b96a4 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/StarImage.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/StarImage.kt @@ -11,7 +11,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.layout.ContentScale import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.component.AutoResizedText import com.unifest.android.core.designsystem.component.NetworkImage import com.unifest.android.core.designsystem.theme.Content9 @@ -74,20 +73,6 @@ fun StarImagePreview() { } } -@DarkComponentPreview -@Composable -fun StarImageDarkPreview() { - UnifestTheme { - StarImage( - imgUrl = "", - onClick = {}, - onLongClick = {}, - isClicked = false, - label = "", - ) - } -} - @ComponentPreview @Composable fun StarImageClickedPreview() { @@ -101,17 +86,3 @@ fun StarImageClickedPreview() { ) } } - -@DarkComponentPreview -@Composable -fun StarImageClickedDarkPreview() { - UnifestTheme { - StarImage( - imgUrl = "", - onClick = {}, - onLongClick = {}, - isClicked = true, - label = "키스오브라이프", - ) - } -} diff --git a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt index adef6406..b382e09f 100644 --- a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt +++ b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt @@ -53,7 +53,6 @@ import com.unifest.android.core.designsystem.theme.Title2 import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.core.model.BoothDetailModel import com.unifest.android.core.model.MenuModel -import com.unifest.android.core.ui.DarkDevicePreview import com.unifest.android.core.ui.DevicePreview import com.unifest.android.feature.booth.component.BoothBottomBar import com.unifest.android.feature.booth.component.BoothDescription @@ -337,33 +336,3 @@ fun BoothScreenPreview() { ) } } - -@DarkDevicePreview -@Composable -fun BoothScreenDarkPreview() { - UnifestTheme { - BoothDetailScreen( - padding = PaddingValues(), - uiState = BoothUiState( - boothDetailInfo = BoothDetailModel( - id = 0L, - name = "컴공 주점", - category = "컴퓨터공학부 전용 부스", - description = "저희 주점은 일본 이자카야를 모티브로 만든 컴공인을 위한 주점입니다. 100번째 방문자에게 깜짝 선물 증정 이벤트를 하고 있으니 많은 관심 부탁드려요~!", - warning = "", - location = "청심대 앞", - latitude = 37.54224856023523f, - longitude = 127.07605430700158f, - menus = listOf( - MenuModel(1L, "모둠 사시미", 45000, ""), - MenuModel(2L, "모둠 사시미", 45000, ""), - MenuModel(3L, "모둠 사시미", 45000, ""), - MenuModel(4L, "모둠 사시미", 45000, ""), - ), - ), - ), - snackBarState = SnackbarHostState(), - onAction = {}, - ) - } -} diff --git a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothLocationScreen.kt b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothLocationScreen.kt index b856fc12..8bcc53ee 100644 --- a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothLocationScreen.kt +++ b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothLocationScreen.kt @@ -40,14 +40,12 @@ import com.naver.maps.map.compose.NaverMap import com.naver.maps.map.compose.PolygonOverlay import com.naver.maps.map.compose.rememberCameraPositionState import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.MarkerCategory import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.theme.BoothLocation import com.unifest.android.core.designsystem.theme.Title1 import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.core.model.BoothDetailModel -import com.unifest.android.core.ui.DarkDevicePreview import com.unifest.android.core.ui.DevicePreview import com.unifest.android.feature.booth.viewmodel.BoothUiState import com.unifest.android.feature.booth.viewmodel.BoothViewModel @@ -185,27 +183,6 @@ fun BoothLocationScreenPreview() { } } -@DarkDevicePreview -@Composable -fun BoothLocationScreenDarkPreview() { - UnifestTheme { - BoothLocationScreen( - uiState = BoothUiState( - boothDetailInfo = BoothDetailModel( - id = 0L, - name = "컴공 주점", - category = "컴퓨터공학부 전용 부스", - description = "저희 주점은 일본 이자카야를 모티브로 만든 컴공인을 위한 주점입니다. 100번째 방문자에게 깜짝 선물 증정 이벤트를 하고 있으니 많은 관심 부탁드려요~!", - location = "청심대 앞", - latitude = 37.54224856023523f, - longitude = 127.07605430700158f, - ), - ), - onBackClick = {}, - ) - } -} - @ComponentPreview @Composable fun BoothLocationAppBarPreview() { @@ -217,15 +194,3 @@ fun BoothLocationAppBarPreview() { ) } } - -@DarkComponentPreview -@Composable -fun BoothLocationAppBarDarkPreview() { - UnifestTheme { - BoothLocationAppBar( - onBackClick = {}, - boothName = "컴공 주점", - boothLocation = "청심대 앞", - ) - } -} diff --git a/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalBottomSheet.kt b/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalBottomSheet.kt index 5811bb3e..9bdd7b53 100644 --- a/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalBottomSheet.kt +++ b/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalBottomSheet.kt @@ -30,7 +30,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.component.FestivalSearchTextField import com.unifest.android.core.designsystem.component.LikedFestivalDeleteDialog @@ -321,142 +320,3 @@ fun SchoolSearchBottomSheetPreview() { ) } } - -@DarkComponentPreview -@Composable -fun SchoolSearchBottomSheetDarkPreview() { - UnifestTheme { - FestivalSearchBottomSheet( - searchTextHintRes = R.string.festival_search_text_field_hint, - searchText = TextFieldValue(), - likedFestivals = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 3, - 3, - "https://picsum.photos/36", - "고려대학교", - "서울", - "고대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 4, - 4, - "https://picsum.photos/36", - "성균관대학교", - "서울", - "성대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 5, - 5, - "https://picsum.photos/36", - "건국대학교", - "서울", - "건대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), - festivalSearchResults = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 3, - 3, - "https://picsum.photos/36", - "고려대학교", - "서울", - "고대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 4, - 4, - "https://picsum.photos/36", - "성균관대학교", - "성대축제", - "서울", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 5, - 5, - "https://picsum.photos/36", - "건국대학교", - "서울", - "건대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), - isSearchMode = false, - isEditMode = false, - isLikedFestivalDeleteDialogVisible = false, - onFestivalUiAction = {}, - ) - } -} diff --git a/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalSearchResults.kt b/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalSearchResults.kt index 07aeefe8..0cb2d33f 100644 --- a/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalSearchResults.kt +++ b/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalSearchResults.kt @@ -31,7 +31,6 @@ import com.unifest.android.core.common.extension.noRippleClickable import com.unifest.android.core.common.utils.formatToString import com.unifest.android.core.common.utils.toLocalDate import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.component.NetworkImage import com.unifest.android.core.designsystem.component.UnifestOutlinedButton import com.unifest.android.core.designsystem.theme.Content2 @@ -259,73 +258,3 @@ fun FestivalSearchResultsPreview() { onFestivalUiAction = {}, ) } - -@DarkComponentPreview -@Composable -fun FestivalSearchResultsDarkPreview() { - FestivalSearchResults( - searchResults = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 3, - 3, - "https://picsum.photos/36", - "고려대학교", - "서울", - "고대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 4, - 4, - "https://picsum.photos/36", - "성균관대학교", - "서울", - "성대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 5, - 5, - "https://picsum.photos/36", - "건국대학교", - "서울", - "건대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), - onFestivalUiAction = {}, - ) -} diff --git a/feature/home/src/main/kotlin/com/unifest/android/feature/home/Calendar.kt b/feature/home/src/main/kotlin/com/unifest/android/feature/home/Calendar.kt index b0b4e86a..25abb31c 100644 --- a/feature/home/src/main/kotlin/com/unifest/android/feature/home/Calendar.kt +++ b/feature/home/src/main/kotlin/com/unifest/android/feature/home/Calendar.kt @@ -55,7 +55,6 @@ import com.kizitonwose.calendar.core.previousMonth import com.kizitonwose.calendar.core.yearMonth import com.unifest.android.core.common.utils.toLocalDate import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.theme.BoothTitle0 import com.unifest.android.core.designsystem.theme.Content6 @@ -426,17 +425,3 @@ fun CalendarPreview() { ) } } - -@DarkComponentPreview -@Composable -fun CalendarDarkPreview() { - UnifestTheme { - Calendar( - selectedDate = LocalDate.now(), - onDateSelected = {}, - allFestivals = persistentListOf(), - isWeekMode = false, - ocClickWeekMode = {}, - ) - } -} diff --git a/feature/home/src/main/kotlin/com/unifest/android/feature/home/HomeScreen.kt b/feature/home/src/main/kotlin/com/unifest/android/feature/home/HomeScreen.kt index 58bb83eb..2d252244 100644 --- a/feature/home/src/main/kotlin/com/unifest/android/feature/home/HomeScreen.kt +++ b/feature/home/src/main/kotlin/com/unifest/android/feature/home/HomeScreen.kt @@ -42,7 +42,6 @@ import com.unifest.android.core.designsystem.theme.Title3 import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.core.model.FestivalModel import com.unifest.android.core.model.FestivalTodayModel -import com.unifest.android.core.ui.DarkDevicePreview import com.unifest.android.core.ui.DevicePreview import com.unifest.android.feature.festival.FestivalSearchBottomSheet import com.unifest.android.feature.festival.viewmodel.FestivalUiAction @@ -311,77 +310,3 @@ fun HomeScreenPreview() { ) } } - -@DarkDevicePreview -@Composable -fun HomeScreenDarkPreview() { - UnifestTheme { - HomeScreen( - padding = PaddingValues(), - homeUiState = HomeUiState( - todayFestivals = persistentListOf( - FestivalTodayModel( - festivalId = 1, - beginDate = "2024-04-05", - endDate = "2024-04-07", - festivalName = "녹색지대 DAY 1", - schoolName = "건국대학교 서울캠퍼스", - starInfo = listOf(), - thumbnail = "https://picsum.photos/36", - schoolId = 1, - ), - - FestivalTodayModel( - festivalId = 2, - beginDate = "2024-04-05", - endDate = "2024-04-07", - festivalName = "녹색지대 DAY 1", - schoolName = "건국대학교 서울캠퍼스", - starInfo = listOf(), - thumbnail = "https://picsum.photos/36", - schoolId = 2, - ), - FestivalTodayModel( - festivalId = 3, - beginDate = "2024-04-05", - endDate = "2024-04-07", - festivalName = "녹색지대 DAY 1", - schoolName = "건국대학교 서울캠퍼스", - starInfo = listOf(), - thumbnail = "https://picsum.photos/36", - schoolId = 3, - ), - ), - incomingFestivals = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), - ), - festivalUiState = FestivalUiState(), - onHomeUiAction = {}, - onFestivalUiAction = {}, - ) - } -} diff --git a/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/LikedBoothScreen.kt b/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/LikedBoothScreen.kt index 1b9eaed5..d591d70c 100644 --- a/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/LikedBoothScreen.kt +++ b/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/LikedBoothScreen.kt @@ -30,7 +30,6 @@ import com.unifest.android.core.designsystem.component.TopAppBarNavigationType import com.unifest.android.core.designsystem.component.UnifestTopAppBar import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.core.model.LikedBoothModel -import com.unifest.android.core.ui.DarkDevicePreview import com.unifest.android.core.ui.DevicePreview import com.unifest.android.core.ui.component.EmptyLikedBoothItem import com.unifest.android.core.ui.component.LikedBoothItem @@ -195,66 +194,3 @@ fun LikedBoothScreenPreview() { ) } } - -@DarkDevicePreview -@Composable -fun LikedBoothScreenDarkPreview() { - UnifestTheme { - LikedBoothScreen( - padding = PaddingValues(), - uiState = LikedBoothUiState( - likedBooths = persistentListOf( - LikedBoothModel( - id = 1, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 2, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 3, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 4, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 5, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 6, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - ), - ), - onAction = {}, - ) - } -} diff --git a/feature/map/src/main/kotlin/com/unifest/android/feature/map/component/BoothItem.kt b/feature/map/src/main/kotlin/com/unifest/android/feature/map/component/BoothItem.kt index d6f2fa4c..5a88fe94 100644 --- a/feature/map/src/main/kotlin/com/unifest/android/feature/map/component/BoothItem.kt +++ b/feature/map/src/main/kotlin/com/unifest/android/feature/map/component/BoothItem.kt @@ -32,7 +32,6 @@ import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.component.NetworkImage import com.unifest.android.core.designsystem.theme.Content2 @@ -158,25 +157,6 @@ fun BoothItemPreview() { } } -@DarkComponentPreview -@Composable -fun BoothItemDarkPreview() { - UnifestTheme { - BoothItem( - boothInfo = BoothMapModel( - id = 1L, - name = "컴공 주점", - category = "", - description = "저희 주점은 일본 이자카야를 모티브로 만든 컴공인을 위한 주점입니다. 100번째 방문자에게 깜짝 선물 증정 이벤트를 하고 있으니 많은 관심 부탁드려요~!", - location = "청심대 앞", - ), - isPopularMode = true, - ranking = 1, - onAction = {}, - ) - } -} - @ComponentPreview @Composable fun RankingBadgePreview() { @@ -184,11 +164,3 @@ fun RankingBadgePreview() { RankingBadge(ranking = 1) } } - -@DarkComponentPreview -@Composable -fun RankingBadgeDarkPreview() { - UnifestTheme { - RankingBadge(ranking = 1) - } -} diff --git a/feature/map/src/main/kotlin/com/unifest/android/feature/map/component/MapTopAppBar.kt b/feature/map/src/main/kotlin/com/unifest/android/feature/map/component/MapTopAppBar.kt index 1cfb36f0..6703247b 100644 --- a/feature/map/src/main/kotlin/com/unifest/android/feature/map/component/MapTopAppBar.kt +++ b/feature/map/src/main/kotlin/com/unifest/android/feature/map/component/MapTopAppBar.kt @@ -15,7 +15,6 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import com.unifest.android.core.designsystem.ComponentPreview -import com.unifest.android.core.designsystem.DarkComponentPreview import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.component.SearchTextField import com.unifest.android.core.designsystem.component.TopAppBarNavigationType @@ -92,18 +91,3 @@ fun MapTopAppBarPreview() { ) } } - -@DarkComponentPreview -@Composable -fun MapTopAppBarDarkPreview() { - UnifestTheme { - MapTopAppBar( - title = "건국대학교", - boothSearchText = TextFieldValue(), - isOnboardingCompleted = false, - onMapUiAction = {}, - onFestivalUiAction = {}, - selectedChips = persistentListOf("주점", "먹거리"), - ) - } -} diff --git a/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/MenuScreen.kt b/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/MenuScreen.kt index 6ae14f5c..f34e75cd 100644 --- a/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/MenuScreen.kt +++ b/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/MenuScreen.kt @@ -68,7 +68,6 @@ import com.unifest.android.core.designsystem.theme.Title3 import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.core.model.FestivalModel import com.unifest.android.core.model.LikedBoothModel -import com.unifest.android.core.ui.DarkDevicePreview import com.unifest.android.core.ui.DevicePreview import com.unifest.android.core.ui.component.EmptyLikedBoothItem import com.unifest.android.core.ui.component.LikedBoothItem @@ -489,63 +488,3 @@ fun MenuScreenPreview() { ) } } - -@DarkDevicePreview -@Composable -fun MenuScreenDarkPreview() { - UnifestTheme { - MenuScreen( - padding = PaddingValues(), - menuUiState = MenuUiState( - festivals = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), - likedBooths = persistentListOf( - LikedBoothModel( - id = 1, - name = "부스 이름", - category = "부스 카테고리", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 2, - name = "부스 이름", - category = "부스 카테고리", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - ), - ), - festivalUiState = FestivalUiState(), - appVersion = "1.0.0", - onMenuUiAction = {}, - onFestivalUiAction = {}, - ) - } -} From aa4a28c273560e97c757cdaa31b615d009b3eafe Mon Sep 17 00:00:00 2001 From: "jihun.lee" Date: Mon, 26 Aug 2024 11:28:59 +0900 Subject: [PATCH 2/4] =?UTF-8?q?refactor:=20BoothDetailScreen=20PreviewPara?= =?UTF-8?q?meterProvider=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/booth/BoothDetailScreen.kt | 29 +++++-------------- ...thDetailUiStatePreviewParameterProvider.kt | 26 +++++++++++++++++ 2 files changed, 33 insertions(+), 22 deletions(-) create mode 100644 feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailUiStatePreviewParameterProvider.kt diff --git a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt index b382e09f..61ab571c 100644 --- a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt +++ b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt @@ -29,6 +29,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -52,11 +53,11 @@ import com.unifest.android.core.designsystem.theme.DarkGrey100 import com.unifest.android.core.designsystem.theme.Title2 import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.core.model.BoothDetailModel -import com.unifest.android.core.model.MenuModel import com.unifest.android.core.ui.DevicePreview import com.unifest.android.feature.booth.component.BoothBottomBar import com.unifest.android.feature.booth.component.BoothDescription import com.unifest.android.feature.booth.component.MenuItem +import com.unifest.android.feature.booth.preview.BoothDetailUiStatePreviewParameterProvider import com.unifest.android.feature.booth.viewmodel.BoothUiAction import com.unifest.android.feature.booth.viewmodel.BoothUiEvent import com.unifest.android.feature.booth.viewmodel.BoothUiState @@ -136,8 +137,6 @@ fun BoothDetailScreen( snackBarState: SnackbarHostState, onAction: (BoothUiAction) -> Unit, ) { - val activity = LocalContext.current.findActivity() - Box( modifier = Modifier .fillMaxSize() @@ -309,28 +308,14 @@ fun BoothDetailContent( @DevicePreview @Composable -fun BoothScreenPreview() { +private fun BoothScreenPreview( + @PreviewParameter(BoothDetailUiStatePreviewParameterProvider::class) + boothDetailInfo: BoothDetailModel, +) { UnifestTheme { BoothDetailScreen( padding = PaddingValues(), - uiState = BoothUiState( - boothDetailInfo = BoothDetailModel( - id = 0L, - name = "컴공 주점", - category = "컴퓨터공학부 전용 부스", - description = "저희 주점은 일본 이자카야를 모티브로 만든 컴공인을 위한 주점입니다. 100번째 방문자에게 깜짝 선물 증정 이벤트를 하고 있으니 많은 관심 부탁드려요~!", - warning = "", - location = "청심대 앞", - latitude = 37.54224856023523f, - longitude = 127.07605430700158f, - menus = listOf( - MenuModel(1L, "모둠 사시미", 45000, ""), - MenuModel(2L, "모둠 사시미", 45000, ""), - MenuModel(3L, "모둠 사시미", 45000, ""), - MenuModel(4L, "모둠 사시미", 45000, ""), - ), - ), - ), + uiState = BoothUiState(boothDetailInfo = boothDetailInfo), snackBarState = SnackbarHostState(), onAction = {}, ) diff --git a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailUiStatePreviewParameterProvider.kt b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailUiStatePreviewParameterProvider.kt new file mode 100644 index 00000000..6c58b15c --- /dev/null +++ b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailUiStatePreviewParameterProvider.kt @@ -0,0 +1,26 @@ +package com.unifest.android.feature.booth.preview + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import com.unifest.android.core.model.BoothDetailModel +import com.unifest.android.core.model.MenuModel + +internal class BoothDetailUiStatePreviewParameterProvider: PreviewParameterProvider { + override val values = sequenceOf( + BoothDetailModel( + id = 0L, + name = "컴공 주점", + category = "컴퓨터공학부 전용 부스", + description = "저희 주점은 일본 이자카야를 모티브로 만든 컴공인을 위한 주점입니다. 100번째 방문자에게 깜짝 선물 증정 이벤트를 하고 있으니 많은 관심 부탁드려요~!", + warning = "", + location = "청심대 앞", + latitude = 37.54224856023523f, + longitude = 127.07605430700158f, + menus = listOf( + MenuModel(1L, "모둠 사시미", 45000, ""), + MenuModel(2L, "모둠 사시미", 45000, ""), + MenuModel(3L, "모둠 사시미", 45000, ""), + MenuModel(4L, "모둠 사시미", 45000, ""), + ), + ) + ) +} From 088d39f670b9c2841c77d41e0a1a9fbb4ab30a2a Mon Sep 17 00:00:00 2001 From: "jihun.lee" Date: Mon, 26 Aug 2024 15:10:12 +0900 Subject: [PATCH 3/4] =?UTF-8?q?chore:=20detekt-config=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- detekt-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detekt-config.yml b/detekt-config.yml index 213ab0e2..36951a0c 100644 --- a/detekt-config.yml +++ b/detekt-config.yml @@ -56,7 +56,7 @@ style: ForbiddenComment: active: false UnusedPrivateMember: - ignoreAnnotated: [ 'Preview' ] + ignoreAnnotated: [ 'Preview', 'ComponentPreview', 'DevicePreview' ] ThrowsCount: active: false ReturnCount: From e64447500e9c8ffda64947b825edf4274c272c4d Mon Sep 17 00:00:00 2001 From: "jihun.lee" Date: Mon, 26 Aug 2024 20:46:50 +0900 Subject: [PATCH 4/4] =?UTF-8?q?refactor:=20@PreviewParameterProvider=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 각 화면의 component 파일별로 분리 -> preview 적용 --- .../designsystem/component/BoothFilterChip.kt | 4 +- .../core/designsystem/component/Button.kt | 4 +- .../core/designsystem/component/Dialog.kt | 15 +- .../component/HorizontalDivider.kt | 2 +- .../designsystem/component/LoadingWheel.kt | 2 +- .../designsystem/component/NetworkImage.kt | 2 +- .../designsystem/component/OutlinedButton.kt | 2 +- .../designsystem/component/SearchTextField.kt | 4 +- .../core/designsystem/component/Tooltip.kt | 4 +- .../core/designsystem/component/TopAppBar.kt | 6 +- .../core/ui/component/BoothFilterChips.kt | 2 +- .../core/ui/component/EmptyLikedBoothItem.kt | 2 +- .../core/ui/component/LikedBoothItem.kt | 7 +- .../core/ui/component/LikedFestivalGrid.kt | 31 +- .../android/core/ui/component/StarImage.kt | 4 +- .../feature/booth/BoothDetailScreen.kt | 9 +- .../feature/booth/BoothLocationScreen.kt | 108 +---- .../android/feature/booth/MenuImageDialog.kt | 18 + .../booth/component/BoothLocationAppBar.kt | 94 +++++ .../BoothDetailPreviewParameterProvider.kt | 29 ++ ...thDetailUiStatePreviewParameterProvider.kt | 26 -- .../feature/festival/FestivalBottomSheet.kt | 139 +------ .../feature/festival/FestivalSearchResults.kt | 80 +--- .../FestivalPreviewParameterProvider.kt | 137 +++++++ .../android/feature/home/HomeScreen.kt | 76 +--- .../android/feature/home/StarImageDialog.kt | 17 + .../feature/home/{ => component}/Calendar.kt | 5 +- .../preview/HomePreviewParameterProvider.kt | 72 ++++ .../android/feature/intro/IntroScreen.kt | 384 ++---------------- .../intro/component/AllFestivalsRow.kt | 226 +++++++++++ .../intro/component/FestivalRowItem.kt | 111 +++++ .../intro/component/LikedFestivalsRow.kt | 97 +++++ .../preview/IntroPreviewParameterProvider.kt | 68 ++++ .../feature/liked_booth/LikedBoothScreen.kt | 62 +-- .../LikedBoothPreviewParameterProvider.kt | 63 +++ .../viewmodel/LikedBoothUiState.kt | 1 - .../android/feature/main/MainScreen.kt | 125 +----- .../feature/main/component/MainBottomBar.kt | 131 ++++++ .../unifest/android/feature/map/MapScreen.kt | 2 +- .../android/feature/menu/MenuScreen.kt | 172 +------- .../feature/menu/component/FestivalItem.kt | 79 ++++ .../feature/menu/component/MenuItem.kt | 47 +++ .../preview/MenuPreviewParameterProvider.kt | 58 +++ .../android/feature/waiting/WaitingScreen.kt | 197 +-------- .../waiting/component/WaitingInfoItem.kt | 209 ++++++++++ .../WaitingPreviewParameterProvider.kt | 50 +++ 46 files changed, 1666 insertions(+), 1317 deletions(-) create mode 100644 feature/booth/src/main/kotlin/com/unifest/android/feature/booth/component/BoothLocationAppBar.kt create mode 100644 feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailPreviewParameterProvider.kt delete mode 100644 feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailUiStatePreviewParameterProvider.kt create mode 100644 feature/festival/src/main/kotlin/com/unifest/android/feature/festival/preview/FestivalPreviewParameterProvider.kt rename feature/home/src/main/kotlin/com/unifest/android/feature/home/{ => component}/Calendar.kt (98%) create mode 100644 feature/home/src/main/kotlin/com/unifest/android/feature/home/preview/HomePreviewParameterProvider.kt create mode 100644 feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/AllFestivalsRow.kt create mode 100644 feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/FestivalRowItem.kt create mode 100644 feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/LikedFestivalsRow.kt create mode 100644 feature/intro/src/main/kotlin/com/unifest/android/feature/intro/preview/IntroPreviewParameterProvider.kt create mode 100644 feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/preview/LikedBoothPreviewParameterProvider.kt create mode 100644 feature/main/src/main/kotlin/com/unifest/android/feature/main/component/MainBottomBar.kt create mode 100644 feature/menu/src/main/kotlin/com/unifest/android/feature/menu/component/FestivalItem.kt create mode 100644 feature/menu/src/main/kotlin/com/unifest/android/feature/menu/component/MenuItem.kt create mode 100644 feature/menu/src/main/kotlin/com/unifest/android/feature/menu/preview/MenuPreviewParameterProvider.kt create mode 100644 feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/component/WaitingInfoItem.kt create mode 100644 feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/preview/WaitingPreviewParameterProvider.kt diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/BoothFilterChip.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/BoothFilterChip.kt index 005bb9c5..ff59d0fa 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/BoothFilterChip.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/BoothFilterChip.kt @@ -55,7 +55,7 @@ fun BoothFilterChip( @ComponentPreview @Composable -fun BoothFilterChipPreview() { +private fun BoothFilterChipPreview() { UnifestTheme { BoothFilterChip( filterName = "주점", @@ -67,7 +67,7 @@ fun BoothFilterChipPreview() { @ComponentPreview @Composable -fun SelectedBoothFilterChipPreview() { +private fun SelectedBoothFilterChipPreview() { UnifestTheme { BoothFilterChip( filterName = "주점", diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Button.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Button.kt index 7d4a804a..db194030 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Button.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Button.kt @@ -48,7 +48,7 @@ fun UnifestButton( @ComponentPreview @Composable -fun UnifestButtonPreview() { +private fun UnifestButtonPreview() { UnifestTheme { UnifestButton( onClick = {}, @@ -60,7 +60,7 @@ fun UnifestButtonPreview() { @ComponentPreview @Composable -fun UnifestDisabledButtonPreview() { +private fun UnifestDisabledButtonPreview() { UnifestTheme { UnifestButton( onClick = {}, diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Dialog.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Dialog.kt index 315db88f..a9f666c3 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Dialog.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Dialog.kt @@ -708,14 +708,15 @@ fun WaitingCancelDialog( @ComponentPreview @Composable -fun ServerErrorDialogPreview() { +private fun ServerErrorDialogPreview() { UnifestTheme { ServerErrorDialog(onRetryClick = {}) } } + @ComponentPreview @Composable -fun NetworkErrorDialogPreview() { +private fun NetworkErrorDialogPreview() { UnifestTheme { NetworkErrorDialog(onRetryClick = {}) } @@ -723,7 +724,7 @@ fun NetworkErrorDialogPreview() { @ComponentPreview @Composable -fun LikedFestivalDeleteDialogPreview() { +private fun LikedFestivalDeleteDialogPreview() { UnifestTheme { LikedFestivalDeleteDialog( onCancelClick = {}, @@ -734,7 +735,7 @@ fun LikedFestivalDeleteDialogPreview() { @ComponentPreview @Composable -fun AppUpdateDialogPreview() { +private fun AppUpdateDialogPreview() { UnifestTheme { AppUpdateDialog( onDismissRequest = {}, @@ -745,7 +746,7 @@ fun AppUpdateDialogPreview() { @ComponentPreview @Composable -fun WaitingPinDialogPreview() { +private fun WaitingPinDialogPreview() { UnifestTheme { WaitingPinDialog( boothName = "컴공 주점", @@ -760,7 +761,7 @@ fun WaitingPinDialogPreview() { @ComponentPreview @Composable -fun WaitingDialogPreview() { +private fun WaitingDialogPreview() { UnifestTheme { WaitingDialog( boothName = "컴공 주점", @@ -782,7 +783,7 @@ fun WaitingDialogPreview() { @ComponentPreview @Composable -fun WaitingConfirmDialogPreview() { +private fun WaitingConfirmDialogPreview() { UnifestTheme { WaitingConfirmDialog( boothName = "컴공 주점", diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/HorizontalDivider.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/HorizontalDivider.kt index a17e989e..1a6f412b 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/HorizontalDivider.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/HorizontalDivider.kt @@ -25,7 +25,7 @@ fun UnifestHorizontalDivider( @ComponentPreview @Composable -fun UnifestHorizontalDividerPreview() { +private fun UnifestHorizontalDividerPreview() { UnifestTheme { UnifestHorizontalDivider() } diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/LoadingWheel.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/LoadingWheel.kt index 0e8e106f..b161f197 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/LoadingWheel.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/LoadingWheel.kt @@ -24,7 +24,7 @@ fun LoadingWheel( @ComponentPreview @Composable -fun LoadingWheelPreview() { +private fun LoadingWheelPreview() { UnifestTheme { LoadingWheel() } diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/NetworkImage.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/NetworkImage.kt index 0c9811fb..6f1b0d65 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/NetworkImage.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/NetworkImage.kt @@ -49,7 +49,7 @@ fun NetworkImage( @ComponentPreview @Composable -fun NetworkImagePreview() { +private fun NetworkImagePreview() { UnifestTheme { NetworkImage( imgUrl = "", diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/OutlinedButton.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/OutlinedButton.kt index 531c4d26..4ddb88c8 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/OutlinedButton.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/OutlinedButton.kt @@ -46,7 +46,7 @@ fun UnifestOutlinedButton( @ComponentPreview @Composable -fun UnifestOutlinedButtonPreview() { +private fun UnifestOutlinedButtonPreview() { UnifestTheme { UnifestOutlinedButton( onClick = {}, diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/SearchTextField.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/SearchTextField.kt index ce5dc60e..a62e4c5e 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/SearchTextField.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/SearchTextField.kt @@ -215,7 +215,7 @@ fun FestivalSearchTextField( @ComponentPreview @Composable -fun SearchTextFieldPreview() { +private fun SearchTextFieldPreview() { UnifestTheme { SearchTextField( searchText = TextFieldValue(), @@ -233,7 +233,7 @@ fun SearchTextFieldPreview() { @ComponentPreview @Composable -fun FestivalSearchTextFieldPreview() { +private fun FestivalSearchTextFieldPreview() { UnifestTheme { FestivalSearchTextField( searchText = TextFieldValue("건국대학교"), diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Tooltip.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Tooltip.kt index 57eb5be9..38f14a80 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Tooltip.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Tooltip.kt @@ -139,7 +139,7 @@ fun SchoolSearchTitleWithToolTip( @ComponentPreview @Composable -fun LikedFestivalToolTipPreview() { +private fun LikedFestivalToolTipPreview() { UnifestTheme { LikedFestivalToolTip( completeOnboarding = {}, @@ -149,7 +149,7 @@ fun LikedFestivalToolTipPreview() { @ComponentPreview @Composable -fun SchoolSearchTitleWithToolTipPreview() { +private fun SchoolSearchTitleWithToolTipPreview() { UnifestTheme { SchoolSearchTitleWithToolTip( title = "건국대학교", diff --git a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/TopAppBar.kt b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/TopAppBar.kt index 01b1149f..6516d145 100644 --- a/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/TopAppBar.kt +++ b/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/TopAppBar.kt @@ -137,7 +137,7 @@ fun SchoolSearchTitle( @ComponentPreview @Composable -fun UnifestTopAppBarPreview() { +private fun UnifestTopAppBarPreview() { UnifestTheme { UnifestTopAppBar( navigationType = TopAppBarNavigationType.None, @@ -148,7 +148,7 @@ fun UnifestTopAppBarPreview() { @ComponentPreview @Composable -fun SchoolSearchTitlePreview() { +private fun SchoolSearchTitlePreview() { UnifestTheme { SchoolSearchTitle( title = "건국대학교", @@ -159,7 +159,7 @@ fun SchoolSearchTitlePreview() { @ComponentPreview @Composable -fun UnifestTopAppBarWithBackButtonPreview() { +private fun UnifestTopAppBarWithBackButtonPreview() { UnifestTheme { UnifestTopAppBar( navigationType = TopAppBarNavigationType.Back, diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/BoothFilterChips.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/BoothFilterChips.kt index a15758b6..20220d9f 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/BoothFilterChips.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/BoothFilterChips.kt @@ -38,7 +38,7 @@ fun BoothFilterChips( @ComponentPreview @Composable -fun BoothFilterChipsPreview() { +private fun BoothFilterChipsPreview() { UnifestTheme { BoothFilterChips( onChipClick = {}, diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/EmptyLikedBoothItem.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/EmptyLikedBoothItem.kt index f5bf46d3..c38575d3 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/EmptyLikedBoothItem.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/EmptyLikedBoothItem.kt @@ -52,7 +52,7 @@ fun EmptyLikedBoothItem( @ComponentPreview @Composable -fun EmptyLikedBoothItemPreview() { +private fun EmptyLikedBoothItemPreview() { UnifestTheme { EmptyLikedBoothItem( modifier = Modifier diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedBoothItem.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedBoothItem.kt index 31d51dce..f26c59fd 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedBoothItem.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedBoothItem.kt @@ -4,7 +4,6 @@ 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.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -50,9 +49,7 @@ fun LikedBoothItem( .padding(horizontal = 20.dp), ) { Spacer(modifier = Modifier.height(16.dp)) - Row( - modifier = Modifier.fillMaxSize(), - ) { + Row { NetworkImage( imgUrl = booth.thumbnail, contentDescription = "Booth Thumbnail", @@ -124,7 +121,7 @@ fun LikedBoothItem( @ComponentPreview @Composable -fun LikedBoothItemPreview() { +private fun LikedBoothItemPreview() { UnifestTheme { LikedBoothItem( booth = LikedBoothModel( diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedFestivalGrid.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedFestivalGrid.kt index 1034f9ec..ed6bc9e5 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedFestivalGrid.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/LikedFestivalGrid.kt @@ -162,22 +162,21 @@ fun FestivalItem( @ComponentPreview @Composable -fun FestivalItemPreview() { - val festival = FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ) +private fun FestivalItemPreview() { UnifestTheme { FestivalItem( - festival = festival, + festival = FestivalModel( + 1, + 1, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), onFestivalSelected = {}, ) } @@ -185,7 +184,7 @@ fun FestivalItemPreview() { @ComponentPreview @Composable -fun LikedFestivalsGridPreview() { +private fun LikedFestivalsGridPreview() { val selectedFestivals = persistentListOf() repeat(5) { selectedFestivals.add( @@ -214,7 +213,7 @@ fun LikedFestivalsGridPreview() { @ComponentPreview @Composable -fun LikedFestivalsGridEditModePreview() { +private fun LikedFestivalsGridEditModePreview() { val selectedFestivals = persistentListOf() repeat(5) { selectedFestivals.add( diff --git a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/StarImage.kt b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/StarImage.kt index 682b96a4..d2a831bc 100644 --- a/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/StarImage.kt +++ b/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/StarImage.kt @@ -61,7 +61,7 @@ fun StarImage( @ComponentPreview @Composable -fun StarImagePreview() { +private fun StarImagePreview() { UnifestTheme { StarImage( imgUrl = "", @@ -75,7 +75,7 @@ fun StarImagePreview() { @ComponentPreview @Composable -fun StarImageClickedPreview() { +private fun StarImageClickedPreview() { UnifestTheme { StarImage( imgUrl = "", diff --git a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt index 61ab571c..edcda1e1 100644 --- a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt +++ b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt @@ -52,12 +52,11 @@ import com.unifest.android.core.designsystem.theme.Content3 import com.unifest.android.core.designsystem.theme.DarkGrey100 import com.unifest.android.core.designsystem.theme.Title2 import com.unifest.android.core.designsystem.theme.UnifestTheme -import com.unifest.android.core.model.BoothDetailModel import com.unifest.android.core.ui.DevicePreview import com.unifest.android.feature.booth.component.BoothBottomBar import com.unifest.android.feature.booth.component.BoothDescription import com.unifest.android.feature.booth.component.MenuItem -import com.unifest.android.feature.booth.preview.BoothDetailUiStatePreviewParameterProvider +import com.unifest.android.feature.booth.preview.BoothDetailPreviewParameterProvider import com.unifest.android.feature.booth.viewmodel.BoothUiAction import com.unifest.android.feature.booth.viewmodel.BoothUiEvent import com.unifest.android.feature.booth.viewmodel.BoothUiState @@ -309,13 +308,13 @@ fun BoothDetailContent( @DevicePreview @Composable private fun BoothScreenPreview( - @PreviewParameter(BoothDetailUiStatePreviewParameterProvider::class) - boothDetailInfo: BoothDetailModel, + @PreviewParameter(BoothDetailPreviewParameterProvider::class) + boothUiState: BoothUiState, ) { UnifestTheme { BoothDetailScreen( padding = PaddingValues(), - uiState = BoothUiState(boothDetailInfo = boothDetailInfo), + uiState = boothUiState, snackBarState = SnackbarHostState(), onAction = {}, ) diff --git a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothLocationScreen.kt b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothLocationScreen.kt index 8bcc53ee..96a5d6cb 100644 --- a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothLocationScreen.kt +++ b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothLocationScreen.kt @@ -1,31 +1,14 @@ package com.unifest.android.feature.booth -import androidx.compose.foundation.background import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box -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.padding -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Text -import androidx.compose.material3.TopAppBar -import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -39,14 +22,11 @@ import com.naver.maps.map.compose.MarkerState import com.naver.maps.map.compose.NaverMap import com.naver.maps.map.compose.PolygonOverlay import com.naver.maps.map.compose.rememberCameraPositionState -import com.unifest.android.core.designsystem.ComponentPreview import com.unifest.android.core.designsystem.MarkerCategory -import com.unifest.android.core.designsystem.R -import com.unifest.android.core.designsystem.theme.BoothLocation -import com.unifest.android.core.designsystem.theme.Title1 import com.unifest.android.core.designsystem.theme.UnifestTheme -import com.unifest.android.core.model.BoothDetailModel import com.unifest.android.core.ui.DevicePreview +import com.unifest.android.feature.booth.component.BoothLocationAppBar +import com.unifest.android.feature.booth.preview.BoothDetailPreviewParameterProvider import com.unifest.android.feature.booth.viewmodel.BoothUiState import com.unifest.android.feature.booth.viewmodel.BoothViewModel import kotlinx.collections.immutable.persistentListOf @@ -109,88 +89,16 @@ fun BoothLocationScreen( } } -@OptIn(ExperimentalMaterial3Api::class) -@Composable -fun BoothLocationAppBar( - onBackClick: () -> Unit, - boothName: String, - boothLocation: String, - modifier: Modifier = Modifier, -) { - TopAppBar( - modifier = modifier - .fillMaxWidth() - .background( - color = MaterialTheme.colorScheme.surface, - shape = RoundedCornerShape(bottomStart = 32.dp, bottomEnd = 32.dp), - ) - .padding(vertical = 8.dp, horizontal = 12.dp), - navigationIcon = { - IconButton(onClick = onBackClick) { - Icon( - imageVector = ImageVector.vectorResource(R.drawable.ic_arrow_back_gray), - contentDescription = "뒤로 가기", - tint = MaterialTheme.colorScheme.onSurfaceVariant, - ) - } - }, - title = { - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - ) { - Text( - text = boothName, - modifier = Modifier.fillMaxWidth(), - color = MaterialTheme.colorScheme.onBackground, - textAlign = TextAlign.Center, - style = Title1, - ) - Text( - text = boothLocation, - modifier = Modifier.fillMaxWidth(), - color = MaterialTheme.colorScheme.onSurfaceVariant, - textAlign = TextAlign.Center, - style = BoothLocation, - ) - } - }, - colors = TopAppBarDefaults.topAppBarColors(MaterialTheme.colorScheme.surface), - actions = { - Spacer(modifier = Modifier.width(48.dp)) - }, - ) -} - @DevicePreview @Composable -fun BoothLocationScreenPreview() { +fun BoothLocationScreenPreview( + @PreviewParameter(BoothDetailPreviewParameterProvider::class) + boothUiState: BoothUiState, +) { UnifestTheme { BoothLocationScreen( - uiState = BoothUiState( - boothDetailInfo = BoothDetailModel( - id = 0L, - name = "컴공 주점", - category = "컴퓨터공학부 전용 부스", - description = "저희 주점은 일본 이자카야를 모티브로 만든 컴공인을 위한 주점입니다. 100번째 방문자에게 깜짝 선물 증정 이벤트를 하고 있으니 많은 관심 부탁드려요~!", - location = "청심대 앞", - latitude = 37.54224856023523f, - longitude = 127.07605430700158f, - ), - ), - onBackClick = {}, - ) - } -} - -@ComponentPreview -@Composable -fun BoothLocationAppBarPreview() { - UnifestTheme { - BoothLocationAppBar( + uiState = boothUiState, onBackClick = {}, - boothName = "컴공 주점", - boothLocation = "청심대 앞", ) } } diff --git a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/MenuImageDialog.kt b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/MenuImageDialog.kt index 88332cd3..76b05aba 100644 --- a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/MenuImageDialog.kt +++ b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/MenuImageDialog.kt @@ -22,9 +22,11 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.min import androidx.compose.ui.window.DialogProperties import com.unifest.android.core.common.utils.formatAsCurrency +import com.unifest.android.core.designsystem.ComponentPreview import com.unifest.android.core.designsystem.component.NetworkImage import com.unifest.android.core.designsystem.theme.Content1 import com.unifest.android.core.designsystem.theme.Title2 +import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.core.model.MenuModel @OptIn(ExperimentalMaterial3Api::class) @@ -79,3 +81,19 @@ fun MenuImageDialog( } } } + +@ComponentPreview +@Composable +private fun MenuImageDialogPreview() { + UnifestTheme { + MenuImageDialog( + onDismissRequest = {}, + menu = MenuModel( + id = 0, + name = "모둠 사시미", + price = 45000, + imgUrl = "", + ), + ) + } +} diff --git a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/component/BoothLocationAppBar.kt b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/component/BoothLocationAppBar.kt new file mode 100644 index 00000000..8060e8c4 --- /dev/null +++ b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/component/BoothLocationAppBar.kt @@ -0,0 +1,94 @@ +package com.unifest.android.feature.booth.component + +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.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import com.unifest.android.core.designsystem.ComponentPreview +import com.unifest.android.core.designsystem.R +import com.unifest.android.core.designsystem.theme.BoothLocation +import com.unifest.android.core.designsystem.theme.Title1 +import com.unifest.android.core.designsystem.theme.UnifestTheme + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun BoothLocationAppBar( + onBackClick: () -> Unit, + boothName: String, + boothLocation: String, + modifier: Modifier = Modifier, +) { + TopAppBar( + modifier = modifier + .fillMaxWidth() + .background( + color = MaterialTheme.colorScheme.surface, + shape = RoundedCornerShape(bottomStart = 32.dp, bottomEnd = 32.dp), + ) + .padding(vertical = 8.dp, horizontal = 12.dp), + navigationIcon = { + IconButton(onClick = onBackClick) { + Icon( + imageVector = ImageVector.vectorResource(R.drawable.ic_arrow_back_gray), + contentDescription = "뒤로 가기", + tint = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } + }, + title = { + Column( + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text( + text = boothName, + modifier = Modifier.fillMaxWidth(), + color = MaterialTheme.colorScheme.onBackground, + textAlign = TextAlign.Center, + style = Title1, + ) + Text( + text = boothLocation, + modifier = Modifier.fillMaxWidth(), + color = MaterialTheme.colorScheme.onSurfaceVariant, + textAlign = TextAlign.Center, + style = BoothLocation, + ) + } + }, + colors = TopAppBarDefaults.topAppBarColors(MaterialTheme.colorScheme.surface), + actions = { + Spacer(modifier = Modifier.width(48.dp)) + }, + ) +} + +@ComponentPreview +@Composable +fun BoothLocationAppBarPreview() { + UnifestTheme { + BoothLocationAppBar( + onBackClick = {}, + boothName = "컴공 주점", + boothLocation = "청심대 앞", + ) + } +} diff --git a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailPreviewParameterProvider.kt b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailPreviewParameterProvider.kt new file mode 100644 index 00000000..967311ae --- /dev/null +++ b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailPreviewParameterProvider.kt @@ -0,0 +1,29 @@ +package com.unifest.android.feature.booth.preview + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import com.unifest.android.core.model.BoothDetailModel +import com.unifest.android.core.model.MenuModel +import com.unifest.android.feature.booth.viewmodel.BoothUiState + +internal class BoothDetailPreviewParameterProvider : PreviewParameterProvider { + override val values = sequenceOf( + BoothUiState( + boothDetailInfo = BoothDetailModel( + id = 0L, + name = "컴공 주점", + category = "컴퓨터공학부 전용 부스", + description = "저희 주점은 일본 이자카야를 모티브로 만든 컴공인을 위한 주점입니다. 100번째 방문자에게 깜짝 선물 증정 이벤트를 하고 있으니 많은 관심 부탁드려요~!", + warning = "", + location = "청심대 앞", + latitude = 37.54224856023523f, + longitude = 127.07605430700158f, + menus = listOf( + MenuModel(1L, "모둠 사시미", 45000, ""), + MenuModel(2L, "모둠 사시미", 45000, ""), + MenuModel(3L, "모둠 사시미", 45000, ""), + MenuModel(4L, "모둠 사시미", 45000, ""), + ), + ), + ), + ) +} diff --git a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailUiStatePreviewParameterProvider.kt b/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailUiStatePreviewParameterProvider.kt deleted file mode 100644 index 6c58b15c..00000000 --- a/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/preview/BoothDetailUiStatePreviewParameterProvider.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.unifest.android.feature.booth.preview - -import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.unifest.android.core.model.BoothDetailModel -import com.unifest.android.core.model.MenuModel - -internal class BoothDetailUiStatePreviewParameterProvider: PreviewParameterProvider { - override val values = sequenceOf( - BoothDetailModel( - id = 0L, - name = "컴공 주점", - category = "컴퓨터공학부 전용 부스", - description = "저희 주점은 일본 이자카야를 모티브로 만든 컴공인을 위한 주점입니다. 100번째 방문자에게 깜짝 선물 증정 이벤트를 하고 있으니 많은 관심 부탁드려요~!", - warning = "", - location = "청심대 앞", - latitude = 37.54224856023523f, - longitude = 127.07605430700158f, - menus = listOf( - MenuModel(1L, "모둠 사시미", 45000, ""), - MenuModel(2L, "모둠 사시미", 45000, ""), - MenuModel(3L, "모둠 사시미", 45000, ""), - MenuModel(4L, "모둠 사시미", 45000, ""), - ), - ) - ) -} diff --git a/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalBottomSheet.kt b/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalBottomSheet.kt index 9bdd7b53..06fee0f2 100644 --- a/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalBottomSheet.kt +++ b/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalBottomSheet.kt @@ -28,6 +28,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import com.unifest.android.core.designsystem.ComponentPreview import com.unifest.android.core.designsystem.R @@ -39,10 +40,11 @@ import com.unifest.android.core.designsystem.theme.Title3 import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.core.model.FestivalModel import com.unifest.android.core.ui.component.LikedFestivalsGrid +import com.unifest.android.feature.festival.preview.FestivalPreviewParameterProvider import com.unifest.android.feature.festival.viewmodel.ButtonType import com.unifest.android.feature.festival.viewmodel.FestivalUiAction +import com.unifest.android.feature.festival.viewmodel.FestivalUiState import kotlinx.collections.immutable.ImmutableList -import kotlinx.collections.immutable.persistentListOf // TODO HorizontalDivider -> UnifestHorizontalDivider 로 전부 변경 @OptIn(ExperimentalMaterial3Api::class) @@ -65,9 +67,7 @@ fun FestivalSearchBottomSheet( // isModal = true, // skipSlightlyExpanded = true, // ) - val bottomSheetState = rememberModalBottomSheetState( - skipPartiallyExpanded = true, - ) + val bottomSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) ModalBottomSheet( onDismissRequest = { @@ -184,135 +184,16 @@ fun FestivalSearchBottomSheet( @ComponentPreview @Composable -fun SchoolSearchBottomSheetPreview() { +fun SchoolSearchBottomSheetPreview( + @PreviewParameter(FestivalPreviewParameterProvider::class) + festivalUiState: FestivalUiState, +) { UnifestTheme { FestivalSearchBottomSheet( searchTextHintRes = R.string.festival_search_text_field_hint, searchText = TextFieldValue(), - likedFestivals = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 3, - 3, - "https://picsum.photos/36", - "고려대학교", - "서울", - "고대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 4, - 4, - "https://picsum.photos/36", - "성균관대학교", - "서울", - "성대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 5, - 5, - "https://picsum.photos/36", - "건국대학교", - "서울", - "건대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), - festivalSearchResults = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 3, - 3, - "https://picsum.photos/36", - "고려대학교", - "서울", - "고대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 4, - 4, - "https://picsum.photos/36", - "성균관대학교", - "성대축제", - "서울", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 5, - 5, - "https://picsum.photos/36", - "건국대학교", - "서울", - "건대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), + likedFestivals = festivalUiState.festivals, + festivalSearchResults = festivalUiState.likedFestivals, isSearchMode = false, isEditMode = false, isLikedFestivalDeleteDialogVisible = false, diff --git a/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalSearchResults.kt b/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalSearchResults.kt index 0cb2d33f..8606873e 100644 --- a/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalSearchResults.kt +++ b/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/FestivalSearchResults.kt @@ -26,6 +26,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import com.unifest.android.core.common.extension.noRippleClickable import com.unifest.android.core.common.utils.formatToString @@ -40,6 +41,9 @@ import com.unifest.android.core.designsystem.theme.Content6 import com.unifest.android.core.model.FestivalModel import com.unifest.android.feature.festival.viewmodel.FestivalUiAction import com.unifest.android.core.designsystem.R +import com.unifest.android.core.designsystem.theme.UnifestTheme +import com.unifest.android.feature.festival.preview.FestivalPreviewParameterProvider +import com.unifest.android.feature.festival.viewmodel.FestivalUiState import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf @@ -191,70 +195,14 @@ fun FestivalSearchResultItem( @ComponentPreview @Composable -fun FestivalSearchResultsPreview() { - FestivalSearchResults( - searchResults = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 3, - 3, - "https://picsum.photos/36", - "고려대학교", - "서울", - "고대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 4, - 4, - "https://picsum.photos/36", - "성균관대학교", - "서울", - "성대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 5, - 5, - "https://picsum.photos/36", - "건국대학교", - "서울", - "건대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), - onFestivalUiAction = {}, - ) +fun FestivalSearchResultsPreview( + @PreviewParameter(FestivalPreviewParameterProvider::class) + festivalUiState: FestivalUiState, +) { + UnifestTheme { + FestivalSearchResults( + searchResults = festivalUiState.likedFestivals, + onFestivalUiAction = {}, + ) + } } diff --git a/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/preview/FestivalPreviewParameterProvider.kt b/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/preview/FestivalPreviewParameterProvider.kt new file mode 100644 index 00000000..f683d865 --- /dev/null +++ b/feature/festival/src/main/kotlin/com/unifest/android/feature/festival/preview/FestivalPreviewParameterProvider.kt @@ -0,0 +1,137 @@ +package com.unifest.android.feature.festival.preview + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import com.unifest.android.core.model.FestivalModel +import com.unifest.android.feature.festival.viewmodel.FestivalUiState +import kotlinx.collections.immutable.persistentListOf + +class FestivalPreviewParameterProvider : PreviewParameterProvider { + override val values = sequenceOf( + FestivalUiState( + festivals = persistentListOf( + FestivalModel( + 1, + 1, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 2, + 2, + "https://picsum.photos/36", + "연세대학교", + "서울", + "연대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 3, + 3, + "https://picsum.photos/36", + "고려대학교", + "서울", + "고대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 4, + 4, + "https://picsum.photos/36", + "성균관대학교", + "서울", + "성대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 5, + 5, + "https://picsum.photos/36", + "건국대학교", + "서울", + "건대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + ), + likedFestivals = persistentListOf( + FestivalModel( + 1, + 1, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 2, + 2, + "https://picsum.photos/36", + "연세대학교", + "서울", + "연대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 3, + 3, + "https://picsum.photos/36", + "고려대학교", + "서울", + "고대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 4, + 4, + "https://picsum.photos/36", + "성균관대학교", + "서울", + "성대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 5, + 5, + "https://picsum.photos/36", + "건국대학교", + "서울", + "건대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + ), + ), + ) +} diff --git a/feature/home/src/main/kotlin/com/unifest/android/feature/home/HomeScreen.kt b/feature/home/src/main/kotlin/com/unifest/android/feature/home/HomeScreen.kt index 2d252244..eb71994c 100644 --- a/feature/home/src/main/kotlin/com/unifest/android/feature/home/HomeScreen.kt +++ b/feature/home/src/main/kotlin/com/unifest/android/feature/home/HomeScreen.kt @@ -27,6 +27,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -40,21 +41,20 @@ import com.unifest.android.core.designsystem.theme.Content6 import com.unifest.android.core.designsystem.theme.Title2 import com.unifest.android.core.designsystem.theme.Title3 import com.unifest.android.core.designsystem.theme.UnifestTheme -import com.unifest.android.core.model.FestivalModel -import com.unifest.android.core.model.FestivalTodayModel import com.unifest.android.core.ui.DevicePreview import com.unifest.android.feature.festival.FestivalSearchBottomSheet import com.unifest.android.feature.festival.viewmodel.FestivalUiAction import com.unifest.android.feature.festival.viewmodel.FestivalUiEvent import com.unifest.android.feature.festival.viewmodel.FestivalUiState import com.unifest.android.feature.festival.viewmodel.FestivalViewModel +import com.unifest.android.feature.home.component.Calendar import com.unifest.android.feature.home.component.FestivalScheduleItem import com.unifest.android.feature.home.component.IncomingFestivalCard +import com.unifest.android.feature.home.preview.HomePreviewParameterProvider import com.unifest.android.feature.home.viewmodel.HomeUiAction import com.unifest.android.feature.home.viewmodel.HomeUiEvent import com.unifest.android.feature.home.viewmodel.HomeUiState import com.unifest.android.feature.home.viewmodel.HomeViewModel -import kotlinx.collections.immutable.persistentListOf import java.time.format.DateTimeFormatter // TODO 이미 관심 축제로 추가된 축제는 관심 축제로 추가하기 버튼이 보이면 안됨 @@ -120,7 +120,8 @@ internal fun HomeScreen( } item { Text( - text = DateTimeFormatter.ofPattern("M월 d일").format(homeUiState.selectedDate) + stringResource(id = R.string.home_festival_schedule_text), + text = DateTimeFormatter.ofPattern("M월 d일") + .format(homeUiState.selectedDate) + stringResource(id = R.string.home_festival_schedule_text), modifier = Modifier.padding(start = 20.dp, top = 20.dp), color = MaterialTheme.colorScheme.onBackground, style = Title3, @@ -239,71 +240,14 @@ internal fun HomeScreen( @DevicePreview @Composable -fun HomeScreenPreview() { +private fun HomeScreenPreview( + @PreviewParameter(HomePreviewParameterProvider::class) + homeUiState: HomeUiState, +) { UnifestTheme { HomeScreen( padding = PaddingValues(), - homeUiState = HomeUiState( - todayFestivals = persistentListOf( - FestivalTodayModel( - festivalId = 1, - beginDate = "2024-04-05", - endDate = "2024-04-07", - festivalName = "녹색지대 DAY 1", - schoolName = "건국대학교 서울캠퍼스", - starInfo = listOf(), - thumbnail = "https://picsum.photos/36", - schoolId = 1, - ), - - FestivalTodayModel( - festivalId = 2, - beginDate = "2024-04-05", - endDate = "2024-04-07", - festivalName = "녹색지대 DAY 1", - schoolName = "건국대학교 서울캠퍼스", - starInfo = listOf(), - thumbnail = "https://picsum.photos/36", - schoolId = 2, - ), - FestivalTodayModel( - festivalId = 3, - beginDate = "2024-04-05", - endDate = "2024-04-07", - festivalName = "녹색지대 DAY 1", - schoolName = "건국대학교 서울캠퍼스", - starInfo = listOf(), - thumbnail = "https://picsum.photos/36", - schoolId = 3, - ), - ), - incomingFestivals = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), - ), + homeUiState = homeUiState, festivalUiState = FestivalUiState(), onHomeUiAction = {}, onFestivalUiAction = {}, diff --git a/feature/home/src/main/kotlin/com/unifest/android/feature/home/StarImageDialog.kt b/feature/home/src/main/kotlin/com/unifest/android/feature/home/StarImageDialog.kt index cbabe22f..ae890ccb 100644 --- a/feature/home/src/main/kotlin/com/unifest/android/feature/home/StarImageDialog.kt +++ b/feature/home/src/main/kotlin/com/unifest/android/feature/home/StarImageDialog.kt @@ -22,8 +22,10 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.min import androidx.compose.ui.window.DialogProperties +import com.unifest.android.core.designsystem.ComponentPreview import com.unifest.android.core.designsystem.component.NetworkImage import com.unifest.android.core.designsystem.theme.Title2 +import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.core.model.StarInfoModel @OptIn(ExperimentalMaterial3Api::class) @@ -71,3 +73,18 @@ fun StarImageDialog( } } } + +@ComponentPreview +@Composable +private fun StarImageDialogPreview() { + UnifestTheme { + StarImageDialog( + onDismissRequest = {}, + star = StarInfoModel( + starId = 0L, + name = "창모", + imgUrl = "", + ), + ) + } +} diff --git a/feature/home/src/main/kotlin/com/unifest/android/feature/home/Calendar.kt b/feature/home/src/main/kotlin/com/unifest/android/feature/home/component/Calendar.kt similarity index 98% rename from feature/home/src/main/kotlin/com/unifest/android/feature/home/Calendar.kt rename to feature/home/src/main/kotlin/com/unifest/android/feature/home/component/Calendar.kt index 25abb31c..a18d4518 100644 --- a/feature/home/src/main/kotlin/com/unifest/android/feature/home/Calendar.kt +++ b/feature/home/src/main/kotlin/com/unifest/android/feature/home/component/Calendar.kt @@ -1,4 +1,4 @@ -package com.unifest.android.feature.home +package com.unifest.android.feature.home.component import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.background @@ -67,6 +67,9 @@ import com.unifest.android.core.designsystem.theme.LightRed import com.unifest.android.core.designsystem.theme.Title5 import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.core.model.FestivalModel +import com.unifest.android.feature.home.clickable +import com.unifest.android.feature.home.displayText +import com.unifest.android.feature.home.rememberFirstVisibleMonthAfterScroll import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList diff --git a/feature/home/src/main/kotlin/com/unifest/android/feature/home/preview/HomePreviewParameterProvider.kt b/feature/home/src/main/kotlin/com/unifest/android/feature/home/preview/HomePreviewParameterProvider.kt new file mode 100644 index 00000000..7528341d --- /dev/null +++ b/feature/home/src/main/kotlin/com/unifest/android/feature/home/preview/HomePreviewParameterProvider.kt @@ -0,0 +1,72 @@ +package com.unifest.android.feature.home.preview + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import com.unifest.android.core.model.FestivalModel +import com.unifest.android.core.model.FestivalTodayModel +import com.unifest.android.feature.home.viewmodel.HomeUiState +import kotlinx.collections.immutable.persistentListOf + +internal class HomePreviewParameterProvider : PreviewParameterProvider { + override val values = sequenceOf( + HomeUiState( + todayFestivals = persistentListOf( + FestivalTodayModel( + festivalId = 1, + beginDate = "2024-04-05", + endDate = "2024-04-07", + festivalName = "녹색지대 DAY 1", + schoolName = "건국대학교 서울캠퍼스", + starInfo = listOf(), + thumbnail = "https://picsum.photos/36", + schoolId = 1, + ), + FestivalTodayModel( + festivalId = 2, + beginDate = "2024-04-05", + endDate = "2024-04-07", + festivalName = "녹색지대 DAY 1", + schoolName = "건국대학교 서울캠퍼스", + starInfo = listOf(), + thumbnail = "https://picsum.photos/36", + schoolId = 2, + ), + FestivalTodayModel( + festivalId = 3, + beginDate = "2024-04-05", + endDate = "2024-04-07", + festivalName = "녹색지대 DAY 1", + schoolName = "건국대학교 서울캠퍼스", + starInfo = listOf(), + thumbnail = "https://picsum.photos/36", + schoolId = 3, + ), + ), + incomingFestivals = persistentListOf( + FestivalModel( + 1, + 1, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 2, + 2, + "https://picsum.photos/36", + "연세대학교", + "서울", + "연대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + ), + ), + ) +} diff --git a/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/IntroScreen.kt b/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/IntroScreen.kt index 769ca92f..272d36ea 100644 --- a/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/IntroScreen.kt +++ b/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/IntroScreen.kt @@ -1,89 +1,52 @@ package com.unifest.android.feature.intro -import androidx.compose.animation.animateColorAsState -import androidx.compose.animation.core.animateFloatAsState -import androidx.compose.foundation.BorderStroke -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background -import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Row 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.foundation.layout.size -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.lazy.LazyRow -import androidx.compose.foundation.lazy.grid.GridCells -import androidx.compose.foundation.lazy.grid.LazyVerticalGrid -import androidx.compose.foundation.pager.HorizontalPager -import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.shape.CircleShape -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.Card -import androidx.compose.material3.CardDefaults -import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.ScrollableTabRow -import androidx.compose.material3.Tab import androidx.compose.material3.Text -import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable -import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue -import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.unifest.android.core.common.ObserveAsEvents -import com.unifest.android.core.common.utils.formatToString -import com.unifest.android.core.common.utils.toLocalDate import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.component.LoadingWheel import com.unifest.android.core.designsystem.component.NetworkErrorDialog -import com.unifest.android.core.designsystem.component.NetworkImage import com.unifest.android.core.designsystem.component.SearchTextField import com.unifest.android.core.designsystem.component.ServerErrorDialog import com.unifest.android.core.designsystem.component.UnifestButton import com.unifest.android.core.designsystem.component.UnifestHorizontalDivider import com.unifest.android.core.designsystem.component.UnifestScaffold import com.unifest.android.core.designsystem.theme.BoothLocation -import com.unifest.android.core.designsystem.theme.Content1 -import com.unifest.android.core.designsystem.theme.Content2 -import com.unifest.android.core.designsystem.theme.Content3 -import com.unifest.android.core.designsystem.theme.Content4 -import com.unifest.android.core.designsystem.theme.Content6 import com.unifest.android.core.designsystem.theme.Title2 -import com.unifest.android.core.designsystem.theme.Title3 import com.unifest.android.core.designsystem.theme.Title4 import com.unifest.android.core.designsystem.theme.UnifestTheme -import com.unifest.android.core.model.FestivalModel import com.unifest.android.core.ui.DevicePreview -import com.unifest.android.core.ui.component.FestivalItem +import com.unifest.android.feature.intro.component.AllFestivalsTabRow +import com.unifest.android.feature.intro.component.LikedFestivalsRow +import com.unifest.android.feature.intro.preview.IntroPreviewParameterProvider import com.unifest.android.feature.intro.viewmodel.ErrorType import com.unifest.android.feature.intro.viewmodel.IntroUiAction import com.unifest.android.feature.intro.viewmodel.IntroUiEvent import com.unifest.android.feature.intro.viewmodel.IntroUiState import com.unifest.android.feature.intro.viewmodel.IntroViewModel -import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf -import kotlinx.coroutines.launch @Composable internal fun IntroRoute( @@ -159,7 +122,25 @@ fun IntroContent( .verticalScroll(rememberScrollState()) .padding(bottom = 60.dp), ) { - InformationText() + Column( + modifier = Modifier + .fillMaxWidth() + .padding(top = 64.dp, bottom = 32.dp), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy(8.dp), + ) { + Text( + text = stringResource(id = R.string.intro_info_title), + style = Title2, + color = MaterialTheme.colorScheme.onBackground, + ) + Text( + text = stringResource(id = R.string.intro_info_description), + style = BoothLocation, + fontSize = 12.sp, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } SearchTextField( searchText = uiState.searchText, updateSearchText = { text -> onAction(IntroUiAction.OnSearchTextUpdated(text)) }, @@ -206,320 +187,15 @@ fun IntroContent( } } -@Composable -fun InformationText() { - Column( - modifier = Modifier - .fillMaxWidth() - .padding(top = 64.dp, bottom = 32.dp), - horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.spacedBy(8.dp), - ) { - Text( - text = stringResource(id = R.string.intro_info_title), - style = Title2, - color = MaterialTheme.colorScheme.onBackground, - ) - Text( - text = stringResource(id = R.string.intro_info_description), - style = BoothLocation, - fontSize = 12.sp, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) - } -} - -@Composable -fun LikedFestivalsRow( - selectedFestivals: ImmutableList, - onAction: (IntroUiAction) -> Unit, -) { - Column { - Row( - horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 20.dp), - ) { - if (selectedFestivals.isNotEmpty()) { - Text( - text = stringResource(id = R.string.intro_liked_festivals_title), - color = MaterialTheme.colorScheme.onBackground, - style = Title3, - ) - TextButton( - onClick = { onAction(IntroUiAction.OnClearSelectionClick) }, - ) { - Text( - text = stringResource(id = R.string.intro_clear_item_button_text), - color = MaterialTheme.colorScheme.onSurfaceVariant, - textDecoration = TextDecoration.Underline, - style = Content6, - ) - } - } - } - LazyRow( - modifier = Modifier - .padding(8.dp) - .height(if (selectedFestivals.isEmpty()) 0.dp else 130.dp), - horizontalArrangement = Arrangement.spacedBy(8.dp), - ) { - items( - count = selectedFestivals.size, - key = { index -> selectedFestivals[index].festivalId }, - ) { index -> - FestivalRowItem( - festival = selectedFestivals[index], - onAction = onAction, - ) - } - } - } -} - -@Composable -fun FestivalRowItem( - festival: FestivalModel, - onAction: (IntroUiAction) -> Unit, -) { - Card( - shape = RoundedCornerShape(16.dp), - colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.background), - border = BorderStroke(1.dp, MaterialTheme.colorScheme.primary), - modifier = Modifier - .height(130.dp) - .width(120.dp), - ) { - Box( - modifier = Modifier.clickable { - onAction(IntroUiAction.OnFestivalDeselected(festival)) - }, - ) { - Column( - horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center, - modifier = Modifier - .fillMaxSize() - .padding(16.dp), - ) { - NetworkImage( - imgUrl = festival.thumbnail, - contentDescription = "Festival Thumbnail", - modifier = Modifier - .size(36.dp) - .clip(CircleShape), - ) - Spacer(modifier = Modifier.height(8.dp)) - Text( - text = festival.schoolName, - color = MaterialTheme.colorScheme.onBackground, - style = Content2, - ) - Spacer(modifier = Modifier.height(2.dp)) - Text( - text = festival.festivalName, - color = MaterialTheme.colorScheme.onBackground, - style = Content4, - ) - Spacer(modifier = Modifier.height(2.dp)) - Text( - "${festival.beginDate.toLocalDate().formatToString()} - ${festival.endDate.toLocalDate().formatToString()}", - color = MaterialTheme.colorScheme.onSurfaceVariant, - style = Content3, - ) - } - } - } -} - -@OptIn(ExperimentalFoundationApi::class) -@Composable -fun AllFestivalsTabRow( - festivals: ImmutableList, - isSearchLoading: Boolean, - onAction: (IntroUiAction) -> Unit, - selectedFestivals: ImmutableList, - modifier: Modifier = Modifier, -) { - val tabTitles = LocalContext.current.resources.getStringArray(R.array.region_tab_titles).toList() - val pagerState = rememberPagerState(pageCount = { tabTitles.size }) - val scope = rememberCoroutineScope() - val selectedTabIndex by remember { derivedStateOf { pagerState.currentPage } } - - Column(modifier) { - ScrollableTabRow( - selectedTabIndex = selectedTabIndex, - containerColor = MaterialTheme.colorScheme.background, - edgePadding = 0.dp, - indicator = {}, - divider = { - HorizontalDivider( - color = MaterialTheme.colorScheme.outline, - thickness = 1.75.dp, - ) - }, - ) { - tabTitles.forEachIndexed { index, title -> - val isSelected = selectedTabIndex == index - val tabTitleColor by animateColorAsState( - targetValue = if (isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground, - ) - val tabTitleFontWeight by animateFloatAsState( - targetValue = (if (isSelected) FontWeight.Bold.weight else FontWeight.Normal.weight).toFloat(), - ) - Tab( - selected = isSelected, - onClick = { - onAction(IntroUiAction.OnRegionTapClicked(title)) - scope.launch { - pagerState.animateScrollToPage(index) - } - }, - text = { - Text( - text = title, - color = tabTitleColor, - style = Content1, - fontWeight = FontWeight(weight = tabTitleFontWeight.toInt()), - ) - }, - ) - } - } - Text( - text = stringResource(id = R.string.total_festivals_count, festivals.size), - modifier = Modifier - .padding(start = 20.dp, top = 15.dp, bottom = 15.dp) - .align(Alignment.Start), - color = MaterialTheme.colorScheme.onBackground, - style = Content6, - ) - HorizontalPager( - state = pagerState, - modifier = Modifier.fillMaxSize(), - ) { - Box( - modifier = Modifier.fillMaxSize(), - ) { - if (festivals.isEmpty()) { - Text( - text = stringResource(id = R.string.intro_no_result), - modifier = Modifier - .align(Alignment.Center) - .padding(bottom = 92.dp), - color = MaterialTheme.colorScheme.onSurfaceVariant, - style = Content3, - ) - } else { - LazyVerticalGrid( - columns = GridCells.Fixed(3), - modifier = Modifier - .padding(horizontal = 8.dp) - .height(if (festivals.isEmpty()) 0.dp else (((festivals.size - 1) / 3 + 1) * 140).dp), - verticalArrangement = Arrangement.spacedBy(8.dp), - horizontalArrangement = Arrangement.spacedBy(8.dp), - contentPadding = PaddingValues(bottom = 48.dp), - ) { - items( - count = festivals.size, - key = { index -> festivals[index].festivalId }, - ) { index -> - FestivalItem( - festival = festivals[index], - onFestivalSelected = { festival -> - if (!selectedFestivals.any { it.festivalId == festival.festivalId }) { - onAction(IntroUiAction.OnFestivalSelected(festival)) - } - }, - ) - } - } - } - if (isSearchLoading) { - LoadingWheel( - modifier = Modifier - .fillMaxSize() - .align(Alignment.Center) - .background(MaterialTheme.colorScheme.background) - .padding(bottom = 92.dp), - ) - } - } - } - } -} - @DevicePreview @Composable -fun IntroScreenPreview() { +fun IntroScreenPreview( + @PreviewParameter(IntroPreviewParameterProvider::class) + introUiState: IntroUiState, +) { UnifestTheme { IntroScreen( - uiState = IntroUiState( - festivals = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 3, - 3, - "https://picsum.photos/36", - "고려대학교", - "서울", - "고대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 4, - 4, - "https://picsum.photos/36", - "성균관대학교", - "서울", - "성대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 5, - 5, - "https://picsum.photos/36", - "건국대학교", - "서울", - "건대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), - ), + uiState = introUiState, onAction = {}, ) } @@ -530,9 +206,7 @@ fun IntroScreenPreview() { fun IntroScreenEmptyPreview() { UnifestTheme { IntroScreen( - uiState = IntroUiState( - festivals = persistentListOf(), - ), + uiState = IntroUiState(festivals = persistentListOf()), onAction = {}, ) } diff --git a/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/AllFestivalsRow.kt b/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/AllFestivalsRow.kt new file mode 100644 index 00000000..6090d9e6 --- /dev/null +++ b/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/AllFestivalsRow.kt @@ -0,0 +1,226 @@ +package com.unifest.android.feature.intro.component + +import androidx.compose.animation.animateColorAsState +import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.pager.HorizontalPager +import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.ScrollableTabRow +import androidx.compose.material3.Tab +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import com.unifest.android.core.designsystem.ComponentPreview +import com.unifest.android.core.designsystem.R +import com.unifest.android.core.designsystem.component.LoadingWheel +import com.unifest.android.core.designsystem.theme.Content1 +import com.unifest.android.core.designsystem.theme.Content3 +import com.unifest.android.core.designsystem.theme.Content6 +import com.unifest.android.core.designsystem.theme.UnifestTheme +import com.unifest.android.core.model.FestivalModel +import com.unifest.android.core.ui.component.FestivalItem +import com.unifest.android.feature.intro.viewmodel.IntroUiAction +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.persistentListOf +import kotlinx.coroutines.launch + +@Composable +fun AllFestivalsTabRow( + festivals: ImmutableList, + isSearchLoading: Boolean, + onAction: (IntroUiAction) -> Unit, + selectedFestivals: ImmutableList, + modifier: Modifier = Modifier, +) { + val tabTitles = LocalContext.current.resources.getStringArray(R.array.region_tab_titles).toList() + val pagerState = rememberPagerState(pageCount = { tabTitles.size }) + val scope = rememberCoroutineScope() + val selectedTabIndex by remember { derivedStateOf { pagerState.currentPage } } + + Column(modifier) { + ScrollableTabRow( + selectedTabIndex = selectedTabIndex, + containerColor = MaterialTheme.colorScheme.background, + edgePadding = 0.dp, + indicator = {}, + divider = { + HorizontalDivider( + color = MaterialTheme.colorScheme.outline, + thickness = 1.75.dp, + ) + }, + ) { + tabTitles.forEachIndexed { index, title -> + val isSelected = selectedTabIndex == index + val tabTitleColor by animateColorAsState( + targetValue = if (isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground, + ) + val tabTitleFontWeight by animateFloatAsState( + targetValue = (if (isSelected) FontWeight.Bold.weight else FontWeight.Normal.weight).toFloat(), + ) + Tab( + selected = isSelected, + onClick = { + if (!isSelected) { + onAction(IntroUiAction.OnRegionTapClicked(title)) + scope.launch { + pagerState.animateScrollToPage(index) + } + } + }, + text = { + Text( + text = title, + color = tabTitleColor, + style = Content1, + fontWeight = FontWeight(weight = tabTitleFontWeight.toInt()), + ) + }, + ) + } + } + Text( + text = stringResource(id = R.string.total_festivals_count, festivals.size), + modifier = Modifier + .padding(start = 20.dp, top = 15.dp, bottom = 15.dp) + .align(Alignment.Start), + color = MaterialTheme.colorScheme.onBackground, + style = Content6, + ) + HorizontalPager( + state = pagerState, + modifier = Modifier.fillMaxSize(), + ) { + Box( + modifier = Modifier.fillMaxSize(), + ) { + if (festivals.isEmpty()) { + Text( + text = stringResource(id = R.string.intro_no_result), + modifier = Modifier + .align(Alignment.Center) + .padding(bottom = 92.dp), + color = MaterialTheme.colorScheme.onSurfaceVariant, + style = Content3, + ) + } else { + LazyVerticalGrid( + columns = GridCells.Fixed(3), + modifier = Modifier + .padding(horizontal = 8.dp) + .height(if (festivals.isEmpty()) 0.dp else (((festivals.size - 1) / 3 + 1) * 140).dp), + verticalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp), + contentPadding = PaddingValues(bottom = 48.dp), + ) { + items( + count = festivals.size, + key = { index -> festivals[index].festivalId }, + ) { index -> + FestivalItem( + festival = festivals[index], + onFestivalSelected = { festival -> + if (!selectedFestivals.any { it.festivalId == festival.festivalId }) { + onAction(IntroUiAction.OnFestivalSelected(festival)) + } + }, + ) + } + } + } + if (isSearchLoading) { + LoadingWheel( + modifier = Modifier + .fillMaxSize() + .align(Alignment.Center) + .background(MaterialTheme.colorScheme.background) + .padding(bottom = 92.dp), + ) + } + } + } + } +} + +@ComponentPreview +@Composable +private fun AllFestivalsTabRowPreview() { + UnifestTheme { + AllFestivalsTabRow( + festivals = persistentListOf( + FestivalModel( + 1, + 1, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 2, + 2, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 3, + 3, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + ), + isSearchLoading = false, + onAction = {}, + selectedFestivals = persistentListOf( + FestivalModel( + 1, + 1, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + ), + ) + } +} diff --git a/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/FestivalRowItem.kt b/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/FestivalRowItem.kt new file mode 100644 index 00000000..ad61c50b --- /dev/null +++ b/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/FestivalRowItem.kt @@ -0,0 +1,111 @@ +package com.unifest.android.feature.intro.component + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +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.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.unit.dp +import com.unifest.android.core.common.utils.formatToString +import com.unifest.android.core.common.utils.toLocalDate +import com.unifest.android.core.designsystem.ComponentPreview +import com.unifest.android.core.designsystem.component.NetworkImage +import com.unifest.android.core.designsystem.theme.Content2 +import com.unifest.android.core.designsystem.theme.Content3 +import com.unifest.android.core.designsystem.theme.Content4 +import com.unifest.android.core.designsystem.theme.UnifestTheme +import com.unifest.android.core.model.FestivalModel +import com.unifest.android.feature.intro.viewmodel.IntroUiAction + +@Composable +fun FestivalRowItem( + festival: FestivalModel, + onAction: (IntroUiAction) -> Unit, +) { + Card( + shape = RoundedCornerShape(16.dp), + colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.background), + border = BorderStroke(1.dp, MaterialTheme.colorScheme.primary), + modifier = Modifier + .height(130.dp) + .width(120.dp), + ) { + Box( + modifier = Modifier.clickable { + onAction(IntroUiAction.OnFestivalDeselected(festival)) + }, + ) { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center, + modifier = Modifier + .fillMaxSize() + .padding(16.dp), + ) { + NetworkImage( + imgUrl = festival.thumbnail, + contentDescription = "Festival Thumbnail", + modifier = Modifier + .size(36.dp) + .clip(CircleShape), + ) + Spacer(modifier = Modifier.height(8.dp)) + Text( + text = festival.schoolName, + color = MaterialTheme.colorScheme.onBackground, + style = Content2, + ) + Spacer(modifier = Modifier.height(2.dp)) + Text( + text = festival.festivalName, + color = MaterialTheme.colorScheme.onBackground, + style = Content4, + ) + Spacer(modifier = Modifier.height(2.dp)) + Text( + "${festival.beginDate.toLocalDate().formatToString()} - ${festival.endDate.toLocalDate().formatToString()}", + color = MaterialTheme.colorScheme.onSurfaceVariant, + style = Content3, + ) + } + } + } +} + +@ComponentPreview +@Composable +private fun FestivalRowItemPreview() { + UnifestTheme { + FestivalRowItem( + festival = FestivalModel( + 1, + 1, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + onAction = {}, + ) + } +} diff --git a/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/LikedFestivalsRow.kt b/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/LikedFestivalsRow.kt new file mode 100644 index 00000000..646744f6 --- /dev/null +++ b/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/component/LikedFestivalsRow.kt @@ -0,0 +1,97 @@ +package com.unifest.android.feature.intro.component + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyRow +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +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.TextDecoration +import androidx.compose.ui.unit.dp +import com.unifest.android.core.designsystem.ComponentPreview +import com.unifest.android.core.designsystem.R +import com.unifest.android.core.designsystem.theme.Content6 +import com.unifest.android.core.designsystem.theme.Title3 +import com.unifest.android.core.designsystem.theme.UnifestTheme +import com.unifest.android.core.model.FestivalModel +import com.unifest.android.feature.intro.viewmodel.IntroUiAction +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.persistentListOf + +@Composable +fun LikedFestivalsRow( + selectedFestivals: ImmutableList, + onAction: (IntroUiAction) -> Unit, +) { + Column { + Row( + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 20.dp), + ) { + if (selectedFestivals.isNotEmpty()) { + Text( + text = stringResource(id = R.string.intro_liked_festivals_title), + color = MaterialTheme.colorScheme.onBackground, + style = Title3, + ) + TextButton( + onClick = { onAction(IntroUiAction.OnClearSelectionClick) }, + ) { + Text( + text = stringResource(id = R.string.intro_clear_item_button_text), + color = MaterialTheme.colorScheme.onSurfaceVariant, + textDecoration = TextDecoration.Underline, + style = Content6, + ) + } + } + } + LazyRow( + modifier = Modifier + .padding(8.dp) + .height(if (selectedFestivals.isEmpty()) 0.dp else 130.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp), + ) { + items( + count = selectedFestivals.size, + key = { index -> selectedFestivals[index].festivalId }, + ) { index -> + FestivalRowItem( + festival = selectedFestivals[index], + onAction = onAction, + ) + } + } + } +} + +@ComponentPreview +@Composable +private fun LikedFestivalRowPreview() { + UnifestTheme { + LikedFestivalsRow( + selectedFestivals = persistentListOf( + FestivalModel( + festivalId = 0L, + schoolName = "건국대", + festivalName = "녹색지대", + beginDate = "2024-05-21", + endDate = "2024-05-23", + thumbnail = "", + ), + ), + onAction = {}, + ) + } +} diff --git a/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/preview/IntroPreviewParameterProvider.kt b/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/preview/IntroPreviewParameterProvider.kt new file mode 100644 index 00000000..c81c5c43 --- /dev/null +++ b/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/preview/IntroPreviewParameterProvider.kt @@ -0,0 +1,68 @@ +package com.unifest.android.feature.intro.preview + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import com.unifest.android.core.model.FestivalModel +import com.unifest.android.feature.intro.viewmodel.IntroUiState +import kotlinx.collections.immutable.persistentListOf + +internal class IntroPreviewParameterProvider : PreviewParameterProvider { + override val values = sequenceOf( + IntroUiState( + festivals = persistentListOf( + FestivalModel( + festivalId = 1, + beginDate = "2024-04-05", + endDate = "2024-04-07", + festivalName = "녹색지대 DAY 1", + schoolName = "건국대학교 서울캠퍼스", + thumbnail = "https://picsum.photos/36", + schoolId = 1, + ), + FestivalModel( + festivalId = 2, + beginDate = "2024-04-05", + endDate = "2024-04-07", + festivalName = "녹색지대 DAY 1", + schoolName = "건국대학교 서울캠퍼스", + thumbnail = "https://picsum.photos/36", + schoolId = 2, + ), + FestivalModel( + festivalId = 3, + beginDate = "2024-04-05", + endDate = "2024-04-07", + festivalName = "녹색지대 DAY 1", + schoolName = "건국대학교 서울캠퍼스", + thumbnail = "https://picsum.photos/36", + schoolId = 3, + ), + ), + selectedFestivals = persistentListOf( + FestivalModel( + 1, + 1, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 2, + 2, + "https://picsum.photos/36", + "연세대학교", + "서울", + "연대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + ), + ), + ) +} diff --git a/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/LikedBoothScreen.kt b/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/LikedBoothScreen.kt index d591d70c..e7fb88ae 100644 --- a/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/LikedBoothScreen.kt +++ b/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/LikedBoothScreen.kt @@ -18,6 +18,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -29,16 +30,15 @@ import com.unifest.android.core.designsystem.component.ServerErrorDialog import com.unifest.android.core.designsystem.component.TopAppBarNavigationType import com.unifest.android.core.designsystem.component.UnifestTopAppBar import com.unifest.android.core.designsystem.theme.UnifestTheme -import com.unifest.android.core.model.LikedBoothModel import com.unifest.android.core.ui.DevicePreview import com.unifest.android.core.ui.component.EmptyLikedBoothItem import com.unifest.android.core.ui.component.LikedBoothItem +import com.unifest.android.feature.liked_booth.preview.LikedBoothPreviewParameterProvider import com.unifest.android.feature.liked_booth.viewmodel.ErrorType import com.unifest.android.feature.liked_booth.viewmodel.LikedBoothUiAction import com.unifest.android.feature.liked_booth.viewmodel.LikedBoothUiEvent import com.unifest.android.feature.liked_booth.viewmodel.LikedBoothUiState import com.unifest.android.feature.liked_booth.viewmodel.LikedBoothViewModel -import kotlinx.collections.immutable.persistentListOf @Composable internal fun LikedBoothRoute( @@ -134,62 +134,14 @@ internal fun LikedBoothScreen( @DevicePreview @Composable -fun LikedBoothScreenPreview() { +fun LikedBoothScreenPreview( + @PreviewParameter(LikedBoothPreviewParameterProvider::class) + likedBoothUiState: LikedBoothUiState, +) { UnifestTheme { LikedBoothScreen( padding = PaddingValues(), - uiState = LikedBoothUiState( - likedBooths = persistentListOf( - LikedBoothModel( - id = 1, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 2, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 3, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 4, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 5, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 6, - name = "부스 이름", - category = "음식", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - ), - ), + uiState = likedBoothUiState, onAction = {}, ) } diff --git a/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/preview/LikedBoothPreviewParameterProvider.kt b/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/preview/LikedBoothPreviewParameterProvider.kt new file mode 100644 index 00000000..0780eabf --- /dev/null +++ b/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/preview/LikedBoothPreviewParameterProvider.kt @@ -0,0 +1,63 @@ +package com.unifest.android.feature.liked_booth.preview + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import com.unifest.android.core.model.LikedBoothModel +import com.unifest.android.feature.liked_booth.viewmodel.LikedBoothUiState +import kotlinx.collections.immutable.persistentListOf + +internal class LikedBoothPreviewParameterProvider : PreviewParameterProvider { + override val values = sequenceOf( + LikedBoothUiState( + likedBooths = persistentListOf( + LikedBoothModel( + id = 1L, + name = "부스 이름", + category = "음식", + description = "부스 설명", + location = "부스 위치", + warning = "학과 전용 부스", + ), + LikedBoothModel( + id = 2L, + name = "부스 이름", + category = "음식", + description = "부스 설명", + location = "부스 위치", + warning = "학과 전용 부스", + ), + LikedBoothModel( + id = 3L, + name = "부스 이름", + category = "음식", + description = "부스 설명", + location = "부스 위치", + warning = "학과 전용 부스", + ), + LikedBoothModel( + id = 4L, + name = "부스 이름", + category = "음식", + description = "부스 설명", + location = "부스 위치", + warning = "학과 전용 부스", + ), + LikedBoothModel( + id = 5L, + name = "부스 이름", + category = "음식", + description = "부스 설명", + location = "부스 위치", + warning = "학과 전용 부스", + ), + LikedBoothModel( + id = 6L, + name = "부스 이름", + category = "음식", + description = "부스 설명", + location = "부스 위치", + warning = "학과 전용 부스", + ), + ), + ), + ) +} diff --git a/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/viewmodel/LikedBoothUiState.kt b/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/viewmodel/LikedBoothUiState.kt index b33e033a..3bb49ee9 100644 --- a/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/viewmodel/LikedBoothUiState.kt +++ b/feature/liked-booth/src/main/kotlin/com/unifest/android/feature/liked_booth/viewmodel/LikedBoothUiState.kt @@ -7,7 +7,6 @@ import kotlinx.collections.immutable.persistentListOf data class LikedBoothUiState( val isLoading: Boolean = false, val likedBooths: ImmutableList = persistentListOf(), - // val likedBoothList: ImmutableList = persistentListOf(), val isServerErrorDialogVisible: Boolean = false, val isNetworkErrorDialogVisible: Boolean = false, ) diff --git a/feature/main/src/main/kotlin/com/unifest/android/feature/main/MainScreen.kt b/feature/main/src/main/kotlin/com/unifest/android/feature/main/MainScreen.kt index 6b9d4cb1..602ff59b 100644 --- a/feature/main/src/main/kotlin/com/unifest/android/feature/main/MainScreen.kt +++ b/feature/main/src/main/kotlin/com/unifest/android/feature/main/MainScreen.kt @@ -1,59 +1,28 @@ package com.unifest.android.feature.main -import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition -import androidx.compose.animation.fadeIn -import androidx.compose.animation.fadeOut -import androidx.compose.animation.slideIn -import androidx.compose.animation.slideOut -import androidx.compose.foundation.background -import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.RowScope -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.navigationBarsPadding -import androidx.compose.foundation.selection.selectable -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.SnackbarDuration import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState -import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color.Companion.White -import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.IntOffset -import androidx.compose.ui.unit.dp import androidx.navigation.compose.NavHost import com.unifest.android.core.common.UiText -import com.unifest.android.core.designsystem.ComponentPreview import com.unifest.android.core.designsystem.component.UnifestScaffold import com.unifest.android.core.designsystem.component.UnifestSnackBar -import com.unifest.android.core.designsystem.theme.BottomMenuBar -import com.unifest.android.core.designsystem.theme.UnifestTheme import com.unifest.android.feature.booth.navigation.boothNavGraph import com.unifest.android.feature.home.navigation.homeNavGraph import com.unifest.android.feature.liked_booth.navigation.likedBoothNavGraph +import com.unifest.android.feature.main.component.MainBottomBar import com.unifest.android.feature.map.navigation.mapNavGraph import com.unifest.android.feature.menu.navigation.menuNavGraph import com.unifest.android.feature.waiting.navigation.waitingNavGraph -import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -146,95 +115,3 @@ internal fun MainScreen( } } } - -@Composable -private fun MainBottomBar( - visible: Boolean, - tabs: ImmutableList, - currentTab: MainTab?, - onTabSelected: (MainTab) -> Unit, -) { - AnimatedVisibility( - visible = visible, - enter = fadeIn() + slideIn { IntOffset(0, it.height) }, - exit = fadeOut() + slideOut { IntOffset(0, it.height) }, - ) { - Box(modifier = Modifier.background(MaterialTheme.colorScheme.surface)) { - Column { - HorizontalDivider(color = MaterialTheme.colorScheme.outline) - Row( - modifier = Modifier - .navigationBarsPadding() - .fillMaxWidth() - .height(64.dp), - verticalAlignment = Alignment.CenterVertically, - ) { - tabs.forEach { tab -> - MainBottomBarItem( - tab = tab, - selected = tab == currentTab, - onClick = { - if (tab != currentTab) { - onTabSelected(tab) - } - }, - ) - } - } - } - } - } -} - -@Composable -private fun RowScope.MainBottomBarItem( - tab: MainTab, - selected: Boolean, - onClick: () -> Unit, -) { - Box( - modifier = Modifier - .weight(1f) - .fillMaxHeight() - .selectable( - selected = selected, - indication = null, - role = null, - interactionSource = remember { MutableInteractionSource() }, - onClick = onClick, - ), - contentAlignment = Alignment.Center, - ) { - Column( - horizontalAlignment = Alignment.CenterHorizontally, - ) { - Icon( - imageVector = if (selected) ImageVector.vectorResource(tab.selectedIconResId) - else ImageVector.vectorResource(tab.iconResId), - contentDescription = tab.contentDescription, - tint = Color.Unspecified, - ) - Spacer(modifier = Modifier.height(5.dp)) - Text( - text = tab.label, - color = if (selected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSecondary, - fontWeight = if (selected) FontWeight.SemiBold - else FontWeight.Normal, - style = BottomMenuBar, - ) - } - } -} - -@ComponentPreview -@Composable -fun MainBottomBarPreview() { - UnifestTheme { - MainBottomBar( - visible = true, - tabs = MainTab.entries.toImmutableList(), - currentTab = MainTab.HOME, - onTabSelected = {}, - ) - } -} diff --git a/feature/main/src/main/kotlin/com/unifest/android/feature/main/component/MainBottomBar.kt b/feature/main/src/main/kotlin/com/unifest/android/feature/main/component/MainBottomBar.kt new file mode 100644 index 00000000..dd28626b --- /dev/null +++ b/feature/main/src/main/kotlin/com/unifest/android/feature/main/component/MainBottomBar.kt @@ -0,0 +1,131 @@ +package com.unifest.android.feature.main.component + +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.slideIn +import androidx.compose.animation.slideOut +import androidx.compose.foundation.background +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.RowScope +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.navigationBarsPadding +import androidx.compose.foundation.selection.selectable +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.IntOffset +import androidx.compose.ui.unit.dp +import com.unifest.android.core.designsystem.ComponentPreview +import com.unifest.android.core.designsystem.theme.BottomMenuBar +import com.unifest.android.core.designsystem.theme.UnifestTheme +import com.unifest.android.feature.main.MainTab +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList + +@Composable +internal fun MainBottomBar( + visible: Boolean, + tabs: ImmutableList, + currentTab: MainTab?, + onTabSelected: (MainTab) -> Unit, +) { + AnimatedVisibility( + visible = visible, + enter = fadeIn() + slideIn { IntOffset(0, it.height) }, + exit = fadeOut() + slideOut { IntOffset(0, it.height) }, + ) { + Box(modifier = Modifier.background(MaterialTheme.colorScheme.surface)) { + Column { + HorizontalDivider(color = MaterialTheme.colorScheme.outline) + Row( + modifier = Modifier + .navigationBarsPadding() + .fillMaxWidth() + .height(64.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + tabs.forEach { tab -> + MainBottomBarItem( + tab = tab, + selected = tab == currentTab, + onClick = { + if (tab != currentTab) { + onTabSelected(tab) + } + }, + ) + } + } + } + } + } +} + +@Composable +private fun RowScope.MainBottomBarItem( + tab: MainTab, + selected: Boolean, + onClick: () -> Unit, +) { + Box( + modifier = Modifier + .weight(1f) + .fillMaxHeight() + .selectable( + selected = selected, + indication = null, + role = null, + interactionSource = remember { MutableInteractionSource() }, + onClick = onClick, + ), + contentAlignment = Alignment.Center, + ) { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Icon( + imageVector = if (selected) ImageVector.vectorResource(tab.selectedIconResId) + else ImageVector.vectorResource(tab.iconResId), + contentDescription = tab.contentDescription, + tint = Color.Unspecified, + ) + Spacer(modifier = Modifier.height(5.dp)) + Text( + text = tab.label, + color = if (selected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSecondary, + fontWeight = if (selected) FontWeight.SemiBold + else FontWeight.Normal, + style = BottomMenuBar, + ) + } + } +} + +@ComponentPreview +@Composable +private fun MainBottomBarPreview() { + UnifestTheme { + MainBottomBar( + visible = true, + tabs = MainTab.entries.toImmutableList(), + currentTab = MainTab.HOME, + onTabSelected = {}, + ) + } +} diff --git a/feature/map/src/main/kotlin/com/unifest/android/feature/map/MapScreen.kt b/feature/map/src/main/kotlin/com/unifest/android/feature/map/MapScreen.kt index 7bfd5820..a17a2134 100644 --- a/feature/map/src/main/kotlin/com/unifest/android/feature/map/MapScreen.kt +++ b/feature/map/src/main/kotlin/com/unifest/android/feature/map/MapScreen.kt @@ -448,7 +448,7 @@ fun MapContent( @DevicePreview @Composable -fun MapScreenPreview() { +private fun MapScreenPreview() { val boothList = persistentListOf() repeat(5) { index -> boothList.add( diff --git a/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/MenuScreen.kt b/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/MenuScreen.kt index f34e75cd..64de4f58 100644 --- a/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/MenuScreen.kt +++ b/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/MenuScreen.kt @@ -4,7 +4,6 @@ import android.content.pm.PackageManager import android.widget.Toast import androidx.compose.animation.core.LinearOutSlowInEasing import androidx.compose.animation.core.tween -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -17,16 +16,12 @@ 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.foundation.layout.size -import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.itemsIndexed -import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TextButton @@ -36,18 +31,15 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.shadow -import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalUriHandler -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -55,19 +47,13 @@ import com.unifest.android.core.common.ObserveAsEvents import com.unifest.android.core.common.UiText import com.unifest.android.core.designsystem.R import com.unifest.android.core.designsystem.component.NetworkErrorDialog -import com.unifest.android.core.designsystem.component.NetworkImage import com.unifest.android.core.designsystem.component.ServerErrorDialog import com.unifest.android.core.designsystem.component.TopAppBarNavigationType import com.unifest.android.core.designsystem.component.UnifestHorizontalDivider import com.unifest.android.core.designsystem.component.UnifestTopAppBar -import com.unifest.android.core.designsystem.theme.Content6 import com.unifest.android.core.designsystem.theme.Content7 -import com.unifest.android.core.designsystem.theme.Content8 -import com.unifest.android.core.designsystem.theme.MenuTitle import com.unifest.android.core.designsystem.theme.Title3 import com.unifest.android.core.designsystem.theme.UnifestTheme -import com.unifest.android.core.model.FestivalModel -import com.unifest.android.core.model.LikedBoothModel import com.unifest.android.core.ui.DevicePreview import com.unifest.android.core.ui.component.EmptyLikedBoothItem import com.unifest.android.core.ui.component.LikedBoothItem @@ -76,12 +62,14 @@ import com.unifest.android.feature.festival.viewmodel.FestivalUiAction import com.unifest.android.feature.festival.viewmodel.FestivalUiEvent import com.unifest.android.feature.festival.viewmodel.FestivalUiState import com.unifest.android.feature.festival.viewmodel.FestivalViewModel +import com.unifest.android.feature.menu.component.FestivalItem +import com.unifest.android.feature.menu.component.MenuItem +import com.unifest.android.feature.menu.preview.MenuPreviewParameterProvider import com.unifest.android.feature.menu.viewmodel.ErrorType import com.unifest.android.feature.menu.viewmodel.MenuUiAction import com.unifest.android.feature.menu.viewmodel.MenuUiEvent import com.unifest.android.feature.menu.viewmodel.MenuUiState import com.unifest.android.feature.menu.viewmodel.MenuViewModel -import kotlinx.collections.immutable.persistentListOf import timber.log.Timber @Composable @@ -141,7 +129,6 @@ internal fun MenuRoute( ) } -@OptIn(ExperimentalFoundationApi::class) @Composable fun MenuScreen( padding: PaddingValues, @@ -260,21 +247,23 @@ fun MenuScreen( items = menuUiState.likedBooths.take(3), key = { _, booth -> booth.id }, ) { index, booth -> + Modifier + .clickable { + onMenuUiAction(MenuUiAction.OnLikedBoothItemClick(booth.id)) + } LikedBoothItem( booth = booth, index = index, totalCount = menuUiState.likedBooths.size, deleteLikedBooth = { onMenuUiAction(MenuUiAction.OnToggleBookmark(booth)) }, - modifier = Modifier - .clickable { - onMenuUiAction(MenuUiAction.OnLikedBoothItemClick(booth.id)) - } - .animateItemPlacement( - animationSpec = tween( - durationMillis = 500, - easing = LinearOutSlowInEasing, - ), + modifier = Modifier.animateItem( + fadeInSpec = null, + fadeOutSpec = null, + placementSpec = tween( + durationMillis = 500, + easing = LinearOutSlowInEasing, ), + ), ) } } @@ -350,137 +339,16 @@ fun MenuScreen( } } -@Composable -fun FestivalItem( - festival: FestivalModel, - onMenuUiAction: (MenuUiAction) -> Unit, -) { - Column( - horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center, - modifier = Modifier - .padding(vertical = 10.dp) - .clickable { - onMenuUiAction(MenuUiAction.OnLikedFestivalItemClick(festival.schoolName)) - }, - ) { - Box( - modifier = Modifier - .size(65.dp) - .shadow( - elevation = 6.dp, - shape = CircleShape, - ) - .background(MaterialTheme.colorScheme.tertiaryContainer, CircleShape) - .padding(5.dp), - contentAlignment = Alignment.Center, - ) { - NetworkImage( - imgUrl = festival.thumbnail, - contentDescription = "Festival Thumbnail", - modifier = Modifier - .size(60.dp) - .clip(CircleShape), - placeholder = painterResource(id = R.drawable.item_placeholder), - ) - } - Spacer(modifier = Modifier.height(8.dp)) - Text( - text = festival.schoolName, - color = MaterialTheme.colorScheme.onSurfaceVariant, - style = Content6, - textAlign = TextAlign.Center, - ) - Spacer(modifier = Modifier.height(2.dp)) - Text( - text = festival.festivalName, - color = MaterialTheme.colorScheme.onBackground, - style = MenuTitle, - textAlign = TextAlign.Center, - ) - } -} - -@Composable -fun MenuItem( - icon: ImageVector, - title: String, - onClick: () -> Unit, -) { - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier - .fillMaxWidth() - .background(MaterialTheme.colorScheme.background) - .clickable(onClick = onClick) - .padding(25.dp), - ) { - Icon( - imageVector = icon, - contentDescription = "Menu Icon", - tint = Color.Unspecified, - ) - Spacer(modifier = Modifier.width(16.dp)) - Text( - text = title, - color = MaterialTheme.colorScheme.onBackground, - style = Content8, - ) - } -} - @DevicePreview @Composable -fun MenuScreenPreview() { +fun MenuScreenPreview( + @PreviewParameter(MenuPreviewParameterProvider::class) + menuUiState: MenuUiState, +) { UnifestTheme { MenuScreen( padding = PaddingValues(), - menuUiState = MenuUiState( - festivals = persistentListOf( - FestivalModel( - 1, - 1, - "https://picsum.photos/36", - "서울대학교", - "서울", - "설대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - FestivalModel( - 2, - 2, - "https://picsum.photos/36", - "연세대학교", - "서울", - "연대축제", - "2024-04-21", - "2024-04-23", - 126.957f, - 37.460f, - ), - ), - likedBooths = persistentListOf( - LikedBoothModel( - id = 1, - name = "부스 이름", - category = "부스 카테고리", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - LikedBoothModel( - id = 2, - name = "부스 이름", - category = "부스 카테고리", - description = "부스 설명", - location = "부스 위치", - warning = "학과 전용 부스", - ), - ), - ), + menuUiState = menuUiState, festivalUiState = FestivalUiState(), appVersion = "1.0.0", onMenuUiAction = {}, diff --git a/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/component/FestivalItem.kt b/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/component/FestivalItem.kt new file mode 100644 index 00000000..f4b0e9ae --- /dev/null +++ b/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/component/FestivalItem.kt @@ -0,0 +1,79 @@ +package com.unifest.android.feature.menu.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.draw.shadow +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import com.unifest.android.core.designsystem.R +import com.unifest.android.core.designsystem.component.NetworkImage +import com.unifest.android.core.designsystem.theme.Content6 +import com.unifest.android.core.designsystem.theme.MenuTitle +import com.unifest.android.core.model.FestivalModel +import com.unifest.android.feature.menu.viewmodel.MenuUiAction + +@Composable +fun FestivalItem( + festival: FestivalModel, + onMenuUiAction: (MenuUiAction) -> Unit, +) { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center, + modifier = Modifier + .padding(vertical = 10.dp) + .clickable { + onMenuUiAction(MenuUiAction.OnLikedFestivalItemClick(festival.schoolName)) + }, + ) { + Box( + modifier = Modifier + .size(65.dp) + .shadow( + elevation = 6.dp, + shape = CircleShape, + ) + .background(MaterialTheme.colorScheme.tertiaryContainer, CircleShape) + .padding(5.dp), + contentAlignment = Alignment.Center, + ) { + NetworkImage( + imgUrl = festival.thumbnail, + contentDescription = "Festival Thumbnail", + modifier = Modifier + .size(60.dp) + .clip(CircleShape), + placeholder = painterResource(id = R.drawable.item_placeholder), + ) + } + Spacer(modifier = Modifier.height(8.dp)) + Text( + text = festival.schoolName, + color = MaterialTheme.colorScheme.onSurfaceVariant, + style = Content6, + textAlign = TextAlign.Center, + ) + Spacer(modifier = Modifier.height(2.dp)) + Text( + text = festival.festivalName, + color = MaterialTheme.colorScheme.onBackground, + style = MenuTitle, + textAlign = TextAlign.Center, + ) + } +} diff --git a/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/component/MenuItem.kt b/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/component/MenuItem.kt new file mode 100644 index 00000000..be8fb8e3 --- /dev/null +++ b/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/component/MenuItem.kt @@ -0,0 +1,47 @@ +package com.unifest.android.feature.menu.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.unit.dp +import com.unifest.android.core.designsystem.theme.Content8 + +@Composable +fun MenuItem( + icon: ImageVector, + title: String, + onClick: () -> Unit, +) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .fillMaxWidth() + .background(MaterialTheme.colorScheme.background) + .clickable(onClick = onClick) + .padding(25.dp), + ) { + Icon( + imageVector = icon, + contentDescription = "Menu Icon", + tint = Color.Unspecified, + ) + Spacer(modifier = Modifier.width(16.dp)) + Text( + text = title, + color = MaterialTheme.colorScheme.onBackground, + style = Content8, + ) + } +} diff --git a/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/preview/MenuPreviewParameterProvider.kt b/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/preview/MenuPreviewParameterProvider.kt new file mode 100644 index 00000000..fa9a36e8 --- /dev/null +++ b/feature/menu/src/main/kotlin/com/unifest/android/feature/menu/preview/MenuPreviewParameterProvider.kt @@ -0,0 +1,58 @@ +package com.unifest.android.feature.menu.preview + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import com.unifest.android.core.model.FestivalModel +import com.unifest.android.core.model.LikedBoothModel +import com.unifest.android.feature.menu.viewmodel.MenuUiState +import kotlinx.collections.immutable.persistentListOf + +internal class MenuPreviewParameterProvider : PreviewParameterProvider { + override val values = sequenceOf( + MenuUiState( + festivals = persistentListOf( + FestivalModel( + 1, + 1, + "https://picsum.photos/36", + "서울대학교", + "서울", + "설대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + FestivalModel( + 2, + 2, + "https://picsum.photos/36", + "연세대학교", + "서울", + "연대축제", + "2024-04-21", + "2024-04-23", + 126.957f, + 37.460f, + ), + ), + likedBooths = persistentListOf( + LikedBoothModel( + id = 1, + name = "부스 이름", + category = "부스 카테고리", + description = "부스 설명", + location = "부스 위치", + warning = "학과 전용 부스", + ), + LikedBoothModel( + id = 2, + name = "부스 이름", + category = "부스 카테고리", + description = "부스 설명", + location = "부스 위치", + warning = "학과 전용 부스", + ), + ), + ), + ) +} diff --git a/feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/WaitingScreen.kt b/feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/WaitingScreen.kt index c0b01344..48ea65eb 100644 --- a/feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/WaitingScreen.kt +++ b/feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/WaitingScreen.kt @@ -3,7 +3,6 @@ package com.unifest.android.feature.waiting import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.background import androidx.compose.foundation.clickable -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -14,18 +13,14 @@ 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.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.CardColors -import androidx.compose.material3.CardDefaults import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text -import androidx.compose.material3.VerticalDivider import androidx.compose.material3.pulltorefresh.PullToRefreshContainer import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState import androidx.compose.runtime.Composable @@ -33,40 +28,25 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.res.stringResource -import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.unifest.android.core.common.ObserveAsEvents -import com.unifest.android.core.designsystem.ComponentPreview import com.unifest.android.core.designsystem.R -import com.unifest.android.core.designsystem.component.UnifestOutlinedButton import com.unifest.android.core.designsystem.component.WaitingCancelDialog import com.unifest.android.core.designsystem.theme.BoothTitle2 -import com.unifest.android.core.designsystem.theme.Content1 import com.unifest.android.core.designsystem.theme.Content2 import com.unifest.android.core.designsystem.theme.Content7 -import com.unifest.android.core.designsystem.theme.DarkGrey100 -import com.unifest.android.core.designsystem.theme.DarkRed -import com.unifest.android.core.designsystem.theme.LightGrey100 -import com.unifest.android.core.designsystem.theme.LightGrey700 -import com.unifest.android.core.designsystem.theme.LightRed -import com.unifest.android.core.designsystem.theme.Title3 import com.unifest.android.core.designsystem.theme.Title4 -import com.unifest.android.core.designsystem.theme.Title5 import com.unifest.android.core.designsystem.theme.UnifestTheme -import com.unifest.android.core.designsystem.theme.WaitingNumber -import com.unifest.android.core.designsystem.theme.WaitingNumber2 import com.unifest.android.core.designsystem.theme.WaitingNumber4 -import com.unifest.android.core.designsystem.theme.WaitingNumber5 -import com.unifest.android.core.model.MyWaitingModel import com.unifest.android.core.ui.DevicePreview +import com.unifest.android.feature.waiting.component.WaitingInfoItem +import com.unifest.android.feature.waiting.preview.WaitingPreviewParameterProvider import com.unifest.android.feature.waiting.viewmodel.WaitingUiAction import com.unifest.android.feature.waiting.viewmodel.WaitingUiEvent import com.unifest.android.feature.waiting.viewmodel.WaitingUiState @@ -234,177 +214,16 @@ internal fun WaitingScreen( } } -@Composable -fun WaitingInfoItem( - myWaitingModel: MyWaitingModel, - onWaitingUiAction: (WaitingUiAction) -> Unit, -) { - Card( - colors = CardColors( - containerColor = MaterialTheme.colorScheme.surface, - contentColor = MaterialTheme.colorScheme.onBackground, - disabledContainerColor = MaterialTheme.colorScheme.secondaryContainer, - disabledContentColor = MaterialTheme.colorScheme.onSurfaceVariant, - ), - elevation = CardDefaults.cardElevation(defaultElevation = 8.dp), - modifier = Modifier.fillMaxWidth(), - ) { - Column( - modifier = Modifier - .background(MaterialTheme.colorScheme.surface) - .padding(16.dp), - ) { - Row( - horizontalArrangement = Arrangement.SpaceBetween, - modifier = Modifier.fillMaxWidth(), - ) { - Text( - text = stringResource(id = R.string.waiting_current_order), - color = MaterialTheme.colorScheme.onBackground, - style = Content1, - ) - Row { - Icon( - imageVector = ImageVector.vectorResource(id = R.drawable.ic_location_green), - contentDescription = "Location Icon", - modifier = Modifier.align(Alignment.CenterVertically), - tint = Color.Unspecified, - ) - Spacer(modifier = Modifier.width(5.dp)) - Text( - text = myWaitingModel.boothName, - color = MaterialTheme.colorScheme.onBackground, - style = Title3, - ) - } - } - Spacer(modifier = Modifier.height(2.dp)) - Row( - verticalAlignment = Alignment.Bottom, - horizontalArrangement = Arrangement.SpaceBetween, - modifier = Modifier.fillMaxWidth(), - ) { - Row( - verticalAlignment = Alignment.Bottom, - ) { - Text( - text = if (myWaitingModel.waitingOrder.toInt() == 1) { - stringResource(id = R.string.waiting_my_turn) - } else { - myWaitingModel.waitingOrder.toString() - }, - style = if (myWaitingModel.waitingOrder.toInt() == 1) WaitingNumber5 else WaitingNumber, - color = MaterialTheme.colorScheme.primary, - modifier = Modifier.alignByBaseline(), - ) - Spacer(modifier = Modifier.width(8.dp)) - if (myWaitingModel.waitingOrder.toInt() != 1) { - Text( - text = stringResource(id = R.string.waiting_nth), - fontSize = 18.sp, - color = MaterialTheme.colorScheme.onBackground, - modifier = Modifier.alignByBaseline(), - ) - } - } - Row( - verticalAlignment = Alignment.CenterVertically, - ) { - Text( - text = stringResource(id = R.string.waiting_waiting_number), - color = MaterialTheme.colorScheme.onBackground, - style = Content1, - ) - Spacer(modifier = Modifier.width(5.dp)) - Text( - text = myWaitingModel.waitingId.toString(), - color = MaterialTheme.colorScheme.onBackground, - style = WaitingNumber2, - ) - Spacer(modifier = Modifier.width(13.dp)) - VerticalDivider( - thickness = 1.dp, - color = MaterialTheme.colorScheme.onSecondaryContainer, - modifier = Modifier.height(13.dp), - ) - Spacer(modifier = Modifier.width(13.dp)) - Text( - text = stringResource(id = R.string.waiting_people), - color = MaterialTheme.colorScheme.onBackground, - style = Content1, - ) - Spacer(modifier = Modifier.width(6.dp)) - Text( - text = myWaitingModel.partySize.toString(), - color = MaterialTheme.colorScheme.onBackground, - style = WaitingNumber2, - ) - } - } - Spacer(modifier = Modifier.height(16.dp)) - Row( - horizontalArrangement = Arrangement.SpaceBetween, - modifier = Modifier.fillMaxWidth(), - ) { - UnifestOutlinedButton( - onClick = { onWaitingUiAction(WaitingUiAction.OnCancelWaitingClick(myWaitingModel.waitingId)) }, - containerColor = if (isSystemInDarkTheme()) DarkGrey100 else LightGrey100, - borderColor = if (isSystemInDarkTheme()) DarkGrey100 else LightGrey100, - modifier = Modifier.weight(1f), - ) { - Text( - text = stringResource(id = R.string.waiting_cancel_waiting), - color = if (isSystemInDarkTheme()) DarkRed else LightRed, - style = Title5, - ) - } - Spacer(modifier = Modifier.width(10.dp)) - UnifestOutlinedButton( - onClick = { onWaitingUiAction(WaitingUiAction.OnCheckBoothDetailClick(myWaitingModel.boothId)) }, - containerColor = LightGrey100, - borderColor = LightGrey100, - modifier = Modifier.weight(1f), - ) { - Text( - text = stringResource(id = R.string.waiting_booth_check), - color = LightGrey700, - style = Title5, - ) - } - } - } - } -} - @DevicePreview @Composable -fun WaitingScreenPreview() { +fun WaitingScreenPreview( + @PreviewParameter(WaitingPreviewParameterProvider::class) + waitingUiState: WaitingUiState, +) { UnifestTheme { WaitingScreen( padding = PaddingValues(), - waitingUiState = WaitingUiState(), - onWaitingUiAction = {}, - ) - } -} - -@ComponentPreview -@Composable -fun WaitingScreenComponentPreview() { - UnifestTheme { - WaitingInfoItem( - myWaitingModel = MyWaitingModel( - boothId = 1L, - waitingId = 1L, - partySize = 2L, - tel = "010-1234-5678", - deviceId = "1234567890", - createdAt = "2021-09-01T00:00:00", - updatedAt = "2021-09-01T00:00:00", - status = "waiting", - waitingOrder = 1L, - boothName = "Booth Name", - ), + waitingUiState = waitingUiState, onWaitingUiAction = {}, ) } diff --git a/feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/component/WaitingInfoItem.kt b/feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/component/WaitingInfoItem.kt new file mode 100644 index 00000000..92d7eda9 --- /dev/null +++ b/feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/component/WaitingInfoItem.kt @@ -0,0 +1,209 @@ +package com.unifest.android.feature.waiting.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.foundation.layout.Arrangement +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.material3.Card +import androidx.compose.material3.CardColors +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.material3.VerticalDivider +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.unifest.android.core.designsystem.ComponentPreview +import com.unifest.android.core.designsystem.R +import com.unifest.android.core.designsystem.component.UnifestOutlinedButton +import com.unifest.android.core.designsystem.theme.Content1 +import com.unifest.android.core.designsystem.theme.DarkGrey100 +import com.unifest.android.core.designsystem.theme.DarkRed +import com.unifest.android.core.designsystem.theme.LightGrey100 +import com.unifest.android.core.designsystem.theme.LightGrey700 +import com.unifest.android.core.designsystem.theme.LightRed +import com.unifest.android.core.designsystem.theme.Title3 +import com.unifest.android.core.designsystem.theme.Title5 +import com.unifest.android.core.designsystem.theme.UnifestTheme +import com.unifest.android.core.designsystem.theme.WaitingNumber +import com.unifest.android.core.designsystem.theme.WaitingNumber2 +import com.unifest.android.core.designsystem.theme.WaitingNumber5 +import com.unifest.android.core.model.MyWaitingModel +import com.unifest.android.feature.waiting.viewmodel.WaitingUiAction + +@Composable +fun WaitingInfoItem( + myWaitingModel: MyWaitingModel, + onWaitingUiAction: (WaitingUiAction) -> Unit, +) { + Card( + colors = CardColors( + containerColor = MaterialTheme.colorScheme.surface, + contentColor = MaterialTheme.colorScheme.onBackground, + disabledContainerColor = MaterialTheme.colorScheme.secondaryContainer, + disabledContentColor = MaterialTheme.colorScheme.onSurfaceVariant, + ), + elevation = CardDefaults.cardElevation(defaultElevation = 8.dp), + modifier = Modifier.fillMaxWidth(), + ) { + Column( + modifier = Modifier + .background(MaterialTheme.colorScheme.surface) + .padding(16.dp), + ) { + Row( + horizontalArrangement = Arrangement.SpaceBetween, + modifier = Modifier.fillMaxWidth(), + ) { + Text( + text = stringResource(id = R.string.waiting_current_order), + color = MaterialTheme.colorScheme.onBackground, + style = Content1, + ) + Row { + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_location_green), + contentDescription = "Location Icon", + modifier = Modifier.align(Alignment.CenterVertically), + tint = Color.Unspecified, + ) + Spacer(modifier = Modifier.width(5.dp)) + Text( + text = myWaitingModel.boothName, + color = MaterialTheme.colorScheme.onBackground, + style = Title3, + ) + } + } + Spacer(modifier = Modifier.height(2.dp)) + Row( + verticalAlignment = Alignment.Bottom, + horizontalArrangement = Arrangement.SpaceBetween, + modifier = Modifier.fillMaxWidth(), + ) { + Row( + verticalAlignment = Alignment.Bottom, + ) { + Text( + text = if (myWaitingModel.waitingOrder.toInt() == 1) { + stringResource(id = R.string.waiting_my_turn) + } else { + myWaitingModel.waitingOrder.toString() + }, + style = if (myWaitingModel.waitingOrder.toInt() == 1) WaitingNumber5 else WaitingNumber, + color = MaterialTheme.colorScheme.primary, + modifier = Modifier.alignByBaseline(), + ) + Spacer(modifier = Modifier.width(8.dp)) + if (myWaitingModel.waitingOrder.toInt() != 1) { + Text( + text = stringResource(id = R.string.waiting_nth), + fontSize = 18.sp, + color = MaterialTheme.colorScheme.onBackground, + modifier = Modifier.alignByBaseline(), + ) + } + } + Row( + verticalAlignment = Alignment.CenterVertically, + ) { + Text( + text = stringResource(id = R.string.waiting_waiting_number), + color = MaterialTheme.colorScheme.onBackground, + style = Content1, + ) + Spacer(modifier = Modifier.width(5.dp)) + Text( + text = myWaitingModel.waitingId.toString(), + color = MaterialTheme.colorScheme.onBackground, + style = WaitingNumber2, + ) + Spacer(modifier = Modifier.width(13.dp)) + VerticalDivider( + thickness = 1.dp, + color = MaterialTheme.colorScheme.onSecondaryContainer, + modifier = Modifier.height(13.dp), + ) + Spacer(modifier = Modifier.width(13.dp)) + Text( + text = stringResource(id = R.string.waiting_people), + color = MaterialTheme.colorScheme.onBackground, + style = Content1, + ) + Spacer(modifier = Modifier.width(6.dp)) + Text( + text = myWaitingModel.partySize.toString(), + color = MaterialTheme.colorScheme.onBackground, + style = WaitingNumber2, + ) + } + } + Spacer(modifier = Modifier.height(16.dp)) + Row( + horizontalArrangement = Arrangement.SpaceBetween, + modifier = Modifier.fillMaxWidth(), + ) { + UnifestOutlinedButton( + onClick = { onWaitingUiAction(WaitingUiAction.OnCancelWaitingClick(myWaitingModel.waitingId)) }, + containerColor = if (isSystemInDarkTheme()) DarkGrey100 else LightGrey100, + borderColor = if (isSystemInDarkTheme()) DarkGrey100 else LightGrey100, + modifier = Modifier.weight(1f), + ) { + Text( + text = stringResource(id = R.string.waiting_cancel_waiting), + color = if (isSystemInDarkTheme()) DarkRed else LightRed, + style = Title5, + ) + } + Spacer(modifier = Modifier.width(10.dp)) + UnifestOutlinedButton( + onClick = { onWaitingUiAction(WaitingUiAction.OnCheckBoothDetailClick(myWaitingModel.boothId)) }, + containerColor = LightGrey100, + borderColor = LightGrey100, + modifier = Modifier.weight(1f), + ) { + Text( + text = stringResource(id = R.string.waiting_booth_check), + color = LightGrey700, + style = Title5, + ) + } + } + } + } +} + +@ComponentPreview +@Composable +fun WaitingInfoItemPreview() { + UnifestTheme { + WaitingInfoItem( + myWaitingModel = MyWaitingModel( + boothId = 1L, + waitingId = 1L, + partySize = 2L, + tel = "010-1234-5678", + deviceId = "1234567890", + createdAt = "2024-05-23", + updatedAt = "2024-05-23", + status = "waiting", + waitingOrder = 1L, + boothName = "부스 이름", + ), + onWaitingUiAction = {}, + ) + } +} diff --git a/feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/preview/WaitingPreviewParameterProvider.kt b/feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/preview/WaitingPreviewParameterProvider.kt new file mode 100644 index 00000000..be08ccfa --- /dev/null +++ b/feature/waiting/src/main/kotlin/com/unifest/android/feature/waiting/preview/WaitingPreviewParameterProvider.kt @@ -0,0 +1,50 @@ +package com.unifest.android.feature.waiting.preview + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import com.unifest.android.core.model.MyWaitingModel +import com.unifest.android.feature.waiting.viewmodel.WaitingUiState +import kotlinx.collections.immutable.persistentListOf + +internal class WaitingPreviewParameterProvider : PreviewParameterProvider { + override val values = sequenceOf( + WaitingUiState( + myWaitingList = persistentListOf( + MyWaitingModel( + boothId = 1L, + waitingId = 1L, + partySize = 4, + tel = "010-1234-5678", + waitingOrder = 1, + ), + MyWaitingModel( + boothId = 2L, + waitingId = 2L, + partySize = 4, + tel = "010-1234-5678", + waitingOrder = 2, + ), + MyWaitingModel( + boothId = 3L, + waitingId = 3L, + partySize = 4, + tel = "010-1234-5678", + waitingOrder = 3, + ), + MyWaitingModel( + boothId = 4L, + waitingId = 4L, + partySize = 4, + tel = "010-1234-5678", + waitingOrder = 4, + ), + MyWaitingModel( + boothId = 5L, + waitingId = 5L, + partySize = 4, + tel = "010-1234-5678", + waitingOrder = 5, + ), + ), + ), + ) +}