);
}
if (servizio.status == "already_saved") {
return (
Annuncio già salvato!
);
}
return (
//todo join table annuncioId e userId richieste di sblocco,per mostrare testo se già inviate, stessa funzionalità in pag ricerca con annunci compatibili con questo bottone
//todo email di richiesta di sblocco deve avere un bottone che rimanda alla pagina di richiesta per poterla accettare o rifiutare
//todo paginina di sunto per richiesta con info minime e link a annuncio e utente
);
};
export const InteressatoButton = ({
annuncioId,
}: {
annuncioId: AnnunciId;
}) => {
const { data: hasInterest, isLoading } =
api.intrests.hasUserInterest.useQuery({
annuncioId,
});
const utils = api.useUtils();
const { mutate: add } = api.intrests.addIntrest.useMutation({
onSuccess: async () => {
await utils.intrests.hasUserInterest.invalidate({
annuncioId,
});
toast.success("Richiesta di interesse inviata con successo!");
},
});
if (isLoading || hasInterest === undefined) {
return (
);
}
if (hasInterest) {
return (
Hai già mandato una richiesta
);
}
return (
);
};
export const InteressatoButtonBatchV = ({
annuncioId,
hasInterest,
}: {
annuncioId: AnnunciId;
hasInterest: boolean;
}) => {
const utils = api.useUtils();
const { mutate: add } = api.intrests.addIntrest.useMutation({
onSuccess: async () => {
await utils.intrests.getUserInterests.invalidate();
toast.success("Richiesta di interesse inviata con successo!");
},
});
if (hasInterest) {
return (
Hai già mandato una richiesta
);
}
return (
);
};