Fix Mac plugins not showing up
Summary: Fixed a bunch of issue in the new sidebar navigation 1) Stop filtering out the host device (collapse it by default instead) 2) Show offline status in title for more clarity 3) Stop sorting devices by name, so that they are sorted in connection order, which feels more consistent 4) Group uninitialised clients together, rather than showing them under every device 5) Rename "device" section to "device plugins", and hide it if there are none 6) some minor margin fixes Reviewed By: jknoxville Differential Revision: D19495950 fbshipit-source-id: 513d0a1171016bd3077641f614a6554a132f8180
This commit is contained in:
committed by
Facebook Github Bot
parent
0f5556dcf0
commit
02e02338e8
@@ -195,19 +195,16 @@ class MainSidebar2 extends PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const devices = this.props.devices
|
const {devices} = this.props;
|
||||||
.slice()
|
|
||||||
.sort((a, b) => a.title.localeCompare(b.title));
|
|
||||||
const renderableDevices = devices.filter(canBeDefaultDevice);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Sidebar position="left" width={200} backgroundColor={colors.light02}>
|
<Sidebar position="left" width={200} backgroundColor={colors.light02}>
|
||||||
<Plugins>
|
<Plugins>
|
||||||
{renderableDevices.length ? (
|
{devices.length ? (
|
||||||
renderableDevices.map(device => this.renderDevice(device))
|
devices.map(device => this.renderDevice(device))
|
||||||
) : (
|
) : (
|
||||||
<NoDevices />
|
<NoDevices />
|
||||||
)}
|
)}
|
||||||
|
{this.renderUnitializedClients()}
|
||||||
</Plugins>
|
</Plugins>
|
||||||
<MainSidebarUtilsSection />
|
<MainSidebarUtilsSection />
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
@@ -218,7 +215,6 @@ class MainSidebar2 extends PureComponent<Props, State> {
|
|||||||
const {
|
const {
|
||||||
selectedPlugin,
|
selectedPlugin,
|
||||||
selectPlugin,
|
selectPlugin,
|
||||||
uninitializedClients,
|
|
||||||
clientPlugins,
|
clientPlugins,
|
||||||
starPlugin,
|
starPlugin,
|
||||||
userStarredPlugins,
|
userStarredPlugins,
|
||||||
@@ -228,30 +224,41 @@ class MainSidebar2 extends PureComponent<Props, State> {
|
|||||||
const clients = getAvailableClients(device, this.props.clients);
|
const clients = getAvailableClients(device, this.props.clients);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarSection title={device.title} key={device.serial} level={1}>
|
<SidebarSection
|
||||||
|
title={`${device.title} ${
|
||||||
|
device.isArchived ? (device.source ? '(imported)' : '(offline)') : ''
|
||||||
|
}`}
|
||||||
|
key={device.serial}
|
||||||
|
level={1}
|
||||||
|
defaultCollapsed={!canBeDefaultDevice(device)}>
|
||||||
{this.showArchivedDeviceDetails(device)}
|
{this.showArchivedDeviceDetails(device)}
|
||||||
<SidebarSection level={2} title="Device" defaultCollapsed={true}>
|
{device.devicePlugins.length > 0 ? (
|
||||||
{device.devicePlugins.map(pluginName => {
|
<SidebarSection
|
||||||
const plugin = this.props.devicePlugins.get(pluginName)!;
|
level={2}
|
||||||
return (
|
title="Device Plugins"
|
||||||
<PluginSidebarListItem
|
defaultCollapsed={true}>
|
||||||
key={plugin.id}
|
{device.devicePlugins.map(pluginName => {
|
||||||
isActive={
|
const plugin = this.props.devicePlugins.get(pluginName)!;
|
||||||
plugin.id === selectedPlugin && selectedDevice === device
|
return (
|
||||||
}
|
<PluginSidebarListItem
|
||||||
onClick={() =>
|
key={plugin.id}
|
||||||
selectPlugin({
|
isActive={
|
||||||
selectedPlugin: plugin.id,
|
plugin.id === selectedPlugin && selectedDevice === device
|
||||||
selectedApp: null,
|
}
|
||||||
deepLinkPayload: null,
|
onClick={() =>
|
||||||
selectedDevice: device,
|
selectPlugin({
|
||||||
})
|
selectedPlugin: plugin.id,
|
||||||
}
|
selectedApp: null,
|
||||||
plugin={plugin}
|
deepLinkPayload: null,
|
||||||
/>
|
selectedDevice: device,
|
||||||
);
|
})
|
||||||
})}
|
}
|
||||||
</SidebarSection>
|
plugin={plugin}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</SidebarSection>
|
||||||
|
) : null}
|
||||||
{clients.length === 0 ? (
|
{clients.length === 0 ? (
|
||||||
<NoClients />
|
<NoClients />
|
||||||
) : (
|
) : (
|
||||||
@@ -269,6 +276,14 @@ class MainSidebar2 extends PureComponent<Props, State> {
|
|||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
|
</SidebarSection>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderUnitializedClients() {
|
||||||
|
const {uninitializedClients} = this.props;
|
||||||
|
return uninitializedClients.length > 0 ? (
|
||||||
|
<SidebarSection title="Connecting..." key="unitializedClients" level={1}>
|
||||||
{uninitializedClients.map(entry => (
|
{uninitializedClients.map(entry => (
|
||||||
<SidebarSection
|
<SidebarSection
|
||||||
color={getColorByApp(entry.client.appName)}
|
color={getColorByApp(entry.client.appName)}
|
||||||
@@ -286,7 +301,7 @@ class MainSidebar2 extends PureComponent<Props, State> {
|
|||||||
level={2}></SidebarSection>
|
level={2}></SidebarSection>
|
||||||
))}
|
))}
|
||||||
</SidebarSection>
|
</SidebarSection>
|
||||||
);
|
) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
showArchivedDeviceDetails(device: BaseDevice) {
|
showArchivedDeviceDetails(device: BaseDevice) {
|
||||||
@@ -300,7 +315,7 @@ class MainSidebar2 extends PureComponent<Props, State> {
|
|||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ListItem>
|
<ListItem style={{marginTop: 8}}>
|
||||||
<Info type="warning" small>
|
<Info type="warning" small>
|
||||||
{device.source ? 'Imported device' : 'Archived device'}
|
{device.source ? 'Imported device' : 'Archived device'}
|
||||||
</Info>
|
</Info>
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ export const NoDevices = () => (
|
|||||||
);
|
);
|
||||||
|
|
||||||
export const NoClients = () => (
|
export const NoClients = () => (
|
||||||
<ListItem>
|
<ListItem style={{marginTop: 8}}>
|
||||||
<Glyph
|
<Glyph
|
||||||
name="mobile-engagement"
|
name="mobile-engagement"
|
||||||
size={16}
|
size={16}
|
||||||
|
|||||||
Reference in New Issue
Block a user