Enhancement: Conversation item redesign (#1857)
* Rearrange the inboxes label in conversations.
This commit is contained in:
28
app/javascript/dashboard/helper/inbox.js
Normal file
28
app/javascript/dashboard/helper/inbox.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { INBOX_TYPES } from 'shared/mixins/inboxMixin';
|
||||
|
||||
export const getInboxClassByType = (type, phoneNumber) => {
|
||||
switch (type) {
|
||||
case INBOX_TYPES.WEB:
|
||||
return 'ion-earth';
|
||||
|
||||
case INBOX_TYPES.FB:
|
||||
return 'ion-social-facebook';
|
||||
|
||||
case INBOX_TYPES.TWITTER:
|
||||
return 'ion-social-twitter';
|
||||
|
||||
case INBOX_TYPES.TWILIO:
|
||||
return phoneNumber.startsWith('whatsapp')
|
||||
? 'ion-social-whatsapp-outline'
|
||||
: 'ion-android-textsms';
|
||||
|
||||
case INBOX_TYPES.API:
|
||||
return 'ion-cloud';
|
||||
|
||||
case INBOX_TYPES.EMAIL:
|
||||
return 'ion-email';
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
};
|
||||
35
app/javascript/dashboard/helper/specs/inbox.spec.js
Normal file
35
app/javascript/dashboard/helper/specs/inbox.spec.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import { getInboxClassByType } from '../inbox';
|
||||
|
||||
describe('#Inbox Helpers', () => {
|
||||
describe('getInboxClassByType', () => {
|
||||
it('should return correct class for web widget', () => {
|
||||
expect(getInboxClassByType('Channel::WebWidget')).toEqual('ion-earth');
|
||||
});
|
||||
it('should return correct class for fb page', () => {
|
||||
expect(getInboxClassByType('Channel::FacebookPage')).toEqual(
|
||||
'ion-social-facebook'
|
||||
);
|
||||
});
|
||||
it('should return correct class for twitter profile', () => {
|
||||
expect(getInboxClassByType('Channel::TwitterProfile')).toEqual(
|
||||
'ion-social-twitter'
|
||||
);
|
||||
});
|
||||
it('should return correct class for twilio sms', () => {
|
||||
expect(getInboxClassByType('Channel::TwilioSms', '')).toEqual(
|
||||
'ion-android-textsms'
|
||||
);
|
||||
});
|
||||
it('should return correct class for whatsapp', () => {
|
||||
expect(getInboxClassByType('Channel::TwilioSms', 'whatsapp')).toEqual(
|
||||
'ion-social-whatsapp-outline'
|
||||
);
|
||||
});
|
||||
it('should return correct class for Api', () => {
|
||||
expect(getInboxClassByType('Channel::Api')).toEqual('ion-cloud');
|
||||
});
|
||||
it('should return correct class for Email', () => {
|
||||
expect(getInboxClassByType('Channel::Email')).toEqual('ion-email');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user