summaryrefslogtreecommitdiff
path: root/src/albums.js
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2025-05-05 22:56:56 -0500
committerTim Keller <tjk@tjkeller.xyz>2025-05-05 22:56:56 -0500
commitf86d11c3ce1f04ee89da235d78447aed6d6d7130 (patch)
treef253642b156ba296c9a5f9211ae95b62da3ccfb5 /src/albums.js
parentbae5fe5501117df1b16da1aeb3355056d6882648 (diff)
downloadimmich-frame-f86d11c3ce1f04ee89da235d78447aed6d6d7130.tar.xz
immich-frame-f86d11c3ce1f04ee89da235d78447aed6d6d7130.zip
albums page and a bunch of stuff
Diffstat (limited to 'src/albums.js')
-rw-r--r--src/albums.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/albums.js b/src/albums.js
new file mode 100644
index 0000000..5628e6d
--- /dev/null
+++ b/src/albums.js
@@ -0,0 +1,26 @@
+import immichConnector from "./immich.js"
+
+export default async function initAlbums(albumsPageContainer) {
+ // TODO empty cells animation
+
+ const albumsContainer = albumsPageContainer.querySelector("#albums-container")
+ const albumTemplate = albumsPageContainer.querySelector("#album-template")
+ async function createAlbum(res) {
+ console.log(res.albumName, res.id, res.startDate, res.endDate, res.assetCount, res.shared)
+ const albumClone = albumTemplate.content.cloneNode(true)
+ albumClone.querySelector(".album-thumb").src = await immichConnector.fetchImageSrc(res.albumThumbnailAssetId)
+ albumClone.querySelector(".album-name").textContent = res.albumName
+ albumClone.querySelector(".album-assets-count").textContent = res.assetCount.toLocaleString()
+ if (!res.shared)
+ albumClone.querySelector(".album-shared").remove()
+
+ albumsContainer.appendChild(albumClone)
+ }
+
+ const albumsResponse = await immichConnector.fetchAlbums()
+
+ for (const res of albumsResponse)
+ createAlbum(res)
+
+ return true
+}