Skip to content
This repository was archived by the owner on Apr 19, 2021. It is now read-only.

Commit 53fa89c

Browse files
committed
[index] Also support Bitbucket.org in URL prefix widget
1 parent 00dd988 commit 53fa89c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/components/index/PrefixInput.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,20 +228,24 @@ const Styled = styled.label`
228228
}
229229
`
230230

231-
const errorMessage = 'Please Enter a valid Github or GitLab repo Url!'
231+
const errorMessage = 'Please Enter a valid GitLab, GitHub, or Bitbucket repo URL'
232232

233233
const PrefixInput = () => {
234234
const [url, setUrl] = useState<string>(`https://github.com/gitpod-io/spring-petclinic`)
235235
const [error, setError] = useState<string>('')
236236

237237
const validateUrl = (url: string) => {
238238
const lowerCaseUrl = url.toLowerCase()
239-
if(!(lowerCaseUrl.includes('github.com') || lowerCaseUrl.includes
240-
('gitlab.com'))) {
241-
return false
242-
} else {
243-
return true
239+
if (lowerCaseUrl.includes('github.com')) {
240+
return true;
241+
}
242+
if (lowerCaseUrl.includes('gitlab.com')) {
243+
return true;
244+
}
245+
if (lowerCaseUrl.includes('bitbucket.org')) {
246+
return true;
244247
}
248+
return false;
245249
}
246250

247251
const handleChange = (e: React.FormEvent<HTMLInputElement>) => {
@@ -258,7 +262,7 @@ const PrefixInput = () => {
258262
if(e.key === 'Enter') {
259263
const el = e.target as HTMLInputElement
260264
if(validateUrl(el.value)) {
261-
window.open(`https://gitpod.io#${el.value}`, '_blank')
265+
window.open(`https://gitpod.io/#${el.value}`, '_blank')
262266
setError('')
263267
} else {
264268
setError(errorMessage)

0 commit comments

Comments
 (0)