diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-11-24 21:13:47 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-11-24 21:17:05 +0100 |
| commit | f3756dac8a49f3b5599fd50f4c631da4168e9eb0 (patch) | |
| tree | a84d95e30269d4b368b741ffd1a781b7cfbb1988 /static/index.js | |
| parent | 97b35ce73fab8a84d4d3e6807618a252efcf4cd9 (diff) | |
add jump-to month
Diffstat (limited to 'static/index.js')
| -rw-r--r-- | static/index.js | 11 |
1 files changed, 7 insertions, 4 deletions
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({ |