mirror of
https://github.com/immich-app/immich.git
synced 2025-12-19 09:13:14 +03:00
fix(server): "view all" for cities only showing 12 cities (#8035)
* view all cities * increase limit * rename endpoint * optimize query * remove pagination * update sql * linting * revert sort by count in explore page for now * fix query * fix * update sql * move to search, add partner support * update sql * pr feedback * euphemism * parameters as separate variable * move comment * update sql * linting
This commit is contained in:
@@ -3,20 +3,20 @@
|
||||
import Icon from '$lib/components/elements/icon.svelte';
|
||||
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
||||
import { AppRoute } from '$lib/constants';
|
||||
import type { SearchExploreResponseDto } from '@immich/sdk';
|
||||
import { mdiMapMarkerOff } from '@mdi/js';
|
||||
import type { PageData } from './$types';
|
||||
import { getMetadataSearchQuery } from '$lib/utils/metadata-search';
|
||||
import type { AssetResponseDto } from '@immich/sdk';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
const CITY_FIELD = 'exifInfo.city';
|
||||
const getFieldItems = (items: SearchExploreResponseDto[]) => {
|
||||
const targetField = items.find((item) => item.fieldName === CITY_FIELD);
|
||||
return targetField?.items || [];
|
||||
type AssetWithCity = AssetResponseDto & {
|
||||
exifInfo: {
|
||||
city: string;
|
||||
};
|
||||
};
|
||||
|
||||
$: places = getFieldItems(data.items);
|
||||
$: places = data.items.filter((item): item is AssetWithCity => !!item.exifInfo?.city);
|
||||
$: hasPlaces = places.length > 0;
|
||||
|
||||
let innerHeight: number;
|
||||
@@ -27,17 +27,18 @@
|
||||
<UserPageLayout title="Places">
|
||||
{#if hasPlaces}
|
||||
<div class="flex flex-row flex-wrap gap-4">
|
||||
{#each places as item (item.data.id)}
|
||||
<a class="relative" href="{AppRoute.SEARCH}?{getMetadataSearchQuery({ city: item.value })}" draggable="false">
|
||||
{#each places as item (item.id)}
|
||||
{@const city = item.exifInfo.city}
|
||||
<a class="relative" href="{AppRoute.SEARCH}?{getMetadataSearchQuery({ city })}" draggable="false">
|
||||
<div
|
||||
class="flex w-[calc((100vw-(72px+5rem))/2)] max-w-[156px] justify-center overflow-hidden rounded-xl brightness-75 filter"
|
||||
>
|
||||
<Thumbnail thumbnailSize={156} asset={item.data} readonly />
|
||||
<Thumbnail thumbnailSize={156} asset={item} readonly />
|
||||
</div>
|
||||
<span
|
||||
class="w-100 absolute bottom-2 w-full text-ellipsis px-1 text-center text-sm font-medium capitalize text-white backdrop-blur-[1px] hover:cursor-pointer"
|
||||
>
|
||||
{item.value}
|
||||
{city}
|
||||
</span>
|
||||
</a>
|
||||
{/each}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { authenticate } from '$lib/utils/auth';
|
||||
import { getExploreData } from '@immich/sdk';
|
||||
import { getAssetsByCity } from '@immich/sdk';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load = (async () => {
|
||||
await authenticate();
|
||||
const items = await getExploreData();
|
||||
const items = await getAssetsByCity();
|
||||
|
||||
return {
|
||||
items,
|
||||
|
||||
Reference in New Issue
Block a user