import { Modal, ModalOverlay, ModalContent, ModalHeader, ModalCloseButton, ModalBody, } from "@chakra-ui/react"; import { Light as SyntaxHighlighter } from "react-syntax-highlighter"; import sh from "react-syntax-highlighter/dist/esm/languages/hljs/bash"; import nord from "react-syntax-highlighter/dist/esm/styles/hljs/nord"; import { useUpstreamNginxConfig } from "src/hooks"; import { intl } from "src/locale"; interface UpstreamNginxConfigModalProps { upstreamId: number; isOpen: boolean; onClose: () => void; } function UpstreamNginxConfigModal({ isOpen, onClose, upstreamId, }: UpstreamNginxConfigModalProps) { const { isLoading, data } = useUpstreamNginxConfig(upstreamId); SyntaxHighlighter.registerLanguage("bash", sh); return ( {isLoading ? ( "loading" ) : ( <> {intl.formatMessage({ id: "nginx-config" })} {data || ""} )} ); } export { UpstreamNginxConfigModal };