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

filter brews by clicking tags #3164

Closed
ericscheid opened this issue Dec 2, 2023 · 2 comments · Fixed by #3165
Closed

filter brews by clicking tags #3164

ericscheid opened this issue Dec 2, 2023 · 2 comments · Fixed by #3165
Labels
P2 - minor feature or not urgent Minor bugs or less-popular features solution found A solution exists; just needs to be applied tweak Small, non-breaking change UI/UX User Interface, user experience

Comments

@ericscheid
Copy link
Collaborator

When you click a tag [in the userpage brew card], it filters the user's documents so only documents with that tag are showing

Reading back through the history on this, we never actually created this functionality. I believe we can probably do so by making the tags automatically link to the current URL with a ?filter=${URL.encode(tag content)}.

Originally posted by @G-Ambatte in #758 (comment)

@ericscheid ericscheid added solution found A solution exists; just needs to be applied tweak Small, non-breaking change UI/UX User Interface, user experience P2 - minor feature or not urgent Minor bugs or less-popular features labels Dec 2, 2023
@ericscheid
Copy link
Collaborator Author

The relevant code to tweak is at

{brew.tags?.length ? <>
<div className='brewTags' title={`Tags:\n${brew.tags.join('\n')}`}>
<i className='fas fa-tags'/>
{brew.tags.map((tag, idx)=>{
const matches = tag.match(/^(?:([^:]+):)?([^:]+)$/);
return <span key={idx} className={matches[1]}>{matches[2]}</span>;
})}
</div>

We could simply apply a html link, but that would entail a server round trip http request. Better would be to do a history.replace( ) or whatever is the React equivalent — that way the browser page isn't forced to fully reload from the server and the browser window contents simply update dynamically (same way the filter UI widget works).

@G-Ambatte
Copy link
Collaborator

I think we need to pass a function from ListPage to BrewItem to allow it to be able to influence the filtering. I suspect the easiest thing to do will be to just replace the current filter with the tag contents, but then we should be able to extend to allow the text input to co-exist with a tag filter.

G-Ambatte added a commit to G-Ambatte/homebrewery that referenced this issue Dec 5, 2023
G-Ambatte added a commit to G-Ambatte/homebrewery that referenced this issue Dec 9, 2023
5e-Cleric added a commit to G-Ambatte/homebrewery that referenced this issue Jan 20, 2024
G-Ambatte added a commit to G-Ambatte/homebrewery that referenced this issue Feb 22, 2024
G-Ambatte added a commit to G-Ambatte/homebrewery that referenced this issue Feb 22, 2024
5e-Cleric added a commit to G-Ambatte/homebrewery that referenced this issue Feb 23, 2024
5e-Cleric added a commit to G-Ambatte/homebrewery that referenced this issue Feb 24, 2024
G-Ambatte added a commit to G-Ambatte/homebrewery that referenced this issue Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 - minor feature or not urgent Minor bugs or less-popular features solution found A solution exists; just needs to be applied tweak Small, non-breaking change UI/UX User Interface, user experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants