@@ -64,26 +64,44 @@ const loadMore = async () => {
64
64
65
65
applyNew (data );
66
66
};
67
+
68
+ const setTab = (tab : SearchType ) => {
69
+ currentTab .value = tab ;
70
+
71
+ if (currentTab .value == SearchType .Tags ) {
72
+ tags .value = [];
73
+ } else if (currentTab .value == SearchType .Profiles ) {
74
+ profiles .value = [];
75
+ }
76
+ };
67
77
</script >
68
78
69
79
<template >
70
80
<PanelLayout >
71
81
<div id =" tabs" >
72
- <a v-for =" tab in tabs" :class =" tab.id == currentTab ? 'selected' : ''" v-on:click.prevent =" currentTab = tab.id" v-bind:key =" tab.id" >{{ $t(tab.i18n) }}</a >
82
+ <a v-for =" tab in tabs" :class =" tab.id == currentTab ? 'selected' : ''" v-on:click.prevent =" setTab(tab.id)"
83
+ v-bind:key =" tab.id" >{{ $t(tab.i18n) }}</a >
73
84
</div >
74
85
<div v-if =" currentTab == SearchType.Posts" >
75
- <TimeLine endpoint =" com.shinolabs.pinksea.getSearchResults" :xrpc-params =" { query: $route.params.value, type: SearchType.Posts }" />
86
+ <TimeLine endpoint =" com.shinolabs.pinksea.getSearchResults"
87
+ :xrpc-params =" { query: $route.params.value, type: SearchType.Posts }" />
76
88
</div >
77
89
<div v-else-if =" currentTab == SearchType.Tags" class =" search-result-list" >
78
- <div v-for =" tag of tags" :key =" tag.tag" >
90
+ <div v-if = " tags.length > 0 " v- for =" tag of tags" :key =" tag.tag" >
79
91
<SearchTag :tag =" tag" v-on:click.prevent =" open(tag.tag)" />
80
92
</div >
93
+ <div v-else class =" search-centered" >
94
+ {{ $t("timeline.nothing_here") }}
95
+ </div >
81
96
<Intersector @intersected =" loadMore" />
82
97
</div >
83
98
<div v-else-if =" currentTab == SearchType.Profiles" class =" search-result-list" >
84
- <div v-for =" profile of profiles" :key =" profile.did" >
99
+ <div v-if = " profiles.length > 0 " v- for =" profile of profiles" :key =" profile.did" >
85
100
<SearchProfileCard :profile =" profile" v-on:click.prevent =" open(profile.did)" />
86
101
</div >
102
+ <div v-else class =" search-centered" >
103
+ {{ $t("timeline.nothing_here") }}
104
+ </div >
87
105
<Intersector @intersected =" loadMore" />
88
106
</div >
89
107
</PanelLayout >
@@ -112,7 +130,8 @@ const loadMore = async () => {
112
130
}
113
131
114
132
#tabs a .selected {
115
- background : #ffb6c1 ; color : #263b48 ;
133
+ background : #ffb6c1 ;
134
+ color : #263b48 ;
116
135
font-weight : bold ;
117
136
}
118
137
@@ -124,7 +143,11 @@ const loadMore = async () => {
124
143
padding : 10px ;
125
144
}
126
145
127
- .search-result-list > div {
146
+ .search-result-list > div {
128
147
cursor : pointer ;
129
148
}
149
+
150
+ .search-centered {
151
+ text-align : center ;
152
+ }
130
153
</style >
0 commit comments