fix(frontend): fix various typo, capfirst, use a grid for home page
All checks were successful
Deploy Amap / deploy (push) Successful in 42s

This commit is contained in:
Julien Aldon
2026-04-17 11:38:33 +02:00
parent 7e3cf6de9d
commit 4b57b29b34
6 changed files with 27 additions and 25 deletions

View File

@@ -123,7 +123,7 @@
"minimum shipment value": "minimum shipment value (€)", "minimum shipment value": "minimum shipment value (€)",
"name": "name", "name": "name",
"nothing found": "nothing to display", "nothing found": "nothing to display",
"number of cheques between 1 and 3 cheques also enter your cheques identifiers, value is calculated automatically": "number of cheques between 1 and 3. Also enter cheque identifiers.", "number of cheques between 1 and 3 cheques also enter your cheques identifiers, value is calculated automatically": "number of cheques between 1 and {{max}}. Also enter cheque identifiers.",
"number of shipment": "number of shipments", "number of shipment": "number of shipments",
"occasional": "occasional", "occasional": "occasional",
"occasional product": "occasional product", "occasional product": "occasional product",

View File

@@ -123,7 +123,7 @@
"minimum shipment value": "valeur minimum d'une livraison (€)", "minimum shipment value": "valeur minimum d'une livraison (€)",
"name": "nom", "name": "nom",
"nothing found": "rien à afficher", "nothing found": "rien à afficher",
"number of cheques between 1 and 3 cheques also enter your cheques identifiers, value is calculated automatically": "nombre de chèques entre 1 et 3, entrez également les identifiants des chèques utilisés.", "number of cheques between 1 and 3 cheques also enter your cheques identifiers, value is calculated automatically": "nombre de chèques entre 1 et {{max}}, entrez également les identifiants des chèques utilisés.",
"number of shipment": "nombre de livraisons", "number of shipment": "nombre de livraisons",
"occasional": "occasionnel", "occasional": "occasionnel",
"occasional product": "produit occasionnel", "occasional product": "produit occasionnel",

View File

@@ -12,12 +12,12 @@ export type FormCardProps = {
export function FormCard({ form }: FormCardProps) { export function FormCard({ form }: FormCardProps) {
const contractBaseTemplate = useGetContractFileTemplate(); const contractBaseTemplate = useGetContractFileTemplate();
return ( return (
<Paper shadow="xl" p="xl" miw={{ base: "100vw", md: "25vw", lg: "20vw" }}> <Paper shadow="xl" p="xl">
<Group justify="start" mb="md"> <Group justify="start" mb="md">
<Tooltip label={t("download base template to print")}> <Tooltip label={t("download base template to print", {capfirst: true})}>
<ActionIcon <ActionIcon
variant={"outline"} variant={"outline"}
aria-label={t("download base template to print")} aria-label={t("download base template to print", {capfirst: true})}
onClick={async () => { onClick={async () => {
await contractBaseTemplate.mutateAsync(form.id); await contractBaseTemplate.mutateAsync(form.id);
}} }}
@@ -25,10 +25,10 @@ export function FormCard({ form }: FormCardProps) {
<IconDownload /> <IconDownload />
</ActionIcon> </ActionIcon>
</Tooltip> </Tooltip>
<Tooltip label={t("fill contract online")}> <Tooltip label={t("fill contract online", {capfirst: true})}>
<ActionIcon <ActionIcon
variant={"outline"} variant={"outline"}
aria-label={t("fill contract online")} aria-label={t("fill contract online", {capfirst: true})}
component={Link} component={Link}
to={`/form/${form.id}`} to={`/form/${form.id}`}
target="_blank" target="_blank"

View File

@@ -46,20 +46,24 @@ export function ContractCheque({ inputForm, price, productor }: ContractChequePr
return productor?.payment_methods.find((el) => el.name === "cheque"); return productor?.payment_methods.find((el) => el.name === "cheque");
}, [productor]); }, [productor]);
const maxCheques = useMemo(() => {
return paymentMethod?.max && paymentMethod?.max !== "" ? Number(paymentMethod?.max) : 3
}, [paymentMethod])
return ( return (
<Stack> <Stack>
<Title order={4}>{`${t("order name")} : ${paymentMethod?.details}`}</Title> <Title order={4}>{`${t("order name", {capfirst: true})} : ${paymentMethod?.details}`}</Title>
<NumberInput <NumberInput
clampBehavior="strict"
label={t("cheque quantity", { capfirst: true })} label={t("cheque quantity", { capfirst: true })}
placeholder={t("enter cheque quantity", { capfirst: true })} placeholder={t("enter cheque quantity", { capfirst: true })}
description={t( description={t(
"number of cheques between 1 and 3 cheques also enter your cheques identifiers, value is calculated automatically", "number of cheques between 1 and 3 cheques also enter your cheques identifiers, value is calculated automatically",
{ capfirst: true }, { capfirst: true, max: maxCheques },
)} )}
min={1} min={1}
max={ max={maxCheques}
paymentMethod?.max && paymentMethod?.max !== "" ? Number(paymentMethod?.max) : 3
}
{...inputForm.getInputProps(`cheque_quantity`)} {...inputForm.getInputProps(`cheque_quantity`)}
/> />
<Group grow> <Group grow>

View File

@@ -107,7 +107,7 @@ export default function Contracts() {
</Tooltip> </Tooltip>
<Tooltip label={t("download recap", { capfirst: true })}> <Tooltip label={t("download recap", { capfirst: true })}>
<ActionIcon <ActionIcon
disabled={false} disabled={true}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
navigate( navigate(

View File

@@ -1,4 +1,4 @@
import { Flex, Stack, Text } from "@mantine/core"; import { SimpleGrid, Text } from "@mantine/core";
import { useGetForms } from "@/services/api"; import { useGetForms } from "@/services/api";
import { FormCard } from "@/components/Forms/Card"; import { FormCard } from "@/components/Forms/Card";
import type { Form } from "@/services/resources/forms"; import type { Form } from "@/services/resources/forms";
@@ -33,8 +33,7 @@ export function Home() {
}, [searchParams]); }, [searchParams]);
return ( return (
<Stack mt="lg"> <SimpleGrid m="lg" cols={{base: 1, md: 3, sm: 2}} spacing="md">
<Flex gap="md" wrap="wrap" justify="center">
{allForms && allForms?.length > 0 ? ( {allForms && allForms?.length > 0 ? (
allForms.map((form: Form) => <FormCard form={form} key={form.id} />) allForms.map((form: Form) => <FormCard form={form} key={form.id} />)
) : ( ) : (
@@ -42,7 +41,6 @@ export function Home() {
{t("there is no contract for now", { capfirst: true })} {t("there is no contract for now", { capfirst: true })}
</Text> </Text>
)} )}
</Flex> </SimpleGrid>
</Stack>
); );
} }