MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / ManagedInput

Function ManagedInput

packages/ui-default/components/problemconfig/BasicForm.tsx:27–41  ·  view source on GitHub ↗
({ placeholder, formKey }: { placeholder?: string, formKey: KeyType<RootState['config']> })

Source from the content-addressed store, hash-verified

25type FileSelectKey = 'checker' | 'interactor' | 'manager';
26
27export function ManagedInput({ placeholder, formKey }: { placeholder?: string, formKey: KeyType<RootState['config']> }) {
28 const value = useSelector((state: RootState) => state.config[formKey]);
29 const dispatch = useDispatch();
30 return (
31 <input
32 placeholder={i18n(placeholder)}
33 value={value || ''}
34 type={typeof value === 'number' ? 'number' : 'text'}
35 onChange={(ev) => {
36 dispatch({ type: 'CONFIG_FORM_UPDATE', key: formKey, value: ev.currentTarget.value });
37 }}
38 className="textbox"
39 />
40 );
41}
42
43export function ManagedSelect({ options, formKey }: { options: string[], formKey: KeyType<RootState['config']> }) {
44 const value = useSelector((state: RootState) => state.config[formKey]);

Callers

nothing calls this directly

Calls 2

i18nFunction · 0.90
dispatchFunction · 0.85

Tested by

no test coverage detected