mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 23:14:53 +09:00
Add custom input component support to the Web UI config in order to provide a user friendly dropdown selector for the Mod Pack that is configured as default on the controller and overridden instances.
21 lines
546 B
TypeScript
21 lines
546 B
TypeScript
import React from "react";
|
|
import { Select } from "antd";
|
|
|
|
import { useModPacks } from "../model/mod_pack";
|
|
import { InputComponentProps } from "../BaseWebPlugin";
|
|
|
|
export default function InputModPack(props: InputComponentProps) {
|
|
const [modPacks] = useModPacks();
|
|
return <Select
|
|
style={{ minWidth: 175 }}
|
|
onChange={(value) => props.onChange(value ?? null)}
|
|
value={props.value}
|
|
options={[...modPacks.values()].map(modPack => ({
|
|
label: modPack.name,
|
|
value: modPack.id,
|
|
}))}
|
|
allowClear={props.fieldDefinition.optional}
|
|
/>;
|
|
}
|
|
|