mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 18:52:56 +00:00
dev day #77
This commit is contained in:
@@ -8,8 +8,8 @@ import { getCachedYouTube, YouTubeVideo } from '../../services/youtube';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
type Props = {
|
||||
// optional manual override
|
||||
videos?: string[];
|
||||
variant?: 'grid' | 'carousel';
|
||||
};
|
||||
|
||||
type RenderItem = {
|
||||
@@ -39,7 +39,7 @@ const toEmbed = (idOrUrl: string): string => {
|
||||
return `https://www.youtube.com/embed/${idOrUrl}`;
|
||||
};
|
||||
|
||||
const VideosSection: React.FC<Props> = ({ videos }) => {
|
||||
const VideosSection: React.FC<Props> = ({ videos, variant }) => {
|
||||
const cardBg = useColorModeValue('white', 'gray.800');
|
||||
const theme = useClubTheme();
|
||||
const { data: settings } = usePublicSettings();
|
||||
@@ -55,7 +55,11 @@ const VideosSection: React.FC<Props> = ({ videos }) => {
|
||||
const enabled = (typeof (settings as any)?.videos_module_enabled === 'boolean')
|
||||
? Boolean((settings as any)?.videos_module_enabled)
|
||||
: (hasManualConfigured || ((settings?.videos_source || 'auto') === 'auto' && hasAutoConfigured));
|
||||
const style = settings?.videos_style || 'slider';
|
||||
const style = (() => {
|
||||
if (variant === 'carousel') return 'slider';
|
||||
if (variant === 'grid') return 'grid';
|
||||
return settings?.videos_style || 'slider';
|
||||
})();
|
||||
const source = settings?.videos_source || 'auto';
|
||||
// Default to 6 items on homepage unless overridden by settings (max 12)
|
||||
const limit = Math.max(1, Math.min(12, settings?.videos_limit ?? 6));
|
||||
|
||||
Reference in New Issue
Block a user