Skip to content

Commit 6d6964f

Browse files
authored
🔀 Merge pull request #258 from ajnart/ajnart/issue256
🐛 Allow anything in the input for the form.
2 parents 2a4012f + 5717084 commit 6d6964f

File tree

1 file changed

+61
-65
lines changed

1 file changed

+61
-65
lines changed

src/components/AppShelf/AddAppShelfItem.tsx

+61-65
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,9 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
123123
validate: {
124124
apiKey: () => null,
125125
// Validate icon with a regex
126-
icon: (value: string) => {
127-
// Regex to match everything that ends with and icon extension
128-
if (!value.match(/\.(png|jpg|jpeg|gif|svg)$/)) {
129-
return 'Please enter a valid icon URL';
130-
}
131-
return null;
132-
},
126+
icon: (value: string) =>
127+
// Disable matching to allow any values
128+
null,
133129
// Validate url with a regex http/https
134130
url: (value: string) => {
135131
try {
@@ -298,64 +294,64 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
298294
</>
299295
)}
300296
{form.values.type === 'qBittorrent' && (
301-
<>
302-
<TextInput
303-
required
304-
label="Username"
305-
placeholder="admin"
306-
value={form.values.username}
307-
onChange={(event) => {
308-
form.setFieldValue('username', event.currentTarget.value);
309-
}}
310-
error={form.errors.username && 'Invalid username'}
311-
/>
312-
<TextInput
313-
required
314-
label="Password"
315-
placeholder="adminadmin"
316-
value={form.values.password}
317-
onChange={(event) => {
318-
form.setFieldValue('password', event.currentTarget.value);
319-
}}
320-
error={form.errors.password && 'Invalid password'}
321-
/>
322-
</>
323-
)}
324-
{form.values.type === 'Deluge' && (
325-
<>
326-
<TextInput
327-
label="Password"
328-
placeholder="password"
329-
value={form.values.password}
330-
onChange={(event) => {
331-
form.setFieldValue('password', event.currentTarget.value);
332-
}}
333-
error={form.errors.password && 'Invalid password'}
334-
/>
335-
</>
336-
)}
337-
{form.values.type === 'Transmission' && (
338-
<>
339-
<TextInput
340-
label="Username"
341-
placeholder="admin"
342-
value={form.values.username}
343-
onChange={(event) => {
344-
form.setFieldValue('username', event.currentTarget.value);
345-
}}
346-
error={form.errors.username && 'Invalid username'}
347-
/>
348-
<TextInput
349-
label="Password"
350-
placeholder="adminadmin"
351-
value={form.values.password}
352-
onChange={(event) => {
353-
form.setFieldValue('password', event.currentTarget.value);
354-
}}
355-
error={form.errors.password && 'Invalid password'}
356-
/>
357-
</>
358-
)}
297+
<>
298+
<TextInput
299+
required
300+
label="Username"
301+
placeholder="admin"
302+
value={form.values.username}
303+
onChange={(event) => {
304+
form.setFieldValue('username', event.currentTarget.value);
305+
}}
306+
error={form.errors.username && 'Invalid username'}
307+
/>
308+
<TextInput
309+
required
310+
label="Password"
311+
placeholder="adminadmin"
312+
value={form.values.password}
313+
onChange={(event) => {
314+
form.setFieldValue('password', event.currentTarget.value);
315+
}}
316+
error={form.errors.password && 'Invalid password'}
317+
/>
318+
</>
319+
)}
320+
{form.values.type === 'Deluge' && (
321+
<>
322+
<TextInput
323+
label="Password"
324+
placeholder="password"
325+
value={form.values.password}
326+
onChange={(event) => {
327+
form.setFieldValue('password', event.currentTarget.value);
328+
}}
329+
error={form.errors.password && 'Invalid password'}
330+
/>
331+
</>
332+
)}
333+
{form.values.type === 'Transmission' && (
334+
<>
335+
<TextInput
336+
label="Username"
337+
placeholder="admin"
338+
value={form.values.username}
339+
onChange={(event) => {
340+
form.setFieldValue('username', event.currentTarget.value);
341+
}}
342+
error={form.errors.username && 'Invalid username'}
343+
/>
344+
<TextInput
345+
label="Password"
346+
placeholder="adminadmin"
347+
value={form.values.password}
348+
onChange={(event) => {
349+
form.setFieldValue('password', event.currentTarget.value);
350+
}}
351+
error={form.errors.password && 'Invalid password'}
352+
/>
353+
</>
354+
)}
359355
</Group>
360356
</ScrollArea>
361357
</Tabs.Tab>

0 commit comments

Comments
 (0)