@@ -7,6 +7,7 @@ import { useMediaQuery } from "@vueuse/core";
77import debounce from " ~/utilities/debounce" ;
88
99const isMobile = useMediaQuery (" (max-width: 768px)" );
10+ const { height : viewportHeight } = useVisualViewport ();
1011 </script >
1112
1213<template >
@@ -41,41 +42,50 @@ const isMobile = useMediaQuery("(max-width: 768px)");
4142 </div >
4243 <DrawerContent >
4344 <DrawerTitle class =" sr-only" >{{ label }}</DrawerTitle >
44- <div class =" flex flex-col h-[80dvh] p-4" >
45- <div class =" flex-1 overflow-y-auto min-h-0" >
45+ <div
46+ class =" flex flex-col"
47+ :style =" { height: `${viewportHeight * 0.9}px` }"
48+ >
49+ <div class =" flex-1 overflow-y-auto min-h-0 p-4 flex flex-col" >
50+ <div class =" flex-1" />
4651 <div
4752 v-if =" !players?.length"
4853 class =" p-4 text-center text-muted-foreground"
4954 >
5055 {{ $t("player.search.no_players_found") }}
5156 </div >
5257
53- <div v-else >
54- <div class =" px-3 py-2 text-sm text-muted-foreground" >
55- {{ players.length }} {{ $t("player.search.found_players") }}
56- </div >
57-
58- <div class =" divide-y" >
59- <div
60- v-for =" player in players"
61- :key =" `player-${player.steam_id}}`"
62- class =" px-3 py-2 hover:bg-accent cursor-pointer"
63- @click =" select(player)"
64- >
65- <PlayerDisplay :player =" player" />
66- </div >
58+ <div v-else class =" divide-y" >
59+ <div
60+ v-for =" player in players"
61+ :key =" `player-${player.steam_id}}`"
62+ class =" px-3 py-2 hover:bg-accent cursor-pointer"
63+ @click =" select(player)"
64+ >
65+ <PlayerDisplay :player =" player" />
6766 </div >
6867 </div >
6968 </div >
7069
71- <div class =" flex items-center justify-between pt-3 border-t" >
70+ <div
71+ v-if =" players?.length"
72+ class =" px-4 py-2 text-xs text-muted-foreground border-t"
73+ >
74+ {{ players.length }} {{ $t("player.search.found_players") }}
75+ </div >
76+
77+ <div class =" flex items-center justify-between p-4 border-t" >
7278 <input
7379 ref =" mobileSearchInput"
7480 v-model =" query"
7581 :placeholder =" $t('player.search.placeholder')"
7682 type =" search"
7783 inputmode =" search"
7884 enterkeyhint =" search"
85+ autocomplete =" off"
86+ autocorrect =" off"
87+ autocapitalize =" off"
88+ spellcheck =" false"
7989 class =" flex-1 bg-transparent outline-none text-base"
8090 @input ="
8191 (e: Event) =>
@@ -252,7 +262,7 @@ export default {
252262 return useAuthStore ().me ;
253263 },
254264 canSelectSelf() {
255- return this .self && ! this .exclude .includes (this .me .steam_id );
265+ return this .self && this . me && ! this .exclude .includes (this .me .steam_id );
256266 },
257267 onlineOnly: {
258268 get() {
@@ -268,6 +278,9 @@ export default {
268278 toggleOnlineOnly() {
269279 this .onlineOnly = ! this .onlineOnly ;
270280 this .searchPlayers ();
281+ this .$nextTick (() => {
282+ (this .$refs .mobileSearchInput as HTMLInputElement )?.focus ();
283+ });
271284 },
272285 select(player : Player ) {
273286 if (! player ) {
@@ -281,9 +294,10 @@ export default {
281294 this .query = query ;
282295 }
283296
284- const exclude = ! this .canSelectSelf
285- ? (this .exclude as string []).concat (this .me .steam_id )
286- : (this .exclude as string []);
297+ const exclude =
298+ ! this .canSelectSelf && this .me ?.steam_id
299+ ? (this .exclude as string []).concat (this .me .steam_id )
300+ : (this .exclude as string []);
287301
288302 if (this .onlineOnly ) {
289303 if (! this .query .trim ()) {
0 commit comments