/* * Copyright (C) 2019-2024 CZ.NIC z.s.p.o. (https://www.nic.cz/) * * This is free software, licensed under the GNU General Public License v3. * See /LICENSE for more information. */ import React from "react"; import PropTypes from "prop-types"; import { HELP_TEXTS, ENCRYPTIONMODES } from "./constants"; import WiFiQRCode from "./WiFiQRCode"; import PasswordInput from "../../bootstrap/PasswordInput"; import Select from "../../bootstrap/Select"; import Switch from "../../bootstrap/Switch"; import TextInput from "../../bootstrap/TextInput"; WifiGuestForm.propTypes = { formData: PropTypes.shape({ id: PropTypes.number.isRequired, SSID: PropTypes.string.isRequired, password: PropTypes.string.isRequired, enabled: PropTypes.bool.isRequired, encryption: PropTypes.string.isRequired, }), formErrors: PropTypes.shape({ SSID: PropTypes.string, password: PropTypes.string, }), setFormValue: PropTypes.func.isRequired, deviceIndex: PropTypes.string, }; export default function WifiGuestForm({ formData, formErrors, setFormValue, deviceIndex, ...props }) { return ( <> ({ devices: { [formData.id]: { guest_wifi: { enabled: { $set: value } }, }, }, }))} {...props} /> {formData.enabled ? ( <> ({ devices: { [formData.id]: { guest_wifi: { SSID: { $set: value } }, }, }, }))} {...props} > ({ devices: { [formData.id]: { guest_wifi: { password: { $set: value } }, }, }, }))} {...props} />