Skip to content

Commit

Permalink
Merge pull request #259 from seanmorley15/development
Browse files Browse the repository at this point in the history
Fix special adventure types
  • Loading branch information
seanmorley15 authored Aug 20, 2024
2 parents e1cff9c + aada13c commit 3b936f7
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 23 deletions.
59 changes: 54 additions & 5 deletions frontend/src/lib/components/AdventureModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
export let latitude: number | null = null;
export let collection_id: string | null = null;
export let is_collection: boolean = false;
import { DefaultMarker, MapEvents, MapLibre } from 'svelte-maplibre';
let markers: Point[] = [];
let query: string = '';
Expand All @@ -27,9 +29,28 @@
let noPlaces: boolean = false;
let adventure: Adventure = {
id: '',
name: '',
type: 'visited',
date: null,
end_date: null,
link: null,
description: null,
activity_types: [],
rating: NaN,
is_public: false,
latitude: NaN,
longitude: NaN,
location: null,
images: [],
user_id: null,
collection: collection_id || null
};
export let adventureToEdit: Adventure | null = null;
let adventure: Adventure = {
adventure = {
id: adventureToEdit?.id || '',
name: adventureToEdit?.name || '',
type: adventureToEdit?.type || 'visited',
Expand Down Expand Up @@ -228,9 +249,8 @@
onMount(async () => {
modal = document.getElementById('my_modal_1') as HTMLDialogElement;
if (modal) {
modal.showModal();
}
modal.showModal();
console.log('open');
});
function close() {
Expand Down Expand Up @@ -342,7 +362,9 @@
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
<div class="modal-box w-11/12 max-w-2xl" role="dialog" on:keydown={handleKeydown} tabindex="0">
<h3 class="font-bold text-lg">Edit {adventure.type} Adventure</h3>
<h3 class="font-bold text-lg">
{adventureToEdit ? 'Edit Adventure' : 'New Adventure'}
</h3>
{#if adventure.id === '' || isDetails}
<div class="modal-action items-center">
<form method="post" style="width: 100%;" on:submit={handleSubmit}>
Expand All @@ -360,6 +382,7 @@
required
/>
</div>

<div>
<div class="form-control">
<label class="label cursor-pointer">
Expand All @@ -385,6 +408,32 @@
/>
</label>
</div>
{#if is_collection}
<div class="form-control">
<label class="label cursor-pointer">
<span class="label-text">Lodging</span>
<input
type="radio"
name="radio-10"
class="radio checked:bg-blue-500"
on:click={() => (adventure.type = 'lodging')}
checked={adventure.type == 'lodging'}
/>
</label>
</div>
<div class="form-control">
<label class="label cursor-pointer">
<span class="label-text">Dining</span>
<input
type="radio"
name="radio-10"
class="radio checked:bg-blue-500"
on:click={() => (adventure.type = 'dining')}
checked={adventure.type == 'dining'}
/>
</label>
</div>
{/if}
</div>

<div>
Expand Down
19 changes: 1 addition & 18 deletions frontend/src/routes/collections/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
collection_id={collection.id}
startDate={collection.start_date}
endDate={collection.end_date}
is_collection={true}
/>
{/if}

Expand Down Expand Up @@ -307,24 +308,6 @@
Adventure</button
>

<button
class="btn btn-primary"
on:click={() => {
isShowingCreateModal = true;
newType = 'lodging';
}}
>
Lodging</button
>
<button
class="btn btn-primary"
on:click={() => {
isShowingCreateModal = true;
newType = 'dining';
}}
>
Dining</button
>
<button
class="btn btn-primary"
on:click={() => {
Expand Down

0 comments on commit 3b936f7

Please sign in to comment.