({ option }: { option: SettingsOption })
| 701 | } |
| 702 | |
| 703 | function EditOptionSelectSingle({ option }: { option: SettingsOption }) { |
| 704 | const { value: rawValue, setValue, error } = useSettingsField(option.name) |
| 705 | |
| 706 | const value = textFieldValue(rawValue?.value, option) |
| 707 | |
| 708 | if (option.kind.kind === "channel") { |
| 709 | return <SelectChannel |
| 710 | multiple={false} |
| 711 | value={value} |
| 712 | label={option.label} |
| 713 | error={error} |
| 714 | onChange={(newValue) => { |
| 715 | setValue(newValue || null) |
| 716 | }} |
| 717 | allowEmpty={!option.required} |
| 718 | types={option.kind.types ?? undefined} |
| 719 | /> |
| 720 | } else if (option.kind.kind === "role") { |
| 721 | return <SelectRole |
| 722 | multiple={false} |
| 723 | value={value} |
| 724 | label={option.label} |
| 725 | error={error} |
| 726 | onChange={(newValue) => { |
| 727 | setValue(newValue ?? null) |
| 728 | }} |
| 729 | allowEmpty={!option.required} |
| 730 | /> |
| 731 | } else if (option.kind.kind === "customStringSelect") { |
| 732 | return <SelectCustom |
| 733 | multiple={false} |
| 734 | value={value} |
| 735 | label={option.label} |
| 736 | error={error} |
| 737 | onChange={(newValue) => { |
| 738 | setValue(newValue ?? null) |
| 739 | }} |
| 740 | allowEmpty={false} |
| 741 | options={option.kind.options} |
| 742 | /> |
| 743 | } else if (option.kind.kind === "customNumberSelect") { |
| 744 | return <SelectCustom |
| 745 | multiple={false} |
| 746 | value={value} |
| 747 | label={option.label} |
| 748 | error={error} |
| 749 | onChange={(newValue) => { |
| 750 | setValue(newValue ?? null) |
| 751 | }} |
| 752 | allowEmpty={false} |
| 753 | options={option.kind.options} |
| 754 | /> |
| 755 | } else { |
| 756 | return <>TODO unsupported kind {option.kind.kind}</> |
| 757 | } |
| 758 | } |
| 759 | |
| 760 | function EditOptionSelectMultiple({ option }: { option: SettingsOption }) { |
nothing calls this directly
no test coverage detected