Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Add device level icons
Browse files Browse the repository at this point in the history
Summary: Gave every device an icon, and use it as fallback in case we don't have a client icon. Added an icon for the Flipper client. This gets (largely) rid of the 'blank' icons

Reviewed By: fabiomassimo

Differential Revision: D26691054

fbshipit-source-id: d83012e755ae5edb230747e88f9b2eac45450b19
  • Loading branch information
mweststrate authored and facebook-github-bot committed Feb 26, 2021
1 parent a5cd18c commit f2689d3
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion desktop/app/src/devices/AndroidDevice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class AndroidDevice extends BaseDevice {
) {
super(serial, deviceType, title, 'Android', specs);
this.adb = adb;
this.icon = 'icons/android.svg';
this.icon = 'mobile';
this.abiList = abiList;
this.sdkVersion = sdkVersion;
this.adb.openLogcat(this.serial).then((reader) => {
Expand Down
1 change: 1 addition & 0 deletions desktop/app/src/devices/ArchivedDevice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default class ArchivedDevice extends BaseDevice {
supportRequestDetails?: SupportFormRequestDetailsState;
}) {
super(options.serial, options.deviceType, options.title, options.os);
this.icon = 'box';
this.connected.set(false);
this.source = options.source || '';
this.supportRequestDetails = options.supportRequestDetails;
Expand Down
2 changes: 1 addition & 1 deletion desktop/app/src/devices/IOSDevice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class IOSDevice extends BaseDevice {

constructor(serial: string, deviceType: DeviceType, title: string) {
super(serial, deviceType, title, 'iOS');
this.icon = 'icons/ios.svg';
this.icon = 'mobile';
this.buffer = '';
this.startLogListener();
}
Expand Down
1 change: 1 addition & 0 deletions desktop/app/src/devices/MacDevice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import BaseDevice from './BaseDevice';
export default class MacDevice extends BaseDevice {
constructor() {
super('', 'physical', 'Mac', 'MacOS');
this.icon = 'app-apple';
}

teardown() {}
Expand Down
1 change: 1 addition & 0 deletions desktop/app/src/devices/WindowsDevice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import BaseDevice from './BaseDevice';
export default class WindowsDevice extends BaseDevice {
constructor() {
super('', 'physical', 'Windows', 'Windows');
this.icon = 'app-microsoft-windows';
}

teardown() {}
Expand Down
12 changes: 9 additions & 3 deletions desktop/app/src/sandy-chrome/appinspect/AppSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function AppSelector() {
}>
<AppInspectButton title="Select the device / app to inspect">
<Layout.Horizontal gap center>
<AppIcon appname={client?.query.app} />
<AppIcon appname={client?.query.app} device={selectedDevice} />
<Layout.Container grow shrink>
<Text strong>{client?.query.app ?? ''}</Text>
<Text>{selectedDevice?.title || 'Available devices'}</Text>
Expand Down Expand Up @@ -137,13 +137,19 @@ const AppInspectButton = styled(Button)({
},
});

function AppIcon({appname}: {appname?: string}) {
function AppIcon({
appname,
device,
}: {
appname?: string;
device?: BaseDevice | null;
}) {
const invert = appname?.endsWith('Lite') ?? false;
const brandName = appname?.replace(/ Lite$/, '');
const color = brandName
? getColorByApp(brandName)
: theme.backgroundTransparentHover;
const icon = brandName && (brandIcons as any)[brandName];
const icon = (brandName && (brandIcons as any)[brandName]) ?? device?.icon;
return (
<AppIconContainer style={{background: invert ? 'white' : color}}>
{icon && (
Expand Down
1 change: 1 addition & 0 deletions desktop/app/src/ui/components/colors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,5 @@ export const brandIcons = {
WhatsApp: 'app-whatsapp',
Workplace: 'app-workplace',
'Work Chat': 'app-work-chat',
Flipper: 'list-gear', // used for the self inspection client
};
15 changes: 13 additions & 2 deletions desktop/static/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
16
],
"box": [
12
12,
24
],
"brush-paint": [
12,
Expand Down Expand Up @@ -536,7 +537,8 @@
16
],
"mobile-outline": [
16
16,
24
],
"bookmark-outline": [
16
Expand Down Expand Up @@ -571,5 +573,14 @@
],
"upload": [
16
],
"list-gear-outline": [
24
],
"app-apple-outline": [
24
],
"app-microsoft-windows": [
24
]
}

0 comments on commit f2689d3

Please sign in to comment.