aboutsummaryrefslogtreecommitdiff
path: root/static/index.js
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-05-18 17:02:32 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-05-18 17:02:32 +0200
commit70994ddaf48a92d062977bc667c72685a4ccb815 (patch)
tree262dd69b72804e00356cd8c98bb2a93d5668d368 /static/index.js
parent2115198c6a292dce97cfb411e939b10c39ca24c1 (diff)
try to use bun for bundling
Diffstat (limited to 'static/index.js')
-rw-r--r--static/index.js17
1 files changed, 5 insertions, 12 deletions
diff --git a/static/index.js b/static/index.js
index 5979d86..ddbead7 100644
--- a/static/index.js
+++ b/static/index.js
@@ -1,7 +1,6 @@
import * as sfw from 'sfw';
import * as api from 'api';
import Month from './month.js';
-import * as service_worker from './service-worker/index.js';
import LoginView from './pages/login/index.js';
import MainView from './pages/main/index.js';
@@ -12,24 +11,18 @@ import SettingsView from './pages/settings/index.js';
import ShuffleView from './pages/shuffle/index.js';
import UploadBar from './widgets/upload-bar/index.js';
-await service_worker.register()
-
-sfw.theme.add_css(await sfw.css(import.meta.url, './index.css'));
+import stylesheet from './index.css';
+sfw.theme.add_css(await sfw.css.sheet(stylesheet));
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);
- }
-
- image_viewer.preload_all();
+ image_viewer.images = images;
shuffle.images = images;
});
}
@@ -90,11 +83,11 @@ const main = MainView.new({
month_select.show();
},
onupload: async () => {
- const uploader = await api.images.upload_to_timeline();
-
upload_bar.progress = 0;
upload_bar.show();
+ const uploader = await api.images.upload_to_timeline();
+
uploader.onprogress = (count, total) => {
upload_bar.progress = count / total;
}