Search the focused search type first

This commit is contained in:
itepechi 2023-11-06 03:55:44 +09:00
parent b808c84b55
commit ca5f98aeee
2 changed files with 14 additions and 7 deletions

View File

@ -116,9 +116,16 @@ const Search = {
this.lastMediaFetchCount = 0
}
const searchTypes = searchType
? [searchType]
: ['statuses', 'media', 'accounts', 'hashtags']
let searchTypes = ['statuses', 'media', 'accounts', 'hashtags']
if (searchType) {
searchTypes = [searchType]
} else if (this.preferredTab !== 'statuses') {
searchTypes = [
this.preferredTab,
...searchTypes.filter((tab) => tab !== this.preferredTab)
]
}
let oldStatusesLength = this.statuses.length
let oldMediaLength = this.media.length
@ -210,7 +217,7 @@ const Search = {
const available = {
statuses: this.visibleStatuses.length > 0,
media: this.visibleMedia.length > 0,
people: this.users.length > 0,
accounts: this.users.length > 0,
hashtags: this.hashtags.length > 0,
}
@ -218,7 +225,7 @@ const Search = {
return this.preferredTab
}
const tabOrder = ['statuses', 'media', 'people', 'hashtags']
const tabOrder = ['statuses', 'media', 'accounts', 'hashtags']
for (const tab of tabOrder) {
if (available[tab]) {
return tab

View File

@ -60,7 +60,7 @@
:label="$t('user_card.media') + resultCount('visibleMedia')"
/>
<span
key="people"
key="accounts"
:label="$t('search.people') + resultCount('users')"
/>
<span
@ -143,7 +143,7 @@
</h4>
</div>
</div>
<div v-else-if="currentResultTab === 'people'">
<div v-else-if="currentResultTab === 'accounts'">
<div
v-if="users.length === 0 && !loading && loadedInitially"
class="search-result-heading"