mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	* Activate more linting rules from eslint and typescript * Properly add VForm as type information * Fix usage of native types * Fix more linting issues * Rename vuetify types file, add VTooltip * Fix some more typing problems * Use composition API for more components * Convert RecipeRating * Convert RecipeNutrition * Convert more components to composition API * Fix globals plugin for type checking * Add missing icon types * Fix vuetify types in Nuxt context * Use composition API for RecipeActionMenu * Convert error.vue to composition API * Convert RecipeContextMenu to composition API * Use more composition API and type checking in recipe/create * Convert AppButtonUpload to composition API * Fix some type checking in RecipeContextMenu * Remove unused components BaseAutoForm and BaseColorPicker * Convert RecipeCategoryTagDialog to composition API * Convert RecipeCardSection to composition API * Convert RecipeCategoryTagSelector to composition API * Properly import vuetify type definitions * Convert BaseButton to composition API * Convert AutoForm to composition API * Remove unused requests API file * Remove static routes from recipe API * Fix more type errors * Convert AppHeader to composition API, fixing some search bar focus problems * Convert RecipeDialogSearch to composition API * Update API types from pydantic models, handle undefined values * Improve more typing problems * Add types to other plugins * Properly type the CRUD API access * Fix typing of static image routes * Fix more typing stuff * Fix some more typing problems * Turn off more rules
		
			
				
	
	
		
			74 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <div>
 | |
|     <v-chip v-for="(time, index) in allTimes" :key="index" label color="accent custom-transparent" class="ma-1">
 | |
|       <v-icon left>
 | |
|         {{ $globals.icons.clockOutline }}
 | |
|       </v-icon>
 | |
|       {{ time.name }} |
 | |
|       {{ time.value }}
 | |
|     </v-chip>
 | |
|   </div>
 | |
| </template>
 | |
| 
 | |
| <script lang="ts">
 | |
| import { computed, defineComponent, useContext } from "@nuxtjs/composition-api";
 | |
| 
 | |
| export default defineComponent({
 | |
|   props: {
 | |
|     prepTime: {
 | |
|       type: String,
 | |
|       default: null,
 | |
|     },
 | |
|     totalTime: {
 | |
|       type: String,
 | |
|       default: null,
 | |
|     },
 | |
|     performTime: {
 | |
|       type: String,
 | |
|       default: null,
 | |
|     },
 | |
|   },
 | |
|   setup(props) {
 | |
|     const { i18n } = useContext();
 | |
| 
 | |
|     function isEmpty(str: string | null) {
 | |
|       return !str || str.length === 0;
 | |
|     }
 | |
| 
 | |
|     const showCards = computed(() => {
 | |
|       return [props.prepTime, props.totalTime, props.performTime].some((x) => !isEmpty(x));
 | |
|     });
 | |
| 
 | |
|     const validateTotalTime = computed(() => {
 | |
|       return !isEmpty(props.totalTime) ? { name: i18n.t("recipe.total-time"), value: props.totalTime } : null;
 | |
|     });
 | |
| 
 | |
|     const validatePrepTime = computed(() => {
 | |
|       return !isEmpty(props.prepTime) ? { name: i18n.t("recipe.prep-time"), value: props.prepTime } : null;
 | |
|     });
 | |
| 
 | |
|     const validatePerformTime = computed(() => {
 | |
|       return !isEmpty(props.performTime) ? { name: i18n.t("recipe.perform-time"), value: props.performTime } : null;
 | |
|     });
 | |
| 
 | |
|     const allTimes = computed(() => {
 | |
|       return [validateTotalTime.value, validatePrepTime.value, validatePerformTime.value].filter((x) => x !== null);
 | |
|     });
 | |
| 
 | |
|     return {
 | |
|       showCards,
 | |
|       allTimes,
 | |
|     }
 | |
|   },
 | |
| });
 | |
| </script>
 | |
| 
 | |
| <style scoped>
 | |
| .time-card-flex {
 | |
|   width: fit-content;
 | |
| }
 | |
| .custom-transparent {
 | |
|   opacity: 0.7;
 | |
| }
 | |
| </style>
 |