included emdash in doc upload validation

This commit is contained in:
2026-02-26 13:04:28 +00:00
parent b39ed0fd8c
commit cfe732f299
6 changed files with 131 additions and 126 deletions
@@ -13,7 +13,7 @@ import {
deleteBlob,
deleteRepBlob,
getFilesFromBlobHashed,
getFilesFromBlobproxy,
getFilesFromBlobproxy
} from "../../../actions";
const LoadingMessage = () => <div>Loading the editor...</div>;
@@ -23,7 +23,7 @@ const ReactQuill = dynamic(
() => import("react-quill-new").then((mod) => mod.default),
{
ssr: false,
loading: () => <LoadingMessage />, // This is valid as long as it's a valid React component
loading: () => <LoadingMessage /> // This is valid as long as it's a valid React component
}
);
import { useDispatch } from "react-redux"; // Import the useDispatch hook
@@ -35,13 +35,13 @@ import {
parseISO,
subDays,
subMonths,
subYears,
subYears
} from "date-fns";
import {
bytesToSize,
getThumbnailIconByExtension,
updateLinks,
updateLinks
} from "../../utils";
import { useRouter } from "next/router";
@@ -537,18 +537,19 @@ export const RenderPickList = ({
? optionsArr[key] == "Questionnaire"
? "Holiadur"
: optionsArr[key] == "Statement"
? "Datganiad"
: optionsArr[key] ==
"Final comments"
? "Sylwadau terfynol"
: optionsArr[key] ==
"Written representations"
? "Sylwadau ysgrifenedig"
: optionsArr[key] == "Inquiry"
? "Ymchwiliad"
: optionsArr[key] == "Hearing"
? "Gwrandawiad"
: optionsArr[key]
? "Datganiad"
: optionsArr[key] ==
"Final comments"
? "Sylwadau terfynol"
: optionsArr[key] ==
"Written representations"
? "Sylwadau ysgrifenedig"
: optionsArr[key] == "Inquiry"
? "Ymchwiliad"
: optionsArr[key] ==
"Hearing"
? "Gwrandawiad"
: optionsArr[key]
: optionsArr[key]}
</option>
);
@@ -627,31 +628,31 @@ export const RenderDatePicker = ({
startDateArr == 0
? new Date()
: startDateArr[0] == "-"
? startDateArr[2] == "y"
? subYears(new Date(), startDateArr[1])
? startDateArr[2] == "y"
? subYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? subMonths(new Date(), startDateArr[1])
: subDays(new Date(), startDateArr[1])
: startDateArr[2] == "y"
? addYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? subMonths(new Date(), startDateArr[1])
: subDays(new Date(), startDateArr[1])
: startDateArr[2] == "y"
? addYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? addMonths(new Date(), startDateArr[1])
: addDays(new Date(), startDateArr[1]);
? addMonths(new Date(), startDateArr[1])
: addDays(new Date(), startDateArr[1]);
var maxDate =
endDateArr == 0
? new Date()
: startDateArr[0] == "-"
? startDateArr[2] == "y"
? subYears(new Date(), startDateArr[1])
? startDateArr[2] == "y"
? subYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? subMonths(new Date(), startDateArr[1])
: subDays(new Date(), startDateArr[1])
: startDateArr[2] == "y"
? addYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? subMonths(new Date(), startDateArr[1])
: subDays(new Date(), startDateArr[1])
: startDateArr[2] == "y"
? addYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? addMonths(new Date(), startDateArr[1])
: addDays(new Date(), startDateArr[1]);
? addMonths(new Date(), startDateArr[1])
: addDays(new Date(), startDateArr[1]);
return (
<>
@@ -739,8 +740,8 @@ export const RenderMultiline = ({
[{ "header": [1, 2, false] }],
["bold", "italic", "underline", "blockquote"],
[{ "list": "ordered" }, { "list": "bullet" }],
["clean"],
],
["clean"]
]
};
return (
@@ -805,8 +806,8 @@ export const RenderRichMultiline = ({
[{ "header": [1, 2, false] }],
["bold", "italic", "underline", "blockquote"],
[{ "list": "ordered" }, { "list": "bullet" }],
["clean"],
],
["clean"]
]
};
return (
@@ -874,19 +875,19 @@ const baseStyle = {
borderStyle: "dashed",
backgroundColor: "#fafafa",
color: "#bdbdbd",
transition: "border .3s ease-in-out",
transition: "border .3s ease-in-out"
};
const activeStyle = {
borderColor: "#2196f3",
borderColor: "#2196f3"
};
const acceptStyle = {
borderColor: "#00e676",
borderColor: "#00e676"
};
const rejectStyle = {
borderColor: "#ff1744",
borderColor: "#ff1744"
};
export const RenderFileUpload = (field) => {
@@ -897,7 +898,7 @@ export const RenderFileUpload = (field) => {
const style = useMemo(
() => ({
...baseStyle,
...baseStyle
// ...(isDragActive ? activeStyle : {}),
// ...(isDragAccept ? acceptStyle : {}),
// ...(isDragReject ? rejectStyle : {}),
@@ -993,7 +994,7 @@ export const RenderFileUpload = (field) => {
typeof filesUploadObj[key].name != "undefined" &&
buildAppealFilesArray.push({
"name": filesUploadObj[key].name,
"size": filesUploadObj[key].size,
"size": filesUploadObj[key].size
});
}
@@ -1087,7 +1088,7 @@ export const RenderFileUpload = (field) => {
setRejectedFiles([]); // Clear any previously rejected file errorsss
};
const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-:()]+$/;
const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-:()]+$/;
const validateFilename = (file, t) => {
const name = file.name;
@@ -1098,7 +1099,7 @@ export const RenderFileUpload = (field) => {
code: "filename-invalid-chars",
message: `${name} ${t(
"myrepresentations:fileupload-file-error-invalid-filename-label"
)}`,
)}`
};
}
@@ -1108,7 +1109,7 @@ export const RenderFileUpload = (field) => {
code: "filename-invalid-chars",
message: `${name} ${t(
"myrepresentations:fileupload-file-error-invalid-filename-label"
)}`,
)}`
};
}
@@ -1118,7 +1119,7 @@ export const RenderFileUpload = (field) => {
code: "filename-invalid-chars",
message: `${name} ${t(
"myrepresentations:fileupload-file-error-invalid-filename-label"
)}`,
)}`
};
}
@@ -1138,7 +1139,7 @@ export const RenderFileUpload = (field) => {
"image/jpeg": [".jpg", ".jpeg"],
"image/png": [".png"],
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
[".xlsx"],
[".xlsx"]
}}
validator={(file) => validateFilename(file, t)}
onDrop={(acceptedFiles, fileRejections, e) => {
@@ -1178,7 +1179,7 @@ export const RenderFileUpload = (field) => {
.values.repfile_name
}_-_Attachment_-_${file.name}`,
{
type: file.type,
type: file.type
}
)
);
@@ -1211,7 +1212,7 @@ export const RenderFileUpload = (field) => {
typeof filesUploadObj[key].name != "undefined" &&
buildAppealFilesArray.push({
"name": filesUploadObj[key].name,
"size": filesUploadObj[key].size,
"size": filesUploadObj[key].size
});
}
@@ -1313,14 +1314,14 @@ export const RenderFileUpload = (field) => {
{uploadCountMessage > 0 && completedUploadFiles == false && (
<div className="govuk-body govuk-!-font-size-14">
{t("home:uploading-files-label", {
number: uploadCountMessage,
number: uploadCountMessage
})}
</div>
)}
{completedUploadFiles > 0 && uploadCountMessage >= 0 && (
<div className="govuk-body govuk-!-font-size-14">
{t("home:completed-uploading-files-label", {
number: uploadCountMessage,
number: uploadCountMessage
})}
</div>
)}
@@ -1449,9 +1450,9 @@ export function FileUploadField(props) {
? props.filenamePrefix.representationForm.values
.repfile_name
: props.filenamePrefix.hasOwnProperty("formObj")
? props.filenamePrefix.formObj["representationForm"]
.values.repfile_name
: ""
? props.filenamePrefix.formObj["representationForm"]
.values.repfile_name
: ""
}
props={props}
/>