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:
2026-02-06 12:56:34 +01:00
parent 7a6a7f5d35
commit 7c8ef45e5a
36 changed files with 325 additions and 317 deletions

View File

@@ -11,6 +11,7 @@ import dayjs from 'dayjs';
import { formatTimestamp, parseTimestamp } from '@/utils/dateTime';
import { downloadAndShareDocument, uploadDocument } from '@/utils/documentUtils';
import AddDocumentModal from '@/components/AddDocumentModal';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function SiteDocumentsScreen() {
const router = useRouter();
@@ -24,12 +25,12 @@ export default function SiteDocumentsScreen() {
const [showUploadModal, setShowUploadModal] = useState(false);
const [isUploading, setIsUploading] = useState(false);
// Fetch dei documenti del cantiere
// Fetch site documents
const fetchSiteDocuments = useCallback(async (siteId: number, isRefreshing = false) => {
try {
if (!isRefreshing) setIsLoading(true);
// Fetch Documenti
// Fetch Documents
const response = await api.get(`/attachment/get-site-attachments`, {
params: { siteId }
});
@@ -74,13 +75,13 @@ export default function SiteDocumentsScreen() {
});
const [showRangePicker, setShowRangePicker] = useState(false);
// Filtraggio Documenti
// Filter documents based on search term and date range
const filteredDocs = documents.filter(doc => {
// Filtro Testuale (su nome documento)
// Textual Filter (on document name)
const matchesSearch = doc.title.toLowerCase().includes(searchTerm.toLowerCase());
if (!matchesSearch) return false;
// Filtro Date Range
// Date Range Filter
if (range.startDate || range.endDate) {
const docDate = parseTimestamp(doc.updated_at);
if (range.startDate) {
@@ -95,7 +96,7 @@ export default function SiteDocumentsScreen() {
return true;
});
// Gestione Download e Condivisione Documento
// Handle Document Download and Share
const handleDownloadAndShare = async (mimetype: string, fileName: string, fileUrl: string) => {
try {
await downloadAndShareDocument(mimetype, fileName, fileUrl);
@@ -105,7 +106,7 @@ export default function SiteDocumentsScreen() {
}
};
// Gestione Caricamento Documento
// Handle Document Upload
const handleUploadDocument = async (file: any, customTitle?: string) => {
setIsUploading(true);
try {
@@ -130,36 +131,40 @@ export default function SiteDocumentsScreen() {
return (
<View className="flex-1 bg-gray-50">
{/* Header */}
<View className="bg-white p-6 pt-16 shadow-sm border-b border-gray-100 flex-row items-center gap-4">
<TouchableOpacity onPress={() => router.back()} className="p-2 -ml-2 rounded-full active:bg-gray-100">
<ChevronLeft size={28} color="#4b5563" />
</TouchableOpacity>
<View className="bg-white px-4 pb-6 shadow-sm border-b border-gray-100">
<SafeAreaView edges={['top']} className='pt-4'>
<View className='flex-row items-center gap-4'>
<TouchableOpacity onPress={() => router.back()} className="p-2 -ml-2 rounded-full active:bg-gray-100">
<ChevronLeft size={28} color="#4b5563" />
</TouchableOpacity>
<View className="flex-1">
{/* Badge Codice Cantiere */}
{site.code && (
<View className="self-start bg-[#E6F4F4] px-2 py-0.5 rounded mb-1 border border-[#099499]/20">
<Text className="text-base font-bold text-[#099499]">
{site.code}
<View className="flex-1">
{/* Site Code Badge */}
{site.code && (
<View className="self-start bg-[#E6F4F4] px-2 py-0.5 rounded mb-1 border border-[#099499]/20">
<Text className="text-base font-bold text-[#099499]">
{site.code}
</Text>
</View>
)}
{/* Site Name with Truncate */}
<Text
className="text-xl font-bold text-gray-800 leading-tight"
numberOfLines={1}
ellipsizeMode="tail"
>
{site.name}
</Text>
<Text className="text-sm text-gray-500 mt-0.5">Archivio documenti</Text>
</View>
)}
{/* Nome Cantiere con Truncate funzionante */}
<Text
className="text-xl font-bold text-gray-800 leading-tight"
numberOfLines={1}
ellipsizeMode="tail"
>
{site.name}
</Text>
<Text className="text-sm text-gray-500 mt-0.5">Archivio documenti</Text>
</View>
</View>
</SafeAreaView>
</View>
<View className="p-5 gap-6 flex-1">
{/* Search + Date Row (Spostato qui) */}
{/* Search + Date Row */}
<View className="flex-row gap-2">
<View className="flex-1 relative justify-center">
<View className="absolute left-4 z-10">
@@ -189,7 +194,7 @@ export default function SiteDocumentsScreen() {
onApply={setRange}
/>
{/* Lista Documenti */}
{/* Documents List */}
<ScrollView
contentContainerStyle={{ gap: 16, paddingBottom: 100 }}
showsVerticalScrollIndicator={false}
@@ -222,7 +227,7 @@ export default function SiteDocumentsScreen() {
</ScrollView>
</View>
{/* FAB (Spostato qui) */}
{/* FAB */}
<TouchableOpacity
onPress={() => setShowUploadModal(true)}
className="absolute bottom-8 right-6 w-16 h-16 bg-[#099499] rounded-full shadow-lg items-center justify-center active:scale-90"
@@ -230,13 +235,13 @@ export default function SiteDocumentsScreen() {
<Plus size={32} color="white" />
</TouchableOpacity>
{/* Modale Caricamento Documento */}
{/* Upload Document Modal */}
<AddDocumentModal
visible={showUploadModal}
onClose={() => setShowUploadModal(false)}
onUpload={handleUploadDocument}
isUploading={isUploading}
/>
</View>
</View >
);
}