diff --git a/.claude/rules/screenshots.md b/.claude/rules/screenshots.md new file mode 100644 index 0000000..f1dc266 --- /dev/null +++ b/.claude/rules/screenshots.md @@ -0,0 +1,34 @@ +# Règles — Captures d'écran + +## Emplacement +Les captures d'écran sont disponibles à l'emplacement suivant : + +``` +/home/Gato/Images/Captures d'écran/ +``` + +## Quand les consulter +- Lorsque l'utilisateur mentionne une capture d'écran sans fournir de chemin explicite. +- Lorsqu'un bug visuel ou un comportement d'interface est décrit — consulter la capture la plus récente pour avoir le contexte visuel. +- Lorsqu'une tâche porte sur l'UI et qu'une illustration de l'état actuel est utile. +- Après avoir relancé l'application pour vérifier un changement visuel. + +## Comportement attendu +- Lire le fichier le plus récent du dossier (tri par date de modification). +- Ne pas demander à l'utilisateur de fournir le chemin si la capture se trouve dans ce dossier. +- Ne pas demander à l'utilisateur de prendre une capture d'écran. +- **Ne jamais prendre de capture d'écran de façon autonome** (`scrot`, `grim`, `gnome-screenshot`, `import`, etc.). + +## Note technique +Le nom du dossier contient un `é` dont l'encodage n'est pas résolu correctement par `ls` ni `find`. Utiliser **Python `os.scandir`** pour lister les fichiers : + +```python +import os, shutil +base = "/home/Gato/Images" +for entry in os.scandir(base): + if "Captures" in entry.name: + files = sorted(os.scandir(entry.path), key=lambda e: e.stat().st_mtime, reverse=True) + shutil.copy(files[0].path, '/tmp/screenshot.png') +``` + +Puis lire `/tmp/screenshot.png` avec le tool `Read`. diff --git a/src/index.html b/src/index.html index e841062..f928ac8 100644 --- a/src/index.html +++ b/src/index.html @@ -17,6 +17,10 @@ +
Impossible de charger le fichier : ${err}
`; @@ -120,6 +188,7 @@ async function loadPage(filePath) { async function openPath(path, mode) { currentPath = path; currentMode = mode; + saveRecent(path, mode); if (mode === 'file') { sidebar.innerHTML = ''; @@ -153,6 +222,8 @@ async function openPath(path, mode) { } } +renderRecents(); + document.getElementById('btn-open-file').addEventListener('click', async () => { const selected = await window.__TAURI__.dialog.open({ multiple: false, diff --git a/src/style.css b/src/style.css index e2fc34d..e0a6304 100644 --- a/src/style.css +++ b/src/style.css @@ -61,6 +61,79 @@ body { transform: translateY(0); } +/* ── Home recents ── */ +.home-recents { + margin-top: 40px; + width: 320px; +} + +.home-recents__label { + color: rgba(255,255,255,0.3); + font-size: 11px; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.08em; + margin: 0 0 10px; +} + +.home-recents__list { + list-style: none; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + gap: 4px; +} + +.home-recents__item { + display: flex; + align-items: center; + gap: 10px; + padding: 9px 14px; + border-radius: 8px; + cursor: pointer; + transition: background 0.15s; + text-align: left; + background: rgba(255,255,255,0.04); + border: none; + width: 100%; + font-family: 'Poppins', sans-serif; +} + +.home-recents__item:hover { + background: rgba(255,255,255,0.08); +} + +.home-recents__item__icon { + font-size: 15px; + flex-shrink: 0; + opacity: 0.7; +} + +.home-recents__item__info { + display: flex; + flex-direction: column; + overflow: hidden; +} + +.home-recents__item__name { + color: rgba(255,255,255,0.85); + font-size: 14px; + font-weight: 500; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.home-recents__item__path { + color: rgba(255,255,255,0.3); + font-size: 11px; + font-weight: 400; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + /* ── Sidebar ── */ .sidebar { position: fixed; @@ -152,6 +225,98 @@ body { opacity: 1; } +/* ── Tree nav ── */ +.nav-tree { list-style: none; margin: 0; padding: 0; } +.nav-tree li { margin: 0; } + +.nav-root-link { + display: block; + padding: 7px 24px; + color: rgba(255,255,255,0.85); + text-decoration: none; + font-size: 16px; + font-weight: 400; + line-height: 1.4; + transition: color 0.2s; +} +.nav-root-link:hover { color: #ff5577; } +.nav-root-link.active { color: #ff5577; font-weight: 500; } + +.nav-folder { margin: 0; } +.nav-folder > summary { + display: flex; + align-items: center; + list-style: none; + cursor: default; + user-select: none; + padding: 0; +} +.nav-folder > summary::-webkit-details-marker { display: none; } + +.nav-arrow { + display: inline-flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + width: 28px; + height: 28px; + font-size: 9px; + opacity: 0.4; + cursor: pointer; + transition: transform 0.18s, opacity 0.2s; + border-radius: 4px; + color: rgba(255,255,255,0.7); +} +.nav-arrow:hover { opacity: 1; background: rgba(255,255,255,0.08); } +.nav-folder[open] > summary .nav-arrow { transform: rotate(90deg); opacity: 0.8; } + +.nav-folder-link, .nav-folder-name { + flex: 1; + display: block; + padding: 6px 24px 6px 0; + font-size: 11px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.08em; + color: rgba(255,255,255,0.35); + text-decoration: none; + transition: color 0.2s; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.nav-folder-link:hover { color: rgba(255,255,255,0.85); } +.nav-folder-link.active { color: #ff5577; } + +.nav-folder .nav-folder > summary .nav-folder-link, +.nav-folder .nav-folder > summary .nav-folder-name { + font-size: 13px; + font-weight: 500; + text-transform: none; + letter-spacing: 0; + color: rgba(255,255,255,0.45); +} +.nav-folder .nav-folder > summary .nav-folder-link:hover { color: rgba(255,255,255,0.9); } + +.nav-file-link { + display: block; + text-decoration: none; + font-size: 14px; + font-weight: 400; + line-height: 1.4; + color: rgba(255,255,255,0.55); + transition: color 0.2s; +} +.nav-file-link:hover { color: #ff5577; } +.nav-file-link.active { color: #ff5577; font-weight: 500; } + +.nav-depth-1 > .nav-file-link { padding: 5px 24px 5px 52px; } +.nav-depth-1 > .nav-folder > summary { padding-left: 24px; } +.nav-depth-2 > .nav-file-link { padding: 4px 24px 4px 68px; } +.nav-depth-2 > .nav-folder > summary { padding-left: 40px; } +.nav-depth-3 > .nav-file-link { padding: 4px 24px 4px 84px; } +.nav-depth-3 > .nav-folder > summary { padding-left: 56px; } + /* ── Content ── */ .content { margin-left: 264px;