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

@@ -58,15 +58,15 @@ export function AuthProvider({ children }: PropsWithChildren) {
useEffect(() => {
const initApp = async () => {
try {
// 1. Recupero Token salvato
// Get saved Token from SecureStore
const savedToken = await SecureStore.getItemAsync(KEY_TOKEN);
if (savedToken) {
console.log("Token trovato: ", savedToken);
// 2. Chiamata al backend per verificare il token e scaricare i dati utente
// Nota: api.ts aggiunge già l'header Authorization grazie all'interceptor (se configurato per leggere da SecureStore)
// Se il tuo api.ts legge da AsyncStorage, assicurati che siano allineati, altrimenti passalo a mano qui:
// Call backend to verify token and fetch user data
// Note: api.ts already adds the Authorization header thanks to the interceptor (if configured to read from SecureStore)
// If your api.ts reads from AsyncStorage, make sure they are aligned, otherwise pass it manually here:
const response = await api.get("/user/info", {
headers: { Authorization: `Bearer ${savedToken}` }
});
@@ -75,13 +75,13 @@ export function AuthProvider({ children }: PropsWithChildren) {
const userData = result.user;
console.log("Sessione valida, dati utente caricati:", userData);
// 3. Mappatura dati (Backend -> Frontend)
// Il backend actionMe ritorna: { id, username, role }
// Data mapping (Backend -> Frontend)
// The backend actionMe returns: { id, username, role }
const loadedUser: UserData = {
id: userData.id,
username: userData.username,
role: userData.role,
// Gestiamo i campi opzionali se il backend non li manda ancora
// Handle optional fields if the backend doesn't send them yet
name: userData.name,
surname: userData.surname || '',
email: userData.email || '',
@@ -96,7 +96,7 @@ export function AuthProvider({ children }: PropsWithChildren) {
} catch (error: any) {
console.error('Errore inizializzazione (Token scaduto o Server down):', error.message);
// Se il token non è valido, puliamo tutto
// If the token is not valid, clear everything
await SecureStore.deleteItemAsync(KEY_TOKEN);
setIsAuthenticated(false);
setUser(null);
@@ -109,7 +109,7 @@ export function AuthProvider({ children }: PropsWithChildren) {
initApp();
}, []);
// Protezione rotte (opzionale, ma consigliata qui o nel Layout)
// Route protection (optional, but recommended here or in the Layout)
useEffect(() => {
if (!isReady) return;