feat: Update assets and improve code comments across multiple components
- Updated favicon and various image assets. - Enhanced comments. - Adjusted styles and functionality in several components for improved user experience. - Updated package-lock.json to reflect dependency updates.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Modal, Text, TouchableOpacity, View, TextInput, ActivityIndicator } from 'react-native';
|
||||
import { X, Upload, FileText, Trash2 } from 'lucide-react-native';
|
||||
import * as DocumentPicker from 'expo-document-picker'; // TODO: Testare in ambiente iOS
|
||||
import * as DocumentPicker from 'expo-document-picker'; // TODO: Test on iOS environment
|
||||
|
||||
interface AddDocumentModalProps {
|
||||
visible: boolean;
|
||||
@@ -15,7 +15,7 @@ export default function AddDocumentModal({ visible, onClose, onUpload, isUploadi
|
||||
const [customTitle, setCustomTitle] = useState('');
|
||||
const [fileExtension, setFileExtension] = useState('');
|
||||
|
||||
// Reset dello stato quando il modale si apre/chiude
|
||||
// Reset of state when modal is closed
|
||||
useEffect(() => {
|
||||
if (!visible) {
|
||||
setSelectedFile(null);
|
||||
@@ -24,11 +24,11 @@ export default function AddDocumentModal({ visible, onClose, onUpload, isUploadi
|
||||
}
|
||||
}, [visible]);
|
||||
|
||||
// TODO: Considerare selezione multipla?
|
||||
// TODO: Need to handle multiple file selection?
|
||||
const pickDocument = async () => {
|
||||
try {
|
||||
const result = await DocumentPicker.getDocumentAsync({
|
||||
type: '*/*', // Puoi limitare a 'application/pdf', 'image/*', ecc.
|
||||
type: '*/*', // You can limit to 'application/pdf', 'image/*', etc.
|
||||
copyToCacheDirectory: true,
|
||||
});
|
||||
|
||||
@@ -55,7 +55,7 @@ export default function AddDocumentModal({ visible, onClose, onUpload, isUploadi
|
||||
if (!selectedFile) return;
|
||||
const fullTitle = customTitle ? `${customTitle}${fileExtension}` : selectedFile.name;
|
||||
|
||||
// Se il titolo custom è vuoto, usiamo il nome originale
|
||||
// If customTitle is empty, we use the original file name
|
||||
onUpload(selectedFile, fullTitle);
|
||||
};
|
||||
|
||||
@@ -65,8 +65,7 @@ export default function AddDocumentModal({ visible, onClose, onUpload, isUploadi
|
||||
setFileExtension('');
|
||||
};
|
||||
|
||||
// Formatta dimensione file
|
||||
// TODO: Spostare in utils?
|
||||
// Format file size in a human-readable format
|
||||
const formatSize = (size?: number) => {
|
||||
if (!size) return '0 B';
|
||||
const k = 1024;
|
||||
@@ -93,10 +92,8 @@ export default function AddDocumentModal({ visible, onClose, onUpload, isUploadi
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
{/* Body */}
|
||||
<View className="gap-5">
|
||||
|
||||
{/* Area Selezione File */}
|
||||
{/* File Selection Area */}
|
||||
{!selectedFile ? (
|
||||
<TouchableOpacity
|
||||
onPress={pickDocument}
|
||||
@@ -109,7 +106,7 @@ export default function AddDocumentModal({ visible, onClose, onUpload, isUploadi
|
||||
<Text className="text-gray-400 text-sm mt-1">PDF, Immagini, Word</Text>
|
||||
</TouchableOpacity>
|
||||
) : (
|
||||
// Visualizzazione File Selezionato
|
||||
// Selected File View
|
||||
<View className="bg-[#E6F4F4] p-4 rounded-2xl border border-[#099499]/20 flex-row items-center gap-4">
|
||||
<View className="bg-white p-3 rounded-xl">
|
||||
<FileText size={24} color="#099499" />
|
||||
@@ -128,7 +125,7 @@ export default function AddDocumentModal({ visible, onClose, onUpload, isUploadi
|
||||
</View>
|
||||
)}
|
||||
|
||||
{/* Campo Rinomina (Visibile solo se c'è un file) */}
|
||||
{/* Rename field (Visible only if a file is selected) */}
|
||||
{selectedFile && (
|
||||
<View>
|
||||
<Text className="text-gray-700 font-bold mb-2 ml-1 text-sm">Rinomina File</Text>
|
||||
|
||||
Reference in New Issue
Block a user