From 421fa1d2676951123e0c054e5ebcb088a04de8af Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 17 Dec 2025 10:51:15 +0000 Subject: [PATCH] style: format code with Prettier and StandardJS This commit fixes the style issues introduced in fb564c2 according to the output from Prettier and StandardJS. Details: None --- frontend/src/app/auth/login/page.tsx | 26 +- frontend/src/app/channel/[id]/page.tsx | 96 ++- frontend/src/app/history/page.tsx | 24 +- frontend/src/app/layout.tsx | 3 +- frontend/src/app/liked/page.tsx | 27 +- frontend/src/app/my-channel/page.tsx | 152 ++-- frontend/src/app/profile/page.tsx | 101 ++- frontend/src/app/upload/page.tsx | 209 +++--- frontend/src/app/video/[id]/page.tsx | 173 +++-- frontend/src/app/videos/page.tsx | 21 +- .../components/channel/CreateChannelModal.tsx | 32 +- frontend/src/components/channel/MyChannel.tsx | 30 +- frontend/src/components/layout/MainLayout.tsx | 84 ++- .../src/components/profile/LikedVideos.tsx | 11 +- .../src/components/profile/ProfileInfo.tsx | 16 +- .../components/profile/ProfileSettings.tsx | 43 +- .../components/profile/SubscribedChannels.tsx | 32 +- .../src/components/studio/StudioAnalytics.tsx | 86 ++- .../src/components/studio/StudioDashboard.tsx | 76 +- .../src/components/studio/StudioVideos.tsx | 75 +- frontend/src/components/ui/badge.tsx | 14 +- .../video/ThumbnailGeneratorModal.tsx | 69 +- frontend/src/components/video/VideoCard.tsx | 8 +- frontend/src/components/video/VideoGrid.tsx | 102 ++- .../src/components/video/VideoJsPlayer.tsx | 99 ++- frontend/src/hooks/useThumbnailGenerator.ts | 25 +- frontend/src/lib/api/channel.ts | 26 +- frontend/src/store/channelStore.ts | 23 +- processing/videoWorker.js | 701 ++++++++++-------- 29 files changed, 1506 insertions(+), 878 deletions(-) diff --git a/frontend/src/app/auth/login/page.tsx b/frontend/src/app/auth/login/page.tsx index 546eed1..6a6cb34 100644 --- a/frontend/src/app/auth/login/page.tsx +++ b/frontend/src/app/auth/login/page.tsx @@ -7,7 +7,7 @@ import apiClient from "@/lib/api"; import { useAuthStore } from "@/store/authStore"; import { Button } from "@/components/ui/button"; import { useToast } from "@/hooks/use-toast"; -import { Mail, Lock } from "lucide-react"; +import { Mail, Lock } from "lucide-react"; // import { log } from "console"; export default function LoginPage() { @@ -25,10 +25,13 @@ export default function LoginPage() { try { // Determine if identifier is email or username - console.log("This dumb fuck has identifier lets see what info it has in identifier",identifier); - - const isEmail = identifier.includes('@'); - const loginData = isEmail + console.log( + "This dumb fuck has identifier lets see what info it has in identifier", + identifier, + ); + + const isEmail = identifier.includes("@"); + const loginData = isEmail ? { email: identifier, password } : { username: identifier, password }; @@ -66,7 +69,9 @@ export default function LoginPage() {
- +
- +

Don't have an account?{" "} - + Create Account

diff --git a/frontend/src/app/channel/[id]/page.tsx b/frontend/src/app/channel/[id]/page.tsx index 072efb6..a5d84a0 100644 --- a/frontend/src/app/channel/[id]/page.tsx +++ b/frontend/src/app/channel/[id]/page.tsx @@ -1,15 +1,15 @@ -'use client'; - -import { useState, useEffect } from 'react'; -import { useParams, useRouter } from 'next/navigation'; -import { MainLayout } from '@/components/layout/MainLayout'; -import { Button } from '@/components/ui/button'; -import { useToast } from '@/hooks/use-toast'; -import { useAuthStore } from '@/store/authStore'; -import apiClient from '@/lib/api'; -import { Bell, BellOff, Video, Users, Play, Settings } from 'lucide-react'; -import Image from 'next/image'; -import { VideoGrid } from '@/components/video/VideoGrid'; +"use client"; + +import { useState, useEffect } from "react"; +import { useParams, useRouter } from "next/navigation"; +import { MainLayout } from "@/components/layout/MainLayout"; +import { Button } from "@/components/ui/button"; +import { useToast } from "@/hooks/use-toast"; +import { useAuthStore } from "@/store/authStore"; +import apiClient from "@/lib/api"; +import { Bell, BellOff, Video, Users, Play, Settings } from "lucide-react"; +import Image from "next/image"; +import { VideoGrid } from "@/components/video/VideoGrid"; interface Channel { _id: string; @@ -25,7 +25,7 @@ export default function ChannelPage() { const router = useRouter(); const { toast } = useToast(); const { user } = useAuthStore(); - + const [channel, setChannel] = useState(null); const [videoCount, setVideoCount] = useState(0); const [loading, setLoading] = useState(true); @@ -47,13 +47,13 @@ export default function ChannelPage() { setChannel(channelData); setSubscribersCount(channelData.subscribersCount || 0); } catch (error: any) { - console.error('Error fetching channel:', error); + console.error("Error fetching channel:", error); toast({ - title: 'Error loading channel', - description: error.response?.data?.message || 'Channel not found', - variant: 'destructive', + title: "Error loading channel", + description: error.response?.data?.message || "Channel not found", + variant: "destructive", }); - router.push('/'); + router.push("/"); } finally { setLoading(false); } @@ -63,10 +63,12 @@ export default function ChannelPage() { try { const response = await apiClient.get(`/videos?page=1&limit=100`); const allVideos = response.data.data || []; - const channelVideos = allVideos.filter((v: any) => v.owner?._id === params.id); + const channelVideos = allVideos.filter( + (v: any) => v.owner?._id === params.id, + ); setVideoCount(channelVideos.length); } catch (error) { - console.error('Error fetching video count:', error); + console.error("Error fetching video count:", error); } }; @@ -75,45 +77,51 @@ export default function ChannelPage() { try { const response = await apiClient.get(`/subscriptions/u/${user._id}`); const subscriptions = response.data.data || []; - const subscribed = subscriptions.some((sub: any) => sub.channel._id === params.id); + const subscribed = subscriptions.some( + (sub: any) => sub.channel._id === params.id, + ); setIsSubscribed(subscribed); - + // Also fetch fresh channel data to get accurate subscriber count - const channelResponse = await apiClient.get(`/users/channel/${params.id}`); + const channelResponse = await apiClient.get( + `/users/channel/${params.id}`, + ); setSubscribersCount(channelResponse.data.data.subscribersCount || 0); } catch (error) { - console.error('Error checking subscription:', error); + console.error("Error checking subscription:", error); } }; const handleSubscribe = async () => { if (!user) { - router.push('/auth/login'); + router.push("/auth/login"); return; } try { const wasSubscribed = isSubscribed; await apiClient.post(`/subscriptions/c/${params.id}`); - + // Toggle subscription state setIsSubscribed(!wasSubscribed); - + // Update count based on previous state - setSubscribersCount(prev => wasSubscribed ? prev - 1 : prev + 1); - + setSubscribersCount((prev) => (wasSubscribed ? prev - 1 : prev + 1)); + toast({ - title: wasSubscribed ? 'Unsubscribed' : 'Subscribed successfully!', - description: wasSubscribed ? 'Channel removed from subscriptions' : 'Channel added to subscriptions', + title: wasSubscribed ? "Unsubscribed" : "Subscribed successfully!", + description: wasSubscribed + ? "Channel removed from subscriptions" + : "Channel added to subscriptions", }); - + // Refresh to get accurate count from backend setTimeout(() => checkSubscription(), 500); } catch (error) { toast({ - title: 'Error', - description: 'Failed to update subscription', - variant: 'destructive', + title: "Error", + description: "Failed to update subscription", + variant: "destructive", }); } }; @@ -160,7 +168,7 @@ export default function ChannelPage() { {/* Avatar */}
{channel.fullName} -

{channel.fullName}

+

+ {channel.fullName} +

@{channel.username} @@ -192,8 +202,8 @@ export default function ChannelPage() { onClick={handleSubscribe} className={`px-8 py-6 text-lg font-semibold ${ isSubscribed - ? 'bg-muted text-foreground hover:bg-muted/80' - : 'bg-gradient-to-r from-orange-500 via-red-500 to-yellow-500 hover:shadow-lg hover:shadow-orange-500/50' + ? "bg-muted text-foreground hover:bg-muted/80" + : "bg-gradient-to-r from-orange-500 via-red-500 to-yellow-500 hover:shadow-lg hover:shadow-orange-500/50" }`} > {isSubscribed ? ( @@ -219,7 +229,9 @@ export default function ChannelPage() { Channel Videos - {videoCount} uploads + + {videoCount} uploads +
{videoCount === 0 ? ( @@ -227,7 +239,9 @@ export default function ChannelPage() {
) : ( diff --git a/frontend/src/app/history/page.tsx b/frontend/src/app/history/page.tsx index 680ce82..f51464e 100644 --- a/frontend/src/app/history/page.tsx +++ b/frontend/src/app/history/page.tsx @@ -1,12 +1,12 @@ -'use client'; +"use client"; -import { useState, useEffect } from 'react'; -import { MainLayout } from '@/components/layout/MainLayout'; -import { VideoCard } from '@/components/video/VideoCard'; -import apiClient from '@/lib/api'; -import { useAuthStore } from '@/store/authStore'; -import { useRouter } from 'next/navigation'; -import { Loader2, History as HistoryIcon } from 'lucide-react'; +import { useState, useEffect } from "react"; +import { MainLayout } from "@/components/layout/MainLayout"; +import { VideoCard } from "@/components/video/VideoCard"; +import apiClient from "@/lib/api"; +import { useAuthStore } from "@/store/authStore"; +import { useRouter } from "next/navigation"; +import { Loader2, History as HistoryIcon } from "lucide-react"; interface Video { _id: string; @@ -33,20 +33,20 @@ export default function HistoryPage() { useEffect(() => { if (!isLoading && !isAuthenticated) { - router.push('/auth/login'); + router.push("/auth/login"); return; } const fetchWatchHistory = async () => { try { setLoading(true); - const response = await apiClient.get('/users/history'); + const response = await apiClient.get("/users/history"); const historyData = response.data.data; - + // Extract videos from watch history setVideos(Array.isArray(historyData) ? historyData : []); } catch (error) { - console.error('Error fetching watch history:', error); + console.error("Error fetching watch history:", error); setVideos([]); } finally { setLoading(false); diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index dfa10fc..512ced2 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -9,7 +9,8 @@ const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { title: "Spark - Video Streaming & Messaging Platform", - description: "Modern video streaming platform with real-time messaging, video editing, and social features", + description: + "Modern video streaming platform with real-time messaging, video editing, and social features", }; export default function RootLayout({ diff --git a/frontend/src/app/liked/page.tsx b/frontend/src/app/liked/page.tsx index e91ba0d..8235ab5 100644 --- a/frontend/src/app/liked/page.tsx +++ b/frontend/src/app/liked/page.tsx @@ -1,12 +1,12 @@ -'use client'; +"use client"; -import { useState, useEffect } from 'react'; -import { MainLayout } from '@/components/layout/MainLayout'; -import { VideoCard } from '@/components/video/VideoCard'; -import apiClient from '@/lib/api'; -import { useAuthStore } from '@/store/authStore'; -import { useRouter } from 'next/navigation'; -import { Loader2, ThumbsUp } from 'lucide-react'; +import { useState, useEffect } from "react"; +import { MainLayout } from "@/components/layout/MainLayout"; +import { VideoCard } from "@/components/video/VideoCard"; +import apiClient from "@/lib/api"; +import { useAuthStore } from "@/store/authStore"; +import { useRouter } from "next/navigation"; +import { Loader2, ThumbsUp } from "lucide-react"; interface Video { _id: string; @@ -33,20 +33,21 @@ export default function LikedVideosPage() { useEffect(() => { if (!isLoading && !isAuthenticated) { - router.push('/auth/login'); + router.push("/auth/login"); return; } const fetchLikedVideos = async () => { try { setLoading(true); - const response = await apiClient.get('/likes/videos'); - + const response = await apiClient.get("/likes/videos"); + // Handle nested response structure - const likedData = response.data?.data?.videos || response.data?.data || []; + const likedData = + response.data?.data?.videos || response.data?.data || []; setVideos(Array.isArray(likedData) ? likedData : []); } catch (error) { - console.error('Error fetching liked videos:', error); + console.error("Error fetching liked videos:", error); setVideos([]); } finally { setLoading(false); diff --git a/frontend/src/app/my-channel/page.tsx b/frontend/src/app/my-channel/page.tsx index c9e7415..ac126de 100644 --- a/frontend/src/app/my-channel/page.tsx +++ b/frontend/src/app/my-channel/page.tsx @@ -11,9 +11,23 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { useToast } from "@/hooks/use-toast"; import apiClient from "@/lib/api"; import { - Play, Eye, Clock, MoreVertical, Trash2, Edit, Globe, - Lock, Upload, Video as VideoIcon, TrendingUp, Users, - Settings, Scissors, Sparkles, Download, Share2 + Play, + Eye, + Clock, + MoreVertical, + Trash2, + Edit, + Globe, + Lock, + Upload, + Video as VideoIcon, + TrendingUp, + Users, + Settings, + Scissors, + Sparkles, + Download, + Share2, } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; @@ -78,31 +92,39 @@ export default function MyChannelPage() { const { toast } = useToast(); const [videos, setVideos] = useState([]); - const [stats, setStats] = useState({ totalVideos: 0, totalViews: 0, totalSubscribers: 0 }); + const [stats, setStats] = useState({ + totalVideos: 0, + totalViews: 0, + totalSubscribers: 0, + }); const [loading, setLoading] = useState(true); const [selectedVideo, setSelectedVideo] = useState