Change star concept to enabled

Summary:
The 'starring' concept of plugins no longer covers the meaning of 'starring', as unstarred plugins will no longer receive data from background plugins, not be available in support request forms due to a lack of data etc. So this diff renames the feature to 'enabled'.

Also fixed an issue where selecting a non-enabled plugin wouldn't show it in the sidebar if the additional plugins are collapsed.

To make disabled plugins more clear, they are . now always rendered in gray.

The toggle button now delays its effect for better visual feedback

- [x] update side bar styling
- [x] remove bottom bar warning
- [x] details screen
- [ ] only open connection for active plugins (will be done in a next diff)
- [x] check archived / imported devices
- [x] make sure device plugins work correctly
- [x] check without GK's

Reviewed By: jknoxville

Differential Revision: D19470326

fbshipit-source-id: 9160a3434287561f56b1b741d5ba282ab6063ea8
This commit is contained in:
Michel Weststrate
2020-01-27 04:02:24 -08:00
committed by Facebook Github Bot
parent 604511715b
commit 23625f7a89
8 changed files with 234 additions and 132 deletions

View File

@@ -8,12 +8,11 @@
*/
import {colors} from '../ui/components/colors';
import {styled, Glyph} from '../ui';
import {styled} from '../ui';
import {connect} from 'react-redux';
import {State} from '../reducers';
import React, {ReactElement} from 'react';
import Text from '../ui/components/Text';
import {pluginIsStarred} from '../reducers/connections';
const StatusBarContainer = styled(Text)({
backgroundColor: colors.macOSTitleBarBackgroundBlur,
@@ -48,39 +47,8 @@ export default connect<Props, void, {}, State>((state: State) => {
} = state;
if (statusMessages.length > 0) {
return {statusMessage: statusMessages[statusMessages.length - 1]};
} else if (isPreviewingBackgroundPlugin(state)) {
return {
statusMessage: (
<>
<Glyph
name="caution-triangle"
color={colors.light20}
size={12}
variant="filled"
style={{marginRight: 8}}
/>
The current plugin would like to send messages while it is in the
background. However, since this plugin is not starred, these messages
will be dropped. Star this plugin to unlock its full capabilities.
</>
),
};
}
return {
statusMessage: null,
};
})(statusBarView);
function isPreviewingBackgroundPlugin(state: State): boolean {
const {
connections: {selectedApp, selectedPlugin},
} = state;
if (!selectedPlugin || !selectedApp) {
return false;
}
const activePlugin = state.plugins.clientPlugins.get(selectedPlugin);
if (!activePlugin || !activePlugin.persistedStateReducer) {
return false;
}
return !pluginIsStarred(state.connections, selectedPlugin);
}