Remove gallery route padding
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { createBrowserRouter, useParams, Link, Navigate } from 'react-router-dom';
|
import { createBrowserRouter, useLocation, useParams, Link, Navigate } from 'react-router-dom';
|
||||||
import Header from './components/Header';
|
import Header from './components/Header';
|
||||||
import BottomNav from './components/BottomNav';
|
import BottomNav from './components/BottomNav';
|
||||||
import RouteTransition from './components/RouteTransition';
|
import RouteTransition from './components/RouteTransition';
|
||||||
@@ -101,6 +101,7 @@ export const router = createBrowserRouter([
|
|||||||
function EventBoundary({ token }: { token: string }) {
|
function EventBoundary({ token }: { token: string }) {
|
||||||
const identity = useOptionalGuestIdentity();
|
const identity = useOptionalGuestIdentity();
|
||||||
const { event, status, error, errorCode } = useEventData();
|
const { event, status, error, errorCode } = useEventData();
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
if (status === 'loading') {
|
if (status === 'loading') {
|
||||||
return <EventLoadingView />;
|
return <EventLoadingView />;
|
||||||
@@ -118,6 +119,9 @@ function EventBoundary({ token }: { token: string }) {
|
|||||||
const localeStorageKey = `guestLocale_event_${event.id ?? token}`;
|
const localeStorageKey = `guestLocale_event_${event.id ?? token}`;
|
||||||
const branding = mapEventBranding(event.branding ?? (event as any)?.settings?.branding ?? null);
|
const branding = mapEventBranding(event.branding ?? (event as any)?.settings?.branding ?? null);
|
||||||
|
|
||||||
|
const isGalleryRoute = /^\/e\/[^/]+\/gallery(?:\/|$)/.test(location.pathname);
|
||||||
|
const contentPaddingClass = isGalleryRoute ? 'px-0 py-0' : 'px-4 py-3';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LocaleProvider defaultLocale={eventLocale} storageKey={localeStorageKey}>
|
<LocaleProvider defaultLocale={eventLocale} storageKey={localeStorageKey}>
|
||||||
<EventBrandingProvider branding={branding}>
|
<EventBrandingProvider branding={branding}>
|
||||||
@@ -125,7 +129,7 @@ function EventBoundary({ token }: { token: string }) {
|
|||||||
<NotificationCenterProvider eventToken={token}>
|
<NotificationCenterProvider eventToken={token}>
|
||||||
<div className="pb-16">
|
<div className="pb-16">
|
||||||
<Header eventToken={token} />
|
<Header eventToken={token} />
|
||||||
<div className="px-4 py-3">
|
<div className={contentPaddingClass}>
|
||||||
<RouteTransition />
|
<RouteTransition />
|
||||||
</div>
|
</div>
|
||||||
<BottomNav />
|
<BottomNav />
|
||||||
|
|||||||
Reference in New Issue
Block a user