Skip to content

Commit 32e46a4

Browse files
authored
Merge pull request #115 from autonomous-testing/feat/add-placeholder-for-your-project-on-vibe-component-instead-of-pre-filled-value
feat: add placeholder for empty url input
2 parents fac36c6 + 5c6fc41 commit 32e46a4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/home-page/HomeHeroVibe.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Add an item to cart, complete the purchase, and verify 'Thank you for your order
2929
Wait for page load, accept cookies (if shown), submit form with pre-filled PIN.`,
3030
},
3131
[AppType.YOUR_APPLICATION]: {
32-
url: "https://your-project-url.com",
32+
url: "",
3333
instructions: "Your testing instructions..",
3434
},
3535
};
@@ -38,6 +38,8 @@ const urlList = Object.entries(appTemplates).map(([key, value]) => ({
3838
type: key as AppType,
3939
}));
4040
const defaultTemplate = AppType.E_COMMERCE;
41+
const URL_REGEX =
42+
/^(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
4143

4244
const HomeHeroVibe = () => {
4345
const [appUrl, setAppUrl] = useState(appTemplates[defaultTemplate].url);
@@ -111,6 +113,7 @@ const HomeHeroVibe = () => {
111113
type="url"
112114
value={appUrl}
113115
size={parseSize}
116+
placeholder="https://your-project-url.com"
114117
className="border-none ml-1 pl-2 pr-5 py-1 bg-gray-300 dark:bg-gray-700 rounded-md max-w-[300px] sm:max-w-none"
115118
onChange={handleUrlChange}
116119
/>
@@ -133,7 +136,9 @@ const HomeHeroVibe = () => {
133136
<Button
134137
size="lg"
135138
variant="wopeeFlat"
136-
disabled={testingInstructions.length === 0}
139+
disabled={
140+
testingInstructions.length === 0 || !URL_REGEX.test(appUrl)
141+
}
137142
onClick={() =>
138143
setLoginDialogState({ isOpen: true, mode: "vibe" })
139144
}

0 commit comments

Comments
 (0)