Refactor: Remove obsolete JavaScript managers and utilities

- Deleted NavigationManager, RecentPlotsManager, SearchManager, SortManager, StatsManager, ThemeManager, Utils, and ViewManager classes.
- Updated gallery builder to improve asset copying logic with a more efficient modification time check.
- Cleaned up gallery HTML template by removing subdirectory listing and embedding gallery data as JSON.
- Added CLAUDE.md for project documentation and guidelines.
This commit is contained in:
Kylian Schmidt
2026-05-06 08:34:40 +02:00
parent 6f0cf4521b
commit 6738c4ca69
44 changed files with 205 additions and 5239 deletions
+11 -6
View File
@@ -2,7 +2,7 @@
import shutil
from pathlib import Path
from typing import Dict, Any, Optional
from typing import Dict, Any, Optional, Union
from jinja2 import Environment, FileSystemLoader, Template
from gallery.config import GalleryConfig
@@ -22,7 +22,7 @@ from gallery.utils.processing import (
)
def get_template(template_dir: Optional[Path | str] = None):
def get_template(template_dir: Optional[Union[Path, str]] = None):
"""
Get the Jinja2 template for gallery rendering.
@@ -167,11 +167,16 @@ def copy_assets(
gallery_root = Path(config.web_folder) / config.plot_root
assets_dst = gallery_root.parent / "assets"
main_css_src = assets_src / "css" / "main.css"
main_css_dst = assets_dst / "css" / "main.css"
# Use the newest mtime across all source asset files as the staleness check,
# so any change to any JS/CSS file triggers a redeploy.
sentinel_dst = assets_dst / "css" / "main.css"
newest_src_mtime = max(
(f.stat().st_mtime for f in assets_src.rglob('*') if f.is_file()),
default=0,
)
dst_mtime = sentinel_dst.stat().st_mtime if sentinel_dst.exists() else 0
if (not assets_dst.exists() or
needs_update(main_css_src, main_css_dst)):
if not assets_dst.exists() or newest_src_mtime > (dst_mtime + 30):
if assets_dst.exists():
shutil.rmtree(assets_dst)
shutil.copytree(assets_src, assets_dst)