diff --git a/README.md b/README.md index 4973173..1e9c8aa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Chef's Meal Planner -![header image](https://socialify.git.ci/rjnemo/meal_planner/image?description=1&font=Raleway&language=1&logo=https%3A%2F%2Fchefs-meal-planner.onrender.com%2Flogo192.png&owner=1&pattern=Diagonal%20Stripes&stargazers=1&theme=Dark) +![header image](https://socialify.git.ci/rjnemo/meal_planner/image?description=1&font=Raleway&language=1&logo=https%3A%2F%2Fmood2food.netlify.app%2Flogo192.png&owner=1&pattern=Diagonal%20Stripes&stargazers=1&theme=Dark) ![license](https://img.shields.io/github/license/rjNemo/meal_planner?style=for-the-badge) ![release tag](https://img.shields.io/github/v/release/rjNemo/meal_planner?style=for-the-badge) diff --git a/components/recipe/view.vue b/components/recipe/view.vue index 56c9d4c..4630118 100644 --- a/components/recipe/view.vue +++ b/components/recipe/view.vue @@ -2,6 +2,25 @@ import type { Recipe } from "~/types/recipe"; defineProps<{ recipe: Recipe }>(); + +const shareRecipe = async (recipe: Recipe) => { + const url = + useRequestURL().href.split("/").slice(0, -1).join("/") + "/" + recipe.id; + + if (navigator.share) { + try { + await navigator.share({ + title: recipe.title, + text: `Check out this recipe: ${recipe.title}`, + url, + }); + } catch (error) { + alert("Failed to share the recipe."); + } + } else { + alert("Sharing not supported on this device."); + } +};