({ option }: { option: SettingsOption })
| 661 | } |
| 662 | |
| 663 | function EditOptionSelect({ option }: { option: SettingsOption }) { |
| 664 | console.assert(option.kind.kind === "channel" |
| 665 | || option.kind.kind === "role" |
| 666 | || option.kind.kind === "roles" |
| 667 | || option.kind.kind === "channels" |
| 668 | || option.kind.kind === "customStringSelect" |
| 669 | || option.kind.kind === "customStringMultiSelect" |
| 670 | || option.kind.kind === "customNumberSelect" |
| 671 | || option.kind.kind === "customNumberMultiSelect") |
| 672 | |
| 673 | const { value: rawValue, setValue, error } = useSettingsField(option.name) |
| 674 | |
| 675 | const isMultiple = option.kind.kind === "channels" |
| 676 | || option.kind.kind === "roles" |
| 677 | || option.kind.kind === "customStringMultiSelect" |
| 678 | || option.kind.kind === "customNumberMultiSelect" |
| 679 | |
| 680 | return <Box mt={3} minWidth={"150px"} display={"flex"}> |
| 681 | <FormControl> |
| 682 | <InputLabel>{option.label}</InputLabel> |
| 683 | {isMultiple |
| 684 | ? <EditOptionSelectMultiple option={option} /> |
| 685 | : <EditOptionSelectSingle option={option} />} |
| 686 | |
| 687 | <FormHelperText error={Boolean(error)}> |
| 688 | <FieldHelpText description={option.description} error={error} /> |
| 689 | </FormHelperText> |
| 690 | |
| 691 | </FormControl> |
| 692 | {(Boolean(rawValue) && (option.defaultValue || !option.required)) && |
| 693 | <IconButton |
| 694 | color='warning' |
| 695 | onClick={() => setValue(null)} |
| 696 | sx={{ alignSelf: "start" }} |
| 697 | > |
| 698 | <ReplayIcon /> |
| 699 | </IconButton>} |
| 700 | </Box> |
| 701 | } |
| 702 | |
| 703 | function EditOptionSelectSingle({ option }: { option: SettingsOption }) { |
| 704 | const { value: rawValue, setValue, error } = useSettingsField(option.name) |
nothing calls this directly
no test coverage detected