Skip to content

Commit

Permalink
chore: remove the button list query and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
anfibiacreativa authored and manekinekko committed Nov 8, 2023
1 parent 5b080af commit e7a479b
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions packages/chat-component/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable unicorn/template-indent */
import { LitElement, html } from 'lit';
import DOMPurify from 'dompurify';
import { customElement, property, query, queryAll } from 'lit/decorators.js';
import { customElement, property, query } from 'lit/decorators.js';
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
import { chatHttpOptions, globalConfig, requestOptions } from './config/global-config.js';
import { getAPIResponse } from './core/http/index.js';
Expand Down Expand Up @@ -65,12 +65,6 @@ export class ChatComponent extends LitElement {
@query('#chat-list-footer')
chatFooter!: HTMLElement;

@queryAll('.debugButton')
debugButtonList!: NodeListOf<HTMLButtonElement>;

@queryAll('.copyButton')
copyButtonList!: NodeListOf<HTMLButtonElement>;

// Default prompts to display in the chat
@property({ type: Boolean })
isDisabled = false;
Expand Down Expand Up @@ -165,15 +159,7 @@ export class ChatComponent extends LitElement {
// this is a temporary fix until we have chat history and can use the corresponding
// datapoints from the history
// TODO: remove this once we have chat history
const buttons = [this.debugButtonList, this.copyButtonList];
for (const buttonList of buttons) {
if (buttonList && buttonList.length >= 2) {
for (const button of buttonList) {
button.disabled = true;
buttonList[buttonList.length - 1].disabled = false;
}
}
}

return true;
}

Expand Down Expand Up @@ -527,7 +513,7 @@ export class ChatComponent extends LitElement {
: html` <div class="chat__header">
<button
title="${globalConfig.SHOW_THOUGH_PROCESS_BUTTON_LABEL_TEXT}"
class="button chat__header--button debugButton"
class="button chat__header--button"
data-testid="chat-show-thought-process"
@click="${this.handleShowThoughtProcess}"
?disabled="${this.isShowingThoughtProcess || !this.canShowThoughtProcess}"
Expand All @@ -540,7 +526,7 @@ export class ChatComponent extends LitElement {
</button>
<button
title="${globalConfig.COPY_RESPONSE_BUTTON_LABEL_TEXT}"
class="button chat__header--button copyButton"
class="button chat__header--button"
@click="${this.copyResponseToClipboard}"
?disabled="${this.isDisabled}"
>
Expand Down

0 comments on commit e7a479b

Please sign in to comment.