This commit is contained in:
Tomas Dvorak
2026-01-26 08:13:18 +01:00
parent aa036b6550
commit dfc079288f
505 changed files with 95755 additions and 5712 deletions
@@ -16,6 +16,7 @@ import {
useColorModeValue,
} from '@chakra-ui/react';
import { Calendar, Image as ImageIcon, ExternalLink, ArrowRight } from 'lucide-react';
import { useTranslation } from 'react-i18next';
interface Album {
id: string;
@@ -35,8 +36,20 @@ const resolveBackendUrl = (path: string) => {
try {
if (/^https?:\/\//i.test(path)) return path;
if (path.startsWith('/cache') || path.startsWith('/uploads') || path.startsWith('/api/')) {
const origin = new URL(API_URL, typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000').origin;
const abs = new URL(path, origin);
// Prefer explicit asset base (backend origin) when provided; fallback to API_URL origin
let origin = '';
try {
const assetBase = (process.env.REACT_APP_ASSET_BASE_URL || '').trim();
if (assetBase) {
origin = new URL(assetBase, typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000').origin;
}
} catch {}
if (!origin) {
try {
origin = new URL(API_URL, typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000').origin;
} catch {}
}
const abs = new URL(path, origin || (typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000'));
return abs.toString();
}
return path;
@@ -46,6 +59,7 @@ const resolveBackendUrl = (path: string) => {
};
const GallerySection: React.FC<{ zoneramaUrl?: string | null }> = ({ zoneramaUrl }) => {
const { t } = useTranslation();
const [albums, setAlbums] = useState<Album[]>([]);
const [loading, setLoading] = useState(true);
const [profileUrl, setProfileUrl] = useState<string | null>(null);
@@ -172,10 +186,10 @@ const GallerySection: React.FC<{ zoneramaUrl?: string | null }> = ({ zoneramaUrl
<HStack justify="space-between" align="center" flexWrap="wrap">
<VStack align="start" spacing={1}>
<Heading size="xl" color={headingColor} id="home-gallery-heading">
Fotogalerie
{t('homepage.gallery')}
</Heading>
<Text color={textColor} fontSize="sm">
Nejnovější alba z našich akcí
{t('gallery.latest_albums')}
</Text>
</VStack>
@@ -187,7 +201,7 @@ const GallerySection: React.FC<{ zoneramaUrl?: string | null }> = ({ zoneramaUrl
variant="outline"
size="md"
>
Zobrazit vše
{t('nav.view_all')}
</Button>
</HStack>
@@ -228,10 +242,9 @@ const GallerySection: React.FC<{ zoneramaUrl?: string | null }> = ({ zoneramaUrl
key={album.id}
as={RouterLink}
to={`/galerie/album/${album.id}`}
className="card"
bg={cardBg}
borderRadius="lg"
overflow="hidden"
boxShadow="md"
transition="all 0.3s"
borderWidth="1px"
borderColor={useColorModeValue('gray.200', 'gray.700')}
@@ -305,7 +318,7 @@ const GallerySection: React.FC<{ zoneramaUrl?: string | null }> = ({ zoneramaUrl
colorScheme="blue"
size="lg"
>
Zobrazit všechna alba
{t('gallery.view_all_albums')}
</Button>
</Box>
</VStack>