From 764c90174e5327f1aeddec854a252473a8356ee9 Mon Sep 17 00:00:00 2001 From: Nithin David Thomas Date: Tue, 12 Jan 2021 14:45:10 +0530 Subject: [PATCH] feat: Improve sidebar UI, add emoji icons instead of ionicons (#1605) Co-authored-by: Pranav --- .../contacts/components/ContactInfoPanel.vue | 4 +- .../conversation/ContactConversations.vue | 26 ++++++---- .../conversation/ContactCustomAttributes.vue | 8 +++- .../conversation/ContactDetailsItem.vue | 45 +++++++++++------- .../dashboard/conversation/ContactPanel.vue | 13 ++--- .../conversation/contact/ContactInfo.vue | 18 +++++-- .../conversation/contact/ContactInfoRow.vue | 20 ++++++-- .../conversation/labels/LabelBox.vue | 32 +++++++++---- .../shared/components/EmojiOrIcon.vue | 47 +++++++++++++++++++ app/javascript/shared/helpers/emoji.js | 34 ++++++++++++++ 10 files changed, 195 insertions(+), 52 deletions(-) create mode 100644 app/javascript/shared/components/EmojiOrIcon.vue create mode 100644 app/javascript/shared/helpers/emoji.js diff --git a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactInfoPanel.vue b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactInfoPanel.vue index e42785a13..45cc635ad 100644 --- a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactInfoPanel.vue +++ b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactInfoPanel.vue @@ -74,12 +74,10 @@ export default { } .conversation--details { - border-top: 1px solid $color-border-light; - padding: var(--space-normal); + padding: 0 var(--space-normal); } .contact-conversation--panel { - border-top: 1px solid $color-border-light; height: 100%; } diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ContactConversations.vue b/app/javascript/dashboard/routes/dashboard/conversation/ContactConversations.vue index 3b0318fcf..960a503ca 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ContactConversations.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ContactConversations.vue @@ -3,11 +3,14 @@ -
-

- {{ $t('CONTACT_PANEL.CONVERSATIONS.NO_RECORDS_FOUND') }} -

+
+
+ + {{ $t('CONTACT_PANEL.CONVERSATIONS.NO_RECORDS_FOUND') }} + +
diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ContactCustomAttributes.vue b/app/javascript/dashboard/routes/dashboard/conversation/ContactCustomAttributes.vue index 98c1775e8..2a5e391c2 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ContactCustomAttributes.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ContactCustomAttributes.vue @@ -3,6 +3,7 @@
.custom-attributes--panel { - border-top: 1px solid var(--b-100); - padding: var(--space-normal); + padding: 0 var(--space-slab) var(--space-slab); } +.conv-details--item { + padding-bottom: 0; +} .custom-attribute--row { margin-bottom: var(--space-small); + margin-left: var(--space-medium); } .custom-attribute--row__attribute { diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ContactDetailsItem.vue b/app/javascript/dashboard/routes/dashboard/conversation/ContactDetailsItem.vue index 401c025bf..cbdfbc535 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ContactDetailsItem.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ContactDetailsItem.vue @@ -1,11 +1,15 @@ + + diff --git a/app/javascript/shared/helpers/emoji.js b/app/javascript/shared/helpers/emoji.js new file mode 100644 index 000000000..eb17fbd4e --- /dev/null +++ b/app/javascript/shared/helpers/emoji.js @@ -0,0 +1,34 @@ +/** + * Detects support for emoji character sets. + * + * Based on the Modernizr emoji detection. + * https://github.com/Modernizr/Modernizr/blob/347ddb078116cee91b25b6e897e211b023f9dcb4/feature-detects/emoji.js + * + * @return {Boolean} true or false + * @example + * + * hasEmojiSupport() + * // => true|false + */ +export const hasEmojiSupport = () => { + const pixelRatio = window.devicePixelRatio || 1; + const offset = 12 * pixelRatio; + const node = document.createElement('canvas'); + + // canvastext support + if ( + !node.getContext || + !node.getContext('2d') || + typeof node.getContext('2d').fillText !== 'function' + ) { + return false; + } + + const ctx = node.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.textBaseline = 'top'; + ctx.font = '32px Arial'; + ctx.fillText('\ud83d\udc28', 0, 0); // U+1F428 KOALA + return ctx.getImageData(offset, offset, 1, 1).data[0] !== 0; +};