UNPKG

@oxyhq/services

Version:

OxyHQ Expo/React Native SDK — UI components, screens, and native features

165 lines (164 loc) 6.35 kB
"use strict"; import React from 'react'; import { View, Text, TouchableOpacity, Modal, ScrollView } from 'react-native'; import { Ionicons } from '@expo/vector-icons'; import { formatFileSize, getFileIcon } from "../../utils/fileManagement.js"; import { fileManagementStyles } from "./styles.js"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; export const FileDetailsModal = ({ visible, file, onClose, onDownload, onDelete, themeStyles, isOwner }) => { const backgroundColor = themeStyles.backgroundColor; const borderColor = themeStyles.borderColor; if (!file) return null; return /*#__PURE__*/_jsx(Modal, { visible: visible, animationType: "slide", presentationStyle: "pageSheet", onRequestClose: onClose, children: /*#__PURE__*/_jsxs(View, { style: [fileManagementStyles.modalContainer, { backgroundColor }], children: [/*#__PURE__*/_jsxs(View, { style: [fileManagementStyles.modalHeader, { borderBottomColor: borderColor }], children: [/*#__PURE__*/_jsx(TouchableOpacity, { style: fileManagementStyles.modalCloseButton, onPress: onClose, children: /*#__PURE__*/_jsx(Ionicons, { name: "close", size: 24, color: themeStyles.textColor }) }), /*#__PURE__*/_jsx(Text, { style: [fileManagementStyles.modalTitle, { color: themeStyles.textColor }], children: "File Details" }), /*#__PURE__*/_jsx(View, { style: fileManagementStyles.modalPlaceholder })] }), /*#__PURE__*/_jsx(ScrollView, { style: fileManagementStyles.modalContent, children: /*#__PURE__*/_jsxs(View, { style: [fileManagementStyles.fileDetailCard, { backgroundColor: themeStyles.secondaryBackgroundColor, borderColor }], children: [/*#__PURE__*/_jsx(View, { style: fileManagementStyles.fileDetailIcon, children: /*#__PURE__*/_jsx(Ionicons, { name: getFileIcon(file.contentType), size: 64, color: themeStyles.primaryColor }) }), /*#__PURE__*/_jsx(Text, { style: [fileManagementStyles.fileDetailName, { color: themeStyles.textColor }], children: file.filename }), /*#__PURE__*/_jsxs(View, { style: fileManagementStyles.fileDetailInfo, children: [/*#__PURE__*/_jsxs(View, { style: fileManagementStyles.detailRow, children: [/*#__PURE__*/_jsx(Text, { style: [fileManagementStyles.detailLabel, { color: themeStyles.isDarkTheme ? '#BBBBBB' : '#666666' }], children: "Size:" }), /*#__PURE__*/_jsx(Text, { style: [fileManagementStyles.detailValue, { color: themeStyles.textColor }], children: formatFileSize(file.length) })] }), /*#__PURE__*/_jsxs(View, { style: fileManagementStyles.detailRow, children: [/*#__PURE__*/_jsx(Text, { style: [fileManagementStyles.detailLabel, { color: themeStyles.isDarkTheme ? '#BBBBBB' : '#666666' }], children: "Type:" }), /*#__PURE__*/_jsx(Text, { style: [fileManagementStyles.detailValue, { color: themeStyles.textColor }], children: file.contentType })] }), /*#__PURE__*/_jsxs(View, { style: fileManagementStyles.detailRow, children: [/*#__PURE__*/_jsx(Text, { style: [fileManagementStyles.detailLabel, { color: themeStyles.isDarkTheme ? '#BBBBBB' : '#666666' }], children: "Uploaded:" }), /*#__PURE__*/_jsx(Text, { style: [fileManagementStyles.detailValue, { color: themeStyles.textColor }], children: new Date(file.uploadDate).toLocaleString() })] }), file.metadata?.description && /*#__PURE__*/_jsxs(View, { style: fileManagementStyles.detailRow, children: [/*#__PURE__*/_jsx(Text, { style: [fileManagementStyles.detailLabel, { color: themeStyles.isDarkTheme ? '#BBBBBB' : '#666666' }], children: "Description:" }), /*#__PURE__*/_jsx(Text, { style: [fileManagementStyles.detailValue, { color: themeStyles.textColor }], children: file.metadata.description })] })] }), /*#__PURE__*/_jsxs(View, { style: fileManagementStyles.modalActions, children: [/*#__PURE__*/_jsxs(TouchableOpacity, { style: [fileManagementStyles.modalActionButton, { backgroundColor: themeStyles.primaryColor }], onPress: () => { onDownload(file.id, file.filename); onClose(); }, children: [/*#__PURE__*/_jsx(Ionicons, { name: "download", size: 20, color: "#FFFFFF" }), /*#__PURE__*/_jsx(Text, { style: fileManagementStyles.modalActionText, children: "Download" })] }), isOwner && /*#__PURE__*/_jsxs(TouchableOpacity, { style: [fileManagementStyles.modalActionButton, { backgroundColor: themeStyles.dangerColor }], onPress: () => { onClose(); onDelete(file.id, file.filename); }, children: [/*#__PURE__*/_jsx(Ionicons, { name: "trash", size: 20, color: "#FFFFFF" }), /*#__PURE__*/_jsx(Text, { style: fileManagementStyles.modalActionText, children: "Delete" })] })] })] }) })] }) }); }; //# sourceMappingURL=FileDetailsModal.js.map