fix: remove unused button and improve layout in ShareAnnunci email template

fix: clear selected listings and email state on successful email send
fix: add logging for annunci data in comunicazioni router
This commit is contained in:
Marco Pedone 2026-01-27 16:47:02 +01:00
parent 95315e6605
commit efb28a96e7
3 changed files with 8 additions and 18 deletions

View file

@ -1,5 +1,4 @@
import {
Button,
Heading,
Img,
Link,
@ -40,33 +39,24 @@ const ShareAnnunci = ({ nome, annunci }: ShareAnnunciProps) => {
disponibili.
</Text>
</Row>
<Section className="mb-5">
<Button
className="mx-auto box-border inline-flex h-10 items-center justify-center whitespace-nowrap rounded-md bg-neutral-100 px-4 py-2 text-center align-middle font-semibold text-neutral-900"
href={`${env.BASE_URL}`}
>
Vai al Sito
</Button>
</Section>
<Section>
<Text className="font-semibold">Annunci selezionati per te:</Text>
{annunci?.map((annuncio) => (
<>
<Text className="font-semibold">
Annunci selezionati per te:
</Text>
<Section className="mb-7.5" key={annuncio.codice}>
<Row className="mb-3">
<Img
alt={`Annuncio image - ${annuncio.codice}`}
className="block w-60 rounded-lg object-cover object-center"
className="block w-60 rounded-md object-cover object-center"
height="140px"
src={`${env.BASE_URL}/storage-api/get/${annuncio.immagine}?media=image`}
width="100%"
/>
</Row>
<Row className="block w-full">
<div className="mb-1.25 flex h-6 w-fit items-center justify-center gap-1 rounded-full bg-indigo-600 px-2 font-semibold text-[12px] text-white leading-0">
<strong>Codice: </strong> {annuncio.codice}
<div className="mb-1 w-fit rounded-md bg-indigo-600 px-2 font-semibold text-sm text-white">
<strong>Codice: {annuncio.codice}</strong>
</div>
<Heading
as="h2"

View file

@ -79,8 +79,8 @@ const SendEmailSection = () => {
const { mutate } = api.comunicazioni.sendAnnunciEmail.useMutation({
onSuccess: () => {
setSelectedAnnunci([]);
setEmail("");
// setSelectedAnnunci([]);
// setEmail("");
toast.success("Email inviata con successo");
},
onError: (error) => {

View file

@ -117,7 +117,7 @@ export const comunicazioniRouter = createTRPCRouter({
.where("images_refs.ordine", "=", 0)
.where("annunci.id", "in", input.annunci)
.execute();
console.log(annunci);
await NewMail({
template: {
mailType: "shareAnnunci",