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

@@ -13,21 +13,19 @@ export default function LoginScreen() {
const [showPassword, setShowPassword] = useState(false);
const [isLoading, setIsLoading] = useState(false);
// TODO: Riscrivere funzione per migliorare leggibilità e gestione errori
// Login Handler function
const handleLogin = async () => {
// TODO: Implementa toast o messaggio di errore più user-friendly
if (!username || !password) {
alert.showAlert('error', 'Attenzione', 'Inserisci username e password');
return;
}
setIsLoading(true);
try {
username.trim();
password.trim();
// Esegui richiesta di login
// Execute login request
const response = await api.post("/user/login", {
username: username,
password: password
@@ -35,25 +33,24 @@ export default function LoginScreen() {
const { token, user } = response.data;
console.log("Login successo, token ricevuto.");
console.log("Login riuscito. Token:", token);
console.log("Dati utente:", user);
// Passiamo token e dati utente al context che gestirà salvataggio e redirect
// Pass token and user data to the context which will handle saving and redirect
authContext.logIn(token, user);
} catch (error: any) {
console.error("Login Error:", error);
let message = "Si è verificato un errore durante l'accesso.";
if (error.response) {
// Errore dal server (es. 401 Credenziali errate)
// Server error (e.g., 401 Invalid credentials)
if (error.response.status === 401) {
// TODO: Alert o Toast specifico per credenziali errate
message = "Credenziali non valide."
} else {
message = `Errore Server: ${error.response.data.message || error.response.status}`;
}
} else if (error.request) {
// Server non raggiungibile
// Server not reachable
message = "Impossibile contattare il server. Controlla la connessione.";
}
@@ -65,7 +62,7 @@ export default function LoginScreen() {
return (
<View className="flex-1 bg-[#099499] h-screen overflow-hidden">
{/* Header con Logo/Titolo */}
{/* Header with Logo/Title */}
<View className="h-[35%] flex-column justify-center items-center">
<Image
source={require('@/assets/images/mariani-logo.png')}
@@ -120,12 +117,13 @@ export default function LoginScreen() {
)}
</TouchableOpacity>
</View>
{/* TODO: Implement password recovery functionality */}
<TouchableOpacity className="mt-3 self-end" style={{ alignSelf: 'flex-end' }}>
<Text className="text-[#099499] font-bold text-base">Password dimenticata?</Text>
</TouchableOpacity>
</View>
{/* Tasto Login */}
{/* Login Button */}
<TouchableOpacity
onPress={handleLogin}
activeOpacity={0.8}