Skip to content

Commit

Permalink
fix: Handle additional breadcrumb info in SummaryList component
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Feb 8, 2024
1 parent 4547e86 commit d66eb52
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { PASSPORT_REQUESTED_FILES_KEY } from "@planx/components/FileUploadAndLabel/model";

export const mockLink = "my-file.png";
export const uploadedPlanUrl = "http://someurl.com/whjhnh65/plan.png";

Expand All @@ -10,6 +12,11 @@ export const fileUploadBreadcrumbs = {
filename: "my-file.png",
},
],
[PASSPORT_REQUESTED_FILES_KEY]: {
required: ["fileUpload"],
recommended: [],
optional: [],
},
},
},
};
Expand Down Expand Up @@ -44,6 +51,11 @@ export const fileUploadPassport = {
filename: "my-file.png",
},
],
[PASSPORT_REQUESTED_FILES_KEY]: {
required: ["fileUpload"],
recommended: [],
optional: [],
},
},
};

Expand Down Expand Up @@ -88,6 +100,11 @@ export const uploadedPlansBreadcrumb = {
},
],
},
[PASSPORT_REQUESTED_FILES_KEY]: {
required: ["locationPlan"],
recommended: [],
optional: [],
},
},
};

Expand Down Expand Up @@ -124,6 +141,11 @@ export const uploadedPlansPassport = {
url: uploadedPlanUrl,
},
],
[PASSPORT_REQUESTED_FILES_KEY]: {
required: ["locationPlan"],
recommended: [],
optional: [],
},
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { styled } from "@mui/material/styles";
import Typography from "@mui/material/Typography";
import { visuallyHidden } from "@mui/utils";
import { PASSPORT_UPLOAD_KEY } from "@planx/components/DrawBoundary/model";
import { PASSPORT_REQUESTED_FILES_KEY } from "@planx/components/FileUploadAndLabel/model";
import { TYPES } from "@planx/components/types";
import format from "date-fns/format";
import { useAnalyticsTracking } from "pages/FlowEditor/lib/analyticsProvider";
Expand Down Expand Up @@ -493,6 +494,7 @@ function ContactInput(props: ComponentProps) {
function FileUploadAndLabel(props: ComponentProps) {
const userFiles = Object.entries(props?.userData?.data || {});
const allFilenames: string[] = userFiles
.filter(([key]) => key !== PASSPORT_REQUESTED_FILES_KEY)
.map(([_key, value]) => value.map((file: any) => file.filename))
.flat();
const uniqueFilenames = [...new Set(allFilenames)];
Expand Down

0 comments on commit d66eb52

Please sign in to comment.