From f86d11c3ce1f04ee89da235d78447aed6d6d7130 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Mon, 5 May 2025 22:56:56 -0500 Subject: albums page and a bunch of stuff --- src/albums.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/albums.js (limited to 'src/albums.js') 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 +} -- cgit v1.2.3