mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-21 22:13:31 -07:00
fix timecard display
This commit is contained in:
parent
efa0d095b9
commit
7fc9c1a0ec
1 changed files with 22 additions and 7 deletions
|
@ -3,7 +3,7 @@
|
||||||
color="accent"
|
color="accent"
|
||||||
class="custom-transparent d-flex justify-start align-center text-center time-card-flex"
|
class="custom-transparent d-flex justify-start align-center text-center time-card-flex"
|
||||||
tile
|
tile
|
||||||
v-if="totalTime || prepTime || performTime"
|
v-if="showCards"
|
||||||
>
|
>
|
||||||
<v-card flat color="rgb(255, 0, 0, 0.0)">
|
<v-card flat color="rgb(255, 0, 0, 0.0)">
|
||||||
<v-icon large color="white" class="mx-2"> mdi-clock-outline </v-icon>
|
<v-icon large color="white" class="mx-2"> mdi-clock-outline </v-icon>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
flat
|
flat
|
||||||
color="rgb(255, 0, 0, 0.0)"
|
color="rgb(255, 0, 0, 0.0)"
|
||||||
>
|
>
|
||||||
<v-card-text class="white--text py-2">
|
<v-card-text class="caption white--text py-2">
|
||||||
<div>
|
<div>
|
||||||
<strong> {{ time.name }} </strong>
|
<strong> {{ time.name }} </strong>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,30 +33,45 @@ export default {
|
||||||
totalTime: String,
|
totalTime: String,
|
||||||
performTime: String,
|
performTime: String,
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
showCards(val) {
|
||||||
|
console.log(val);
|
||||||
|
},
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
showCards() {
|
||||||
|
return [this.prepTime, this.totalTime, this.performTime].some(
|
||||||
|
x => !this.isEmpty(x)
|
||||||
|
);
|
||||||
|
},
|
||||||
allTimes() {
|
allTimes() {
|
||||||
return [
|
return [
|
||||||
this.validateTotalTime,
|
this.validateTotalTime,
|
||||||
this.validatePrepTime,
|
this.validatePrepTime,
|
||||||
this.validatePerformTime,
|
this.validatePerformTime,
|
||||||
];
|
].filter(x => x !== null);
|
||||||
},
|
},
|
||||||
validateTotalTime() {
|
validateTotalTime() {
|
||||||
return this.prepTime
|
return !this.isEmpty(this.totalTime)
|
||||||
? { name: this.$t("recipe.prep-time"), value: this.prepTime }
|
? { name: this.$t("recipe.total-time"), value: this.totalTime }
|
||||||
: null;
|
: null;
|
||||||
},
|
},
|
||||||
validatePrepTime() {
|
validatePrepTime() {
|
||||||
return this.prepTime
|
return !this.isEmpty(this.prepTime)
|
||||||
? { name: this.$t("recipe.prep-time"), value: this.prepTime }
|
? { name: this.$t("recipe.prep-time"), value: this.prepTime }
|
||||||
: null;
|
: null;
|
||||||
},
|
},
|
||||||
validatePerformTime() {
|
validatePerformTime() {
|
||||||
return this.prepTime
|
return !this.isEmpty(this.performTime)
|
||||||
? { name: this.$t("recipe.perform-time"), value: this.performTime }
|
? { name: this.$t("recipe.perform-time"), value: this.performTime }
|
||||||
: null;
|
: null;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
isEmpty(str) {
|
||||||
|
return !str || str.length === 0;
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue