refactor: remove unused AnnunciInConferma components and clean up form_utils
This commit is contained in:
parent
72a2935797
commit
dacea2481e
2 changed files with 0 additions and 147 deletions
|
|
@ -53,49 +53,6 @@ const DialogServizio = ({
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export const AnnunciInConfermaDialog = ({
|
|
||||||
annunci,
|
|
||||||
}: {
|
|
||||||
annunci: ServizioData["annunci"];
|
|
||||||
}) => {
|
|
||||||
const { servizioId, userId } = useServizio();
|
|
||||||
return (
|
|
||||||
<DialogServizio
|
|
||||||
title="Annunci in conferma"
|
|
||||||
trigger={
|
|
||||||
<div className="relative">
|
|
||||||
<Button
|
|
||||||
className="text-lg"
|
|
||||||
disabled={annunci.length === 0}
|
|
||||||
size="xl"
|
|
||||||
variant="success"
|
|
||||||
>
|
|
||||||
Annunci in conferma
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<span className="-translate-y-1/2 absolute top-0 right-0 flex min-w-6 origin-center translate-x-1/2 items-center justify-center rounded-full bg-destructive px-1 text-white">
|
|
||||||
{annunci.length || 0}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<div className="flex max-h-[80vh] flex-col gap-2 overflow-y-auto">
|
|
||||||
{annunci.map((data) => {
|
|
||||||
return (
|
|
||||||
<ServizioAnnuncioProvider
|
|
||||||
data={data}
|
|
||||||
key={data.id}
|
|
||||||
servizioId={servizioId}
|
|
||||||
userId={userId}
|
|
||||||
>
|
|
||||||
<AnnuncioCard className="border-2 border-green-500" />
|
|
||||||
</ServizioAnnuncioProvider>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</DialogServizio>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const AnnunciSelezionatiDialog = ({
|
export const AnnunciSelezionatiDialog = ({
|
||||||
annunci,
|
annunci,
|
||||||
|
|
@ -156,93 +113,6 @@ export const AnnunciSelezionatiDialog = ({
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AnnunciInConfermaAccordion = ({
|
|
||||||
annunci,
|
|
||||||
}: {
|
|
||||||
annunci: ServizioData["annunci"];
|
|
||||||
}) => {
|
|
||||||
const { servizioId, userId } = useServizio();
|
|
||||||
if (annunci.length === 0) {
|
|
||||||
return null; // If there are no announcements in confirmation, do not render this section
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Accordion collapsible defaultValue="in-conferma" type="single">
|
|
||||||
<AccordionItem className="space-y-4" value="in-conferma">
|
|
||||||
<AccordionTrigger className="rounded-md border-2 border-green-500 bg-muted p-2">
|
|
||||||
Annunci in conferma:
|
|
||||||
</AccordionTrigger>
|
|
||||||
<AccordionContent>
|
|
||||||
<div className="flex flex-col flex-wrap gap-5">
|
|
||||||
{annunci.map((data) => {
|
|
||||||
return (
|
|
||||||
<ServizioAnnuncioProvider
|
|
||||||
data={data}
|
|
||||||
key={data.id}
|
|
||||||
servizioId={servizioId}
|
|
||||||
userId={userId}
|
|
||||||
>
|
|
||||||
<AnnuncioCard className="border-2 border-green-500" />
|
|
||||||
</ServizioAnnuncioProvider>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</AccordionContent>
|
|
||||||
</AccordionItem>
|
|
||||||
</Accordion>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const AnnunciSelezionatiAccordion = ({
|
|
||||||
annunci,
|
|
||||||
}: {
|
|
||||||
annunci: ServizioData["annunci"];
|
|
||||||
}) => {
|
|
||||||
const { servizioId, userId } = useServizio();
|
|
||||||
return (
|
|
||||||
<Accordion collapsible defaultValue="open" type="single">
|
|
||||||
<AccordionItem className="space-y-4" value="open">
|
|
||||||
<AccordionTrigger className="cursor-pointer rounded-md border-2 border-sky-500 bg-muted p-2">
|
|
||||||
Annunci Selezionati:
|
|
||||||
</AccordionTrigger>
|
|
||||||
<AccordionContent>
|
|
||||||
<div className="flex flex-col flex-wrap gap-5">
|
|
||||||
{annunci.length > 0 ? (
|
|
||||||
annunci.map((data) => {
|
|
||||||
return (
|
|
||||||
<ServizioAnnuncioProvider
|
|
||||||
data={data}
|
|
||||||
key={data.id}
|
|
||||||
servizioId={servizioId}
|
|
||||||
userId={userId}
|
|
||||||
>
|
|
||||||
<AnnuncioCard className="border-2 border-sky-500" />
|
|
||||||
</ServizioAnnuncioProvider>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
) : (
|
|
||||||
<div className="flex items-center justify-center gap-1 rounded-md bg-muted p-4 sm:flex">
|
|
||||||
<span>
|
|
||||||
Nessun annuncio selezionato, fai una ricerca nella pagina{" "}
|
|
||||||
<Link
|
|
||||||
aria-label="Annunci Compatibili"
|
|
||||||
className="inline-flex items-center gap-1 text-blue-500 underline"
|
|
||||||
href="/annunci"
|
|
||||||
>
|
|
||||||
Annunci
|
|
||||||
<ExternalLink className="size-4" />
|
|
||||||
</Link>{" "}
|
|
||||||
o tra gli annunci compatibili qui sotto.
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</AccordionContent>
|
|
||||||
</AccordionItem>
|
|
||||||
</Accordion>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const AnnunciRichiesti = ({ userId }: { userId: UsersId }) => {
|
export const AnnunciRichiesti = ({ userId }: { userId: UsersId }) => {
|
||||||
const { data, isLoading } = api.intrests.getUserInterestsAnnunci.useQuery({
|
const { data, isLoading } = api.intrests.getUserInterestsAnnunci.useQuery({
|
||||||
userId,
|
userId,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import type { ChangeEvent } from "react";
|
import type { ChangeEvent } from "react";
|
||||||
import type { z } from "zod/v4";
|
import type { z } from "zod/v4";
|
||||||
import type { ListOption } from "~/components/custom_ui/multiselect";
|
|
||||||
import type { Comuni } from "~/schemas/public/Comuni";
|
import type { Comuni } from "~/schemas/public/Comuni";
|
||||||
import type { Nazioni } from "~/schemas/public/Nazioni";
|
import type { Nazioni } from "~/schemas/public/Nazioni";
|
||||||
import { ITALY_CATASTO_CODE } from "./catasto";
|
import { ITALY_CATASTO_CODE } from "./catasto";
|
||||||
|
|
@ -22,22 +21,6 @@ export const FormDebug: React.ElementType =
|
||||||
)
|
)
|
||||||
: () => null; // Return null component in production
|
: () => null; // Return null component in production
|
||||||
|
|
||||||
export const getComuneFieldValue = (
|
|
||||||
fieldValue: string,
|
|
||||||
comuni_options: string[],
|
|
||||||
): ListOption | undefined => {
|
|
||||||
if (fieldValue !== "") {
|
|
||||||
const num = parseInt(fieldValue);
|
|
||||||
if (num <= comuni_options.length) {
|
|
||||||
return {
|
|
||||||
label: String(comuni_options[num as keyof typeof comuni_options]),
|
|
||||||
value: String(num),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getInizialiCF = (stringa: string) => {
|
const getInizialiCF = (stringa: string) => {
|
||||||
const vocali = ["A", "E", "I", "O", "U"];
|
const vocali = ["A", "E", "I", "O", "U"];
|
||||||
let iniziali = "";
|
let iniziali = "";
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue