Skip to content

Commit

Permalink
recipe view tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Dec 19, 2024
1 parent a34fddc commit b9e5126
Show file tree
Hide file tree
Showing 37 changed files with 95 additions and 44 deletions.
8 changes: 5 additions & 3 deletions vue3/src/components/display/IngredientsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<v-table density="compact" v-if="props.ingredients.length > 0">

<tbody>
<IngredientsTableRow v-for="i in props.ingredients" :ingredient="i" :key="i.id" :show-notes="props.showNotes" :draggable="props.draggable"></IngredientsTableRow>
<ingredients-table-row v-for="i in props.ingredients" :ingredient="i" :key="i.id" :show-notes="props.showNotes"
:ingredient-factor="ingredientFactor"></ingredients-table-row>
</tbody>

</v-table>
Expand All @@ -23,8 +24,9 @@ const props = defineProps({
type: Boolean,
default: true
},
draggable: {
type: Boolean,
ingredientFactor: {
type: Number,
required: true,
},
})
Expand Down
10 changes: 4 additions & 6 deletions vue3/src/components/display/IngredientsTableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
<td colspan="4"><b>{{ props.ingredient.note }}</b></td>
</template>
<template v-else>
<td>{{ props.ingredient.amount }}</td>
<td>{{ props.ingredient.amount * props.ingredientFactor }}</td>
<td><span v-if="props.ingredient.unit != null">{{ props.ingredient.unit.name }}</span></td>
<td><span v-if="props.ingredient.food != null">{{ props.ingredient.food.name }}</span></td>
<td v-if="props.showNotes">
<v-icon class="far fa-comment float-right" v-if="props.ingredient.note != '' && props.ingredient.note != undefined" @click="showTooltip = !showTooltip">
<v-tooltip v-model="showTooltip" activator="parent" location="start">{{ props.ingredient.note }}</v-tooltip>
</v-icon>
</td>
<td v-if="props.draggable" >
<v-icon icon="$dragHandle" class="drag-handle cursor-move"></v-icon>
</td>
</template>

</tr>
Expand All @@ -33,8 +30,9 @@ const props = defineProps({
type: Boolean,
default: true
},
draggable: {
type: Boolean,
ingredientFactor: {
type: Number,
required: true,
},
})
Expand Down
34 changes: 21 additions & 13 deletions vue3/src/components/display/RecipeActivity.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
<template>

<v-card class="mt-1">
<v-card-title>Activity</v-card-title>
<v-card-title>{{ $t('Activity') }}</v-card-title>
<v-card-text>

<v-card v-for="c in cookLogs" :key="c.id" class="mt-1">
<v-card-text>
<v-rating density="comfortable" size="x-small" color="tandoor" v-model="c.rating"></v-rating>
<br/>
<span v-if="c.servings != null && c.servings > 0">{{ c.servings }} <span v-if="recipe.servingsText != ''">{{ recipe.servingsText }}</span><span v-else>Servings</span></span> <br/>
<v-list>
<v-list-item v-for="c in cookLogs" :key="c.id">
<template #prepend>
<v-avatar color="primary">V</v-avatar>
</template>
<v-list-item-title class="font-weight-bold">{{ c.createdBy.displayName }}
<v-rating density="comfortable" size="x-small" color="tandoor" class="float-right" v-model="c.rating"></v-rating>
</v-list-item-title>

{{ c.comment }}
</v-card-text>
<v-divider></v-divider>
<v-card-subtitle>
{{ DateTime.fromJSDate(c.createdAt).toLocaleString(DateTime.DATETIME_SHORT) }} by {{ c.createdBy.displayName }}
</v-card-subtitle>
</v-card>


<p v-if="c.servings != null && c.servings > 0">
{{ c.servings }}
<span v-if="recipe.servingsText != ''">{{ recipe.servingsText }}</span>
<span v-else-if="c.servings == 1">{{ $t('Serving') }}</span>
<span v-else>{{ $t('Servings') }}</span>
</p>

<p class="text-disabled">
{{ DateTime.fromJSDate(c.createdAt).toLocaleString(DateTime.DATETIME_SHORT) }}
</p>
</v-list-item>
</v-list>

</v-card-text>
</v-card>
Expand Down
27 changes: 15 additions & 12 deletions vue3/src/components/display/RecipeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
>
<template #overlay>
<v-chip class="ms-2" color="primary" variant="flat" size="x-small">by {{ props.recipe.createdBy }}</v-chip>
<KeywordsComponent variant="flat" class="ms-1 mb-2" :keywords="props.recipe.keywords"></KeywordsComponent>
<keywords-component variant="flat" class="ms-1 mb-2" :keywords="props.recipe.keywords"></keywords-component>
</template>
</recipe-image>


<v-card>
<v-sheet class="d-flex align-center">
<span class="ps-2 text-h5 flex-grow-1" :class="{'text-truncate': !showFullRecipeName}" @click="showFullRecipeName = !showFullRecipeName">{{ props.recipe.name }}</span>
<span class="ps-2 text-h5 flex-grow-1" :class="{'text-truncate': !showFullRecipeName}" @click="showFullRecipeName = !showFullRecipeName">
{{ props.recipe.name }}
</span>
<recipe-context-menu :recipe="recipe"></recipe-context-menu>
</v-sheet>
</v-card>
Expand All @@ -34,25 +36,26 @@
<div class="text-grey">Waiting Time</div>
</v-col>
<v-col class="pt-1 pb-1">
<NumberScalerDialog :number="servings" @change="servings = $event.number" title="Servings">
<template #activator>
<div class="cursor-pointer">
<i class="fas fa-sort-numeric-up fa-fw mr-1"></i> {{ servings }} <br/>
<div class="text-grey"><span v-if="props.recipe?.servingsText">{{ props.recipe.servingsText }}</span><span v-else>Servings</span></div>
</div>
</template>
</NumberScalerDialog>

<div class="cursor-pointer">
<i class="fas fa-sort-numeric-up fa-fw mr-1"></i> {{ servings }} <br/>
<div class="text-grey"><span v-if="props.recipe?.servingsText">{{ props.recipe.servingsText }}</span><span v-else>{{ $t('Servings') }}</span></div>
<number-scaler-dialog :number="servings" @confirm="(s: number) => {servings = s}" title="Servings">
</number-scaler-dialog>
</div>


</v-col>
</v-row>
</v-container>
</v-card>

<v-card class="mt-1" v-if="props.recipe.steps.length > 1">
<StepsOverview :steps="props.recipe.steps"></StepsOverview>
<steps-overview :steps="props.recipe.steps"></steps-overview>
</v-card>

<v-card class="mt-1" v-for="(step, index) in props.recipe.steps" :key="step.id">
<Step :step="step" :step-number="index+1" :ingredient_factor="ingredientFactor"></Step>
<step :step="step" :step-number="index+1" :ingredientFactor="ingredientFactor"></step>
</v-card>

<recipe-activity :recipe="recipe"></recipe-activity>
Expand Down
27 changes: 18 additions & 9 deletions vue3/src/components/display/Step.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,32 @@
<v-card>
<v-card-title>
<v-row>
<v-col><span v-if="props.step.name">{{ props.step.name }}</span><span v-else>Step {{ props.stepNumber }}</span></v-col>
<v-col><span v-if="props.step.name">{{ props.step.name }}</span><span v-else>{{ $t('Step') }} {{ props.stepNumber }}</span></v-col>
<v-col class="text-right">
<v-btn-group density="compact" variant="tonal">
<v-btn size="small" color="info" v-if="props.step.time != undefined && props.step.time > 0" @click="timerRunning = true"><i class="fas fa-stopwatch mr-1 fa-fw"></i> {{ props.step.time }}</v-btn>
<v-btn size="small" color="success" v-if="hasDetails" @click="stepChecked = !stepChecked"><i class="fas fa-fw" :class="{'fa-check': !stepChecked, 'fa-times': stepChecked}"></i></v-btn>
<v-btn size="small" color="info" v-if="props.step.time != undefined && props.step.time > 0" @click="timerRunning = true"><i
class="fas fa-stopwatch mr-1 fa-fw"></i> {{ props.step.time }}
</v-btn>
<v-btn size="small" color="success" v-if="hasDetails" @click="stepChecked = !stepChecked"><i class="fas fa-fw"
:class="{'fa-check': !stepChecked, 'fa-times': stepChecked}"></i>
</v-btn>
</v-btn-group>
</v-col>
</v-row>
</v-card-title>
<template v-if="!stepChecked">
<timer :seconds="props.step.time != undefined ? props.step.time*60 : 0" @stop="timerRunning = false" v-if="timerRunning"></timer>

<IngredientsTable :ingredients="props.step.ingredients"></IngredientsTable>

<v-card-text v-if="props.step.instructionsMarkdown.length > 0">
<instructions :instructions_html="props.step.instructionsMarkdown" :ingredient_factor="ingredient_factor"></instructions>
<v-card-text>
<v-row>
<v-col cols="12" md="6" v-if="props.step?.ingredients.length > 0">
<ingredients-table :ingredients="props.step.ingredients" :ingredient-factor="ingredientFactor"></ingredients-table>
</v-col>
<v-col cols="12" md="6">
<instructions :instructions_html="props.step.instructionsMarkdown" :ingredient_factor="ingredientFactor"></instructions>
</v-col>
</v-row>
</v-card-text>

</template>

</v-card>
Expand All @@ -42,7 +51,7 @@ const props = defineProps({
required: false,
default: 1
},
ingredient_factor: {
ingredientFactor: {
type: Number,
required: true,
},
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/ar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"Access_Token": "",
"Actions": "",
"Activity": "",
"Add": "",
"AddAll": "",
"AddFoodToShopping": "",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/bg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"Access_Token": "",
"Actions": "",
"Activity": "",
"Add": "Добави",
"AddAll": "",
"AddFoodToShopping": "Добавете {food} към списъка си за пазаруване",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "",
"Actions": "",
"Activity": "",
"Add": "",
"AddAll": "",
"AddFoodToShopping": "",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Účet",
"Actions": "",
"Activity": "",
"Add": "Přidat",
"AddAll": "",
"AddFoodToShopping": "Přidat {food} na váš nákupní seznam",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Bruger",
"Actions": "",
"Activity": "",
"Add": "Tilføj",
"AddAll": "",
"AddFoodToShopping": "Tilføj {food} til indkøbsliste",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "Zugriffstoken",
"Account": "Konto",
"Actions": "Aktionen",
"Activity": "Aktivität",
"Add": "Hinzufügen",
"AddAll": "Alle Hinzufügen",
"AddFoodToShopping": "Fügen Sie {food} zur Einkaufsliste hinzu",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Λογαριασμός",
"Actions": "",
"Activity": "",
"Add": "Προσθήκη",
"AddAll": "",
"AddFoodToShopping": "Προσθήκη του φαγητού {food} στη λίστα αγορών σας",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "Access Token",
"Account": "Account",
"Actions": "Actions",
"Activity": "Activity",
"Add": "Add",
"AddAll": "Add all",
"AddFoodToShopping": "Add {food} to your shopping list",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Cuenta",
"Actions": "",
"Activity": "",
"Add": "Añadir",
"AddAll": "",
"AddFoodToShopping": "Añadir {food} a la lista de la compra",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/fi.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"Access_Token": "",
"Actions": "",
"Activity": "",
"Add": "Lisää",
"AddAll": "",
"AddMany": "",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Compte",
"Actions": "",
"Activity": "",
"Add": "Ajouter",
"AddAll": "",
"AddFoodToShopping": "Ajouter l’aliment {food} à votre liste de courses",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "חשבון",
"Actions": "",
"Activity": "",
"Add": "הוספה",
"AddAll": "",
"AddFoodToShopping": "הוסף {מזון} לרשימת הקניות",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Fiók",
"Actions": "",
"Activity": "",
"Add": "Hozzáadás",
"AddAll": "",
"AddFoodToShopping": "{food} hozzáadása bevásárlólistához",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/hy.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"Access_Token": "",
"Actions": "",
"Activity": "",
"Add": "",
"AddAll": "",
"AddMany": "",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "",
"Actions": "",
"Activity": "",
"Add": "Tambahkan",
"AddAll": "",
"AddFoodToShopping": "",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/is.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "",
"Actions": "",
"Activity": "",
"Add": "",
"AddAll": "",
"AddFoodToShopping": "",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Account",
"Actions": "",
"Activity": "",
"Add": "Aggiungi",
"AddAll": "",
"AddFoodToShopping": "Aggiungi {food} alla tua lista della spesa",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "",
"Actions": "",
"Activity": "",
"Add": "",
"AddAll": "",
"AddFoodToShopping": "",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/nb_NO.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "",
"Actions": "",
"Activity": "",
"Add": "Legg til",
"AddAll": "",
"AddFoodToShopping": "Legg til {food] i handlelisten din",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Account",
"Actions": "",
"Activity": "",
"Add": "Voeg toe",
"AddAll": "",
"AddFoodToShopping": "Voeg {food} toe aan je boodschappenlijst",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Konto",
"Actions": "",
"Activity": "",
"Add": "Dodaj",
"AddAll": "",
"AddFoodToShopping": "Dodaj {food} do swojej listy zakupów",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/pt.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"Access_Token": "",
"Actions": "",
"Activity": "",
"Add": "Adicionar",
"AddAll": "",
"AddFoodToShopping": "Adicionar {food} à sua lista de compras",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Conta",
"Actions": "",
"Activity": "",
"Add": "Adicionar",
"AddAll": "",
"AddFoodToShopping": "Incluir {food} na sua lista de compras",
Expand Down
1 change: 1 addition & 0 deletions vue3/src/locales/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Access_Token": "",
"Account": "Cont",
"Actions": "",
"Activity": "",
"Add": "Adaugă",
"AddAll": "",
"AddFoodToShopping": "Adăugă {food} în lista de cumpărături",
Expand Down
Loading

0 comments on commit b9e5126

Please sign in to comment.