feat: Redesigns conversation card to show labels

This commit is contained in:
Nithin David 2022-12-06 18:03:07 +05:30
parent 89cfc5bbf3
commit 3f77f65aaa
8 changed files with 356 additions and 192 deletions

View file

@ -67,3 +67,8 @@ code {
.margin-right-small {
margin-right: var(--space-small);
}
input[type="checkbox"],
input[type="radio"] {
accent-color: var(--w-500);
}

View file

@ -1,4 +1,5 @@
@keyframes left-shift-animation {
0%,
100% {
transform: translateX(0);
@ -13,70 +14,29 @@
@include flex;
@include flex-shrink;
border-bottom: 1px solid transparent;
border-left: $space-micro solid transparent;
border-top: 1px solid transparent;
cursor: pointer;
padding: 0 0 0 $space-normal;
position: relative;
&.active {
animation: left-shift-animation 0.25s $swift-ease-out-function;
background: $color-background;
border-bottom-color: $color-border-light;
border-left-color: $color-woot;
border-top-color: $color-border-light;
.conversation--details {
border-top-color: transparent;
}
+ .conversation .conversation--details {
+.conversation::after {
border-top-color: transparent;
}
}
&:first-child {
.conversation--details {
border-top-color: transparent;
}
&:first-child::after {
border-top-color: transparent;
}
&:last-child {
.conversation--details {
.message {
border-bottom-color: $color-border-light;
}
}
.conversation--details {
@include border-light-bottom;
@include border-light-top;
border-bottom-color: transparent;
margin: 0 0 0 $space-one;
padding: $space-slab 0;
}
.conversation--user {
font-size: $font-size-small;
margin-bottom: 0;
text-transform: capitalize;
.label {
left: $space-micro;
max-width: $space-jumbo;
overflow: hidden;
position: relative;
text-overflow: ellipsis;
top: $space-micro;
white-space: nowrap;
}
}
.conversation--message {
color: $color-body;
font-size: $font-size-small;
font-weight: $font-weight-normal;
height: $space-medium;
line-height: $space-medium;
margin: 0;
max-width: 96%;
overflow: hidden;
@ -119,24 +79,24 @@
}
}
&.unread-chat {
.unread {
display: inline-block;
}
// &.unread-chat {
// .unread {
// display: inline-block;
// }
.conversation--message {
font-weight: $font-weight-bold;
}
// .conversation--message {
// font-weight: $font-weight-bold;
// }
.conversation--user {
font-weight: $font-weight-bold;
}
}
// .conversation--user {
// font-weight: $font-weight-bold;
// }
// }
&.compact {
padding-left: 0;
.conversation--details {
.message {
border-radius: var(--border-radius-small);
margin-left: 0;
padding-left: var(--space-two);

View file

@ -786,6 +786,7 @@ export default {
}
.conversations-list {
padding-top: var(--space-small);
// Prevent the list from scrolling if the submenu is opened
&.is-context-menu-open {
overflow: hidden !important;
@ -796,12 +797,7 @@ export default {
flex-shrink: 0;
width: 34rem;
overflow: hidden;
@include breakpoint(large up) {
width: 36rem;
}
@include breakpoint(xlarge up) {
width: 35rem;
}
@include breakpoint(xxlarge up) {
width: 38rem;
}

View file

@ -117,10 +117,10 @@ export default {
height: var(--space-medium);
&.small {
font-size: var(--font-size-micro);
font-size: var(--font-size-mini);
padding: var(--space-micro) var(--space-smaller);
line-height: 1.2;
letter-spacing: 0.15px;
height: var(--space-two);
}
.label--icon {
@ -199,8 +199,8 @@ export default {
&.smooth {
background: transparent;
border: 1px solid var(--s-75);
color: var(--s-800);
border: 1px solid var(--s-100);
color: var(--s-700);
}
}
@ -231,4 +231,10 @@ export default {
border-radius: var(--border-radius-small);
margin-right: var(--space-smaller);
}
.label.small .label-color-dot {
width: var(--space-small);
height: var(--space-small);
border-radius: var(--border-radius-small);
margin-right: var(--space-smaller);
}
</style>

View file

@ -26,15 +26,15 @@ export default {
<style scoped>
.inbox--name {
display: inline-flex;
padding: var(--space-micro) 0;
line-height: var(--space-slab);
font-weight: var(--font-weight-medium);
align-items: center;
line-height: var(--space-normal);
height: var(--space-normal);
background: none;
color: var(--s-500);
color: var(--s-600);
font-size: var(--font-size-mini);
}
.inbox--icon {
margin-right: var(--space-micro);
margin-right: var(--space-smaller);
}
</style>

View file

@ -16,7 +16,7 @@
<input
:value="selected"
:checked="selected"
class="checkbox"
class="checkbox select-conversation"
type="checkbox"
@change="onSelectConversation($event.target.checked)"
/>
@ -25,73 +25,99 @@
v-if="bulkActionCheck"
:src="currentContact.thumbnail"
:badge="inboxBadge"
class="columns"
class="sender-thumbnail"
:username="currentContact.name"
:status="currentContact.availability_status"
size="40px"
size="24px"
/>
<div class="conversation--details columns">
<div class="conversation--metadata">
<inbox-name v-if="showInboxName" :inbox="inbox" />
<span
<div class="message">
<div class="header">
<div class="conversation-meta">
<inbox-name v-if="showInboxName" :inbox="inbox" />
<div class="conversation__id">
<fluent-icon icon="number-symbol" size="12" />
{{ chat.id }}
</div>
</div>
<woot-label
v-if="showAssignee && assignee.name"
class="label assignee-label text-truncate"
>
<fluent-icon icon="person" size="12" />
{{ assignee.name }}
</span>
icon="headset"
small
:title="assignee.name"
class="assignee-label"
/>
</div>
<h4 class="conversation--user">
{{ currentContact.name }}
</h4>
<p v-if="lastMessageInChat" class="conversation--message">
<fluent-icon
v-if="isMessagePrivate"
size="16"
class="message--attachment-icon last-message-icon"
icon="lock-closed"
/>
<fluent-icon
v-else-if="messageByAgent"
size="16"
class="message--attachment-icon last-message-icon"
icon="arrow-reply"
/>
<fluent-icon
v-else-if="isMessageAnActivity"
size="16"
class="message--attachment-icon last-message-icon"
icon="info"
/>
<span v-if="lastMessageInChat.content">
{{ parsedLastMessage }}
<div class="user-info">
<h4 class="text-block-title conversation--user">
{{ currentContact.name }}
</h4>
</div>
<div class="content">
<span v-if="unreadCount" class="unread badge">
{{ unreadCount > 9 ? '9+' : unreadCount }}
</span>
<span v-else-if="lastMessageInChat.attachments">
<p v-if="lastMessageInChat" class="conversation--message">
<fluent-icon
v-if="attachmentIcon"
size="16"
class="message--attachment-icon"
:icon="attachmentIcon"
v-if="isMessagePrivate"
size="12"
class="message--attachment-icon last-message-icon"
icon="lock-closed"
/>
{{ this.$t(`${attachmentMessageContent}`) }}
</span>
<span v-else>
{{ $t('CHAT_LIST.NO_CONTENT') }}
</span>
</p>
<p v-else class="conversation--message">
<fluent-icon size="16" class="message--attachment-icon" icon="info" />
<span>
{{ this.$t(`CHAT_LIST.NO_MESSAGES`) }}
</span>
</p>
<div class="conversation--meta">
<span class="timestamp">
<time-ago :timestamp="chat.timestamp" />
</span>
<span class="unread">{{ unreadCount > 9 ? '9+' : unreadCount }}</span>
<fluent-icon
v-else-if="messageByAgent"
size="12"
class="message--attachment-icon last-message-icon"
icon="arrow-reply"
/>
<fluent-icon
v-else-if="isMessageAnActivity"
size="12"
class="message--attachment-icon last-message-icon"
icon="info"
/>
<span v-if="lastMessageInChat.content">
{{ parsedLastMessage }}
</span>
<span v-else-if="lastMessageInChat.attachments">
<fluent-icon
v-if="attachmentIcon"
size="12"
class="message--attachment-icon"
:icon="attachmentIcon"
/>
{{ this.$t(`${attachmentMessageContent}`) }}
</span>
<span v-else>
{{ $t('CHAT_LIST.NO_CONTENT') }}
</span>
</p>
<p v-else class="conversation--message">
<fluent-icon size="12" class="message--attachment-icon" icon="info" />
<span>
{{ this.$t(`CHAT_LIST.NO_MESSAGES`) }}
</span>
</p>
<div class="meta">
<span class="timestamp">
<time-ago :timestamp="chat.timestamp" />
</span>
</div>
</div>
<div class="footer">
<woot-label
v-for="label in activeLabels"
:key="label.id"
:title="label.title"
:description="label.description"
:color="label.color"
variant="smooth"
small
/>
</div>
</div>
<woot-context-menu
v-if="showContextMenu"
ref="menu"
@ -115,6 +141,7 @@
<script>
import { mapGetters } from 'vuex';
import { MESSAGE_TYPE } from 'widget/helpers/constants';
import conversationLabelMixin from 'dashboard/mixins/conversation/labelMixin';
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
import Thumbnail from '../Thumbnail';
import conversationMixin from '../../../mixins/conversations';
@ -145,11 +172,12 @@ export default {
},
mixins: [
inboxMixin,
timeMixin,
conversationMixin,
messageFormatterMixin,
alertMixin,
conversationMixin,
conversationLabelMixin,
inboxMixin,
messageFormatterMixin,
timeMixin,
],
props: {
activeLabel: {
@ -207,9 +235,15 @@ export default {
currentUser: 'getCurrentUser',
accountId: 'getCurrentAccountId',
}),
conversationId() {
return this.chat.id;
},
bulkActionCheck() {
return !this.hideThumbnail && !this.hovered && !this.selected;
},
chatMetadata() {
return this.chat.meta || {};
},
@ -370,81 +404,242 @@ export default {
</script>
<style lang="scss" scoped>
.conversation {
align-items: center;
display: flex;
position: relative;
border-radius: var(--border-radius-medium);
margin: 0 var(--space-small);
padding: var(--space-small);
cursor: pointer;
position: relative;
box-sizing: content-box;
&::after {
content: '';
right: 0;
top: -1px;
width: calc(100% - 40px);
position: absolute;
border-top: 1px solid var(--s-50);
}
&:hover {
background: var(--color-background-light);
background: var(--s-25);
}
&.active {
background: var(--w-25);
border: 1px solid var(--w-200);
}
&.active::after {
border-top-color: transparent;
}
&.unread-chat {
.message__content {
font-weight: var(--font-weight-medium);
}
}
&.compact {
padding-left: 0;
margin: var(--space-smaller);
.message {
margin-left: 0;
padding-left: var(--space-small);
}
}
}
.conversation-selected {
background: var(--color-background-light);
.message {
width: 100%;
min-width: 0;
margin-left: var(--space-small);
}
.has-inbox-name {
&::v-deep .user-thumbnail-box {
margin-top: var(--space-normal);
align-items: flex-start;
}
.conversation--meta {
margin-top: var(--space-normal);
}
}
.conversation--details {
.conversation--user {
padding-top: var(--space-micro);
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 60%;
}
}
.last-message-icon {
color: var(--s-600);
}
.conversation--metadata {
.message__content {
display: flex;
justify-content: space-between;
padding-right: var(--space-normal);
.label {
background: none;
align-items: center;
color: var(--color-body);
flex-grow: 0;
font-size: var(--font-size-small);
font-weight: var(--font-weight-normal);
height: var(--font-size-medium);
line-height: var(--font-size-medium);
margin: 0;
max-width: 100%;
width: auto;
.fluent-icon {
flex-shrink: 0;
margin-right: var(--space-micro);
}
}
.meta {
display: flex;
flex-grow: 1;
flex-shrink: 0;
align-items: center;
justify-content: flex-end;
padding-left: var(--space-medium);
.timestamp {
color: var(--s-500);
font-size: var(--font-size-mini);
font-weight: var(--font-weight-medium);
line-height: var(--space-slab);
padding: var(--space-micro) 0 var(--space-micro) 0;
}
.assignee-label {
display: inline-flex;
max-width: 50%;
font-weight: var(--font-weight-normal);
line-height: var(--font-size-medium);
}
}
.header {
display: flex;
justify-content: space-between;
.message--attachment-icon {
margin-top: var(--space-minus-micro);
vertical-align: middle;
height: var(--space-normal);
padding-top: var(--space-smaller);
box-sizing: content-box;
}
.content {
display: flex;
align-items: center;
height: var(--space-medium);
.badge {
color: var(--white);
margin-right: var(--space-smaller);
}
}
.assignee-name-wrap {
display: flex;
align-items: center;
margin-right: var(--space-smaller);
margin-bottom: var(--space-smaller);
}
.assignee-arrow {
color: var(--w-700);
}
.assignee-avatar {
margin-right: var(--space-micro);
}
.message--with-icon {
display: inline-flex;
align-items: center;
}
.inbox-name-wrap {
display: flex;
justify-content: flex-end;
align-items: center;
padding-left: var(--space-normal);
margin-left: auto;
.label {
background: none;
color: var(--s-600);
margin-bottom: 0;
margin-right: 0;
max-width: 12rem;
}
}
.footer {
display: flex;
align-items: center;
flex-flow: row wrap;
.label {
margin-bottom: var(--space-smaller);
}
}
.assignee-name {
font-size: var(--font-size-mini);
padding-left: var(--space-smaller);
}
.assignee-name-wrap {
border-radius: var(--border-radius-small);
padding: 0 var(--space-smaller);
border: 1px solid var(--w-75);
background: var(--w-25);
color: var(--w-800);
flex-shrink: 0;
font-weight: var(--font-weight-medium);
}
.checkbox-wrapper {
height: 40px;
width: 40px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 100%;
flex: 1 0 auto;
height: var(--space-medium);
width: var(--space-medium);
border-radius: var(--space-medium);
margin-top: var(--space-normal);
cursor: pointer;
&:hover {
background-color: var(--w-100);
}
input[type='checkbox'] {
margin: var(--space-zero);
cursor: pointer;
&:hover {
background-color: var(--w-75);
.select-conversation {
margin: var(--space-zero);
cursor: pointer;
}
}
}
.user-info {
display: flex;
align-items: center;
height: var(--space-two);
margin-top: var(--space-micro);
}
.conversation--user {
margin-bottom: 0;
text-transform: capitalize;
/* color: var(--s-800); */
}
.footer {
display: flex;
align-items: center;
flex-flow: row wrap;
margin-top: var(--space-smaller);
.label {
margin-bottom: var(--space-smaller);
}
}
.conversation-meta {
display: flex;
}
.conversation__id {
display: inline-flex;
align-items: center;
color: var(--s-600);
line-height: var(--space-normal);
height: var(--space-normal);
margin-left: var(--space-small);
}
.message--attachment-icon {
flex-shrink: 0;
position: relative;
top: 1px;
color: var(--s-600);
}
.sender-thumbnail {
margin-top: var(--space-two);
}
.select-conversation {
margin: var(--space-zero);
cursor: pointer;
}
.assignee-label {
color: var(--s-600);
margin: 0;
border-color: var(--s-25);
}
.badge {
min-width: var(--space-normal);
height: var(--space-normal);
line-height: var(--space-normal);
padding: 0 var(--space-micro);
text-align: center;
border-radius: var(--space-medium);
font-weight: var(--font-weight-bold);
}
</style>

View file

@ -186,16 +186,17 @@ export default {
<style scoped lang="scss">
.bulk-action__container {
border-bottom: 1px solid var(--s-100);
padding: var(--space-normal) var(--space-one);
padding: var(--space-normal) var(--space-small);
position: relative;
}
.bulk-action__panel {
cursor: pointer;
padding-left: var(--space-normal);
span {
font-size: var(--font-size-mini);
margin-left: var(--space-smaller);
padding-left: var(--space-small);
}
input[type='checkbox'] {

View file

@ -86,6 +86,7 @@
"globe-outline": "M12 1.999c5.524 0 10.002 4.478 10.002 10.002 0 5.523-4.478 10.001-10.002 10.001-5.524 0-10.002-4.478-10.002-10.001C1.998 6.477 6.476 1.999 12 1.999ZM14.939 16.5H9.06c.652 2.414 1.786 4.002 2.939 4.002s2.287-1.588 2.939-4.002Zm-7.43 0H4.785a8.532 8.532 0 0 0 4.094 3.411c-.522-.82-.953-1.846-1.27-3.015l-.102-.395Zm11.705 0h-2.722c-.324 1.335-.792 2.5-1.373 3.411a8.528 8.528 0 0 0 3.91-3.127l.185-.283ZM7.094 10H3.735l-.005.017a8.525 8.525 0 0 0-.233 1.984c0 1.056.193 2.067.545 3h3.173a20.847 20.847 0 0 1-.123-5Zm8.303 0H8.603a18.966 18.966 0 0 0 .135 5h6.524a18.974 18.974 0 0 0 .135-5Zm4.868 0h-3.358c.062.647.095 1.317.095 2a20.3 20.3 0 0 1-.218 3h3.173a8.482 8.482 0 0 0 .544-3c0-.689-.082-1.36-.236-2ZM8.88 4.09l-.023.008A8.531 8.531 0 0 0 4.25 8.5h3.048c.314-1.752.86-3.278 1.583-4.41ZM12 3.499l-.116.005C10.62 3.62 9.396 5.622 8.83 8.5h6.342c-.566-2.87-1.783-4.869-3.045-4.995L12 3.5Zm3.12.59.107.175c.669 1.112 1.177 2.572 1.475 4.237h3.048a8.533 8.533 0 0 0-4.339-4.29l-.291-.121Z",
"globe-desktop-outline": "M22.002 12C22.002 6.477 17.524 2 12 2 6.476 1.999 2 6.477 2 12.001c0 5.186 3.947 9.45 9.001 9.952V20.11c-.778-.612-1.478-1.905-1.939-3.61h1.94V15H8.737a18.969 18.969 0 0 1-.135-5h6.794c.068.64.105 1.31.105 2h1.5c0-.684-.033-1.353-.095-2h3.358c.154.64.237 1.31.237 2h1.5ZM4.786 16.5h2.722l.102.396c.317 1.17.748 2.195 1.27 3.015a8.532 8.532 0 0 1-4.094-3.41ZM3.736 10h3.358a20.847 20.847 0 0 0-.095 2c0 1.043.075 2.051.217 3H4.043a8.483 8.483 0 0 1-.544-3c0-.682.08-1.347.232-1.983L3.736 10Zm5.122-5.902.023-.008C8.16 5.222 7.611 6.748 7.298 8.5H4.25c.905-2 2.56-3.587 4.608-4.402Zm3.026-.594L12 3.5l.126.006c1.262.126 2.48 2.125 3.045 4.995H8.83c.568-2.878 1.79-4.88 3.055-4.996Zm3.343.76-.107-.174.291.121a8.533 8.533 0 0 1 4.339 4.29h-3.048c-.298-1.665-.806-3.125-1.475-4.237Z M12 19a1 1 0 0 0 1 1h3v2h-.5a.5.5 0 1 0 0 1h4a.5.5 0 0 0 0-1H19v-2h3a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v5Z",
"headphones-sound-wave-outline": "M3.5 12a8.5 8.5 0 0 1 17 0v2h-2.25a.75.75 0 0 0-.75.75v6.5c0 .414.336.75.75.75H19a3 3 0 0 0 3-3v-7c0-5.523-4.477-10-10-10S2 6.477 2 12v7a3 3 0 0 0 3 3h.75a.75.75 0 0 0 .75-.75v-6.5a.75.75 0 0 0-.75-.75H3.5v-2Zm17 3.5V19a1.5 1.5 0 0 1-1.5 1.5v-5h1.5ZM3.5 19v-3.5H5v5A1.5 1.5 0 0 1 3.5 19Zm9.25-7.25a.75.75 0 0 0-1.5 0v10.5a.75.75 0 0 0 1.5 0v-10.5Zm-4 2.25a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5a.75.75 0 0 1 .75-.75Zm7.25.75a.75.75 0 0 0-1.5 0v4.5a.75.75 0 0 0 1.5 0v-4.5Z",
"headset-outline": "M12 18.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm5.5-8.5V9a5.5 5.5 0 1 0-11 0v1H9a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H6.5v.25a2.25 2.25 0 0 0 2.096 2.245l.154.005h1.128a2.251 2.251 0 1 1 0 1.5H8.75a3.75 3.75 0 0 1-3.745-3.55L5 16.25V9a7 7 0 0 1 14 0v5a2 2 0 0 1-1.85 1.995L17 16h-2a1 1 0 0 1-.993-.883L14 15v-4a1 1 0 0 1 .883-.993L15 10h2.5Zm-9 1.5h-2v3h2v-3Zm9 0h-2v3H17a.5.5 0 0 0 .492-.41L17.5 14v-2.5Z",
"image-outline": "M17.75 3A3.25 3.25 0 0 1 21 6.25v11.5A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V6.25A3.25 3.25 0 0 1 6.25 3h11.5Zm.58 16.401-5.805-5.686a.75.75 0 0 0-.966-.071l-.084.07-5.807 5.687c.182.064.378.099.582.099h11.5c.203 0 .399-.035.58-.099l-5.805-5.686L18.33 19.4ZM17.75 4.5H6.25A1.75 1.75 0 0 0 4.5 6.25v11.5c0 .208.036.408.103.594l5.823-5.701a2.25 2.25 0 0 1 3.02-.116l.128.116 5.822 5.702c.067-.186.104-.386.104-.595V6.25a1.75 1.75 0 0 0-1.75-1.75Zm-2.498 2a2.252 2.252 0 1 1 0 4.504 2.252 2.252 0 0 1 0-4.504Zm0 1.5a.752.752 0 1 0 0 1.504.752.752 0 0 0 0-1.504Z",
"info-outline": "M12 1.999c5.524 0 10.002 4.478 10.002 10.002 0 5.523-4.478 10.001-10.002 10.001-5.524 0-10.002-4.478-10.002-10.001C1.998 6.477 6.476 1.999 12 1.999Zm0 1.5a8.502 8.502 0 1 0 0 17.003A8.502 8.502 0 0 0 12 3.5Zm-.004 7a.75.75 0 0 1 .744.648l.007.102.003 5.502a.75.75 0 0 1-1.493.102l-.007-.101-.003-5.502a.75.75 0 0 1 .75-.75ZM12 7.003a.999.999 0 1 1 0 1.997.999.999 0 0 1 0-1.997Z",
"keyboard-outline": "M19.745 5a2.25 2.25 0 0 1 2.25 2.25v9.505a2.25 2.25 0 0 1-2.25 2.25H4.25A2.25 2.25 0 0 1 2 16.755V7.25A2.25 2.25 0 0 1 4.25 5h15.495Zm0 1.5H4.25a.75.75 0 0 0-.75.75v9.505c0 .414.336.75.75.75h15.495a.75.75 0 0 0 .75-.75V7.25a.75.75 0 0 0-.75-.75Zm-12.995 8h10.5a.75.75 0 0 1 .102 1.493L17.25 16H6.75a.75.75 0 0 1-.102-1.493l.102-.007h10.5-10.5ZM16.5 11a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm-5.995 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm-3 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm6 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2ZM6 8a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm2.995 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm3 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm3 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm3 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z",