diff --git a/src/langs/json/en.json b/src/langs/json/en.json index 4047f7bf9..7e480e21f 100644 --- a/src/langs/json/en.json +++ b/src/langs/json/en.json @@ -17,7 +17,9 @@ "reset": "Clear Search", "help": "Use filters like user:, project: or organization: to refine searches. Use sort: to order results.", "more": "Learn more", - "empty": "No matching results found." + "collapseAll": "Collapse all", + "expandAll": "Expand all", + "empty": "No matching results found" }, "homeTemplate": { "signedIn": "Signed in as {name}", diff --git a/src/lib/components/common/Highlight.svelte b/src/lib/components/common/Highlight.svelte index 79922e104..c4a94721e 100644 --- a/src/lib/components/common/Highlight.svelte +++ b/src/lib/components/common/Highlight.svelte @@ -3,13 +3,14 @@ export let title: string = ""; export let segments: string[] = []; + export let inlineTitle: boolean = false; function sanitize(s: string): string { return DOMPurify.sanitize(s, { ALLOWED_TAGS: ["em"] }); } -
+
{#if title}

{@html sanitize(title)}

{/if} {#if segments.length > 0}
@@ -23,6 +24,9 @@ diff --git a/src/lib/components/common/HighlightGroup.svelte b/src/lib/components/common/HighlightGroup.svelte index 02ce7b0e9..d36db09e2 100644 --- a/src/lib/components/common/HighlightGroup.svelte +++ b/src/lib/components/common/HighlightGroup.svelte @@ -1,19 +1,79 @@ {#if highlights.length} -
+
- - {$_("search.matchingResults", { values: { n: highlights.length } })} - +
+ {#if open} + + {:else} + + {/if} + + {$_("search.matchingResults", { values: { n: highlights.length } })} + +
+ {#if showAll} +
+ {#if open} + + {:else} + + {/if} +
+ {/if}
    {#each highlights as [id, highlight]} @@ -33,13 +93,30 @@ overflow: hidden; } .highlights summary { + display: flex; + flex-flow: row wrap; + justify-content: flex-start; + gap: 1rem; color: var(--gray-4); + fill: var(--gray-4); padding: 0.5rem 0.75rem; font-size: var(--font-sm); font-weight: var(--font-semibold); } - .highlights summary::marker { - margin-right: 1rem; + .highlights summary .left, + .highlights summary .right { + display: flex; + align-items: center; + gap: 0.5rem; + white-space: no-wrap; + padding: 0 0.5rem 0 0.25rem; + border-radius: 0.5rem; + } + summary .left:hover, + summary .left:focus, + summary:hover .left, + summary:focus .left { + background-color: var(--blue-1); } .highlights ul { list-style-type: none; diff --git a/src/lib/components/common/stories/HighlightGroup.stories.svelte b/src/lib/components/common/stories/HighlightGroup.stories.svelte index 497cd3fff..e1eeea7c6 100644 --- a/src/lib/components/common/stories/HighlightGroup.stories.svelte +++ b/src/lib/components/common/stories/HighlightGroup.stories.svelte @@ -25,3 +25,11 @@ + + + + + + + + diff --git a/src/lib/components/documents/NoteHighlights.svelte b/src/lib/components/documents/NoteHighlights.svelte index 1df18798f..e8e4a19ac 100644 --- a/src/lib/components/documents/NoteHighlights.svelte +++ b/src/lib/components/documents/NoteHighlights.svelte @@ -17,27 +17,44 @@ --> - + {$_("documents.matchingNotes", { values: { n: highlights.length } })} diff --git a/src/lib/components/documents/PageHighlights.svelte b/src/lib/components/documents/PageHighlights.svelte index 66bfeb7f7..610952bd8 100644 --- a/src/lib/components/documents/PageHighlights.svelte +++ b/src/lib/components/documents/PageHighlights.svelte @@ -11,8 +11,10 @@ ``` --> - + {$_("documents.matchingPages", { values: { n: highlights.length } })} diff --git a/src/lib/components/documents/ResultsList.svelte b/src/lib/components/documents/ResultsList.svelte index 6ea8779a1..1d114d28c 100644 --- a/src/lib/components/documents/ResultsList.svelte +++ b/src/lib/components/documents/ResultsList.svelte @@ -18,10 +18,16 @@ ); export let total: Writable = writable(0); + + // In order for the highlight state to be shared between components, we need to + // create a writable store and set it in the context. + export const highlightState: Writable<{ allOpen: boolean }> = writable({ + allOpen: true, + });
    - + {#each results as document (document.id)} - +
    {#if !embed} {/if} - - - - {#if document.highlights} - - {/if} - - {#if document.note_highlights} - - {/if} +
    + + {#if document.highlights} + + {/if} + {#if document.note_highlights} + + {/if} +
    +
    {:else}

    {$_("noDocuments.noSearchResults")}

    @@ -170,6 +197,24 @@ padding: 1rem; display: flex; flex-direction: column; + width: 100%; + } + + .result-row { + width: 100%; + display: flex; + gap: 0.625rem; + align-items: flex-start; + padding-bottom: 0.5rem; + } + + .result-row.selected { + background-color: var(--blue-1, #f0f0f0); + } + + .result-content { + flex: 1 1 auto; + min-width: 0; } label { @@ -177,9 +222,11 @@ align-items: center; gap: 0.5rem; padding-left: 0.5rem; + margin-top: 1.25rem; } input[type="checkbox"] { + margin: 0; height: 1.25rem; width: 1.25rem; } diff --git a/src/lib/components/documents/stories/NoteHighlights.stories.svelte b/src/lib/components/documents/stories/NoteHighlights.stories.svelte index 015198731..a5fb0ede3 100644 --- a/src/lib/components/documents/stories/NoteHighlights.stories.svelte +++ b/src/lib/components/documents/stories/NoteHighlights.stories.svelte @@ -1,6 +1,7 @@ + + diff --git a/src/lib/components/documents/stories/PageHighlights.stories.svelte b/src/lib/components/documents/stories/PageHighlights.stories.svelte index 3487685c6..6578e522c 100644 --- a/src/lib/components/documents/stories/PageHighlights.stories.svelte +++ b/src/lib/components/documents/stories/PageHighlights.stories.svelte @@ -1,7 +1,7 @@ + +