#101 Add loading spinner

This commit is contained in:
Alan Grainger
2025-07-11 21:09:06 +02:00
parent fe3ad806ff
commit a7d7bf22b8
7 changed files with 43 additions and 8 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "immich-public-proxy",
"version": "1.11.4",
"version": "1.11.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "immich-public-proxy",
"version": "1.11.4",
"version": "1.11.5",
"license": "AGPL-3.0",
"dependencies": {
"archiver": "^7.0.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "immich-public-proxy",
"version": "1.11.4",
"version": "1.11.5",
"scripts": {
"dev": "ts-node src/index.ts",
"build": "npx tsc",
+23
View File
@@ -68,3 +68,26 @@ html {
#download-all {
margin: auto 4px auto auto;
}
#loading-spinner {
text-align: center;
margin: 75px 0;
}
.loader {
width: 48px;
height: 48px;
border: 5px solid #888;
border-bottom-color: transparent;
border-radius: 50%;
display: inline-block;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
+3
View File
@@ -68,6 +68,9 @@ class LGallery {
})
this.index += PER_PAGE
this.lightGallery.refresh()
} else {
// Remove the loading spinner once all items are loaded
document.getElementById('loading-spinner')?.remove()
}
}
}
+12
View File
@@ -254,6 +254,18 @@ class Immich {
return baseUrl + query
}
/**
* Return the correct preview size, depending on the image MIME type
*/
getPreviewImageSize (asset: Asset) {
// For certain media types, use the original file rather than the preview
if (['image/gif'].includes(asset.originalMimeType || '')) {
return ImageSize.original
} else {
return ImageSize.preview
}
}
/**
* Return the image data URL for a photo
*/
+1 -5
View File
@@ -119,11 +119,7 @@ class Render {
}
const thumbnailUrl = baseUrl + immich.photoUrl(share.key, asset.id, ImageSize.thumbnail)
// For certain media types, use the original file rather than the preview
const originalSizeMimes = ['image/gif']
const previewUrl = immich.photoUrl(share.key, asset.id, originalSizeMimes.includes(asset.originalMimeType || '') ? ImageSize.original : ImageSize.preview)
const previewUrl = immich.photoUrl(share.key, asset.id, immich.getPreviewImageSize(asset))
const description = getConfigOption('ipp.showMetadata.description', false) && typeof asset?.exifInfo?.description === 'string' ? asset.exifInfo.description.replace(/'/g, ''') : ''
// Create the full HTML element source to pass to the gallery view
+1
View File
@@ -35,6 +35,7 @@
%><%- item.html %>
<% }) %>
</div>
<div id="loading-spinner"><span class="loader"></span></div>
<script src="/share/static/web.js"></script>
<script src="/share/static/lg/lightgallery.min.js"></script>
<script src="/share/static/lg/lg-fullscreen.min.js"></script>