aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-12-23 23:03:31 +0100
committerPřemysl Eric Janouch <p@janouch.name>2023-12-23 23:03:31 +0100
commite25b07e5987bd7a2b70b57e21b0eed6607f1b2d9 (patch)
treea667926419c496b0875213e5c3582a5af6dc2361 /public
parent20a102a047c85053db96c85b7bf2f760d7e90c6d (diff)
downloadgallery-e25b07e5987bd7a2b70b57e21b0eed6607f1b2d9.tar.gz
gallery-e25b07e5987bd7a2b70b57e21b0eed6607f1b2d9.tar.xz
gallery-e25b07e5987bd7a2b70b57e21b0eed6607f1b2d9.zip
Implement orphans
Diffstat (limited to 'public')
-rw-r--r--public/gallery.js36
-rw-r--r--public/style.css7
2 files changed, 37 insertions, 6 deletions
diff --git a/public/gallery.js b/public/gallery.js
index 222bde5..96f0216 100644
--- a/public/gallery.js
+++ b/public/gallery.js
@@ -371,15 +371,45 @@ let OrphansModel = {
},
}
+let OrphansReplacement = {
+ view(node) {
+ const info = vnode.attrs.info
+ if (!info)
+ return []
+
+ return [
+ ` → `,
+ m(m.route.Link, {href: `/view/${info.sha1}`},
+ m('img.thumbnail', {src: `/thumb/${info.sha1}`,
+ width: info.thumbW, height: info.thumbH, loading})),
+ `${info.tags} tags`,
+ ]
+ },
+}
+
+let OrphansRow = {
+ view(node) {
+ const info = vnode.attrs.info
+ return m('.row', [
+ m('img.thumbnail', {src: `/thumb/${info.sha1}`,
+ width: info.thumbW, height: info.thumbH, loading}),
+ `${info.tags} tags`,
+ m(OrphansReplacement, {info: info.replacement}),
+ ])
+ },
+}
+
let OrphansList = {
// See BrowseView.
oncreate(vnode) { vnode.dom.focus() },
view(vnode) {
- let children = (DuplicatesModel.entries.length == 0)
+ let children = (OrphansModel.entries.length == 0)
? "No orphans"
- : OrphansModel.entries.map(group =>
- m('.row', "TODO"))
+ : OrphansModel.entries.map(info => [
+ m("h3", info.lastPath),
+ m(OrphansRow, {info}),
+ ])
return m('.orphans[tabindex=0]', {}, children)
},
}
diff --git a/public/style.css b/public/style.css
index 978e01b..0276e43 100644
--- a/public/style.css
+++ b/public/style.css
@@ -59,6 +59,7 @@ img.thumbnail { display: block; box-shadow: 0 0 3px rgba(0, 0, 0, 0.75);
.similar .row { display: flex; margin: .5rem 0; }
.similar .row ul { margin: 0; padding: 0 0 0 1.25em; list-style-type: "- "; }
-.duplicates { padding: .5rem; flex-grow: 1; overflow: auto; }
-.duplicates .row { display: flex; margin: .5rem 0;
- align-items: center; gap: 3px; }
+.duplicates,
+.orphans { padding: .5rem; flex-grow: 1; overflow: auto; }
+.duplicates .row,
+.orphans .row { display: flex; margin: .5rem 0; align-items: center; gap: 3px; }