-
Notifications
You must be signed in to change notification settings - Fork 44
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: Lucene Shortcuts and Archive Page Documentation #2589
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0d85fbb
initial commit
tylerbarna 1d68e5c
hide lucene menu behind feature flag
tylerbarna 08929d3
add basic documentation in accordion menu
tylerbarna 1537a18
simplify accordion
tylerbarna c52f390
initial structure for quick actions
tylerbarna fafbb38
change variable name
tylerbarna 40e8791
added structure for buttons to update query
tylerbarna 575a452
correct feature flag typo
tylerbarna e965246
add quick action buttons
tylerbarna 6401a2d
fix typo
tylerbarna 2e6567d
minor style changes
tylerbarna 71f10d4
address changes
tylerbarna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
app/routes/circulars._archive._index/CircularsLuceneMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Link } from '@remix-run/react' | ||
import { Button } from '@trussworks/react-uswds' | ||
|
||
export function LuceneAccordion({ | ||
query, | ||
querySetter, | ||
}: { | ||
query?: string | ||
querySetter: (value: string) => void | ||
}) { | ||
function populateSearch(value: string) { | ||
querySetter(`${query} ${value}`) | ||
} | ||
return ( | ||
<details> | ||
<summary>Advanced Search</summary> | ||
|
||
<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"> | ||
Lucene Search Syntax Page | ||
</Link> | ||
{'. '} | ||
<h4>Lucene Examples:</h4> | ||
<div> | ||
<Button | ||
type="button" | ||
outline | ||
onClick={() => populateSearch('subject:"Swift"')} | ||
> | ||
subject:"Swift" | ||
</Button> | ||
<Button | ||
type="button" | ||
outline | ||
onClick={() => populateSearch('body:"GRB"')} | ||
> | ||
body:"GRB" | ||
</Button> | ||
<Button | ||
type="button" | ||
outline | ||
onClick={() => populateSearch('submitter:"Tomas Ahumada Mena"')} | ||
> | ||
submitter:"Tomas Ahumada Mena" | ||
</Button> | ||
</div> | ||
</div> | ||
</details> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember where I read this, but I think it's considered a common mistake to have an input that, on change, updates a state variable, and whose value comes from a state variable. @dakota002, @Courey, have you heard that? Or am I misremembering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure on that, I think it might be dependent on where in the general hierarchy of components those state values are used. Like if they need to affect a value in a child/parent component. And if they are basic inputs vs more complex components. But I think generally speaking your idea sounds correct
I think there was something going on here where, when the page reloads due to a form submission, the value was not updating correctly, like the
defaultValue
would still show the previous value, even though the query string would update. @tylerbarna is this correct or am I thinking of another thing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dakota002 without setting
value
the search bar won't update to reflect the current query string inside the search bar until the page is reloaded, so there's not visual feedback that one of the quick action buttons have been pressed until you reload the page; we don't want the page to reload every time a quick action button is pressed since the contents of the quick action button is likely not the exact term users are looking to search forThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry that this has been holding things up. I am still not sure if this is the right way to programmatically modify the search field. To unblock this, let's just not automatically fill in the search field right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lpsinger apologies for missing this last week, I'm going to close this PR and open a new one with just the in-page documentation