1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-25 15:59:38 +02:00

feat: implement Immich integration with CRUD API, add serializer, and enhance frontend components

This commit is contained in:
Sean Morley 2025-01-02 13:34:51 -05:00
parent 5d12d103fc
commit cee9f16cf5
12 changed files with 317 additions and 8 deletions

View file

@ -191,7 +191,7 @@
<!-- action options dropdown -->
{#if type != 'link'}
{#if adventure.user_id == user?.uuid || (collection && user && collection.shared_with.includes(user.uuid))}
{#if adventure.user_id == user?.uuid || (collection && user && collection.shared_with?.includes(user.uuid))}
<div class="dropdown dropdown-end">
<div tabindex="0" role="button" class="btn btn-neutral-200">
<DotsHorizontal class="w-6 h-6" />

View file

@ -228,6 +228,8 @@
let immichSearchValue: string = '';
let immichError: string = '';
let immichNext: string = '';
let immichPage: number = 1;
async function searchImmich() {
let res = await fetch(`/api/integrations/immich/search/?query=${immichSearchValue}`);
@ -245,6 +247,44 @@
} else {
immichError = $t('immich.no_items_found');
}
if (data.next) {
immichNext =
'/api/integrations/immich/search?query=' +
immichSearchValue +
'&page=' +
(immichPage + 1);
} else {
immichNext = '';
}
}
}
async function loadMoreImmich() {
let res = await fetch(immichNext);
if (!res.ok) {
let data = await res.json();
let errorMessage = data.message;
console.log(errorMessage);
immichError = $t(data.code);
} else {
let data = await res.json();
console.log(data);
immichError = '';
if (data.results && data.results.length > 0) {
immichImages = [...immichImages, ...data.results];
} else {
immichError = $t('immich.no_items_found');
}
if (data.next) {
immichNext =
'/api/integrations/immich/search?query=' +
immichSearchValue +
'&page=' +
(immichPage + 1);
immichPage++;
} else {
immichNext = '';
}
}
}
@ -1077,6 +1117,11 @@ it would also work to just use on:click on the MapLibre component itself. -->
</button>
</div>
{/each}
{#if immichNext}
<button class="btn btn-neutral" on:click={loadMoreImmich}
>{$t('immich.load_more')}</button
>
{/if}
</div>
</div>
{/if}