Skip to content

Conversation

@atharvsp02
Copy link

Problem

Language drop-downs were missing a list of recently used languages, requiring editors to repeatedly type or search for the same languages when setting both title and content languages (BB-874). This created unnecessary friction in the editing workflow, especially for editors who frequently work with the same set of languages

Issue link: https://tickets.metabrainz.org/browse/BB-874

Solution

Added recently used languages section to language dropdowns:

  • Created RecentlyUsed service for localStorage management
  • Enhanced language field to display recently used languages above frequently used section
  • Modified selection handlers to save user's language choices
  • Limited to 10 most recent languages using FIFO logic
  • Maintains existing single and multi-select functionality

Areas of Impact

  • LanguageField component - now displays "Recently Used" section above "Frequently Used"
  • Language selection behavior - recently used languages are saved and prioritized in dropdowns
  • Frontend storage only - uses localStorage; no database changes
  • All entity forms using language dropdowns (Edition, Work, etc.)

Screenshot

image

Copy link
Member

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

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

Works absolutely great, nice work!

Barely any comment regarding coding style, apart from that I say it's ready to go 🚀

empty,
error,
tooltipText,
...rest
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest desctructuring onChange here, instead of using rest.onChange below ```suggestion
onChange,
...rest

Comment on lines 113 to 114
if (rest.onChange) {
rest.onChange(selectedOption);
Copy link
Member

Choose a reason for hiding this comment

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

With my comment above:

Suggested change
if (rest.onChange) {
rest.onChange(selectedOption);
if (onChange) {
onChange(selectedOption);

Copy link
Author

Choose a reason for hiding this comment

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

Done, Thanks for the suggestion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants