Fix meal planner editor

This commit is contained in:
2026-06-04 22:16:55 +02:00
parent d1916d3fe6
commit 4dd8ef5f8a
2 changed files with 129 additions and 100 deletions

View File

@@ -1,5 +1,6 @@
package dev.ulfrx.recipe.ui.screens.mealplaneditor package dev.ulfrx.recipe.ui.screens.mealplaneditor
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
@@ -41,6 +42,7 @@ import dev.ulfrx.recipe.ui.theme.RecipeTheme
import kotlinx.datetime.LocalDate import kotlinx.datetime.LocalDate
import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.resources.stringResource
import recipe.composeapp.generated.resources.Res import recipe.composeapp.generated.resources.Res
import recipe.composeapp.generated.resources.meal_plan_editor_title
import recipe.composeapp.generated.resources.meal_plan_editor_section_ingredients import recipe.composeapp.generated.resources.meal_plan_editor_section_ingredients
import recipe.composeapp.generated.resources.meal_plan_editor_section_servings import recipe.composeapp.generated.resources.meal_plan_editor_section_servings
import recipe.composeapp.generated.resources.meal_plan_editor_section_slot import recipe.composeapp.generated.resources.meal_plan_editor_section_slot
@@ -94,6 +96,7 @@ internal fun MealPlanEditorContent(
editing.addedIngredients.mapTo(mutableSetOf()) { it.ingredientId } editing.addedIngredients.mapTo(mutableSetOf()) { it.ingredientId }
} }
Box(modifier = Modifier.fillMaxSize().background(RecipeTheme.colors.background)) {
Column( Column(
modifier = modifier =
modifier modifier
@@ -113,7 +116,7 @@ internal fun MealPlanEditorContent(
.padding(horizontal = spacing.lg + topChromeHeight + spacing.sm), .padding(horizontal = spacing.lg + topChromeHeight + spacing.sm),
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
RecipeTitle(title = editing.recipe.title) RecipeTitle(recipeTitle = editing.recipe.title)
} }
Spacer(Modifier.height(spacing.xl)) Spacer(Modifier.height(spacing.xl))
RecipeCalendarPill( RecipeCalendarPill(
@@ -183,6 +186,7 @@ internal fun MealPlanEditorContent(
Spacer(Modifier.height(bottomInset + spacing.xxl)) Spacer(Modifier.height(bottomInset + spacing.xxl))
} }
}
} }
@Composable @Composable
@@ -224,22 +228,48 @@ private fun SectionContainer(content: @Composable () -> Unit) {
@Composable @Composable
private fun RecipeTitle( private fun RecipeTitle(
title: String, recipeTitle: String,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
Column(
modifier = modifier,
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
BasicText( BasicText(
text = title, text = stringResource(Res.string.meal_plan_editor_title),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = style =
RecipeTheme.typography.body.copy( RecipeTheme.typography.body.copy(
color = RecipeTheme.colors.content, color = RecipeTheme.colors.content,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.Medium,
fontSize = RecipeTitleSize, fontSize = RecipeTitleSize,
lineHeight = RecipeTitleLineHeight,
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
), ),
modifier = modifier, modifier = Modifier.fillMaxWidth(),
) )
Spacer(Modifier.height(RecipeTitleGap))
BasicText(
text = recipeTitle,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style =
RecipeTheme.typography.body.copy(
color = RecipeTheme.colors.contentMuted,
fontWeight = FontWeight.Normal,
fontSize = RecipeSubtitleSize,
lineHeight = RecipeSubtitleLineHeight,
textAlign = TextAlign.Center,
),
modifier = Modifier.fillMaxWidth(),
)
}
} }
private val RecipeTitleSize = 14.sp private val RecipeTitleSize = 16.sp
private val RecipeTitleLineHeight = 17.sp
private val RecipeTitleGap = 4.dp
private val RecipeSubtitleSize = 11.sp
private val RecipeSubtitleLineHeight = 14.sp

View File

@@ -35,14 +35,13 @@ fun recipeGlassFor(colors: RecipeColors): RecipeGlass =
frost = 0.dp, frost = 0.dp,
), ),
button = RecipeGlassStyle( button = RecipeGlassStyle(
refraction = 0.5f, refraction = 0.3f,
curve = 0.4f, curve = 0.2f,
edge = 0.03f, edge = 0.03f,
dispersion = 0.5f, dispersion = 0.5f,
saturation = 1f, saturation = 1f,
contrast = 1f, contrast = 0.85f,
frost = 15.dp, frost = 5.dp,
tint = colors.surfaceGlass,
), ),
panel = RecipeGlassStyle( panel = RecipeGlassStyle(
refraction = 0f, refraction = 0f,