MCPcopy Create free account
hub / github.com/Botloader/botloader / useSettingsField

Function useSettingsField

frontend/src/components/GuildScriptPage.tsx:117–132  ·  view source on GitHub ↗
(field: string)

Source from the content-addressed store, hash-verified

115
116// }
117function useSettingsField(field: string) {
118 const hook = useContext(SettingsValuesContext)
119 if (!hook) {
120 throw new Error("no settings context")
121 }
122
123 const error = hook.getFieldError(field)
124 const value = hook.getFieldValue(field)
125 const setter = (value: any) => hook.setFieldValue(field, value)
126
127 return {
128 value,
129 error,
130 setValue: setter,
131 }
132}
133
134function stripUnknownFields(script: Script): SettingsOptionValue[] {
135 const clone = []

Callers 7

EditSettingsOptionListFunction · 0.85
EditOptionNumberFieldFunction · 0.85
EditOptionBooleanFieldFunction · 0.85
EditOptionTextFieldFunction · 0.85
EditOptionSelectFunction · 0.85
EditOptionSelectSingleFunction · 0.85
EditOptionSelectMultipleFunction · 0.85

Calls 1

getFieldErrorMethod · 0.80

Tested by

no test coverage detected