From f1cbda66c115be136c58a4077fc5a2194dc425a7 Mon Sep 17 00:00:00 2001 From: Chris Amico Date: Tue, 21 May 2024 17:07:12 -0400 Subject: [PATCH] Everything but the excerpt --- src/lib/api/documents.ts | 2 +- .../fixtures/documents/document-expanded.json | 180 ++++++++++++++++-- src/lib/components/documents/Note.svelte | 116 ++++++++++- .../documents/stories/Note.stories.svelte | 6 +- 4 files changed, 279 insertions(+), 25 deletions(-) diff --git a/src/lib/api/documents.ts b/src/lib/api/documents.ts index 4b42cf080..268bf2681 100644 --- a/src/lib/api/documents.ts +++ b/src/lib/api/documents.ts @@ -70,7 +70,7 @@ export async function get( "projects", "revisions", "sections", - "notes", + "notes.user", ]; endpoint.searchParams.set("expand", expand.join(",")); diff --git a/src/lib/api/fixtures/documents/document-expanded.json b/src/lib/api/fixtures/documents/document-expanded.json index 9b51b69a0..758eb2dcd 100644 --- a/src/lib/api/fixtures/documents/document-expanded.json +++ b/src/lib/api/fixtures/documents/document-expanded.json @@ -74,7 +74,17 @@ "notes": [ { "id": 551, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 0, "access": "public", @@ -90,7 +100,17 @@ }, { "id": 549, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 0, "access": "public", @@ -106,7 +126,17 @@ }, { "id": 550, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 0, "access": "public", @@ -122,7 +152,17 @@ }, { "id": 552, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 0, "access": "public", @@ -138,7 +178,17 @@ }, { "id": 554, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 1, "access": "public", @@ -154,7 +204,17 @@ }, { "id": 553, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 1, "access": "public", @@ -170,7 +230,17 @@ }, { "id": 556, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 2, "access": "public", @@ -186,7 +256,17 @@ }, { "id": 555, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 2, "access": "public", @@ -202,7 +282,17 @@ }, { "id": 557, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 2, "access": "public", @@ -218,7 +308,17 @@ }, { "id": 558, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 2, "access": "public", @@ -234,7 +334,17 @@ }, { "id": 560, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 4, "access": "public", @@ -250,7 +360,17 @@ }, { "id": 559, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 4, "access": "public", @@ -266,7 +386,17 @@ }, { "id": 562, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 5, "access": "public", @@ -282,7 +412,17 @@ }, { "id": 561, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 5, "access": "public", @@ -298,7 +438,17 @@ }, { "id": 563, - "user": 126, + "user": { + "id": 126, + "avatar_url": "", + "name": "Chris Amico", + "organization": 14187, + "organizations": [14187], + "admin_organizations": [14187], + "username": "ChrisAmico_lSozDZNW", + "uuid": "caea06a2-ee1c-43e6-865a-a09078522bf1", + "verified_journalist": true + }, "organization": 60, "page_number": 6, "access": "public", diff --git a/src/lib/components/documents/Note.svelte b/src/lib/components/documents/Note.svelte index 12ed83840..d4ef56aac 100644 --- a/src/lib/components/documents/Note.svelte +++ b/src/lib/components/documents/Note.svelte @@ -4,22 +4,56 @@ It has two states, focused and normal. --> {#if focused} @@ -27,12 +61,12 @@

{note.title}

- + {#if note.edit_access} Edit Delete - + {/if}
@@ -46,9 +80,32 @@
- {note.content} +

{@html clean(note.content)}

- + {:else} diff --git a/src/lib/components/documents/stories/Note.stories.svelte b/src/lib/components/documents/stories/Note.stories.svelte index 8114a61a0..fdd042091 100644 --- a/src/lib/components/documents/stories/Note.stories.svelte +++ b/src/lib/components/documents/stories/Note.stories.svelte @@ -15,10 +15,10 @@ }; - + - - + +