Skip to content

Commit

Permalink
[#2149] UI crashes when filtering with unknown source involved (#2152)
Browse files Browse the repository at this point in the history
* fixed ui crash for unknown source

* added colorful ig icon
  • Loading branch information
AudreyKj authored Jul 13, 2021
1 parent a88c16f commit eb717c8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/ui/src/components/SourceIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ import {ReactComponent as WhatsappIcon} from 'assets/images/icons/whatsapp_avata
import {ReactComponent as SmsIcon} from 'assets/images/icons/sms_avatar.svg';
import {ReactComponent as FacebookIcon} from 'assets/images/icons/messenger_avatar.svg';
import {ReactComponent as AiryAvatar} from 'assets/images/icons/airy_avatar.svg';
import {ReactComponent as InstagramIcon} from 'assets/images/icons/instagramSource.svg';
import {ReactComponent as BubbleIcon} from 'assets/images/icons/bubble.svg';

const sourceIconsMap = {
google: GoogleIcon,
facebook: FacebookIcon,
'twilio.sms': SmsIcon,
'twilio.whatsapp': WhatsappIcon,
chatplugin: AiryAvatar,
instagram: InstagramIcon,
unknown: BubbleIcon,
};

export const SourceIcon = ({source, ...props}) => {
const SourceIcon = sourceIconsMap[source];
const SourceIcon = sourceIconsMap[source] ?? sourceIconsMap['unknown'];
return <SourceIcon {...props} />;
};
3 changes: 3 additions & 0 deletions lib/typescript/assets/images/icons/bubble.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions lib/typescript/assets/images/icons/instagramSource.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit eb717c8

Please sign in to comment.