import { useState } from 'react' import { View, Text, ScrollView, TouchableOpacity, StyleSheet, ActivityIndicator, Alert, } from 'react-native' import { useRouter } from 'expo-router' import { supabase } from '../../src/shared/supabase' export default function AdminMediaScreen() { const router = useRouter() const [uploading, setUploading] = useState(false) const [activeTab, setActiveTab] = useState<'videos' | 'thumbnails' | 'avatars'>('videos') const handleUpload = async () => { Alert.alert('Info', 'File upload requires file picker integration. This is a placeholder.') } const handleDelete = async (path: string) => { Alert.alert( 'Delete File', `Are you sure you want to delete "${path}"?`, [ { text: 'Cancel', style: 'cancel' }, { text: 'Delete', style: 'destructive', onPress: async () => { try { const { error } = await supabase.storage .from(activeTab) .remove([path]) if (error) throw error Alert.alert('Success', 'File deleted') } catch (err) { Alert.alert('Error', err instanceof Error ? err.message : 'Failed to delete') } } }, ] ) } return ( router.back()} style={styles.backButton}> ← Back Media Library Upload {(['videos', 'thumbnails', 'avatars'] as const).map((tab) => ( setActiveTab(tab)} > {tab.charAt(0).toUpperCase() + tab.slice(1)} ))} Storage Buckets • videos - Workout videos (MP4, MOV){'\n'} • thumbnails - Workout thumbnails (JPG, PNG){'\n'} • avatars - Trainer avatars (JPG, PNG) 🎬 Media Management Upload and manage media files for workouts and trainers.{'\n\n'} This feature requires file picker integration.{'\n'} Files will be stored in Supabase Storage. ) } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#000', }, header: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', padding: 20, paddingTop: 60, borderBottomWidth: 1, borderBottomColor: '#1C1C1E', }, backButton: { padding: 8, }, backText: { color: '#FF6B35', fontSize: 16, }, title: { fontSize: 20, fontWeight: 'bold', color: '#fff', }, uploadButton: { backgroundColor: '#FF6B35', paddingHorizontal: 16, paddingVertical: 8, borderRadius: 8, }, uploadButtonText: { color: '#000', fontWeight: 'bold', }, tabs: { flexDirection: 'row', padding: 16, gap: 8, }, tab: { flex: 1, paddingVertical: 12, paddingHorizontal: 16, borderRadius: 8, backgroundColor: '#1C1C1E', alignItems: 'center', }, activeTab: { backgroundColor: '#FF6B35', }, tabText: { color: '#999', fontWeight: '600', }, activeTabText: { color: '#000', }, content: { flex: 1, padding: 16, }, infoCard: { backgroundColor: '#1C1C1E', borderRadius: 12, padding: 16, marginBottom: 16, }, infoTitle: { fontSize: 16, fontWeight: 'bold', color: '#fff', marginBottom: 8, }, infoText: { fontSize: 14, color: '#999', lineHeight: 20, }, placeholderCard: { backgroundColor: '#1C1C1E', borderRadius: 12, padding: 32, alignItems: 'center', }, placeholderIcon: { fontSize: 48, marginBottom: 16, }, placeholderTitle: { fontSize: 18, fontWeight: 'bold', color: '#fff', marginBottom: 8, }, placeholderText: { fontSize: 14, color: '#999', textAlign: 'center', lineHeight: 20, }, })