Skip to content

Commit

Permalink
✨ feat: Expose ability to define open chat icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jolzee committed Nov 24, 2020
1 parent b2d79ba commit cbd2366
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 10 deletions.
7 changes: 4 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
:class="`leopard-open-close-button embed-button-center pulse ${textColor('primary')}`"
:style="customCssButtonToolbar"
>
<v-icon>mdi-message-text</v-icon>
<v-icon>{{ getChatOpenIcon }}</v-icon>
</v-btn>
</v-fab-transition>
</div>
Expand Down Expand Up @@ -61,7 +61,7 @@
@click="maximizeChat = true"
v-on:keydown.enter.prevent="maximizeChat = true"
>
<v-icon color="secondary">mdi-message-text</v-icon>
<v-icon color="secondary">{{ getChatOpenIcon }}</v-icon>
<span>Continue conversation..</span>
<v-spacer></v-spacer>
<v-icon color="secondary">mdi-arrow-expand-all</v-icon>
Expand All @@ -86,7 +86,7 @@
}`"
:style="customCssButtonToolbar"
>
<v-icon v-text="isChatOpen ? 'mdi-close' : 'mdi-message-text'"></v-icon>
<v-icon v-text="isChatOpen ? 'mdi-close' : getChatOpenIcon"></v-icon>
</v-btn>
</v-fab-transition>
</div>
Expand Down Expand Up @@ -805,6 +805,7 @@ export default {
"dialogs",
"chatTitle",
"customCssButtonToolbar",
"getChatOpenIcon",
"getAnimatedIn",
"getAnimatedOut",
"embed",
Expand Down
58 changes: 56 additions & 2 deletions src/components/ConfigAddEditSolution.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
filled
validate-on-blur
color="teal darken-4"
label="Response Icon - MDI Icons (mdi-icon-name)"
label="Bot Response Icon on the Left 👈 - MDI Icons (mdi-icon-name)"
:append-icon="solution.responseIcon"
:rules="[ruleMustHaveValue]"
></v-text-field>
Expand Down Expand Up @@ -271,7 +271,7 @@
filled
validate-on-blur
color="teal darken-4"
label="User Icon - MDI Icons (mdi-icon-name)"
label="User/Customer Icon on the Right 👉 - MDI Icons (mdi-icon-name)"
:aria-label="`Set the icon representing the customer in the chat UI`"
:append-icon="solution.userIcon"
:rules="[ruleMustHaveValue]"
Expand All @@ -295,6 +295,38 @@
</v-btn>
</v-col>
</v-row>
<!-- Chat OPEN icon -->
<v-row>
<v-col :cols="12" class="pb-0">
<v-text-field
v-model.trim="solution.chatOpenIcon"
filled
validate-on-blur
color="teal darken-4"
label="Chat Open Icon 🔘 - MDI Icons (mdi-icon-name)"
:aria-label="`Set the icon used to open the chat UI`"
:append-icon="solution.chatOpenIcon"
:rules="[ruleMustHaveValue]"
></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col :cols="12" class="py-0">
<v-btn
v-for="(icon, index) in openIcons"
:key="index + 'open-icons'"
:aria-label="`Set the icon used to open the chat UI to ${icon}`"
dark
small
:elevation="solution.chatOpenIcon === icon ? '2' : '0'"
icon
:color="solution.chatOpenIcon === icon ? 'orange darken-4' : 'indigo'"
@click="solution.chatOpenIcon = icon"
>
<v-icon>{{ icon }}</v-icon>
</v-btn>
</v-col>
</v-row>
<v-row>
<v-col :cols="12" class="pb-0">
<v-select
Expand Down Expand Up @@ -1399,6 +1431,28 @@ export default {
{ text: "Chinese (Hong Kong)", value: "cn(hk)" },
{ text: "Indonesian", value: "id" }
],
openIcons: [
"mdi-message-bulleted",
"mdi-comment-arrow-left",
"mdi-comment-arrow-left-outline",
"mdi-comment-arrow-right",
"mdi-comment-arrow-right-outline ",
"mdi-comment-question",
"mdi-comment-question-outline",
"mdi-comment-quote",
"mdi-comment-quote-outline",
"mdi-comment-text-outline",
"mdi-message-text",
"mdi-message-outline",
"mdi-message",
"mdi-chat-outline",
"mdi-chat",
"mdi-message-reply",
"mdi-message-reply-text",
"mdi-android-messages",
"mdi-assistant",
"mdi-bullseye-arrow"
],
chatIcons: [
"mdi-message-bulleted",
"mdi-comment-arrow-left",
Expand Down
4 changes: 3 additions & 1 deletion src/constants/solution-config-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ okkay | ok
url: "",
useLocalStorage: false,
userIcon: "mdi-comment-quote-outline",
useInProduction: false
chatOpenIcon: "mdi-message-text",
useInProduction: false,
asrLangCode: "en-GB"
};

export const STORAGE_KEY = window.location.hostname + window.location.pathname + ":";
3 changes: 3 additions & 0 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,9 @@ function storeSetup(vuetify) {

return hasModal;
},
getChatOpenIcon(state) {
return state.activeSolution.chatOpenIcon;
},
getNamedExtension: (_state, getters) => (item, name) => {
let extensions = getters.itemExtensions(item);
let foundExtension = null;
Expand Down
12 changes: 8 additions & 4 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ export const hasConflictingSolution = (solution, allSolutions) => {
export const fixSolution = solution => {
if (!("id" in solution)) {
const id = uuid();
// TODO: I know I need to fix this...
// if (solution.name === allSolutions.activeSolution) {
// allSolutions.activeSolution = id;
// }
solution.id = id;
}

if (!("asrLangCode" in solution)) {
solution.enableTts = solutionDefault.asrLangCode;
}

if (!("chatOpenIcon" in solution)) {
solution.enableTts = solutionDefault.chatOpenIcon;
}

if (!("enableTts" in solution)) {
solution.enableTts = solutionDefault.enableTts;
}
Expand Down

0 comments on commit cbd2366

Please sign in to comment.