import { useState } from "react"; import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Plus, Search, Edit3, Trash2, Upload, Play, Pause, Settings, BarChart3, Users, Video as VideoIcon } from "lucide-react"; import { type Video } from "@shared/schema"; import { apiRequest } from "@/lib/queryClient"; import BunnyVideoModal from "@/components/bunny-video-modal"; interface BunnyStats { totalVideos: number; totalViews: number; totalStorage: number; bandwidth: number; } function formatFileSize(bytes: number): string { const sizes = ['B', 'KB', 'MB', 'GB', 'TB']; if (bytes === 0) return '0 B'; const i = Math.floor(Math.log(bytes) / Math.log(1024)); return Math.round(bytes / Math.pow(1024, i) * 100) / 100 + ' ' + sizes[i]; } function formatDuration(seconds: number): string { const minutes = Math.floor(seconds / 60); const remainingSeconds = seconds % 60; return `${minutes}:${remainingSeconds.toString().padStart(2, '0')}`; } function formatViews(views: number): string { if (views >= 1000000) { return `${(views / 1000000).toFixed(1)}M`; } else if (views >= 1000) { return `${(views / 1000).toFixed(1)}K`; } return views.toString(); } export default function BunnyAdminPage() { const [searchTerm, setSearchTerm] = useState(""); const [selectedVideo, setSelectedVideo] = useState