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

[TAS-2785] ✨ Add random keyword search feature to homepage #2003

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

AuroraHuang22
Copy link
Contributor

No description provided.

Copy link

AuroraHuang22 added a commit that referenced this pull request Dec 26, 2024
Comment on lines 850 to 851
placeholderText: '',
randomKeywords: [],
Copy link
Member

Choose a reason for hiding this comment

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

can be computed props

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 1114 to 1124
getRandomPlaceholder() {
if (this.$i18n.locale === 'zh-Hant') {
const shuffled = [...SEARCH_SUGGESTIONS].sort(
() => Math.random() - 0.5
);
const randomTerms = shuffled.slice(0, 3);
this.randomKeywords = randomTerms;
return randomTerms.join('、');
}
return this.$t('gutenberg_search_placeholder');
},
Copy link
Member

Choose a reason for hiding this comment

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

Can be refactored to a searchMixin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the two use cases(homepage/ bookstore) are different, refactor it as a mixin would require more modifications. so I think it doesn't need to be made into a mixin.

@AuroraHuang22 AuroraHuang22 requested a review from nwingt December 27, 2024 04:17
Comment on lines 1020 to 1022
this.placeholderText = this.randomKeywords?.length
? this.randomKeywords.join('、')
: this.$t('gutenberg_search_placeholder');
Copy link
Member

Choose a reason for hiding this comment

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

this can be computed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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