import { Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, Input, Textarea, FormHelperText, VStack, } from "@hope-ui/solid" import { createSignal, JSXElement, Show } from "solid-js" import { useT } from "~/hooks" import { notify } from "~/utils" export type ModalTwoInputProps = { opened: boolean onClose: () => void title: string onSubmit?: (text1: string, text2: string) => void // Update onSubmit to accept two input texts type?: string defaultValue1?: string // Update defaultValue to defaultValue1 defaultValue2?: string // Add defaultValue2 for second input loading?: boolean tips?: string topSlot?: JSXElement } export const ModalTwoInput = (props: ModalTwoInputProps) => { const [value1, setValue1] = createSignal(props.defaultValue1 ?? "") // Update value and setValue to value1 and setValue1 const [value2, setValue2] = createSignal(props.defaultValue2 ?? "") // Add value2 and setValue2 for second input const t = useT() const submit = () => { if (!value1() || !value2()) { // Check if both input values are not empty notify.warning(t("global.empty_input")) return } props.onSubmit?.(value1(), value2()) // Update onSubmit to pass both input values } return ( {/* */} {t(props.title)} {props.topSlot} { setValue1(e.currentTarget.value) }} onKeyDown={(e) => { if (e.key === "Enter") { submit() } }} /> { setValue2(e.currentTarget.value) }} onKeyDown={(e) => { if (e.key === "Enter") { submit() } }} /> } >