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,5 +1,5 @@
|
||||
import { useAlert } from '@/components/AlertComponent';
|
||||
import { ArrowLeft, Download, FileText, MapPin, Plus, Search, CalendarIcon } from 'lucide-react-native';
|
||||
import { Download, FileText, MapPin, Plus, Search, CalendarIcon, ChevronLeft } from 'lucide-react-native';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useRouter } from 'expo-router';
|
||||
import { RangePickerModal } from '@/components/RangePickerModal';
|
||||
@@ -11,6 +11,7 @@ import LoadingScreen from '@/components/LoadingScreen';
|
||||
import { formatTimestamp, parseTimestamp } from '@/utils/dateTime';
|
||||
import AddDocumentModal from '@/components/AddDocumentModal';
|
||||
import { downloadAndShareDocument, uploadDocument } from '@/utils/documentUtils';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
|
||||
export default function DocumentsScreen() {
|
||||
const router = useRouter();
|
||||
@@ -32,7 +33,7 @@ export default function DocumentsScreen() {
|
||||
try {
|
||||
if (!refreshing) setIsLoading(true);
|
||||
|
||||
// Fetch Documenti Utente
|
||||
// Fetch User Documents
|
||||
const response = await api.get(`/attachment/get-user-attachments`);
|
||||
setDocuments(response.data);
|
||||
} catch (error) {
|
||||
@@ -53,24 +54,24 @@ export default function DocumentsScreen() {
|
||||
fetchUserDocuments();
|
||||
};
|
||||
|
||||
// Filtra Documenti in base a searchTerm e range
|
||||
// Filter Documents based on searchTerm and range
|
||||
const filteredDocs = documents.filter(doc => {
|
||||
// Filtro Testuale
|
||||
// Text Filter
|
||||
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); // doc.date è "DD/MM/YYYY"
|
||||
|
||||
// Controllo Data Inizio
|
||||
// Start Date Check
|
||||
if (range.startDate) {
|
||||
// dayjs(range.startDate).toDate() converte in oggetto Date JS standard
|
||||
// dayjs(range.startDate).toDate() converts to standard JS Date object
|
||||
const start = dayjs(range.startDate).startOf('day').toDate();
|
||||
if (docDate < start) return false;
|
||||
}
|
||||
|
||||
// Controllo Data Fine
|
||||
// End Date Check
|
||||
if (range.endDate) {
|
||||
const end = dayjs(range.endDate).endOf('day').toDate();
|
||||
if (docDate > end) return false;
|
||||
@@ -80,7 +81,7 @@ export default function DocumentsScreen() {
|
||||
return true;
|
||||
});
|
||||
|
||||
// Gestione Caricamento Documento
|
||||
// Document Upload Handling
|
||||
const handleUploadDocument = async (file: any, customTitle?: string) => {
|
||||
setIsUploading(true);
|
||||
try {
|
||||
@@ -105,14 +106,18 @@ export default function DocumentsScreen() {
|
||||
return (
|
||||
<View className="flex-1 bg-gray-50">
|
||||
{/* Header */}
|
||||
<View className="flex-row items-center gap-4 bg-white p-6 pt-16 shadow-sm border-b border-gray-100">
|
||||
<TouchableOpacity onPress={() => router.back()} className="p-2 -ml-2 rounded-full active:bg-gray-100">
|
||||
<ArrowLeft size={24} color="#374151" />
|
||||
</TouchableOpacity>
|
||||
<View className="flex-1">
|
||||
<Text className="text-3xl font-bold text-gray-800">Documenti</Text>
|
||||
<Text className="text-base text-gray-500">Gestisci i tuoi documenti</Text>
|
||||
</View>
|
||||
<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 rounded-full active:bg-gray-100">
|
||||
<ChevronLeft size={28} color="#4b5563" />
|
||||
</TouchableOpacity>
|
||||
<View className="flex-1">
|
||||
<Text className="text-3xl font-bold text-gray-800">Documenti</Text>
|
||||
<Text className="text-base text-gray-500">Gestisci i tuoi documenti</Text>
|
||||
</View>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
|
||||
<View className="p-5 gap-6 flex-1">
|
||||
@@ -141,7 +146,7 @@ export default function DocumentsScreen() {
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
{/* Modale Unico per il Range */}
|
||||
{/* Range Picker Modal */}
|
||||
<RangePickerModal
|
||||
visible={showRangePicker}
|
||||
onClose={() => setShowRangePicker(false)}
|
||||
@@ -149,7 +154,7 @@ export default function DocumentsScreen() {
|
||||
onApply={setRange}
|
||||
/>
|
||||
|
||||
{/* List */}
|
||||
{/* Documents List */}
|
||||
<ScrollView
|
||||
contentContainerStyle={{ gap: 16, paddingBottom: 100 }}
|
||||
showsVerticalScrollIndicator={false}
|
||||
@@ -172,7 +177,7 @@ export default function DocumentsScreen() {
|
||||
</View>
|
||||
</View>
|
||||
<TouchableOpacity
|
||||
onPress={() => downloadAndShareDocument(doc.mimetype, doc.title, doc.url)}
|
||||
onPress={() => downloadAndShareDocument(doc.mimetype, doc.title, doc.url)}
|
||||
className="p-4 bg-gray-50 rounded-2xl active:bg-gray-100">
|
||||
<Download size={24} color="#6b7280" />
|
||||
</TouchableOpacity>
|
||||
@@ -193,7 +198,7 @@ export default function DocumentsScreen() {
|
||||
<Plus size={32} color="white" />
|
||||
</TouchableOpacity>
|
||||
|
||||
{/* Modale Caricamento Documento */}
|
||||
{/* Document Upload Modal */}
|
||||
<AddDocumentModal
|
||||
visible={showUploadModal}
|
||||
onClose={() => setShowUploadModal(false)}
|
||||
|
||||
@@ -3,55 +3,56 @@ import { ChevronLeft, FileText, LogOut, Mail, Settings, User } from 'lucide-reac
|
||||
import React, { useContext } from 'react';
|
||||
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { AuthContext } from '@/utils/authContext';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
|
||||
export default function ProfileScreen() {
|
||||
const authContext = useContext(AuthContext);
|
||||
const { user } = authContext;
|
||||
const router = useRouter();
|
||||
|
||||
// Genera le iniziali dell'utente
|
||||
// Generate user initials
|
||||
const initials = `${user?.name?.[0] ?? ''}${user?.surname?.[0] ?? ''}`.toUpperCase();
|
||||
|
||||
return (
|
||||
<View className="flex-1 bg-[#099499]">
|
||||
{/* --- SEZIONE HEADER (INVARIATA) --- */}
|
||||
<View className="pt-16 pb-6 px-6">
|
||||
<View className="flex-row justify-start items-center gap-4">
|
||||
<TouchableOpacity
|
||||
onPress={() => router.back()}
|
||||
>
|
||||
<ChevronLeft size={28} color="white" />
|
||||
</TouchableOpacity>
|
||||
<View className="flex-row items-center gap-4">
|
||||
<View className="w-16 h-16 rounded-full bg-white/20 items-center justify-center">
|
||||
<Text className="text-white font-bold text-2xl">{initials}</Text>
|
||||
</View>
|
||||
<View>
|
||||
<Text className="text-teal-100 text-lg font-medium uppercase tracking-wider mb-1">Profilo</Text>
|
||||
<Text className="text-white text-2xl font-bold">{user?.name} {user?.surname}</Text>
|
||||
<SafeAreaView edges={['top']} className='pt-4'>
|
||||
{/* Header Section */}
|
||||
<View className="pb-6 px-4">
|
||||
<View className="flex-row justify-start items-center gap-4">
|
||||
<TouchableOpacity
|
||||
onPress={() => router.back()}
|
||||
>
|
||||
<ChevronLeft size={28} color="white" />
|
||||
</TouchableOpacity>
|
||||
<View className="flex-row items-center gap-4">
|
||||
<View className="w-16 h-16 rounded-full bg-white/20 items-center justify-center">
|
||||
<Text className="text-white font-bold text-2xl">{initials}</Text>
|
||||
</View>
|
||||
<View>
|
||||
<Text className="text-teal-100 text-lg font-medium uppercase tracking-wider mb-1">Profilo</Text>
|
||||
<Text className="text-white text-2xl font-bold">{user?.name} {user?.surname}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
|
||||
<ScrollView
|
||||
className="flex-1 bg-gray-50 rounded-t-[2.5rem] px-5 pt-8"
|
||||
contentContainerStyle={{ paddingBottom: 60, gap: 24 }}
|
||||
showsVerticalScrollIndicator={false}
|
||||
>
|
||||
{/* Card info - Testi ingranditi */}
|
||||
{/* Info Card - Enlarged Texts */}
|
||||
<View className="bg-white p-7 rounded-3xl shadow-sm border border-gray-100">
|
||||
{/* Titolo sezione ingrandito */}
|
||||
{/* Section title */}
|
||||
<Text className="text-2xl font-bold text-gray-800">Informazioni</Text>
|
||||
|
||||
<View className="mt-6 gap-5">
|
||||
<View className="flex-row items-center gap-5">
|
||||
{/* Icona leggermente più grande e container adattato */}
|
||||
<View className="w-14 h-14 bg-gray-100 rounded-2xl items-center justify-center">
|
||||
<Mail size={24} color="#374151" />
|
||||
</View>
|
||||
<View>
|
||||
{/* Label e valore ingranditi */}
|
||||
<Text className="text-lg text-gray-700 font-bold">Email</Text>
|
||||
<Text className="text-gray-500 text-base">{user?.email}</Text>
|
||||
</View>
|
||||
@@ -69,7 +70,7 @@ export default function ProfileScreen() {
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Actions - Testi e Pulsanti ingranditi */}
|
||||
{/* Actions */}
|
||||
<View>
|
||||
<Text className="text-gray-800 text-2xl font-bold mb-5 px-1">Azioni</Text>
|
||||
|
||||
@@ -86,7 +87,8 @@ export default function ProfileScreen() {
|
||||
<Text className="text-[#099499] text-base font-bold">Apri</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
<TouchableOpacity onPress={() => console.log('Apri impostazioni')} className="bg-white p-4 rounded-3xl shadow-sm flex-row items-center justify-between border border-gray-100 mb-4">
|
||||
{/* TODO: Settings not implemented at the moment */}
|
||||
{/* <TouchableOpacity onPress={() => console.log('Apri impostazioni')} className="bg-white p-4 rounded-3xl shadow-sm flex-row items-center justify-between border border-gray-100 mb-4">
|
||||
<View className="flex-row items-center gap-5">
|
||||
<View className="bg-gray-100 p-3.5 rounded-2xl">
|
||||
<Settings size={26} color="#374151" />
|
||||
@@ -97,7 +99,7 @@ export default function ProfileScreen() {
|
||||
</View>
|
||||
</View>
|
||||
<Text className="text-gray-400 text-base font-bold">Apri</Text>
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity> */}
|
||||
|
||||
<TouchableOpacity onPress={authContext.logOut} className="bg-white p-4 rounded-3xl shadow-sm flex-row items-center justify-between border border-gray-100">
|
||||
<View className="flex-row items-center gap-5">
|
||||
|
||||
Reference in New Issue
Block a user