2022-12-11 15:16:55 -06:00
|
|
|
|
<template>
|
|
|
|
|
<v-tooltip bottom nudge-right="50" :color="buttonStyle ? 'info' : 'secondary'">
|
|
|
|
|
<template #activator="{ on, attrs }">
|
|
|
|
|
<v-btn
|
|
|
|
|
small
|
|
|
|
|
:color="buttonStyle ? 'info' : 'secondary'"
|
|
|
|
|
:fab="buttonStyle"
|
|
|
|
|
class="ml-1"
|
|
|
|
|
v-bind="attrs"
|
|
|
|
|
v-on="on"
|
|
|
|
|
@click.prevent="toggleTimeline"
|
|
|
|
|
>
|
|
|
|
|
<v-icon :small="!buttonStyle" :color="buttonStyle ? 'white' : 'secondary'">
|
|
|
|
|
{{ $globals.icons.timelineText }}
|
|
|
|
|
</v-icon>
|
|
|
|
|
</v-btn>
|
2023-04-25 12:46:00 -05:00
|
|
|
|
<BaseDialog v-model="showTimeline" :title="timelineAttrs.title" :icon="$globals.icons.timelineText" width="70%">
|
|
|
|
|
<RecipeTimeline v-model="showTimeline" :query-filter="timelineAttrs.queryFilter" max-height="70vh" />
|
|
|
|
|
</BaseDialog>
|
|
|
|
|
|
2022-12-11 15:16:55 -06:00
|
|
|
|
</template>
|
|
|
|
|
<span>{{ $t('recipe.open-timeline') }}</span>
|
|
|
|
|
</v-tooltip>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-04-25 12:46:00 -05:00
|
|
|
|
import { computed, defineComponent, ref, useContext } from "@nuxtjs/composition-api";
|
|
|
|
|
import RecipeTimeline from "./RecipeTimeline.vue";
|
2022-12-11 15:16:55 -06:00
|
|
|
|
export default defineComponent({
|
2023-04-25 12:46:00 -05:00
|
|
|
|
components: { RecipeTimeline },
|
2022-12-11 15:16:55 -06:00
|
|
|
|
|
|
|
|
|
props: {
|
|
|
|
|
buttonStyle: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
slug: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: "",
|
|
|
|
|
},
|
|
|
|
|
recipeName: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: "",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
2023-04-25 12:46:00 -05:00
|
|
|
|
setup(props) {
|
|
|
|
|
const { $vuetify, i18n } = useContext();
|
2022-12-11 15:16:55 -06:00
|
|
|
|
const showTimeline = ref(false);
|
|
|
|
|
function toggleTimeline() {
|
|
|
|
|
showTimeline.value = !showTimeline.value;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-25 12:46:00 -05:00
|
|
|
|
const timelineAttrs = computed(() => {
|
|
|
|
|
let title = i18n.tc("recipe.timeline")
|
|
|
|
|
if ($vuetify.breakpoint.smAndDown) {
|
|
|
|
|
title += ` – ${props.recipeName}`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
title,
|
|
|
|
|
queryFilter: `recipe.slug="${props.slug}"`,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return { showTimeline, timelineAttrs, toggleTimeline };
|
2022-12-11 15:16:55 -06:00
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
</script>
|