mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 02:32:57 +00:00
fix update
This commit is contained in:
@@ -214,7 +214,7 @@ const MobileMenu = ({ isOpen, onClose, isAdmin, isAuthenticated, menuBg, divider
|
||||
<Button as={RouterLink} to="/hraci" variant="ghost" justifyContent="flex-start">{t('nav.players')}</Button>
|
||||
)}
|
||||
{hasTables && (
|
||||
<Button as={RouterLink} to="/tabulky" variant="ghost" justifyContent="flex-start">{t('nav.tables')}</Button>
|
||||
<Button as={RouterLink} to="/tabulky" variant="ghost" justifyContent="flex-start">{t('nav.table')}</Button>
|
||||
)}
|
||||
{Array.isArray(settings?.custom_nav) && settings.custom_nav.length > 0 && settings.custom_nav.map((item: any, idx: number) => {
|
||||
const customLinkIsExternal = typeof item?.url === 'string' && /^https?:\/\//i.test(item.url);
|
||||
@@ -595,7 +595,7 @@ const Navbar: React.FC<{ fullWidth?: boolean; variant?: string }> = ({ fullWidth
|
||||
baseLinks.push({ label: t('nav.players'), to: '/hraci' });
|
||||
}
|
||||
if (navbarData.hasTables) {
|
||||
baseLinks.push({ label: t('nav.tables'), to: '/tabulky' });
|
||||
baseLinks.push({ label: t('nav.table'), to: '/tabulky' });
|
||||
}
|
||||
if (navbarData.hasArticles) {
|
||||
baseLinks.push(
|
||||
|
||||
@@ -65,7 +65,7 @@ const SetupPage: React.FC = () => {
|
||||
const [selectedClubSearchLabel, setSelectedClubSearchLabel] = useState('');
|
||||
const { data: publicSettings } = usePublicSettings();
|
||||
const isManualClubDataMode = (publicSettings?.club_data_mode || '').toLowerCase() === 'manual';
|
||||
const { searchClubs, searchResults, searchLoading, clearSearchResults } = useFacrApi();
|
||||
const { searchClubs, searchResults, searchLoading, clearSearchResults, getClub, getClubTable } = useFacrApi();
|
||||
const suppressNextClubSearchRef = useRef(false);
|
||||
|
||||
const resolveLogoUrl = (u?: string | null) => {
|
||||
@@ -138,6 +138,8 @@ const SetupPage: React.FC = () => {
|
||||
const [processingLogos, setProcessingLogos] = useState(false);
|
||||
const [rembgTotal, setRembgTotal] = useState(0);
|
||||
const [rembgDone, setRembgDone] = useState(0);
|
||||
const [fetchingFacrData, setFetchingFacrData] = useState(false);
|
||||
const [facrDataProgress, setFacrDataProgress] = useState('');
|
||||
|
||||
const toast = useToast();
|
||||
const navigate = useNavigate();
|
||||
@@ -498,6 +500,29 @@ const SetupPage: React.FC = () => {
|
||||
});
|
||||
} catch {}
|
||||
toast({ title: 'Nastavení dokončeno', status: 'success', duration: 3000, isClosable: true });
|
||||
|
||||
// Prefetch FACR data (club info and tables) before proceeding
|
||||
// This ensures data is cached and ready when user enters admin
|
||||
if (clubId && clubType && !isManualClubDataMode) {
|
||||
setFetchingFacrData(true);
|
||||
setFacrDataProgress('Získáváme data z FAČR...');
|
||||
try {
|
||||
// Fetch club info with retries (backend handles retries)
|
||||
setFacrDataProgress('Získáváme data z FAČR... (informace o klubu)');
|
||||
await getClub(clubId, clubType as 'football' | 'futsal').catch(() => null);
|
||||
|
||||
// Fetch club tables
|
||||
setFacrDataProgress('Získáváme data z FAČR... (tabulky a zápasy)');
|
||||
await getClubTable(clubId, clubType as 'football' | 'futsal').catch(() => null);
|
||||
|
||||
setFacrDataProgress('Data z FAČR načtena');
|
||||
} catch {
|
||||
// Continue even if FACR fetch fails - user can retry later
|
||||
} finally {
|
||||
setFetchingFacrData(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Start background removal only if backend allows it; otherwise skip waiting UI
|
||||
let allowRembg = false;
|
||||
try {
|
||||
@@ -1324,6 +1349,16 @@ const SetupPage: React.FC = () => {
|
||||
</VStack>
|
||||
</Box>
|
||||
)}
|
||||
{fetchingFacrData && (
|
||||
<Box position="fixed" top={0} left={0} right={0} bottom={0} bg="rgba(0,0,0,0.6)" zIndex={9999} display="flex" alignItems="center" justifyContent="center">
|
||||
<VStack spacing={3} bg={bg} p={8} borderRadius="xl" boxShadow="xl">
|
||||
<Spinner size="xl" />
|
||||
<Heading size="md">Získáváme data z FAČR</Heading>
|
||||
<Text>{facrDataProgress || 'Načítám data…'}</Text>
|
||||
<Text fontSize="sm" color="gray.500">Prosím vyčkejte, může to chvíli trvat…</Text>
|
||||
</VStack>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user