Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circulars: Add In-Page Lucene Documentation #2713

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions app/routes/circulars._archive._index/LuceneMenu.tsx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add copyright banner.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Link } from '@remix-run/react'
import { Button } from '@trussworks/react-uswds'
import CopyToClipboard from 'react-copy-to-clipboard'

Check warning on line 3 in app/routes/circulars._archive._index/LuceneMenu.tsx

View check run for this annotation

Codecov / codecov/patch

app/routes/circulars._archive._index/LuceneMenu.tsx#L1-L3

Added lines #L1 - L3 were not covered by tests

export function LuceneAccordion() {
function copyableButton(text: string) {
return (

Check warning on line 7 in app/routes/circulars._archive._index/LuceneMenu.tsx

View check run for this annotation

Codecov / codecov/patch

app/routes/circulars._archive._index/LuceneMenu.tsx#L5-L7

Added lines #L5 - L7 were not covered by tests
<CopyToClipboard text={text}>
<Button type="button" outline>
{text}
</Button>
</CopyToClipboard>
)
}
return (

Check warning on line 15 in app/routes/circulars._archive._index/LuceneMenu.tsx

View check run for this annotation

Codecov / codecov/patch

app/routes/circulars._archive._index/LuceneMenu.tsx#L15

Added line #L15 was not covered by tests
<details>
<summary>Advanced Search</summary>

<div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary div.

To narrow the search results, use Lucene search syntax. This allows for
specifying which circular field to search (submitter, subject, and/or
body). Further documentation can be found on the{' '}
<Link className="usa-link" to="/docs/circulars/lucene">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link is broken.

Lucene Search Syntax Page
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Poor link text: every link goes to a "page", so "page" is redundant.

</Link>
{'. '}
<h4>Lucene Examples (click to copy):</h4>
<div>
{copyableButton('subject:"Swift"')}
{copyableButton('body:"GRB"')}
{copyableButton('submitter:"Tomas Ahumada Mena"')}
</div>
</div>
</details>
)
}
4 changes: 3 additions & 1 deletion app/routes/circulars._archive._index/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@
import CircularsHeader from './CircularsHeader'
import CircularsIndex from './CircularsIndex'
import { DateSelector } from './DateSelectorMenu'
import { LuceneAccordion } from './LuceneMenu'

Check warning on line 40 in app/routes/circulars._archive._index/route.tsx

View check run for this annotation

Codecov / codecov/patch

app/routes/circulars._archive._index/route.tsx#L40

Added line #L40 was not covered by tests
import { SortSelector } from './SortSelectorButton'
import Hint from '~/components/Hint'
import { ToolbarButtonGroup } from '~/components/ToolbarButtonGroup'
import PaginationSelectionFooter from '~/components/pagination/PaginationSelectionFooter'
import { origin } from '~/lib/env.server'
import { getFormDataString } from '~/lib/utils'
import { postZendeskRequest } from '~/lib/zendesk.server'
import { useModStatus } from '~/root'
import { useFeature, useModStatus } from '~/root'

Check warning on line 48 in app/routes/circulars._archive._index/route.tsx

View check run for this annotation

Codecov / codecov/patch

app/routes/circulars._archive._index/route.tsx#L48

Added line #L48 was not covered by tests

import searchImg from 'nasawds/src/img/usa-icons-bg/search--white.svg'

Expand Down Expand Up @@ -271,6 +272,7 @@
To navigate to a specific circular, enter the associated Circular ID
(e.g. 'gcn123', 'Circular 123', or '123').
</Hint>
{useFeature('CIRCULARS_LUCENE') && <LuceneAccordion />}
{clean && (
<>
<CircularsIndex
Expand Down
Loading