Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/app/screens/Feed/FeedView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default async function FeedView({
feedId={feed.id ?? ''}
/>

<Box sx={{ mt: 2 }}>
<Box sx={{ mt: 1 }}>
<FeedTitle sortedProviders={sortedProviders} feed={feed} />
</Box>

Expand Down
19 changes: 10 additions & 9 deletions src/app/screens/Feed/components/FeedNavigationControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@ export default function FeedNavigationControls({
const t = useTranslations('common');
const router = useRouter();

const handleBack = (): void => {
if (window.history.length > 1) {
router.back();
return;
}
router.push('/feeds');
};

return (
<Grid container spacing={3} alignItems='flex-end'>
<Grid container spacing={3} alignItems='center'>
<Button
sx={{ py: 0 }}
size='large'
startIcon={<ChevronLeft />}
color={'inherit'}
onClick={() => {
if (window.history.length > 1) {
router.back();
} else {
router.push('/feeds');
}
}}
onClick={handleBack}
>
{t('back')}
</Button>
Expand Down
30 changes: 16 additions & 14 deletions src/app/screens/Feed/components/FullMapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ export default function FullMapView({
const isGtfsFeed = feed?.data_type === 'gtfs';
const hasError = !isGtfsFeed || feed == null || boundingBox == null;

const handleExitMap = (): void => {
if (window.history.length > 1) {
router.back();
return;
}

if (feedId != null) {
router.replace(`/feeds/${feed?.data_type ?? 'gtfs'}/${feedId}`);
return;
}

router.replace('/feeds');
};

const errorDetails = useMemo(() => {
const messages: string[] = [];
if (feed == null) {
Expand Down Expand Up @@ -251,13 +265,7 @@ export default function FullMapView({
startIcon={<ChevronLeft />}
color={'inherit'}
sx={{ pl: 0, display: { xs: 'none', md: 'inline-flex' } }}
onClick={() => {
if (!hasError && feedId != null) {
router.push(`/feeds/gtfs/${feedId}`);
} else {
router.push('/');
}
}}
onClick={handleExitMap}
>
{tCommon('back')}
</Button>
Expand Down Expand Up @@ -387,13 +395,7 @@ export default function FullMapView({
size='small'
aria-label={t('fullMapView.aria.close')}
sx={{ position: 'absolute', top: 10, right: 10, zIndex: 1000 }}
onClick={() => {
if (!hasError && feedId != null) {
router.push(`/feeds/${feed?.data_type}/${feedId}`);
} else {
router.push('/');
}
}}
onClick={handleExitMap}
>
<CloseIcon />
</Fab>
Expand Down
Loading