Skip to content

Commit

Permalink
feat: enhance Vinito purchase email with dynamic logo URL
Browse files Browse the repository at this point in the history
  • Loading branch information
franco14lorenzo committed Nov 16, 2024
1 parent 73641fc commit cad275b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
11 changes: 7 additions & 4 deletions src/emails/vinito-purchase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
Text
} from '@react-email/components'

import { formatCurrency } from '@/lib/utils'
import { formatCurrency, getImageUrl } from '@/lib/utils'

interface VinitoPurchaseEmailProps {
customer: {
Expand Down Expand Up @@ -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 (
<Html>
Expand All @@ -82,10 +85,10 @@ export const VinitoPurchaseEmail = ({
<Row>
<Column align="center">
<Img
src={`${baseUrl}/vinito-logo.png`}
src={logoUrl}
width="115"
height="32"
alt="Vinito"
alt="Vinito Logo"
className="mx-auto my-0"
/>
</Column>
Expand Down Expand Up @@ -219,7 +222,7 @@ export const VinitoPurchaseEmail = ({
>
<Column className="w-[70%]">
<Text className="text-sm text-gray-800">
{item.quantity}x {item.name}
{item.name} x {item.quantity}
</Text>
</Column>
<Column align="right">
Expand Down
4 changes: 4 additions & 0 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
}
3 changes: 3 additions & 0 deletions supabase/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
.branches
.temp
.env

#Images Storage
Images
10 changes: 5 additions & 5 deletions supabase/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cad275b

Please sign in to comment.