2021-04-26 16:36:41 +00:00
|
|
|
import React, { useContext } from "react"
|
2021-04-29 14:58:31 +00:00
|
|
|
import BoxFull from "../base/BoxFull"
|
|
|
|
import FormLabelled from "../base/FormLabelled"
|
|
|
|
import FormLabel from "../base/formparts/FormLabel"
|
|
|
|
import InputWithIcon from "../base/InputWithIcon"
|
2021-04-26 16:36:41 +00:00
|
|
|
import { faGlobe } from "@fortawesome/free-solid-svg-icons"
|
2021-04-29 14:58:31 +00:00
|
|
|
import ContextServer from "../../contexts/ContextServer"
|
2021-04-26 16:36:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A {@link BoxFull} allowing the user to select the backend server they want to login to.
|
|
|
|
*
|
|
|
|
* @param props - Additional props to pass to the box.
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
export default function BoxSetServer({ ...props }) {
|
|
|
|
const {server, setServer} = useContext(ContextServer);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<BoxFull header={"Choose server"} {...props}>
|
|
|
|
<FormLabelled>
|
|
|
|
<FormLabel text={"Base URL"} htmlFor={"set-server-base-url"}>
|
|
|
|
<InputWithIcon
|
|
|
|
id={"set-server-base-url"}
|
|
|
|
type={"url"}
|
|
|
|
icon={faGlobe}
|
|
|
|
value={server}
|
|
|
|
onChange={e => setServer(e.target.value)}
|
|
|
|
/>
|
|
|
|
</FormLabel>
|
|
|
|
</FormLabelled>
|
|
|
|
</BoxFull>
|
|
|
|
)
|
|
|
|
}
|