Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web-app/src/app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ export default function DrawerAppBar(): React.ReactElement {
void i18n.changeLanguage(lang.target.value);
}}
variant='standard'
inputProps={{ 'aria-label': 'language select' }}
>
<MenuItem value={'en'}>EN</MenuItem>
<MenuItem value={'fr'}>FR</MenuItem>
Expand Down
56 changes: 43 additions & 13 deletions web-app/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
FormControlLabel,
Checkbox,
useTheme,
Link,
Container,
FormControl,
MenuItem,
Expand All @@ -16,6 +15,7 @@
} from '@mui/material';
import SearchIcon from '@mui/icons-material/Search';
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';

enum AuthTypeEnum {
BASIC = 'Basic Auth',
Expand All @@ -26,6 +26,7 @@

export default function GbfsFeedSearchInput(): React.ReactElement {
const theme = useTheme();
const navigate = useNavigate();
const [autoDiscoveryUrlInput, setAutoDiscoveryUrlInput] =
useState<string>('');
const [requiresAuth, setRequiresAuth] = useState(false);
Expand Down Expand Up @@ -81,13 +82,21 @@
// navigate to /gbfs-validator?AutoDiscoveryUrl=url&auth details
// store the auth details in context
// let the GbfsValidator component handle the loading state
console.log('Validating GBFS Feed for URL: ', autoDiscoveryUrlInput);

Check warning on line 85 in web-app/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx

View workflow job for this annotation

GitHub Actions / deploy-web-app / Test

Unexpected console statement
// I'm sure if a query param exists, instead of navigation, we will update the param, and have a useEffect to call the new feed to validate
navigate(
`/gbfs-validator?AutoDiscoveryUrl=${encodeURIComponent(
autoDiscoveryUrlInput,
)}`,
);
};

return (
<Box
id='input-box'
sx={{
padding: 2,
pt: 3,
marginTop: 2,
backgroundColor: theme.palette.background.default,
border: '3px solid ' + theme.palette.text.primary,
Expand All @@ -106,6 +115,7 @@
>
<TextField
variant='outlined'
label='GBFS Auto-Discovery URL'
placeholder='eg: https://example.com/gbfs.json'
sx={{ width: '100%', mr: 2 }}
onChange={(e) => {
Expand All @@ -119,13 +129,10 @@
variant='contained'
color='primary'
sx={{ p: '12px' }}
component={Link}
href={`/gbfs-validator?AutoDiscoveryUrl=${encodeURIComponent(
autoDiscoveryUrlInput,
)}`}
disabled={isSubmitBoxDisabled()}
type='submit'
onClick={() => {
onClick={(e) => {
e.preventDefault();
validateGBFSFeed();
}}
>
Expand All @@ -134,6 +141,7 @@
</Container>
<FormGroup>
<FormControlLabel
sx={{ width: 'fit-content' }}
control={<Checkbox checked={requiresAuth} onChange={handleChange} />}
label='Requires Authentication'
/>
Expand All @@ -143,7 +151,7 @@
value={authType}
onChange={handleAuthTypeChange}
displayEmpty
inputProps={{ 'aria-label': 'Without label' }}
inputProps={{ 'aria-label': 'authentication type select' }}
>
<MenuItem value={''}>
<em>Select Authentication Type</em>
Expand All @@ -158,7 +166,14 @@
)}

{requiresAuth && authType === AuthTypeEnum.BASIC && (
<Box sx={{ display: 'flex', gap: 2, mt: 2 }}>
<Box
sx={{
display: 'flex',
gap: 2,
mt: 2,
flexWrap: { xs: 'wrap', md: 'nowrap' },
}}
>
<TextField
size='small'
variant='outlined'
Expand Down Expand Up @@ -198,7 +213,14 @@
)}

{requiresAuth && authType === AuthTypeEnum.OAUTH && (
<Box sx={{ display: 'flex', gap: 2, mt: 2 }}>
<Box
sx={{
display: 'flex',
gap: 2,
mt: 2,
flexWrap: { xs: 'wrap', md: 'nowrap' },
}}
>
<TextField
size='small'
variant='outlined'
Expand Down Expand Up @@ -232,11 +254,19 @@
</Box>
)}
</FormGroup>
<Box id='cta-buttons' sx={{ display: 'flex', gap: 2, mt: 2 }}>
<Button variant='text' color='primary'>
Broswe GBFS Feeds
<Box
id='cta-buttons'
sx={{
display: 'flex',
gap: { xs: 0, md: 2 },
mt: 2,
flexWrap: { xs: 'wrap', md: 'nowrap' },
}}
>
<Button variant='text' color='primary' href='/feeds?gbfs=true'>
Browse GBFS Feeds
</Button>
<Button variant='text' color='primary' endIcon={<OpenInNew />}>
<Button variant='text' color='primary' href='/' endIcon={<OpenInNew />}>
View GBFS Validator API Docs
</Button>
</Box>
Expand Down
Loading
Loading