Added an example file and last modified at date in recipe info page
parent
7a3c9730a2
commit
a11e8ac0da
|
|
@ -1,5 +1,6 @@
|
||||||
package xyz.pixelatedw.recipe.ui.components
|
package xyz.pixelatedw.recipe.ui.components
|
||||||
|
|
||||||
|
import android.text.format.DateFormat
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
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.RecipeWithTags
|
||||||
import xyz.pixelatedw.recipe.data.RecipesView
|
import xyz.pixelatedw.recipe.data.RecipesView
|
||||||
import xyz.pixelatedw.recipe.utils.parseMarkdown
|
import xyz.pixelatedw.recipe.utils.parseMarkdown
|
||||||
|
import java.util.Calendar
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun RecipeInfo(
|
fun RecipeInfo(
|
||||||
|
|
@ -49,6 +52,11 @@ fun RecipeInfo(
|
||||||
val openDeletionDialog = remember { mutableStateOf(false) }
|
val openDeletionDialog = remember { mutableStateOf(false) }
|
||||||
val picsCounts = remember { active.recipe.pics.size };
|
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(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.verticalScroll(rememberScrollState())
|
.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(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
Loading…
Reference in New Issue