added some cooklog stuff

This commit is contained in:
vabene1111
2024-02-24 13:44:20 +01:00
parent 1e349214fe
commit 3c7fd0fa35
11 changed files with 217 additions and 56 deletions

View File

@@ -0,0 +1,57 @@
<template>
<v-container>
<v-row>
<v-col>
<h2>Activity</h2>
<v-timeline side="end" align="start">
<v-timeline-item dot-color="grey" size="xsmall" v-for="c in cook_logs" :key="c.id">
<v-card>
<v-card-text class="bg-primary"><small>{{ c.createdAt }} by {{ c.createdBy.displayName }}</small></v-card-text>
<v-rating density="compact" size="small" color="tandoor" v-model="c.rating"></v-rating>
<span v-if="c.servings != null && c.servings > 0">{{ c.servings }} {{ recipe.servingsText }}</span>
<p>
{{ c.comment }}
</p>
</v-card>
</v-timeline-item>
</v-timeline>
</v-col>
</v-row>
</v-container>
</template>
<script lang="ts">
import {defineComponent, PropType} from 'vue'
import {ApiApi, CookLog, Recipe} from "@/openapi";
export default defineComponent({
name: "RecipeActivity",
props: {
recipe: {
type: Object as PropType<Recipe>,
required: true
},
},
data() {
return {
cook_logs: [] as CookLog[]
}
},
mounted() {
const api = new ApiApi()
api.listCookLogs({recipe: this.recipe.id}).then(r => {
// TODO pagination
this.cook_logs = r.results
})
},
})
</script>
<style scoped>
</style>

View File

@@ -65,6 +65,8 @@
<Step :step="s"></Step>
</v-card>
<RecipeActivity :recipe="recipe"></RecipeActivity>
</template>
<script lang="ts">
@@ -76,10 +78,11 @@ import NumberScalerDialog from "@/components/inputs/NumberScalerDialog.vue"
import IngredientsTable from "@/components/display/IngredientsTable.vue";
import StepsOverview from "@/components/display/StepsOverview.vue";
import Step from "@/components/display/Step.vue";
import RecipeActivity from "@/components/display/RecipeActivity.vue";
export default defineComponent({
name: "RecipeView",
components: {Step, StepsOverview, IngredientsTable, NumberScalerDialog, KeywordsBar},
components: {RecipeActivity, Step, StepsOverview, IngredientsTable, NumberScalerDialog, KeywordsBar},
computed: {
},