Spaces:
Sleeping
Sleeping
Replace injury tracking dropdown with checkboxes for left/right knee
Browse filesAllows tracking pain for both knees simultaneously instead of
requiring a single selection from a dropdown.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Files changed (2)
106 unmodified lines107108109110111112113114115116117106 unmodified linesbox-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);}.pain-inputs {display: grid;grid-template-columns: 1fr 1fr;gap: 0.75rem;margin-bottom: 0;}.btn-primary {106 unmodified lines107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146106 unmodified linesbox-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);}.injury-checkboxes {display: flex;gap: 1.25rem;margin-top: 0.25rem;}.injury-checkbox-label {display: flex !important;align-items: center;gap: 0.375rem;font-size: 0.875rem;font-weight: 500;color: var(--color-text);cursor: pointer;}.injury-checkbox-label input[type="checkbox"] {width: auto;accent-color: var(--color-primary);cursor: pointer;}.pain-inputs {display: grid;grid-template-columns: 1fr 1fr;gap: 0.75rem;margin-bottom: 0.75rem;}.pain-location-label {grid-column: 1 / -1;font-size: 0.8rem;font-weight: 600;color: var(--color-text-muted);}.btn-primary {
25 unmodified lines2627282930313233349 unmodified lines4445464748495051522 unmodified lines55565758596061626355 unmodified lines11912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016125 unmodified linesconst [time, setTime] = useState('');const [rpe, setRpe] = useState(5);const [notes, setNotes] = useState('');const [injuryLocation, setInjuryLocation] = useState('');const [painDuring, setPainDuring] = useState('');const [painAfter, setPainAfter] = useState('');function handleSubmit(e) {e.preventDefault();9 unmodified linesnotes: notes.trim(),};if (injuryLocation) {runData[`${injuryLocation}_during`] = painDuring ? Number(painDuring) : null;runData[`${injuryLocation}_after`] = painAfter ? Number(painAfter) : null;}onAddRun(runData);2 unmodified linessetTime('');setRpe(5);setNotes('');setInjuryLocation('');setPainDuring('');setPainAfter('');}return (55 unmodified lines</div></div><div className="form-group"><label htmlFor="injury-location">Injury Tracking</label><selectid="injury-location"value={injuryLocation}onChange={(e) => {setInjuryLocation(e.target.value);if (!e.target.value) { setPainDuring(''); setPainAfter(''); }}}><option value="">None</option>{INJURY_LOCATIONS.map((loc) => (<option key={loc.key} value={loc.key}>{loc.label}</option>))}</select></div>{injuryLocation && (<div className="pain-inputs"><div className="form-group pain-field"><label htmlFor="pain-during">Pain During (1β10)</label><inputid="pain-during"type="number" min="1" max="10" step="1" placeholder="1β10"value={painDuring}onChange={(e) => setPainDuring(e.target.value)}/></div><div className="form-group pain-field"><label htmlFor="pain-after">Pain After (1β10)</label><inputid="pain-after"type="number" min="1" max="10" step="1" placeholder="1β10"value={painAfter}onChange={(e) => setPainAfter(e.target.value)}/></div></div>)}<div className="form-group"><label htmlFor="run-notes">Notes</label><textarea25 unmodified lines2627282930313233349 unmodified lines4445464748495051525354552 unmodified lines58596061626364656655 unmodified lines12212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817925 unmodified linesconst [time, setTime] = useState('');const [rpe, setRpe] = useState(5);const [notes, setNotes] = useState('');const [injuries, setInjuries] = useState(Object.fromEntries(INJURY_LOCATIONS.map((loc) => [loc.key, { enabled: false, during: '', after: '' }])));function handleSubmit(e) {e.preventDefault();9 unmodified linesnotes: notes.trim(),};for (const loc of INJURY_LOCATIONS) {const inj = injuries[loc.key];if (inj.enabled) {runData[`${loc.key}_during`] = inj.during ? Number(inj.during) : null;runData[`${loc.key}_after`] = inj.after ? Number(inj.after) : null;}}onAddRun(runData);2 unmodified linessetTime('');setRpe(5);setNotes('');setInjuries(Object.fromEntries(INJURY_LOCATIONS.map((loc) => [loc.key, { enabled: false, during: '', after: '' }])));}return (55 unmodified lines</div></div><div className="form-group"><label>Injury Tracking</label><div className="injury-checkboxes">{INJURY_LOCATIONS.map((loc) => (<label key={loc.key} className="injury-checkbox-label"><inputtype="checkbox"checked={injuries[loc.key].enabled}onChange={(e) =>setInjuries((prev) => ({...prev,[loc.key]: { ...prev[loc.key], enabled: e.target.checked, ...(!e.target.checked && { during: '', after: '' }) },}))}/>{loc.label}</label>))}</div></div>{INJURY_LOCATIONS.filter((loc) => injuries[loc.key].enabled).map((loc) => (<div key={loc.key} className="pain-inputs"><span className="pain-location-label">{loc.label}</span><div className="form-group pain-field"><label htmlFor={`pain-during-${loc.key}`}>Pain During (1β10)</label><inputid={`pain-during-${loc.key}`}type="number" min="1" max="10" step="1" placeholder="1β10"value={injuries[loc.key].during}onChange={(e) =>setInjuries((prev) => ({...prev,[loc.key]: { ...prev[loc.key], during: e.target.value },}))}/></div><div className="form-group pain-field"><label htmlFor={`pain-after-${loc.key}`}>Pain After (1β10)</label><inputid={`pain-after-${loc.key}`}type="number" min="1" max="10" step="1" placeholder="1β10"value={injuries[loc.key].after}onChange={(e) =>setInjuries((prev) => ({...prev,[loc.key]: { ...prev[loc.key], after: e.target.value },}))}/></div></div>))}<div className="form-group"><label htmlFor="run-notes">Notes</label><textarea
src/components/RunForm.css+30-1
src/components/RunForm.js+50-32