Feature: As an end-user, I should be able to see the list of agents in the widget. (#461)
Co-authored-by: Pranav Raj S <pranavrajs@gmail.com>
This commit is contained in:
parent
33e0bd434b
commit
83b0bb4062
20 changed files with 406 additions and 34 deletions
79
app/javascript/widget/components/AvailableAgents.vue
Normal file
79
app/javascript/widget/components/AvailableAgents.vue
Normal file
|
@ -0,0 +1,79 @@
|
|||
<template>
|
||||
<div class="available-agents">
|
||||
<div class="toast-bg">
|
||||
<div class="avatars-wrap">
|
||||
<GroupedAvatars :users="users" />
|
||||
</div>
|
||||
<div class="title">
|
||||
{{ title }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GroupedAvatars from 'widget/components/GroupedAvatars.vue';
|
||||
import { getAvailableAgentsText } from 'widget/helpers/utils';
|
||||
|
||||
export default {
|
||||
name: 'AvailableAgents',
|
||||
components: { GroupedAvatars },
|
||||
props: {
|
||||
agents: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
onClose: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
users() {
|
||||
return this.agents.map(agent => ({
|
||||
id: agent.id,
|
||||
avatar: agent.avatar_url,
|
||||
name: agent.name,
|
||||
}));
|
||||
},
|
||||
title() {
|
||||
return getAvailableAgentsText(this.agents);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '~widget/assets/scss/variables.scss';
|
||||
@import '~widget/assets/scss/mixins.scss';
|
||||
|
||||
.available-agents {
|
||||
display: flex;
|
||||
position: relative;
|
||||
justify-content: center;
|
||||
margin: $space-normal $space-medium;
|
||||
box-sizing: border-box;
|
||||
|
||||
.toast-bg {
|
||||
border-radius: $space-large;
|
||||
background: $color-body;
|
||||
@include shadow-medium;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: $font-size-default;
|
||||
font-weight: $font-weight-medium;
|
||||
color: $color-white;
|
||||
padding: $space-one $space-normal $space-one $space-small;
|
||||
line-height: 1.4;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.avatars-wrap {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-left: $space-small;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue