import type {HTML} from "../../../../common/html"; import {html} from "../../../../common/html"; import * as t from "../../../../common/translation-util"; import {reloadApp} from "./base-section"; import NewServerForm from "./new-server-form"; interface ServersSectionProps { $root: Element; } export default class ServersSection { props: ServersSectionProps; $newServerContainer: Element; constructor(props: ServersSectionProps) { this.props = props; } templateHTML(): HTML { return html`
`; } init(): void { this.initServers(); } initServers(): void { this.props.$root.textContent = ""; this.props.$root.innerHTML = this.templateHTML().html; this.$newServerContainer = document.querySelector("#new-server-container"); this.initNewServerForm(); } initNewServerForm(): void { new NewServerForm({ $root: this.$newServerContainer, onChange: reloadApp, }).init(); } }