diff --git a/backend/server/adventures/views.py b/backend/server/adventures/views.py index d0a1b0cb..5ad66971 100644 --- a/backend/server/adventures/views.py +++ b/backend/server/adventures/views.py @@ -143,6 +143,8 @@ def all(self, request): @action(detail=False, methods=['get']) def search(self, request): query = self.request.query_params.get('query', '') + if len(query) < 2: + return Response({"error": "Query must be at least 2 characters long"}, status=400) queryset = Adventure.objects.filter( (Q(name__icontains=query) | Q(description__icontains=query) | Q(location__icontains=query) | Q(activity_types__icontains=query)) & (Q(user_id=request.user.id) | Q(is_public=True)) diff --git a/frontend/src/lib/components/AdventureCard.svelte b/frontend/src/lib/components/AdventureCard.svelte index 8535a0c6..48242085 100644 --- a/frontend/src/lib/components/AdventureCard.svelte +++ b/frontend/src/lib/components/AdventureCard.svelte @@ -161,49 +161,53 @@ {/if}
- + +
+ {/if} + {#if type == 'link'} + + {/if} diff --git a/frontend/src/lib/components/NotFound.svelte b/frontend/src/lib/components/NotFound.svelte index e05ade2a..8337c709 100644 --- a/frontend/src/lib/components/NotFound.svelte +++ b/frontend/src/lib/components/NotFound.svelte @@ -1,5 +1,6 @@
No adventures found -

- There are no adventures to display. Add some using the plus button at the bottom right or try - changing filters! -

+ {#if !error} +

+ There are no adventures to display. Add some using the plus button at the bottom right or + try changing filters! +

+ {:else} +

{error}

+ {/if}
diff --git a/frontend/src/lib/components/PointSelectionModal.svelte b/frontend/src/lib/components/PointSelectionModal.svelte index 882f670b..e9e89d2e 100644 --- a/frontend/src/lib/components/PointSelectionModal.svelte +++ b/frontend/src/lib/components/PointSelectionModal.svelte @@ -1,6 +1,6 @@ {#if adventures.length === 0} - + {:else}
{#each adventures as adventure}