[Enhancement] Use thumbnail component

This commit is contained in:
Pranav Raj Sreepuram 2019-11-05 10:15:09 +05:30
parent 7a2fb8eef1
commit de76780ce5
5 changed files with 19 additions and 31 deletions

View file

@ -92,16 +92,11 @@
} }
.current-user { .current-user {
align-items: center;
@include flex; @include flex;
flex-direction: row; flex-direction: row;
cursor: pointer; cursor: pointer;
.current-user--thumbnail {
@include round-corner();
height: $space-large;
width: $space-large;
}
.current-user--data { .current-user--data {
@include flex; @include flex;
flex-direction: column; flex-direction: column;
@ -120,6 +115,7 @@
font-size: $font-size-mini; font-size: $font-size-mini;
margin-bottom: $zero; margin-bottom: $zero;
margin-left: $space-one; margin-left: $space-one;
text-transform: capitalize;
} }
} }

View file

@ -1,19 +0,0 @@
<template>
<div class="profile-card">
<div class="profile-image" v-bind:style="{ height: size, width: size }">
<img v-bind:src="src">
</div>
<img class="source-badge" src="../assets/images/fb-badge.png" v-if="badge === 'fb'">
</div>
</template>
<script>
/**
* Thumbnail Component
* Src - source for round image
* Size - Size of the thumbnail
* Badge - Chat source indication { fb / telegram }
*/
export default {
props: ['src', 'size', 'badge'],
};
</script>

View file

@ -2,7 +2,6 @@
/* eslint-env browser */ /* eslint-env browser */
import Modal from './Modal'; import Modal from './Modal';
import Thumbnail from './Thumbnail';
import Spinner from './Spinner'; import Spinner from './Spinner';
import SubmitButton from './buttons/FormSubmitButton'; import SubmitButton from './buttons/FormSubmitButton';
import Tabs from './ui/Tabs/Tabs'; import Tabs from './ui/Tabs/Tabs';
@ -14,7 +13,6 @@ import ModalHeader from './ModalHeader';
const WootUIKit = { const WootUIKit = {
Modal, Modal,
Thumbnail,
Spinner, Spinner,
SubmitButton, SubmitButton,
Tabs, Tabs,

View file

@ -39,7 +39,10 @@
</div> </div>
</transition> </transition>
<div class="current-user" @click.prevent="showOptions()"> <div class="current-user" @click.prevent="showOptions()">
<img class="current-user--thumbnail" :src="gravatarUrl()" /> <thumbnail
:src="gravatarUrl()"
:username="currentUser.name"
></thumbnail>
<div class="current-user--data"> <div class="current-user--data">
<h3 class="current-user--name"> <h3 class="current-user--name">
{{ currentUser.name }} {{ currentUser.name }}
@ -67,6 +70,7 @@ import Auth from '../../api/auth';
import SidebarItem from './SidebarItem'; import SidebarItem from './SidebarItem';
import WootStatusBar from '../widgets/StatusBar'; import WootStatusBar from '../widgets/StatusBar';
import { frontendURL } from '../../helper/URLHelper'; import { frontendURL } from '../../helper/URLHelper';
import Thumbnail from '../widgets/Thumbnail';
export default { export default {
mixins: [clickaway, adminMixin], mixins: [clickaway, adminMixin],
@ -144,7 +148,7 @@ export default {
}, },
gravatarUrl() { gravatarUrl() {
const hash = md5(this.currentUser.email); const hash = md5(this.currentUser.email);
return `${window.WootConstants.GRAVATAR_URL}${hash}?d=monsterid`; return `${window.WootConstants.GRAVATAR_URL}${hash}?default=404`;
}, },
showOptions() { showOptions() {
this.showOptionsMenu = !this.showOptionsMenu; this.showOptionsMenu = !this.showOptionsMenu;
@ -154,6 +158,7 @@ export default {
components: { components: {
SidebarItem, SidebarItem,
WootStatusBar, WootStatusBar,
Thumbnail,
}, },
}; };
</script> </script>

View file

@ -23,8 +23,14 @@
<tbody> <tbody>
<tr v-for="(agent, index) in agentList" :key="agent.email"> <tr v-for="(agent, index) in agentList" :key="agent.email">
<!-- Gravtar Image --> <!-- Gravtar Image -->
<td> <td>
<img class="woot-thumbnail" :src="gravatarUrl(agent.email)" /> <thumbnail
:src="gravatarUrl(agent.email)"
class="columns"
:username="agent.name"
size="40px"
/>
</td> </td>
<!-- Agent Name + Email --> <!-- Agent Name + Email -->
<td> <td>
@ -105,6 +111,7 @@
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import md5 from 'md5'; import md5 from 'md5';
import Thumbnail from '../../../../components/widgets/Thumbnail';
import AddAgent from './AddAgent'; import AddAgent from './AddAgent';
import EditAgent from './EditAgent'; import EditAgent from './EditAgent';
@ -115,6 +122,7 @@ export default {
AddAgent, AddAgent,
EditAgent, EditAgent,
DeleteAgent, DeleteAgent,
Thumbnail,
}, },
data() { data() {
return { return {
@ -166,7 +174,7 @@ export default {
// Gravatar URL // Gravatar URL
gravatarUrl(email) { gravatarUrl(email) {
const hash = md5(email); const hash = md5(email);
return `${window.WootConstants.GRAVATAR_URL}${hash}?d=monsterid`; return `${window.WootConstants.GRAVATAR_URL}${hash}?default=404`;
}, },
// Edit Function // Edit Function
openAddPopup() { openAddPopup() {