From 77f11e3ae5b8ce5e671640aaab43439604f0c5e4 Mon Sep 17 00:00:00 2001 From: Emanuel Bennici Date: Fri, 26 Jan 2024 19:11:54 +0100 Subject: [PATCH] feat(web): places page (#6669) Add a place overview page, like the "People" page. This adds the same functionality as available on mobile. --- web/src/lib/constants.ts | 1 + web/src/routes/(user)/explore/+page.svelte | 7 ++- web/src/routes/(user)/places/+page.svelte | 52 ++++++++++++++++++++++ web/src/routes/(user)/places/+page.ts | 15 +++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 web/src/routes/(user)/places/+page.svelte create mode 100644 web/src/routes/(user)/places/+page.ts diff --git a/web/src/lib/constants.ts b/web/src/lib/constants.ts index b5539c3c2c..31f510efe3 100644 --- a/web/src/lib/constants.ts +++ b/web/src/lib/constants.ts @@ -21,6 +21,7 @@ export enum AppRoute { ARCHIVE = '/archive', FAVORITES = '/favorites', PEOPLE = '/people', + PLACES = '/places', PHOTOS = '/photos', EXPLORE = '/explore', SHARING = '/sharing', diff --git a/web/src/routes/(user)/explore/+page.svelte b/web/src/routes/(user)/explore/+page.svelte index b6f337b833..5896a6c77a 100644 --- a/web/src/routes/(user)/explore/+page.svelte +++ b/web/src/routes/(user)/explore/+page.svelte @@ -72,8 +72,13 @@ {#if places.length > 0}
-
+

Places

+ View All
{#each places as item (item.data.id)} diff --git a/web/src/routes/(user)/places/+page.svelte b/web/src/routes/(user)/places/+page.svelte new file mode 100644 index 0000000000..6237321db0 --- /dev/null +++ b/web/src/routes/(user)/places/+page.svelte @@ -0,0 +1,52 @@ + + + + + + {#if hasPlaces} +
+ {#each places as item (item.data.id)} + +
+ +
+ + {item.value} + +
+ {/each} +
+ {:else} +
+
+ +

No places

+
+
+ {/if} +
diff --git a/web/src/routes/(user)/places/+page.ts b/web/src/routes/(user)/places/+page.ts new file mode 100644 index 0000000000..a08c40680a --- /dev/null +++ b/web/src/routes/(user)/places/+page.ts @@ -0,0 +1,15 @@ +import { authenticate } from '$lib/utils/auth'; +import { api } from '@api'; +import type { PageLoad } from './$types'; + +export const load = (async () => { + await authenticate(); + const { data: items } = await api.searchApi.getExploreData(); + + return { + items, + meta: { + title: 'Places', + }, + }; +}) satisfies PageLoad;