|
163 | 163 | } |
164 | 164 | } |
165 | 165 |
|
| 166 | + $: userHasSearchText = $search != ''; |
| 167 | + $: userHasSearchFilters = $filter != filterOptions[0]; |
| 168 | +
|
| 169 | + const removeSearchText = () => { |
| 170 | + $search = ''; |
| 171 | + }; |
| 172 | + const removeSearchFilters = () => { |
| 173 | + $filter = filterOptions[0]; |
| 174 | + }; |
| 175 | +
|
166 | 176 | export let hideMods: boolean = false; |
167 | 177 | </script> |
168 | 178 |
|
|
184 | 194 | {#if displayMods.length === 0 && !fetchingMods && !filteringMods && $hasFetchedMods} |
185 | 195 | <div class="flex flex-col h-full items-center justify-center"> |
186 | 196 | {#if mods.length !== 0} |
187 | | - <p class="text-xl text-center text-surface-400-700-token"><T defaultValue="No mods matching your filters" keyName="mods-list.no-mods-filtered"/></p> |
188 | | - <button |
189 | | - class="btn variant-filled-primary mt-4" |
190 | | - on:click={() => { |
191 | | - $search = ''; |
192 | | - $filter = filterOptions[0]; |
193 | | - }} |
194 | | - > |
195 | | - <T defaultValue="Show all" keyName="mods-list.show-all"/> |
196 | | - </button> |
| 197 | + <p class="text-xl text-center text-surface-400-700-token"><T defaultValue="No mods matching your search" keyName="mods-list.no-mods-filtered"/></p> |
| 198 | + {#if userHasSearchFilters} |
| 199 | + {#if userHasSearchText} |
| 200 | + <button |
| 201 | + class="btn variant-filled-primary mt-4" |
| 202 | + on:click={removeSearchFilters} |
| 203 | + > |
| 204 | + <T defaultValue="Remove search filters" keyName="mods-list.remove-search-filters"/> |
| 205 | + </button> |
| 206 | + <button |
| 207 | + class="btn variant-filled-primary mt-4" |
| 208 | + on:click={removeSearchText} |
| 209 | + > |
| 210 | + <T defaultValue="Remove search text" keyName="mods-list.remove-search-text"/> |
| 211 | + </button> |
| 212 | + {:else} |
| 213 | + <button |
| 214 | + class="btn variant-filled-primary mt-4" |
| 215 | + on:click={removeSearchFilters} |
| 216 | + > |
| 217 | + <T defaultValue="Show all" keyName="mods-list.show-all"/> |
| 218 | + </button> |
| 219 | + {/if} |
| 220 | + {:else} |
| 221 | + <button |
| 222 | + class="btn variant-filled-primary mt-4" |
| 223 | + on:click={removeSearchText} |
| 224 | + > |
| 225 | + <T defaultValue="Show all" keyName="mods-list.show-all"/> |
| 226 | + </button> |
| 227 | + {/if} |
197 | 228 | {:else} |
198 | 229 | <p class="text-xl text-center text-surface-400-700-token"><T defaultValue="No mods found" keyName="mods-list.no-mods-found"/></p> |
199 | 230 | {/if} |
|
0 commit comments