Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/ActivityView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class ActivityView extends React.Component<ActivityViewProps, {}> {
}
})
return (
<div>
<div>
<FormattedText
text={ activity.text }
format={ activity.textFormat }
Expand All @@ -120,11 +120,17 @@ export class ActivityView extends React.Component<ActivityViewProps, {}> {
size={ props.size }
tiles={tiles}
/>
</div>
</div>
);

case 'typing':
return <div className="wc-typing"/>;
return <div className="ticontainer">
<div className="tiblock">
<div className="tidot"></div>
<div className="tidot"></div>
<div className="tidot"></div>
</div>
</div>;
}
}
}
25 changes: 21 additions & 4 deletions src/App/templates/AssistantTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export class AssistantTemplate extends React.Component<
Props,
{ introMode: boolean; inputValue: string; darkMode: boolean }
> {
private textareaRef: HTMLTextAreaElement | null = null;
private cardRef: HTMLDivElement | null = null;

constructor(props: Props) {
super(props)
this.state = {
Expand Down Expand Up @@ -42,7 +45,9 @@ export class AssistantTemplate extends React.Component<
}

handleInputChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
this.setState({ inputValue: event.target.value })
this.setState({ inputValue: event.target.value }, () => {
this.adjustTextareaHeight();
})
}

handleInputKeyPress = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {
Expand All @@ -57,6 +62,17 @@ export class AssistantTemplate extends React.Component<
this.setState((prevState) => ({ darkMode: !prevState.darkMode }))
}

adjustTextareaHeight = () => {
const textarea = this.textareaRef;
const card = this.cardRef
if (textarea && card) {
textarea.style.height = 'auto';
card.style.height = "auto";
textarea.style.height = `${textarea.scrollHeight}px`;
card.style.height = `${textarea.scrollHeight}px`;
}
}

renderIntroSection() {
const { theme } = this.props
const welcomeTitle = (theme && theme.template && theme.template.welcomeTitle) || 'Welcome to the chatbot!'
Expand All @@ -66,15 +82,16 @@ export class AssistantTemplate extends React.Component<
return (
<div className="intro-section">
<h1 className="intro-title">{welcomeTitle}</h1>
<div className="card">
<div className="card" ref={el => this.cardRef = el}>
<textarea
ref={el => this.textareaRef = el}
id="chat-input"
className="chat-input"
placeholder="Type your message..."
placeholder={this.props.consolePlaceholder || "Type your message..."}
value={this.state.inputValue}
onChange={this.handleInputChange}
onKeyPress={this.handleInputKeyPress}
rows={5}
rows={1}
autoFocus
/>
<button
Expand Down
46 changes: 42 additions & 4 deletions src/scss/botchat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,49 @@

/* animation */

.wc-typing {
background-image: url('data:image/gif;base64,R0lGODlhMgAZAPUAAH9/f5mZmeXl5czMzLKystXV1YaGhoODg7y8vICAgPX19fT09JaWlubm5peXl76+voWFhff394KCgufn57a2tv39/d3d3e7u7vLy8s/Pz+rq6vv7+56enr29vZiYmJWVlYeHh83NzdfX1+Tk5JycnLOzs/b29rW1tcnJyfj4+Pn5+cHBwcvLy9jY2KysrMDAwKurq52dnbS0tM7Ozpubm8rKyq2trZ+fn6qqqtbW1r+/v7e3t////wAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6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WpphZkClWnitajXDa2oHIex3wMVMtVcl0wlNEjNHYRAAIfkEBQoAPAAsFQAIAAkACQAABi5AHk+z2mVUQl4LUSKcUKMhgkClZnioahXBO2mpJeyXwNVMtVcl0wlNal5GJC8IACH5BAUKADwALBUACAAJAAkAAAYvQB5P4LqtIkJeCEcLxCgi3ugWqFZXvJLVeuORtlVaFhzoTsFY5a35jAoFMCOSFwQAIfkEBQoAPAAsFQAIAAkACQAABi5AHs/iMRAUQt7qI0lAcLMhCEClyni3ahXEk2ipCewXwLVMtVcl0wlNWhygozAIACH5BAUKADwALCAACAAIAAkAAAYlQB5vMZkohLzLRCCYXHiYBpPZIE6nmtGVutxqotdqsutEEo3CIAAh+QQFCgA8ACwgAAgACAAJAAAGKEAeb5LJXIQ8S2YwyFiGMyZzNilIpQXWlRmybguTqJSaXIacSKJRGAQAIfkEBQoAPAAsIAAIAAgACQAABihAHs+yQ4yEvNmuVNplhieClECxPKbTF3Yqu25flui0mlw2n0KiURgEACH5BAUKADwALCAACAAIAAkAAAYqQB6vcLu1hDzdLUC7rXgZUmAa4BRwVKorS6Vhua5o1sp7LJtPIRF35AUBACH5BAUKADwALCAACAAIAAkAAAYqQB4PBQJlhDwCKJEAnYYHgBQAYn2mU08CK5VcuR5UdFpNLptPIfFz5AUBADs=');
background-repeat: no-repeat;
.tiblock {
align-items: center;
display: flex;
height: 20px;
width: 64px;
}

.ticontainer .tidot {
background-color: #333;
}

.feedbot-wrapper.dark-mode .ticontainer .tidot {
background-color: white;
}

.tidot {
animation: mercuryTypingAnimation 1.5s infinite ease-in-out;
border-radius: 3px;
display: inline-block;
height: 5px;
margin-right: 2px;
width: 5px;
}

@keyframes mercuryTypingAnimation{
0%{
transform:translateY(0px)
}
28%{
transform:translateY(-5px)
}
44%{
transform:translateY(0px)
}
}

.tidot:nth-child(1){
animation-delay:200ms;
}
.tidot:nth-child(2){
animation-delay:300ms;
}
.tidot:nth-child(3){
animation-delay:400ms;
}

.wc-animate-scroll {
Expand Down
102 changes: 90 additions & 12 deletions src/themes/AssistantTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,34 @@ export const AssistantTheme = (theme: Theme) => {
opacity: 0.75;
}

.feedbot-wrapper .wc-message-content {
border-radius: 16px !important;
padding: 10px 15px !important;
}

.feedbot-wrapper .wc-message-content p {
margin: 0;
padding: 0;
}

.feedbot-wrapper .wc-message-from-bot .wc-message-content {
background-color: #eee !important;
}

.feedbot-wrapper.dark-mode .wc-message-from-bot .wc-message-content {
background-color: #333 !important;
color: white !important;
}

.feedbot-wrapper .wc-message-from-me .wc-message-content {
background-color: ${theme.mainColor};
color: white;
}

svg.wc-message-callout {
display: none !important;
}

.example-query:hover {
opacity: 1;
}
Expand All @@ -113,6 +141,7 @@ export const AssistantTheme = (theme: Theme) => {
border-radius: 32px;
width: 100%;
height: 100%;
max-height: 130px;
font-size: 16px;
outline: none;
resize: none;
Expand All @@ -125,10 +154,11 @@ export const AssistantTheme = (theme: Theme) => {
border-color: ${secondaryColor};
}

.card {
.card{
width: 100%;
max-width: 600px;
height: 60px;
height: 58px;
max-height: 130px;
margin: 50px auto 65px auto;
border-radius: 15px;
position: relative;
Expand All @@ -140,7 +170,7 @@ export const AssistantTheme = (theme: Theme) => {
inherits: false;
}

.card::after, .card::before {
.card::after, .card::before{
content: '';
position: absolute;
height: 100%;
Expand Down Expand Up @@ -203,6 +233,10 @@ export const AssistantTheme = (theme: Theme) => {
color: white;
}

.send-button svg {
margin-top: 2px;
}

.send-button.active svg {
fill: white;
transition: fill 0.3s ease;
Expand Down Expand Up @@ -378,6 +412,7 @@ export const AssistantTheme = (theme: Theme) => {

.feedbot-wrapper .wc-console {
border-width: 0px;
display: block;
height: 70px;
}

Expand All @@ -400,20 +435,13 @@ export const AssistantTheme = (theme: Theme) => {

.wc-console .wc-mic, .wc-console .wc-send {
top: 10px !important;
right: 25px;
}

.wc-console input[type=text], .wc-console textarea {
margin: 0px 15px;
}

.wc-textbox {
border-radius: 13px;
background-color: #eceff1;
height: 70%;
margin-bottom: 0px;
top: 6px !important;
}

.wc-suggested-actions .wc-hscroll > ul {
text-align: center;
margin-top: 10px;
Expand Down Expand Up @@ -502,4 +530,54 @@ export const AssistantTheme = (theme: Theme) => {
margin: 15px auto;
}
}
`}

.wc-message-groups {
bottom: 120px;
}

.feedbot-wrapper .wc-console {
position: fixed;
bottom: 0;
display: flex;
justify-content: center;
height: 100px;
background-color: transparent !important;
}



.wc-console .wc-textbox {
padding: 0 18px;
height: 100%;
border-radius: 28px;
position: static;
width: 100%;
display: block;
}

.wc-console .wc-textbox textarea {
padding: 15px;
border-radius: 12px;
margin: 0px;
border: 1px solid #ccc;
box-sizing: border-box;
margin: 0;
}

.feedbot-wrapper.dark-mode .wc-console .wc-textbox textarea {
border : 1px solid #555;
background: #232323;
color: white;
}
@media (min-width: 1200px) {
.feedbot-wrapper .wc-console {
width: 1000px;
left: calc(50% - 500px);
}
}

.feedbot-wrapper.dark-mode a {
color: #67b0ffff !important;
}
`
}