Add user ratings

Summary:
Adds a star rating to flipper internal.

Based on the nuclide behaviour:
We get an event emitted when a user changes their rating.
And we also get the rating with every ping event, which is fired every minute, if flipper is the primary window.

The only thing I don't like that much is that this doesn't actually say anywhere what the stars are for.

Reviewed By: passy

Differential Revision: D16420281

fbshipit-source-id: 69a52f64058955d7cd068215478e95c554cb9ed4
This commit is contained in:
John Knox
2019-07-24 00:11:26 -07:00
committed by Facebook Github Bot
parent a646c4e2ff
commit f7875002dd
6 changed files with 123 additions and 1 deletions

View File

@@ -23,7 +23,9 @@ import {
toggleLeftSidebarVisible,
toggleRightSidebarVisible,
ACTIVE_SHEET_BUG_REPORTER,
setFlipperRating,
} from '../reducers/application.js';
import RatingButton from './RatingButton.js';
import DevicesButton from './DevicesButton.js';
import ScreenCaptureButtons from './ScreenCaptureButtons.js';
import AutoUpdateVersion from './AutoUpdateVersion.js';
@@ -62,6 +64,7 @@ type DispatchFromProps = {
toggleLeftSidebarVisible: (visible?: boolean) => void,
toggleRightSidebarVisible: (visible?: boolean) => void,
setActiveSheet: (sheet: ActiveSheet) => void,
setFlipperRating: number => void,
};
type StateFromProps = {
@@ -71,6 +74,7 @@ type StateFromProps = {
rightSidebarAvailable: boolean,
downloadingImportData: boolean,
launcherMsg: LauncherMsg,
flipperRating: ?number,
};
const VersionText = styled(Text)({
@@ -124,7 +128,14 @@ class TitleBar extends React.Component<Props> {
&nbsp;Importing data...
</Importing>
)}
<Spacer />
{config.showFlipperRating ? (
<RatingButton
rating={this.props.flipperRating}
onRatingChanged={this.props.setFlipperRating}
/>
) : null}
<Version>{this.props.version + (isProduction() ? '' : '-dev')}</Version>
{isAutoUpdaterEnabled() ? (
@@ -175,6 +186,7 @@ export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
rightSidebarAvailable,
downloadingImportData,
launcherMsg,
flipperRating,
},
}) => ({
windowIsFocused,
@@ -183,10 +195,12 @@ export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
rightSidebarAvailable,
downloadingImportData,
launcherMsg,
flipperRating,
}),
{
setActiveSheet,
toggleLeftSidebarVisible,
toggleRightSidebarVisible,
setFlipperRating,
},
)(TitleBar);