diff --git a/backend/server/adventures/serializers.py b/backend/server/adventures/serializers.py index 282ba15..dbb69b3 100644 --- a/backend/server/adventures/serializers.py +++ b/backend/server/adventures/serializers.py @@ -62,7 +62,7 @@ class NoteSerializer(serializers.ModelSerializer): class Meta: model = Note fields = [ - 'id', 'user_id', 'name', 'content', 'date', + 'id', 'user_id', 'name', 'content', 'date', 'links', 'is_public', 'collection', 'created_at', 'updated_at' ] read_only_fields = ['id', 'created_at', 'updated_at'] diff --git a/frontend/src/lib/components/NoteModal.svelte b/frontend/src/lib/components/NoteModal.svelte index 27fe793..0698cd8 100644 --- a/frontend/src/lib/components/NoteModal.svelte +++ b/frontend/src/lib/components/NoteModal.svelte @@ -8,6 +8,16 @@ export let note: Note | null = null; export let collection: Collection; + let newLink: string = ''; + + function addLink() { + if (newLink.trim().length > 0) { + newNote.links = [...newNote.links, newLink]; + newLink = ''; + } + console.log(newNote.links); + } + let newNote = { name: note?.name || '', content: note?.content || '', @@ -38,6 +48,7 @@ async function save() { if (note && note.id) { + console.log('newNote', newNote); const res = await fetch(`/api/notes/${note.id}`, { method: 'PATCH', headers: { @@ -54,6 +65,7 @@ console.error('Failed to save note'); } } else { + console.log('newNote', newNote); const res = await fetch(`/api/notes/`, { method: 'POST', headers: { @@ -115,6 +127,39 @@ rows="5" > +
+ + { + if (e.key === 'Enter') { + e.preventDefault(); + addLink(); + } + }} + /> +
+ {#if newNote.links.length > 0} + + {/if} {#if collection.is_public}

This note will be public because it is in a public collection. diff --git a/frontend/src/routes/collections/[id]/+page.svelte b/frontend/src/routes/collections/[id]/+page.svelte index 3a05969..bbf7e93 100644 --- a/frontend/src/routes/collections/[id]/+page.svelte +++ b/frontend/src/routes/collections/[id]/+page.svelte @@ -462,6 +462,24 @@ {/if} + {#if notes.length > 0} +

Notes

+
+ {#each notes as note} + { + noteToEdit = event.detail; + isNoteModalOpen = true; + }} + on:delete={(event) => { + notes = notes.filter((n) => n.id != event.detail); + }} + /> + {/each} +
+ {/if} + {#if collection.start_date && collection.end_date}

Itinerary by Date

{#if numberOfDays}