From cad275b2eccd3665d0158cfe6e0a7f3c248f478b Mon Sep 17 00:00:00 2001 From: Franco Lorenzo Date: Fri, 15 Nov 2024 23:04:01 -0300 Subject: [PATCH] feat: enhance Vinito purchase email with dynamic logo URL --- src/emails/vinito-purchase.tsx | 11 +++++++---- src/lib/utils.ts | 4 ++++ supabase/.gitignore | 3 +++ supabase/config.toml | 10 +++++----- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/emails/vinito-purchase.tsx b/src/emails/vinito-purchase.tsx index d40ef0d..bcaffae 100644 --- a/src/emails/vinito-purchase.tsx +++ b/src/emails/vinito-purchase.tsx @@ -16,7 +16,7 @@ import { Text } from '@react-email/components' -import { formatCurrency } from '@/lib/utils' +import { formatCurrency, getImageUrl } from '@/lib/utils' interface VinitoPurchaseEmailProps { customer: { @@ -70,6 +70,9 @@ export const VinitoPurchaseEmail = ({ settings }: VinitoPurchaseEmailProps) => { const previewText = `Vinito - ConfirmaciĆ³n de Pedido ${orderNumber}` + const logoUrl = getImageUrl( + '/storage/v1/object/public/images/vinito-logo.png' + ) return ( @@ -82,10 +85,10 @@ export const VinitoPurchaseEmail = ({ Vinito @@ -219,7 +222,7 @@ export const VinitoPurchaseEmail = ({ > - {item.quantity}x {item.name} + {item.name} x {item.quantity} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 465b47e..e29a1d5 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -24,3 +24,7 @@ export function formatCurrency(value: number | undefined) { ? value.toLocaleString('es-AR', { style: 'currency', currency: 'ARS' }) : '$0,00' } + +export function getImageUrl(image: string) { + return `${process.env.NEXT_PUBLIC_SUPABASE_URL}${image}` +} diff --git a/supabase/.gitignore b/supabase/.gitignore index a3ad880..d10a034 100644 --- a/supabase/.gitignore +++ b/supabase/.gitignore @@ -2,3 +2,6 @@ .branches .temp .env + +#Images Storage +Images diff --git a/supabase/config.toml b/supabase/config.toml index a990167..58ca5e7 100644 --- a/supabase/config.toml +++ b/supabase/config.toml @@ -74,11 +74,11 @@ file_size_limit = "50MiB" enabled = true # Uncomment to configure local storage buckets -# [storage.buckets.images] -# public = false -# file_size_limit = "50MiB" -# allowed_mime_types = ["image/png", "image/jpeg"] -# objects_path = "./images" + [storage.buckets.images] +public = true +file_size_limit = "50MiB" +allowed_mime_types = ["image/png", "image/jpeg"] +objects_path = "./images" [auth] enabled = true