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 { import {
Button,
Heading, Heading,
Img, Img,
Link, Link,
@ -40,33 +39,24 @@ const ShareAnnunci = ({ nome, annunci }: ShareAnnunciProps) => {
disponibili. disponibili.
</Text> </Text>
</Row> </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> <Section>
<Text className="font-semibold">Annunci selezionati per te:</Text>
{annunci?.map((annuncio) => ( {annunci?.map((annuncio) => (
<> <>
<Text className="font-semibold">
Annunci selezionati per te:
</Text>
<Section className="mb-7.5" key={annuncio.codice}> <Section className="mb-7.5" key={annuncio.codice}>
<Row className="mb-3"> <Row className="mb-3">
<Img <Img
alt={`Annuncio image - ${annuncio.codice}`} 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" height="140px"
src={`${env.BASE_URL}/storage-api/get/${annuncio.immagine}?media=image`} src={`${env.BASE_URL}/storage-api/get/${annuncio.immagine}?media=image`}
width="100%" width="100%"
/> />
</Row> </Row>
<Row className="block w-full"> <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"> <div className="mb-1 w-fit rounded-md bg-indigo-600 px-2 font-semibold text-sm text-white">
<strong>Codice: </strong> {annuncio.codice} <strong>Codice: {annuncio.codice}</strong>
</div> </div>
<Heading <Heading
as="h2" as="h2"

View file

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

View file

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