${this.provider}
${
this.testing
? Badge({ children: i18n("Testing..."), variant: "secondary" })
: this.hasKey
? html`✓`
: ""
}
${this.failed ? Badge({ children: i18n("✗ Invalid"), variant: "destructive" }) : ""}
${Input({
type: "password",
placeholder: this.hasKey ? "••••••••••••" : i18n("Enter API key"),
value: this.keyInput,
onInput: (e: Event) => {
this.keyInput = (e.target as HTMLInputElement).value;
this.requestUpdate();
},
className: "flex-1",
})}
${
this.hasKey
? Button({
onClick: () => this.removeKey(),
variant: "ghost",
size: "sm",
children: i18n("Clear"),
className: "!text-destructive",
})
: Button({
onClick: () => this.saveKey(),
variant: "default",
size: "sm",
disabled: !this.keyInput || this.testing,
children: i18n("Save"),
})
}
`;
}
}