mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 18:52:56 +00:00
dev day #100 - WE ARE FUCKING DONE, hotfixes incoming but we did it in 100 days, lets fucking go guys, anyone reading this...i love you
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { API_URL } from '../../services/api';
|
||||
import { getZoneramaManifestWithFallbacks } from '../../services/zonerama';
|
||||
import { Link as RouterLink } from 'react-router-dom';
|
||||
import {
|
||||
Box,
|
||||
@@ -93,6 +94,29 @@ const GallerySection: React.FC<{ zoneramaUrl?: string | null }> = ({ zoneramaUrl
|
||||
|
||||
combinedAlbums = [...combinedAlbums, ...validBlogAlbums];
|
||||
}
|
||||
|
||||
// Fallback: synthesize albums from manifest/picks when both sources are empty or invalid
|
||||
if ((!combinedAlbums || combinedAlbums.length === 0)) {
|
||||
try {
|
||||
const items = await getZoneramaManifestWithFallbacks();
|
||||
if (Array.isArray(items) && items.length > 0) {
|
||||
const byAlbum: Record<string, typeof items> = {} as any;
|
||||
items.forEach((it) => {
|
||||
const aid = String(it.album_id || 'unknown');
|
||||
(byAlbum[aid] = byAlbum[aid] || []).push(it);
|
||||
});
|
||||
const synthesized: Album[] = Object.entries(byAlbum).map(([aid, arr]) => ({
|
||||
id: aid,
|
||||
title: 'Album',
|
||||
url: (arr[0] as any).page_url || '#',
|
||||
date: '',
|
||||
photos_count: arr.length,
|
||||
photos: arr.slice(0, 12).map((p: any) => ({ id: String(p.id || ''), page_url: String(p.page_url || ''), image_1500: String(p.src || p.local || '') })),
|
||||
}));
|
||||
combinedAlbums = synthesized;
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
// Sort by date (newest first)
|
||||
combinedAlbums.sort((a, b) => {
|
||||
|
||||
Reference in New Issue
Block a user