From 78930f6b80300cb130c99a6d256688c25542517f Mon Sep 17 00:00:00 2001 From: AG Date: Fri, 28 Nov 2025 22:56:18 +0200 Subject: [PATCH] Exersice name field focus opens keyboard. Typing filters the options. --- components/FilledInput.tsx | 8 ++++- components/Tracker.tsx | 59 ++++++++++++++++++++++++++++--------- server/prisma/dev.db | Bin 61440 -> 61440 bytes 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/components/FilledInput.tsx b/components/FilledInput.tsx index aedf34c..d363c80 100644 --- a/components/FilledInput.tsx +++ b/components/FilledInput.tsx @@ -4,15 +4,18 @@ interface FilledInputProps { label: string; value: string | number; onChange: (e: React.ChangeEvent) => void; + onFocus?: (e: React.FocusEvent) => void; + onBlur?: (e: React.FocusEvent) => void; type?: string; icon?: React.ReactNode; autoFocus?: boolean; step?: string; inputMode?: "search" | "text" | "email" | "tel" | "url" | "none" | "numeric" | "decimal"; autocapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters"; + autoComplete?: string; } -const FilledInput: React.FC = ({ label, value, onChange, type = "number", icon, autoFocus, step, inputMode, autocapitalize }) => ( +const FilledInput: React.FC = ({ label, value, onChange, onFocus, onBlur, type = "number", icon, autoFocus, step, inputMode, autocapitalize, autoComplete }) => (
); diff --git a/components/Tracker.tsx b/components/Tracker.tsx index 17db065..f31c8a5 100644 --- a/components/Tracker.tsx +++ b/components/Tracker.tsx @@ -30,6 +30,8 @@ const Tracker: React.FC = ({ userId, userWeight, activeSession, ac const [plans, setPlans] = useState([]); const [selectedExercise, setSelectedExercise] = useState(null); const [lastSet, setLastSet] = useState(undefined); + const [searchQuery, setSearchQuery] = useState(''); + const [showSuggestions, setShowSuggestions] = useState(false); // Timer State const [elapsedTime, setElapsedTime] = useState('00:00:00'); @@ -174,11 +176,19 @@ const Tracker: React.FC = ({ userId, userWeight, activeSession, ac if (selectedExercise.type !== ExerciseType.HIGH_JUMP) { setHeight(''); } + } else { + setSearchQuery(''); // Clear search query if no exercise is selected } }; updateSelection(); }, [selectedExercise, userId]); + const filteredExercises = searchQuery === '' + ? exercises + : exercises.filter(ex => + ex.name.toLowerCase().includes(searchQuery.toLowerCase()) + ); + const handleStart = (plan?: WorkoutPlan) => { if (plan && plan.description) { setShowPlanPrep(plan); @@ -486,25 +496,46 @@ const Tracker: React.FC = ({ userId, userWeight, activeSession, ac
- - - + ) => { + setSearchQuery(e.target.value); + setShowSuggestions(true); + }} + onFocus={() => setShowSuggestions(true)} + onBlur={() => setTimeout(() => setShowSuggestions(false), 100)} // Delay hiding to allow click + icon={} + autoComplete="off" + type="text" + /> + {showSuggestions && ( +
+ {filteredExercises.length > 0 ? ( + filteredExercises.map(ex => ( + + )) + ) : ( +
{t('no_exercises_found', lang)}
+ )} +
+ )}
{selectedExercise && ( diff --git a/server/prisma/dev.db b/server/prisma/dev.db index 6a11c8e867d4b9f5766a65eef2ed2bae4b1064c0..42180ac9dc8a179dcc38636632b7fe32a035505e 100644 GIT binary patch delta 195 zcmZp8z})bFd4e>f&O{k!MxBibkE>LS4U9|;Oe`&Q&CQLCbxn-SlXMdkQ<8O4jg2i0 z%uOs4lg$k#^Vh4foU!2eyLn=DISUJa8(;cno`!fnqBL*r?<-|wmSfyLnSFvS3&T-{ zqZ23APCh!Jl81qTp)xd-gMpEOfpaq7YL(4-6Q}X9$Z;DpOy*i($Het;v!K9CuE`Hq PX|e#7YHsFR{mBIY<-<9S delta 130 zcmV-|0Db>}-~)i*1CSd5Dv=yR0V=Uz<9d^BktCDiyd(wzn#>>+P_vPHcLW3uXAg$6 z41iw_lWvhDvyYB-0Rtca#ghk+Jp=(h0L77!eUrtIc?@?S3RP8A2mk>9011;0t0c2- kk(LeyAPV6C3ks76pgyw^5Sa>-;i@SFC<9divkt5BMBL9TZ~y=R