Skip to content

Commit cadd644

Browse files
manekinekkosinedied
authored andcommitted
chore: import wc in Chat and OneShot
1 parent fa1bc20 commit cadd644

File tree

6 files changed

+147
-427
lines changed

6 files changed

+147
-427
lines changed

packages/chat-component/src/config/global-config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const globalConfig = {
1616
CHAT_MESSAGES: [],
1717
// This are the labels for the chat button and input
1818
CHAT_BUTTON_LABEL_TEXT: 'Ask Support',
19-
CHAT_INPUT_LABEL_TEXT: 'Ask a question now',
2019
CHAT_INPUT_PLACEHOLDER: 'Type your question, eg. "How to search and book rentals?"',
2120
USER_IS_BOT: 'Support Bot',
2221
RESET_BUTTON_LABEL_TEXT: 'X',

packages/chat-component/src/main.ts

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ import { getTimestamp, processText } from './utils/index.js';
2121

2222
@customElement('chat-component')
2323
export class ChatComponent extends LitElement {
24+
//--
25+
// Public attributes
26+
// --
27+
28+
@property({ type: Boolean, attribute: 'inputPosition' })
29+
inputPosition = 'sticky';
30+
31+
// interaction type: should come from dynamic settings
32+
// INTERACTION_MODEL defines the UI presentation and behavior
33+
// but for now we can switch between 'chat' and 'ask', using this
34+
@property({ type: String, attribute: 'interactionModel' })
35+
interactionModel = INTERACTION_MODEL[0];
36+
37+
//--
38+
2439
@property({ type: String })
2540
currentQuestion = '';
2641
@query('#question-input')
@@ -48,11 +63,6 @@ export class ChatComponent extends LitElement {
4863
isShowingThoughtProcess = false;
4964
@property({ type: Boolean })
5065
canShowThoughtProcess = false;
51-
// interaction type: should come from dynamic settings
52-
// INTERACTION_MODEL defines the UI presentation and behavior
53-
// but for now we can switch between 'chat' and 'ask', using this
54-
@property({ type: String })
55-
interactionModel = INTERACTION_MODEL[0];
5666
// api response
5767
apiResponse = {} as BotResponse | Response;
5868
// These are the chat bubbles that will be displayed in the chat
@@ -61,7 +71,6 @@ export class ChatComponent extends LitElement {
6171
defaultPrompts: string[] = globalConfig.DEFAULT_PROMPTS;
6272
defaultPromptsHeading: string = globalConfig.DEFAULT_PROMPTS_HEADING;
6373
chatButtonLabelText: string = globalConfig.CHAT_BUTTON_LABEL_TEXT;
64-
chatInputLabelText: string = globalConfig.CHAT_INPUT_LABEL_TEXT;
6574
chatThoughtProcess: BotResponse[] = [];
6675
chatThoughts: string | null = '';
6776
chatDataPoints: string[] = [];
@@ -446,11 +455,11 @@ export class ChatComponent extends LitElement {
446455
${this.hasDefaultPromptsEnabled
447456
? html`
448457
<div class="defaults__container">
449-
<h2 class="subheadline">
458+
<h1 class="headline">
450459
${this.interactionModel === 'chat'
451-
? globalConfig.DEFAULT_PROMPTS_HEADING_CHAT
452-
: globalConfig.DEFAULT_PROMPTS_HEADING_ASK}
453-
</h2>
460+
? this.title || globalConfig.DEFAULT_PROMPTS_HEADING_CHAT
461+
: this.title || globalConfig.DEFAULT_PROMPTS_HEADING_ASK}
462+
</h1>
454463
<ul class="defaults__list">
455464
${this.defaultPrompts.map(
456465
(prompt) => html`
@@ -472,11 +481,10 @@ export class ChatComponent extends LitElement {
472481
`
473482
: ''}
474483
</div>
475-
<form id="chat-form" class="form__container">
476-
<label id="chatbox-label" for="question-input" class="form__label"
477-
>${globalConfig.CHAT_INPUT_LABEL_TEXT}</label
478-
>
479-
484+
<form
485+
id="chat-form"
486+
class="form__container ${this.inputPosition === 'sticky' ? 'form__container-sticky' : ''}"
487+
>
480488
<div class="chatbox__container container-col container-row">
481489
<input
482490
class="chatbox__input"
@@ -516,16 +524,15 @@ export class ChatComponent extends LitElement {
516524
${globalConfig.RESET_BUTTON_LABEL_TEXT}
517525
</button>
518526
</div>
519-
</form>
520-
<div class="chat__containerFooter">
527+
521528
${this.hasDefaultPromptsEnabled
522529
? ''
523-
: html`
530+
: html`<div class="chat__containerFooter">
524531
<button type="button" @click="${this.showDefaultPrompts}" class="defaults__span button">
525532
${globalConfig.DISPLAY_DEFAULT_PROMPTS_BUTTON}
526533
</button>
527-
`}
528-
</div>
534+
</div>`}
535+
</form>
529536
</section>
530537
${this.isShowingThoughtProcess
531538
? html`

packages/chat-component/src/style.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { css } from 'lit';
22

33
export const mainStyle = css`
44
:host {
5+
width: 100vw;
56
display: block;
67
padding: 16px;
78
--secondary-color: #f8fffd;
@@ -136,14 +137,12 @@ export const mainStyle = css`
136137
}
137138
.chat__containerWrapper.aside-open .aside {
138139
width: 100%;
140+
border-left: 1px solid #d2d2d2;
139141
140142
@media (max-width: 1024px) {
141143
width: 80%;
142144
}
143145
}
144-
.chat__containerFooter {
145-
padding: 0 0 50px 0;
146-
}
147146
@media (max-width: 1024px) {
148147
.aside {
149148
top: 30px;
@@ -161,6 +160,12 @@ export const mainStyle = css`
161160
margin-top: 30px;
162161
padding: 10px;
163162
}
163+
.form__container-sticky {
164+
position: sticky;
165+
bottom: 0;
166+
z-index: 1;
167+
background: var(--accent-light);
168+
}
164169
.form__label {
165170
display: block;
166171
padding: 5px 0;

0 commit comments

Comments
 (0)