feat: Add activity types functionality to CreateNewAdventure and AdventureCard components
This commit is contained in:
@@ -46,10 +46,7 @@
|
||||
const activities = activityInput
|
||||
.split(" ")
|
||||
.filter((activity) => activity.trim() !== "");
|
||||
newAdventure.activityTypes = [
|
||||
...(newAdventure.activityTypes || []),
|
||||
...activities,
|
||||
];
|
||||
newAdventure.activityTypes = activities;
|
||||
activityInput = "";
|
||||
}
|
||||
console.log(newAdventure.activityTypes);
|
||||
@@ -104,7 +101,7 @@
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="date">Activity Types</label>
|
||||
<label for="date">Activity Types (Comma Seperated)</label>
|
||||
<input
|
||||
type="text"
|
||||
id="activityTypes"
|
||||
@@ -112,6 +109,17 @@
|
||||
class="input input-bordered w-full max-w-xs"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="rating">Rating</label>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="5"
|
||||
id="rating"
|
||||
bind:value={newAdventure.rating}
|
||||
class="input input-bordered w-full max-w-xs"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary mr-4 mt-4"
|
||||
|
||||
@@ -40,9 +40,8 @@
|
||||
if (activityInput.trim() !== "") {
|
||||
const activities = activityInput
|
||||
.split(",")
|
||||
.map((activity) => activity.trim());
|
||||
.filter((activity) => activity.trim() !== "");
|
||||
adventureToEdit.activityTypes = activities;
|
||||
// override the original activity types
|
||||
activityInput = "";
|
||||
}
|
||||
console.log(adventureToEdit.activityTypes);
|
||||
@@ -97,7 +96,7 @@
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="date">Activity Types</label>
|
||||
<label for="date">Activity Types (Comma Seperated)</label>
|
||||
<input
|
||||
type="text"
|
||||
id="activityTypes"
|
||||
@@ -105,6 +104,17 @@
|
||||
class="input input-bordered w-full max-w-xs"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="rating">Rating</label>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="5"
|
||||
id="rating"
|
||||
bind:value={adventureToEdit.rating}
|
||||
class="input input-bordered w-full max-w-xs"
|
||||
/>
|
||||
</div>
|
||||
<button class="btn btn-primary mr-4 mt-4" on:click={submit}>Save</button
|
||||
>
|
||||
<!-- if there is a button in form, it will close the modal -->
|
||||
|
||||
Reference in New Issue
Block a user