From f3756dac8a49f3b5599fd50f4c631da4168e9eb0 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 24 Nov 2025 21:13:47 +0100 Subject: add jump-to month --- static/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'static/index.js') diff --git a/static/index.js b/static/index.js index c5bfccc..e67d234 100644 --- a/static/index.js +++ b/static/index.js @@ -1,6 +1,6 @@ import * as sfw from 'sfw'; import * as api from 'api'; -import { literal as m } from './month.js'; +import Month from './month.js'; import * as service_worker from './service-worker/index.js'; import LoginView from './pages/login/index.js'; @@ -19,8 +19,12 @@ const image_viewer = ImageViewer.new(); const reload = () => { image_viewer.clear(); api.images.list().then(images => { + const last = Month.from_unix(images[0].timestamp); + let first = Month.from_unix(images.findLast(i => i.timestamp).timestamp); + month_select.months = first.to(last); + for (const image of images) { - image_viewer.add(image.id); + image_viewer.add(image); } }); } @@ -50,9 +54,8 @@ const search = Search.new({ }); const month_select = MonthSelect.new({ - months: m`2019-08`.to(m`2025-11`), + onmonth: (month) => image_viewer.jump_to(month), }); - const upload_bar = UploadBar.new(); const settings = SettingsView.new({ -- cgit v1.2.3-70-g09d2