fix/improve recipe page & cookmode

This commit is contained in:
p0lycarpio 2025-06-27 16:02:57 +00:00
commit fbc1cb1fa3
7 changed files with 30 additions and 35 deletions

View file

@ -74,6 +74,7 @@
:size="$vuetify.display.xs ? 'small' : undefined" :size="$vuetify.display.xs ? 'small' : undefined"
:color="btn.color" :color="btn.color"
variant="elevated" variant="elevated"
:icon="$vuetify.display.xs"
@click="emitHandler(btn.event)" @click="emitHandler(btn.event)"
> >
<v-icon :left="!$vuetify.display.xs"> <v-icon :left="!$vuetify.display.xs">

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="ma-0 pa-0 text-subtitle-1 dense-markdown ingredient-item"> <div class="text-subtitle-1 dense-markdown ingredient-item">
<SafeMarkdown <SafeMarkdown
v-if="parsedIng.quantity" v-if="parsedIng.quantity"
class="d-inline" class="d-inline"

View file

@ -29,6 +29,7 @@
<v-list-item <v-list-item
density="compact" density="compact"
@click.stop="toggleChecked(index)" @click.stop="toggleChecked(index)"
class="pa-0"
> >
<template #prepend> <template #prepend>
<v-checkbox <v-checkbox

View file

@ -87,11 +87,10 @@
/> />
<RecipePrintContainer :recipe="recipe" :scale="scale" /> <RecipePrintContainer :recipe="recipe" :scale="scale" />
</v-container> </v-container>
<!-- Cook mode displayes two columns with ingredients and instructions side by side, each being scrolled individually, allowing to view both at the same timer --> <!-- Cook mode displayes two columns with ingredients and instructions side by side, each being scrolled individually, allowing to view both at the same time -->
<v-sheet <v-sheet
v-show="isCookMode && !hasLinkedIngredients" v-show="isCookMode && !hasLinkedIngredients"
key="cookmode" key="cookmode"
:style="{ height: $vuetify.display.smAndUp ? 'calc(100vh - 48px)' : '' }"
> >
<!-- the calc is to account for the toolbar a more dynamic solution could be needed --> <!-- the calc is to account for the toolbar a more dynamic solution could be needed -->
<v-row style="height: 100%" no-gutters class="overflow-hidden"> <v-row style="height: 100%" no-gutters class="overflow-hidden">
@ -107,7 +106,12 @@
/> />
<v-divider /> <v-divider />
</v-col> </v-col>
<v-col class="overflow-y-auto py-2" style="height: 100%" cols="12" sm="7"> <v-col class="overflow-y-auto"
:class="$vuetify.display.smAndDown.value ? 'py-2': 'py-6'"
style="height: 100%" cols="12" sm="7">
<h2 class="text-h5 px-4 font-weight-medium opacity-80">
{{ $t('recipe.instructions') }}
</h2>
<RecipePageInstructions <RecipePageInstructions
v-model="recipe.recipeInstructions" v-model="recipe.recipeInstructions"
v-model:assets="recipe.assets" v-model:assets="recipe.assets"

View file

@ -1,32 +1,28 @@
<template> <template>
<div class="d-flex justify-start align-top flex-wrap py-2"> <div class="d-flex justify-start align-top flex-wrap">
<RecipeImageUploadBtn <RecipeImageUploadBtn
class="my-1" class="my-2"
:slug="recipe.slug" :slug="recipe.slug"
@upload="uploadImage" @upload="uploadImage"
@refresh="imageKey++" @refresh="imageKey++"
/> />
<RecipeSettingsMenu <RecipeSettingsMenu
v-model="recipe.settings" v-model="recipe.settings"
class="my-1 mx-1" class="my-2 mx-1"
:is-owner="recipe.userId == user.id" :is-owner="recipe.userId == user.id"
@upload="uploadImage" @upload="uploadImage"
/> />
<v-spacer /> <v-spacer />
<v-container
class="py-0"
style="width: 40%;"
>
<v-select <v-select
v-model="recipe.userId" v-model="recipe.userId"
max-width="100" class="my-2"
max-width="300"
:items="allUsers" :items="allUsers"
item-title="fullName" :item-props="itemsProps"
item-value="id"
:label="$t('general.owner')" :label="$t('general.owner')"
hide-details
:disabled="!canEditOwner" :disabled="!canEditOwner"
variant="underlined" variant="outlined"
density="compact"
> >
<template #prepend> <template #prepend>
<UserAvatar <UserAvatar
@ -35,16 +31,6 @@
/> />
</template> </template>
</v-select> </v-select>
<v-card-text
v-if="ownerHousehold"
class="pa-0 d-flex"
style="align-items: flex-end;"
>
<v-spacer />
<v-icon>{{ $globals.icons.household }}</v-icon>
<span class="pl-1">{{ ownerHousehold.name }}</span>
</v-card-text>
</v-container>
</div> </div>
</template> </template>
@ -72,13 +58,15 @@ const canEditOwner = computed(() => {
const { store: allUsers } = useUserStore(); const { store: allUsers } = useUserStore();
const { store: households } = useHouseholdStore(); const { store: households } = useHouseholdStore();
const ownerHousehold = computed(() => {
const owner = allUsers.value.find(u => u.id === recipe.value.userId); function itemsProps(item: any) {
if (!owner) { const owner = allUsers.value.find(u => u.id === item.id);
return null; return {
value: item.id,
title: item.fullName,
subtitle: owner ? households.value.find(h => h.id === owner.householdId)?.name || "" : "",
};
} }
return households.value.find(h => h.id === owner.householdId);
});
async function uploadImage(fileObject: File) { async function uploadImage(fileObject: File) {
if (!recipe.value || !recipe.value.slug) { if (!recipe.value || !recipe.value.slug) {

View file

@ -15,12 +15,13 @@
v-for="(tool, index) in recipe.tools" v-for="(tool, index) in recipe.tools"
:key="index" :key="index"
density="compact" density="compact"
class="px-1"
> >
<template #prepend> <template #prepend>
<v-checkbox <v-checkbox
v-model="recipeTools[index].onHand" v-model="recipeTools[index].onHand"
hide-details hide-details
class="pt-0 my-auto py-auto" class="pt-0 py-auto"
color="secondary" color="secondary"
density="compact" density="compact"
@change="updateTool(index)" @change="updateTool(index)"

View file

@ -60,7 +60,7 @@
{{ $t('tool.required-tools') }} {{ $t('tool.required-tools') }}
</v-card-title> </v-card-title>
<v-divider class="mx-2" /> <v-divider class="mx-2" />
<v-card-text class="pt-0"> <v-card-text>
<RecipeOrganizerSelector <RecipeOrganizerSelector
v-model="recipe.tools" v-model="recipe.tools"
selector-type="tools" selector-type="tools"