From 538219102762a503b6b1ae2d31de21068977f857 Mon Sep 17 00:00:00 2001 From: shamim-emon Date: Thu, 12 Sep 2024 22:15:55 +0600 Subject: [PATCH] fix-issue-3488 --- .../com/ivy/categories/CategoriesScreen.kt | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/screen/categories/src/main/java/com/ivy/categories/CategoriesScreen.kt b/screen/categories/src/main/java/com/ivy/categories/CategoriesScreen.kt index 74d91b50e8..1b119fda25 100644 --- a/screen/categories/src/main/java/com/ivy/categories/CategoriesScreen.kt +++ b/screen/categories/src/main/java/com/ivy/categories/CategoriesScreen.kt @@ -686,6 +686,12 @@ private fun PreviewCategoriesCompactModeEnabled(theme: Theme = Theme.LIGHT) { Preview(theme = theme, compactModeEnabled = true) } +@Preview +@Composable +private fun PreviewCategoriesCompactModeEnabledAndSearchBarEnabled(theme: Theme = Theme.LIGHT) { + Preview(theme = theme, compactModeEnabled = true, displaySearchBarEnabled = true) +} + @Preview @Composable private fun Preview( @@ -766,6 +772,86 @@ private fun Preview( } } +@Preview +@Composable +private fun PreviewWithSearchBarEnabled( + theme: Theme = Theme.LIGHT, + compactModeEnabled: Boolean = false, + displaySearchBarEnabled: Boolean = true +) { + com.ivy.legacy.IvyWalletPreview(theme) { + val state = CategoriesScreenState( + baseCurrency = "BGN", + compactCategoriesModeEnabled = compactModeEnabled, + showCategorySearchBar = displaySearchBarEnabled, + categories = persistentListOf( + CategoryData( + category = Category( + id = CategoryId(UUID.randomUUID()), + name = NotBlankTrimmedString.unsafe("Groceries"), + color = ColorInt(Green.toArgb()), + icon = IconAsset.unsafe("groceries"), + orderNum = 0.0, + ), + monthlyBalance = 2125.0, + monthlyExpenses = 920.0, + monthlyIncome = 3045.0 + ), + CategoryData( + category = Category( + id = CategoryId(UUID.randomUUID()), + name = NotBlankTrimmedString.unsafe("Fun"), + color = ColorInt(Orange.toArgb()), + icon = IconAsset.unsafe("game"), + orderNum = 0.0, + ), + monthlyBalance = 1200.0, + monthlyExpenses = 750.0, + monthlyIncome = 0.0 + ), + CategoryData( + category = Category( + id = CategoryId(UUID.randomUUID()), + name = NotBlankTrimmedString.unsafe("Ivy"), + color = ColorInt(IvyDark.toArgb()), + icon = IconAsset.unsafe("star"), + orderNum = 0.0, + ), + monthlyBalance = 1200.0, + monthlyExpenses = 0.0, + monthlyIncome = 5000.0 + ), + CategoryData( + category = Category( + id = CategoryId(UUID.randomUUID()), + name = NotBlankTrimmedString.unsafe("Food"), + color = ColorInt(GreenLight.toArgb()), + icon = IconAsset.unsafe("atom"), + orderNum = 0.0, + ), + monthlyBalance = 12125.21, + monthlyExpenses = 1350.50, + monthlyIncome = 8000.48 + ), + CategoryData( + category = Category( + id = CategoryId(UUID.randomUUID()), + name = NotBlankTrimmedString.unsafe("Shisha"), + color = ColorInt(GreenDark.toArgb()), + icon = IconAsset.unsafe("drink"), + orderNum = 0.0, + ), + monthlyBalance = 820.0, + monthlyExpenses = 340.0, + monthlyIncome = 400.0 + ), + + ) + ) + UI(state = state) + } +} + @Composable private fun SearchField( onSearch: (String) -> Unit,