Use predefined icons for Facebook family apps
Summary: Ideally, we want to fetch app Icons from the device, but for now, we can at least for Facebook owned apps we can use a hardcoded set of icons, which probably even looks better. For ` Lite` apps, the colors of the icon and background are reversed, which makes both variations recognizable. Reviewed By: jknoxville Differential Revision: D24920161 fbshipit-source-id: 5220093fb3a443ae535faa4c346a2029de9cbbd5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
dca419ee24
commit
c9a278fb0f
@@ -15,7 +15,7 @@ import {
|
|||||||
WindowsOutlined,
|
WindowsOutlined,
|
||||||
CaretDownOutlined,
|
CaretDownOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import {Layout, styled} from '../../ui';
|
import {Glyph, Layout, styled} from '../../ui';
|
||||||
import {theme} from 'flipper-plugin';
|
import {theme} from 'flipper-plugin';
|
||||||
import {batch} from 'react-redux';
|
import {batch} from 'react-redux';
|
||||||
import {Dispatch, useDispatch, useStore} from '../../utils/useStore';
|
import {Dispatch, useDispatch, useStore} from '../../utils/useStore';
|
||||||
@@ -29,6 +29,7 @@ import BaseDevice, {OS} from '../../devices/BaseDevice';
|
|||||||
import {getColorByApp} from '../../chrome/mainsidebar/sidebarUtils';
|
import {getColorByApp} from '../../chrome/mainsidebar/sidebarUtils';
|
||||||
import Client from '../../Client';
|
import Client from '../../Client';
|
||||||
import {State} from '../../reducers';
|
import {State} from '../../reducers';
|
||||||
|
import {brandIcons} from '../../ui/components/colors';
|
||||||
|
|
||||||
const {Text} = Typography;
|
const {Text} = Typography;
|
||||||
|
|
||||||
@@ -113,14 +114,33 @@ const AppInspectButton = styled(Button)({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const AppIcon = styled.div<{appname?: string}>(({appname}) => ({
|
function AppIcon({appname}: {appname?: string}) {
|
||||||
|
const brandName = appname?.replace(/ Lite$/, '');
|
||||||
|
const color = brandName
|
||||||
|
? getColorByApp(brandName)
|
||||||
|
: theme.backgroundTransparentHover;
|
||||||
|
const icon = brandName && (brandIcons as any)[brandName];
|
||||||
|
return (
|
||||||
|
<AppIconContainer
|
||||||
|
style={{background: brandName != appname ? 'white' : color}}>
|
||||||
|
{icon && (
|
||||||
|
<Glyph
|
||||||
|
name={icon}
|
||||||
|
size={24}
|
||||||
|
variant="outline"
|
||||||
|
color={brandName != appname ? color : 'white'}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</AppIconContainer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const AppIconContainer = styled.div({
|
||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
width: 36,
|
width: 36,
|
||||||
height: 36,
|
height: 36,
|
||||||
background: appname
|
padding: 6,
|
||||||
? getColorByApp(appname)
|
});
|
||||||
: theme.backgroundTransparentHover,
|
|
||||||
}));
|
|
||||||
|
|
||||||
function computeEntries(
|
function computeEntries(
|
||||||
devices: BaseDevice[],
|
devices: BaseDevice[],
|
||||||
|
|||||||
@@ -280,5 +280,18 @@ export const brandColors = {
|
|||||||
Facebook: '#0D7BED',
|
Facebook: '#0D7BED',
|
||||||
Messenger: '#0088FA',
|
Messenger: '#0088FA',
|
||||||
Instagram: '#E61E68',
|
Instagram: '#E61E68',
|
||||||
|
WhatsApp: '#25D366',
|
||||||
|
Workplace: '#20262c',
|
||||||
|
'Work Chat': '#20262c',
|
||||||
Flipper: theme.primaryColor,
|
Flipper: theme.primaryColor,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// https://www.internalfb.com/intern/assets/set/facebook_icons/
|
||||||
|
export const brandIcons = {
|
||||||
|
Facebook: 'app-facebook-f',
|
||||||
|
Messenger: 'app-messenger',
|
||||||
|
Instagram: 'app-instagram',
|
||||||
|
WhatsApp: 'app-whatsapp',
|
||||||
|
Workplace: 'app-workplace',
|
||||||
|
'Work Chat': 'app-work-chat',
|
||||||
|
};
|
||||||
|
|||||||
@@ -538,5 +538,23 @@
|
|||||||
],
|
],
|
||||||
"bookmark-outline": [
|
"bookmark-outline": [
|
||||||
16
|
16
|
||||||
|
],
|
||||||
|
"app-facebook-f-outline": [
|
||||||
|
24
|
||||||
|
],
|
||||||
|
"app-messenger-outline": [
|
||||||
|
24
|
||||||
|
],
|
||||||
|
"app-instagram-outline": [
|
||||||
|
24
|
||||||
|
],
|
||||||
|
"app-whatsapp-outline": [
|
||||||
|
24
|
||||||
|
],
|
||||||
|
"app-workplace-outline": [
|
||||||
|
24
|
||||||
|
],
|
||||||
|
"app-work-chat-outline": [
|
||||||
|
24
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user