React/TypeScript/Vite/Tailwind prototype from the design session (login, dashboard, photos, backups, settings views with mocked API layer). Infra work (Rust services, Ansible, OpenTofu) follows in subsequent commits. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
18 lines
598 B
TypeScript
18 lines
598 B
TypeScript
import { useEffect, useState } from 'react';
|
|
import { getAlbums, getPhotoTiles } from '../api/photos';
|
|
import type { Album, PhotoScope, PhotoTile } from '../types';
|
|
|
|
const SCOPES: PhotoScope[] = ['Tout', 'Personnes', 'Lieux'];
|
|
|
|
export function usePhotos() {
|
|
const [albums, setAlbums] = useState<Album[]>([]);
|
|
const [tiles, setTiles] = useState<PhotoTile[]>([]);
|
|
const [scope, setScope] = useState<PhotoScope>('Tout');
|
|
|
|
useEffect(() => {
|
|
void getAlbums().then(setAlbums);
|
|
void getPhotoTiles().then(setTiles);
|
|
}, []);
|
|
|
|
return { albums, tiles, scopes: SCOPES, scope, setScope };
|
|
}
|