From e7df805b51c65450be3d6654718bf6c15cf35c49 Mon Sep 17 00:00:00 2001 From: sua yoo Date: Tue, 7 May 2024 15:14:27 -0700 Subject: [PATCH] check confirmation string --- frontend/src/components/orgs-list.ts | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/orgs-list.ts b/frontend/src/components/orgs-list.ts index 657fb5aa..344d0724 100644 --- a/frontend/src/components/orgs-list.ts +++ b/frontend/src/components/orgs-list.ts @@ -1,7 +1,7 @@ import { localized, msg, str } from "@lit/localize"; -import type { SlInput } from "@shoelace-style/shoelace"; +import type { SlChangeEvent, SlInput } from "@shoelace-style/shoelace"; import { html, type TemplateResult } from "lit"; -import { customElement, property, query } from "lit/decorators.js"; +import { customElement, property, query, state } from "lit/decorators.js"; import { when } from "lit/directives/when.js"; import { TailwindElement } from "@/classes/TailwindElement"; @@ -26,6 +26,9 @@ export class OrgsList extends TailwindElement { @property({ type: Object }) currOrg?: OrgData | null = null; + @state() + enableDeleteButton = false; + @query("#orgDeleteDialog") orgDeleteDialog?: Dialog | null; @@ -122,7 +125,13 @@ export class OrgsList extends TailwindElement { - + { + const { value } = e.target as SlInput; + this.enableDeleteButton = value === confirmationStr; + }} + > ${msg(str`Type "${confirmationStr}" to confirm`)} @@ -132,9 +141,13 @@ export class OrgsList extends TailwindElement {
{ + console.log("TODO"); + }} variant="danger" - >${msg("Delete Org")} + ?disabled=${!this.enableDeleteButton} + > + ${msg("Delete Org")}