Skip to content

Commit

Permalink
fix retour review
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianaJM committed Jan 9, 2025
1 parent fa5e838 commit c2c708d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type TransporterAccordionProps = {
disableDown?: boolean;
expanded?: boolean;
children: NonNullable<React.ReactNode>;
deleteLabel: string;
};

/**
Expand All @@ -38,7 +39,8 @@ export function TransporterAccordion({
disableDelete = false,
disableUp = false,
disableDown = false,
children
children,
deleteLabel
}: TransporterAccordionProps) {
const collapseElementId = `transporter__${numero}__form`;

Expand Down Expand Up @@ -82,11 +84,11 @@ export function TransporterAccordion({
priority="tertiary"
iconPosition="right"
iconId="ri-delete-bin-line"
title={disableUp && disableDown ? "Effacer" : "Supprimer"}
title={deleteLabel}
onClick={onTransporterDelete}
disabled={disableDelete}
>
{disableUp && disableDown ? "Effacer" : "Supprimer"}
{deleteLabel}
</Button>
<Button
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ export function TransporterList<TransporterInput extends AnyTransporterInput>({
// Désactive la possibilité de supprimer le transporteur
// s'il est le seul dans la liste ou s'il a déjà pris en charge le déchet
const disableDelete =
hasTakenOver || (transporters.length === 1 && hasTakenOver);
hasTakenOver || (transporters.length === 1 && !t.company?.name);

const deleteLabel =
transporters.length === 1 ? "Effacer" : "Supprimer";

// Désactive le bouton permettant de remonter le transporteur dans
// la liste s'il est le seul ou le premier, ou s'il a déjà pris en
Expand Down Expand Up @@ -160,6 +163,7 @@ export function TransporterList<TransporterInput extends AnyTransporterInput>({
disableUp={disableUp}
disableDown={disableDown}
expanded={idx === expandedIdx}
deleteLabel={deleteLabel}
>
{t.takenOverAt ? (
<TransporterDisplay transporter={t} />
Expand Down

0 comments on commit c2c708d

Please sign in to comment.