Skip to content

Commit

Permalink
Merge branch 'main' into 2781-remove-passport-text-in-cart-for-rounds…
Browse files Browse the repository at this point in the history
…-not-using-passport
  • Loading branch information
vacekj authored Jan 10, 2024
2 parents 0f8e53a + 1750385 commit 428ab3f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
12 changes: 10 additions & 2 deletions packages/builder/src/components/base/ProjectForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ function ProjectForm({
setBannerImg(banner);
dispatch(metadataImageSaved(banner, "bannerImgData"));
};

const validate = async () => {
try {
await validateProjectForm(props.formMetaData);
await validateProjectForm({
...props.formMetaData,
website: `https://${props.formMetaData.website}`,
});
setFormValidation({
messages: [],
valid: true,
Expand Down Expand Up @@ -121,6 +123,12 @@ function ProjectForm({
setSubmitted(true);
const valid = await validate();
if (valid) {
dispatch(
metadataSaved({
...props.formMetaData,
website: `https://${props.formMetaData.website}`,
})
);
setVerifying(ProjectFormStatus.Verification);
}
};
Expand Down
19 changes: 9 additions & 10 deletions packages/builder/src/components/grants/inputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,9 @@ export function WebsiteInput({
}: InputProps) {
const styleInfo = getStyleInfoForFeedback(feedback);
const { borderClass, feedbackColor } = styleInfo;

const removeWhiteSpace = (event: React.ChangeEvent<HTMLInputElement>) => {
const validatedEvent = event;
validatedEvent.target.value = `https://${event.target.value.trim()}`;

changeHandler(event);
};

const sanitizedInput = (value as string).replace(/(^\w+:|^)\/\//, "");
const sanitizedInput = (value as string)
.replace(/(^\w+:|^)\/\//, "")
.replaceAll(" ", "");

return (
<div className="mt-6 w-full sm:max-w-md relative">
Expand All @@ -268,9 +262,14 @@ export function WebsiteInput({
id={name}
name={name}
value={sanitizedInput ?? ""}
onKeyDown={(e) => {
if (e.key === " ") {
e.preventDefault();
}
}}
placeholder={placeholder}
disabled={disabled}
onChange={removeWhiteSpace}
onChange={changeHandler}
className={borderClass}
/>
</div>
Expand Down

0 comments on commit 428ab3f

Please sign in to comment.