diff --git a/Seasoned.Backend/Controllers/RecipeController.cs b/Seasoned.Backend/Controllers/RecipeController.cs index d2917cc..843efb3 100644 --- a/Seasoned.Backend/Controllers/RecipeController.cs +++ b/Seasoned.Backend/Controllers/RecipeController.cs @@ -63,7 +63,23 @@ public class RecipeController : ControllerBase _context.Recipes.Add(recipe); await _context.SaveChangesAsync(); - return Ok(new { message = "Recipe saved to your collection!" }); + return Ok(new {id = recipe.Id, message = "Recipe saved to your collection!" }); + } + + [HttpGet("{id}")] + [AllowAnonymous] + public async Task> GetRecipe(int id) + { + var recipe = await _context.Recipes + .AsNoTracking() + .FirstOrDefaultAsync(r => r.Id == id); + + if (recipe == null) + { + return NotFound("That recipe seems to have vanished from the archives."); + } + + return Ok(recipe); } [HttpPut("update/{id}")] @@ -123,7 +139,7 @@ public class RecipeController : ControllerBase public async Task>> SearchRecipes([FromQuery] string query) { Console.WriteLine($"--> Search hit! Query: {query}"); - + var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); if (string.IsNullOrWhiteSpace(query)) diff --git a/Seasoned.Frontend/app/assets/css/app-theme.css b/Seasoned.Frontend/app/assets/css/app-theme.css index 027d8b5..6b0e6a6 100644 --- a/Seasoned.Frontend/app/assets/css/app-theme.css +++ b/Seasoned.Frontend/app/assets/css/app-theme.css @@ -287,6 +287,25 @@ html, body { border-radius: 8px !important; } +.public-cta-container { + background: rgba(255, 255, 255, 0.3); + border-radius: 16px; + border: 1px dashed #dccca7; +} + +.cta-title { + font-family: 'Libre Baskerville', serif !important; + color: #2e1e0a; + font-size: 1.8rem; +} + +.cta-text { + font-family: 'Libre Baskerville', serif !important; + color: #5d4a36; + font-size: 1.1rem; + line-height: 1.6; +} + @media print { @page { margin: 0 !important; @@ -308,7 +327,7 @@ html, body { .chat-container, .v-app-bar, .no-print, .separator, .v-divider, .recipe-description, button, .v-btn, .drop-zone, .v-card-actions, .v-btn--variant-text, .v-btn--variant-elevated, - footer, .v-footer, .recipe-actions-row, .share-btn { + footer, .v-footer, .recipe-actions-row, .share-btn, .public-cta-container { display: none !important; visibility: hidden !important; opacity: 0 !important; diff --git a/Seasoned.Frontend/app/components/RecipeDisplay.vue b/Seasoned.Frontend/app/components/RecipeDisplay.vue index 0b1d633..d24de14 100644 --- a/Seasoned.Frontend/app/components/RecipeDisplay.vue +++ b/Seasoned.Frontend/app/components/RecipeDisplay.vue @@ -41,7 +41,7 @@ + +
+ +

Enjoyed this recipe?

+

+ Join Seasoned to scan your own family recipes, + consult with the Chef, and build your digital archive. +

+ + Start Your Collection + +
+
@@ -112,10 +130,14 @@ const printRecipe = () => { } const shareRecipe = async () => { + const shareUrl = props.recipe.id + ? `${window.location.origin}/recipe/${props.recipe.id}` + : window.location.href; + const shareData = { title: props.recipe.title, - text: `Check out this delicious ${props.recipe.title} recipe!`, - url: window.location.href + text: `Check out this delicious ${props.recipe.title} recipe on Seasoned!`, + url: shareUrl } try { @@ -123,7 +145,7 @@ const shareRecipe = async () => { await navigator.share(shareData) triggerShareSuccess() } else { - await navigator.clipboard.writeText(window.location.href) + await navigator.clipboard.writeText(shareUrl) triggerShareSuccess() } } catch (err) { diff --git a/Seasoned.Frontend/app/pages/recipe/[id].vue b/Seasoned.Frontend/app/pages/recipe/[id].vue new file mode 100644 index 0000000..5883867 --- /dev/null +++ b/Seasoned.Frontend/app/pages/recipe/[id].vue @@ -0,0 +1,31 @@ + + + \ No newline at end of file