Refactor components by removing unused imports and components.
This commit is contained in:
@@ -5,16 +5,15 @@ import { Image } from 'expo-image';
|
|||||||
import ImageView from "react-native-image-viewing";
|
import ImageView from "react-native-image-viewing";
|
||||||
import { useLocalSearchParams, useRouter, useFocusEffect } from 'expo-router';
|
import { useLocalSearchParams, useRouter, useFocusEffect } from 'expo-router';
|
||||||
import { ChevronLeft, ImageIcon, Users, HardHat, MapPin, Calendar as CalendarIcon, Briefcase, TextAlignStart, CheckCircle2, Wrench, Pencil } from 'lucide-react-native';
|
import { ChevronLeft, ImageIcon, Users, HardHat, MapPin, Calendar as CalendarIcon, Briefcase, TextAlignStart, CheckCircle2, Wrench, Pencil } from 'lucide-react-native';
|
||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useState } from 'react';
|
||||||
import { Dimensions, RefreshControl, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
import { Dimensions, RefreshControl, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||||
import { StatusBar } from 'expo-status-bar';
|
import { StatusBar } from 'expo-status-bar';
|
||||||
|
|
||||||
export default function ActivityDetailScreen() {
|
export default function ActivityDetailScreen() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const alert = useAlert();
|
const alert = useAlert();
|
||||||
const params = useLocalSearchParams();
|
const params = useLocalSearchParams();
|
||||||
const insets = useSafeAreaInsets();
|
|
||||||
|
|
||||||
const [activityData, setActivityData] = useState<any>(null);
|
const [activityData, setActivityData] = useState<any>(null);
|
||||||
const [placeName, setPlaceName] = useState<string>('');
|
const [placeName, setPlaceName] = useState<string>('');
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { View, Text, TouchableOpacity, TextInput, KeyboardAvoidingView, ScrollView, Platform, Dimensions, ActivityIndicator, Modal } from 'react-native';
|
import { View, Text, TouchableOpacity, TextInput, Dimensions, ActivityIndicator, Modal } from 'react-native';
|
||||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||||
import { useLocalSearchParams, useRouter } from 'expo-router';
|
import { useLocalSearchParams, useRouter } from 'expo-router';
|
||||||
import { StatusBar } from 'expo-status-bar';
|
import { StatusBar } from 'expo-status-bar';
|
||||||
|
|||||||
@@ -2,14 +2,13 @@ import { useAlert } from '@/components/AlertComponent';
|
|||||||
import LoadingScreen from '@/components/LoadingScreen';
|
import LoadingScreen from '@/components/LoadingScreen';
|
||||||
import api from '@/utils/api';
|
import api from '@/utils/api';
|
||||||
import { Plus, Filter, Newspaper, ShoppingBag } from 'lucide-react-native';
|
import { Plus, Filter, Newspaper, ShoppingBag } from 'lucide-react-native';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState, useCallback } from 'react';
|
||||||
import { RefreshControl, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
import { RefreshControl, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||||
import FilterModal from '@/components/FilterModal';
|
import FilterModal from '@/components/FilterModal';
|
||||||
import { Place, ActivityItem } from '@/types/types';
|
import { Place, ActivityItem } from '@/types/types';
|
||||||
import { useRouter, useFocusEffect } from 'expo-router';
|
import { useRouter, useFocusEffect } from 'expo-router';
|
||||||
import { StatusBar } from 'expo-status-bar';
|
import { StatusBar } from 'expo-status-bar';
|
||||||
import { useCallback } from 'react';
|
|
||||||
|
|
||||||
export default function JournalScreen() {
|
export default function JournalScreen() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ const TOOLTIP_BASE = {
|
|||||||
const screenWidth = Dimensions.get("window").width;
|
const screenWidth = Dimensions.get("window").width;
|
||||||
|
|
||||||
export default function DashboardScreen() {
|
export default function DashboardScreen() {
|
||||||
const router = useRouter();
|
|
||||||
const alert = useAlert();
|
|
||||||
|
|
||||||
const [chartData, setChartData] = useState<any>({
|
const [chartData, setChartData] = useState<any>({
|
||||||
costiRicavi: null,
|
costiRicavi: null,
|
||||||
|
|||||||
+2
-5
@@ -24,13 +24,10 @@ export default function LoginScreen() {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
username.trim();
|
|
||||||
password.trim();
|
|
||||||
|
|
||||||
// Execute login request
|
// Execute login request
|
||||||
const response = await api.post("/user/login", {
|
const response = await api.post("/user/login", {
|
||||||
username: username,
|
username: username.trim(),
|
||||||
password: password
|
password: password.trim()
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.data && response.data.success === false) {
|
if (response.data && response.data.success === false) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { View, Text, TouchableOpacity } from 'react-native';
|
import { View, Text, TouchableOpacity } from 'react-native';
|
||||||
import { ChevronLeft, ChevronRight } from 'lucide-react-native';
|
import { ChevronLeft, ChevronRight } from 'lucide-react-native';
|
||||||
import { TimeOffRequest, TimeOffRequestType } from '@/types/types';
|
import { TimeOffRequest, TimeOffRequestType } from '@/types/types';
|
||||||
@@ -82,10 +82,6 @@ export default function CalendarWidget({ events, types, onMonthChange, initialDa
|
|||||||
const day = i + 1;
|
const day = i + 1;
|
||||||
const event = getEventForDay(day);
|
const event = getEventForDay(day);
|
||||||
|
|
||||||
let bgClass = 'bg-transparent';
|
|
||||||
let textClass = 'text-gray-700';
|
|
||||||
let borderClass = 'border-transparent';
|
|
||||||
|
|
||||||
const bgColor = event?.timeOffRequestType?.color ? `${event.timeOffRequestType.color}25` : 'transparent';
|
const bgColor = event?.timeOffRequestType?.color ? `${event.timeOffRequestType.color}25` : 'transparent';
|
||||||
const borderColor = event?.timeOffRequestType?.color || 'transparent';
|
const borderColor = event?.timeOffRequestType?.color || 'transparent';
|
||||||
const textColor = event ? event.timeOffRequestType?.color : '#374151';
|
const textColor = event ? event.timeOffRequestType?.color : '#374151';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ConstructionSite } from '@/types/types';
|
import { ConstructionSite } from '@/types/types';
|
||||||
import { Building2, MapPin } from 'lucide-react-native';
|
import { Building2 } from 'lucide-react-native';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Text, TouchableOpacity, View } from 'react-native';
|
import { Text, TouchableOpacity, View } from 'react-native';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { View, Text } from 'react-native';
|
import { View, Text } from 'react-native';
|
||||||
import { CheckCircle2, AlertTriangle, Briefcase, Calendar, MapPin } from 'lucide-react-native';
|
import { CheckCircle2, AlertTriangle, Calendar, MapPin } from 'lucide-react-native';
|
||||||
import { QualityControlItem } from '@/types/types';
|
import { QualityControlItem } from '@/types/types';
|
||||||
|
|
||||||
interface QualityControlCardProps {
|
interface QualityControlCardProps {
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
import {
|
|
||||||
KeyboardAvoidingView,
|
|
||||||
Modal,
|
|
||||||
Platform,
|
|
||||||
Text,
|
|
||||||
TextInput,
|
|
||||||
TouchableOpacity,
|
|
||||||
View,
|
|
||||||
Keyboard,
|
|
||||||
ScrollView
|
|
||||||
} from 'react-native';
|
|
||||||
import { X } from 'lucide-react-native';
|
|
||||||
|
|
||||||
interface SetDescriptionModalProps {
|
|
||||||
visible: boolean;
|
|
||||||
initialDescription: string;
|
|
||||||
onClose: () => void;
|
|
||||||
onSave: (desc: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function SetDescriptionModal({
|
|
||||||
visible,
|
|
||||||
initialDescription,
|
|
||||||
onClose,
|
|
||||||
onSave
|
|
||||||
}: SetDescriptionModalProps) {
|
|
||||||
const [desc, setDesc] = useState(initialDescription);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (visible) {
|
|
||||||
setDesc(initialDescription || '');
|
|
||||||
}
|
|
||||||
}, [visible, initialDescription]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
visible={visible}
|
|
||||||
transparent
|
|
||||||
animationType="slide"
|
|
||||||
statusBarTranslucent
|
|
||||||
onRequestClose={onClose}
|
|
||||||
>
|
|
||||||
<KeyboardAvoidingView
|
|
||||||
behavior={Platform.OS === 'ios' ? 'padding' : 'padding'}
|
|
||||||
className="flex-1"
|
|
||||||
>
|
|
||||||
<View className="flex-1 bg-black/60 justify-end">
|
|
||||||
|
|
||||||
{/* Backdrop */}
|
|
||||||
<TouchableOpacity
|
|
||||||
className="flex-1 w-full"
|
|
||||||
onPress={() => {
|
|
||||||
Keyboard.dismiss();
|
|
||||||
onClose();
|
|
||||||
}}
|
|
||||||
activeOpacity={1}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<View className="bg-white w-full rounded-t-[2.5rem] p-6 shadow-2xl max-h-[85%]">
|
|
||||||
|
|
||||||
{/* Header */}
|
|
||||||
<View className="flex-row justify-between items-center mb-6">
|
|
||||||
<Text className="text-2xl font-bold text-gray-800">Descrizione Foto</Text>
|
|
||||||
<TouchableOpacity onPress={onClose} className="p-2 bg-gray-100 rounded-full">
|
|
||||||
<X size={24} color="#4b5563" />
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
{/* Text Area with Scroll */}
|
|
||||||
<ScrollView
|
|
||||||
className="mb-6"
|
|
||||||
showsVerticalScrollIndicator={false}
|
|
||||||
keyboardShouldPersistTaps="handled"
|
|
||||||
bounces={false}
|
|
||||||
>
|
|
||||||
<TextInput
|
|
||||||
className="bg-gray-50 border border-gray-200 rounded-2xl p-4 text-base text-gray-800"
|
|
||||||
placeholder="Inserisci una descrizione... (max 250 caratteri)"
|
|
||||||
placeholderTextColor="#9ca3af"
|
|
||||||
multiline
|
|
||||||
maxLength={250}
|
|
||||||
value={desc}
|
|
||||||
onChangeText={setDesc}
|
|
||||||
style={{ minHeight: 120, maxHeight: 200, textAlignVertical: 'top' }}
|
|
||||||
/>
|
|
||||||
<Text className={`text-right mt-2 text-sm font-medium ${desc.length >= 250 ? 'text-red-500' : 'text-gray-500'}`}>
|
|
||||||
{desc.length}/250
|
|
||||||
</Text>
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
{/* Actions */}
|
|
||||||
<View className="flex-row gap-4 mb-4">
|
|
||||||
<TouchableOpacity
|
|
||||||
onPress={onClose}
|
|
||||||
className="flex-1 py-4 bg-gray-200 rounded-2xl shadow-sm active:bg-gray-300"
|
|
||||||
>
|
|
||||||
<Text className="text-gray-700 text-center font-bold text-lg">Annulla</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
|
|
||||||
<TouchableOpacity
|
|
||||||
onPress={() => onSave(desc)}
|
|
||||||
className="flex-1 py-4 rounded-2xl shadow-lg active:scale-[0.98] bg-[#1071C2]"
|
|
||||||
>
|
|
||||||
<Text className="text-white text-center font-bold text-lg">Salva</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</KeyboardAvoidingView>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -96,7 +96,7 @@ export default function SupplierFilter({ selectedSupplierId, onSupplierSelect, t
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* Nested Place Picker Modal */}
|
{/* Nested Supplier Picker Modal */}
|
||||||
<Modal visible={showPicker} transparent={true} animationType="fade" onRequestClose={() => setShowPicker(false)}>
|
<Modal visible={showPicker} transparent={true} animationType="fade" onRequestClose={() => setShowPicker(false)}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
activeOpacity={1}
|
activeOpacity={1}
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ipcostruzioni_app",
|
"name": "progeco_app",
|
||||||
"main": "expo-router/entry",
|
"main": "expo-router/entry",
|
||||||
"version": "1.7.0",
|
"version": "1.6",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "expo start",
|
"start": "expo start",
|
||||||
"reset-project": "node ./scripts/reset-project.js",
|
"reset-project": "node ./scripts/reset-project.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user