From a11e8ac0da7e06071c59279413a7f055bc4ba629 Mon Sep 17 00:00:00 2001 From: Wynd Date: Sat, 20 Dec 2025 23:51:53 +0200 Subject: [PATCH] Added an example file and last modified at date in recipe info page --- .../recipe/ui/components/RecipeInfo.kt | 23 +++++++++++++++ example.md | 29 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 example.md diff --git a/app/src/main/java/xyz/pixelatedw/recipe/ui/components/RecipeInfo.kt b/app/src/main/java/xyz/pixelatedw/recipe/ui/components/RecipeInfo.kt index fbfa5d0..8b1a1f3 100644 --- a/app/src/main/java/xyz/pixelatedw/recipe/ui/components/RecipeInfo.kt +++ b/app/src/main/java/xyz/pixelatedw/recipe/ui/components/RecipeInfo.kt @@ -1,5 +1,6 @@ package xyz.pixelatedw.recipe.ui.components +import android.text.format.DateFormat import android.view.WindowManager import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement @@ -36,6 +37,8 @@ import xyz.pixelatedw.recipe.MainActivity import xyz.pixelatedw.recipe.data.RecipeWithTags import xyz.pixelatedw.recipe.data.RecipesView import xyz.pixelatedw.recipe.utils.parseMarkdown +import java.util.Calendar +import java.util.Locale @Composable fun RecipeInfo( @@ -49,6 +52,11 @@ fun RecipeInfo( val openDeletionDialog = remember { mutableStateOf(false) } val picsCounts = remember { active.recipe.pics.size }; + val timestamp = view.activeRecipe.collectAsState().value?.recipe?.lastModified ?: 0 + val calendar = Calendar.getInstance(Locale.ENGLISH) + calendar.timeInMillis = timestamp + val lastModified = DateFormat.format("yyyy-MM-dd",calendar).toString() + Column( modifier = Modifier .verticalScroll(rememberScrollState()) @@ -113,6 +121,21 @@ fun RecipeInfo( } ) } + Box( + modifier = Modifier + .fillMaxHeight() + .padding(start = 16.dp) + ) { + Text( + text = "Last Modified", + style = MaterialTheme.typography.bodySmall, + ) + Text( + text = lastModified, + modifier = Modifier.padding(start = 2.dp, top = 24.dp), + style = MaterialTheme.typography.bodyMedium, + ) + } Row( modifier = Modifier .fillMaxWidth() diff --git a/example.md b/example.md new file mode 100644 index 0000000..b34074c --- /dev/null +++ b/example.md @@ -0,0 +1,29 @@ ++++ +title = "Example Recipe Name" # mandatory +tags = ["test", "recipe"] # optional +pics = ["pics/test.jpg", "pics/test2.jpg"] # optional, only reads jpgs + +# Everything below here is just plain markdown, +# use whatever format or layout you feel fits your needs best + ++++ + +- **Portions:** +- **Prep Time:** +- **Cook Time:** + +## Ingredients + +- Ingredient 1 + +- Ingredient 2 + +- Ingredient 3 + +## Steps + +1. Step 1 + +2. Step 2 + +3. Step 3