From 545a78f32ca8c9ed0afc1e744abdbafe2d6409a6 Mon Sep 17 00:00:00 2001 From: Kailasdevdas Date: Tue, 16 Jun 2026 12:53:41 +0530 Subject: [PATCH] feat: include video/image upload --- .../BannerModal/HomepageBannerModal.tsx | 6 +-- .../BytescaleUploader/BytescaleUploader.tsx | 39 +++++++++++++------ 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/BannerModal/HomepageBannerModal.tsx b/frontend/src/components/BannerModal/HomepageBannerModal.tsx index f61f2da..43a7eec 100644 --- a/frontend/src/components/BannerModal/HomepageBannerModal.tsx +++ b/frontend/src/components/BannerModal/HomepageBannerModal.tsx @@ -84,7 +84,7 @@ export default function HomepageBannerModal({

{bannerForm.mediaType === 'VIDEO' - ? 'Recommended: 16:9 MP4 Format' + ? 'Recommended: 1920 × 650 MP4 Format ' : 'Recommended: 1920 × 650 Widescreen'}

- {bannerForm.mediaType === 'VIDEO' - ? 'Recommended: 9:16 Vertical Video' - : 'Recommended: 750 × 1000 Portrait'} + {bannerForm.mediaType === 'VIDEO' ? 'Recommended: 340 × 390 MP4 Format' : 'Recommended: 340 × 390 '}

(null); + const isVideo = (url: string) => { + return /\.(mp4|webm|ogg)$/i.test(url); + }; + const onFileSelected = async (event: React.ChangeEvent) => { const file = event.target.files?.[0]; + if (!file) return; - if (file.size > 5 * 1024 * 1024) { - alert('File is too large (Max 5MB)'); + const maxSize = file.type.startsWith('video/') ? 10 * 1024 * 1024 : 5 * 1024 * 1024; + + if (file.size > maxSize) { + alert(file.type.startsWith('video/') ? 'Video is too large (Max 10MB)' : 'Image is too large (Max 5MB)'); return; } @@ -52,7 +59,10 @@ export function BytescaleUploader({ value, onChange, folderPath }: BytescaleUplo alert(`Upload Error: ${errorMessage}`); } finally { setIsUploading(false); - if (fileInputRef.current) fileInputRef.current.value = ''; + + if (fileInputRef.current) { + fileInputRef.current.value = ''; + } } }; @@ -62,11 +72,16 @@ export function BytescaleUploader({ value, onChange, folderPath }: BytescaleUplo
{value ? ( <> - Preview + {isVideo(value) ? ( +