fix: flow errors
This commit is contained in:
parent
b1633481e7
commit
88a731ffea
14 changed files with 71 additions and 58 deletions
|
@ -50,6 +50,7 @@
|
|||
"no-prototype-builtins": 0,
|
||||
"flowtype/space-after-type-colon": [2, "always", { "allowLineBreak": true }],
|
||||
"no-restricted-syntax": 0,
|
||||
"no-empty": 0
|
||||
"no-empty": 0,
|
||||
"react/prefer-stateless-function": 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[ignore]
|
||||
node_modules/
|
||||
|
||||
[include]
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@ type Analytics = {
|
|||
track: (string, ?Object) => void,
|
||||
setUser: Object => void,
|
||||
toggle: (boolean, ?boolean) => void,
|
||||
apiLogView: (string, string, string) => void,
|
||||
apiLogView: (string, string, string, ?number, ?() => void) => void,
|
||||
};
|
||||
|
||||
let analyticsEnabled: boolean = false;
|
||||
|
||||
const analytics: Analytics = {
|
||||
track: (name: string, payload: ?Object): void => {
|
||||
track: (name, payload) => {
|
||||
if (analyticsEnabled) {
|
||||
if (payload) {
|
||||
mixpanel.track(name, payload);
|
||||
|
@ -28,7 +28,7 @@ const analytics: Analytics = {
|
|||
}
|
||||
}
|
||||
},
|
||||
setUser: (user: Object): void => {
|
||||
setUser: user => {
|
||||
if (user.id) {
|
||||
mixpanel.identify(user.id);
|
||||
}
|
||||
|
@ -44,13 +44,7 @@ const analytics: Analytics = {
|
|||
}
|
||||
analyticsEnabled = enabled;
|
||||
},
|
||||
apiLogView: (
|
||||
uri: string,
|
||||
outpoint: string,
|
||||
claimId: string,
|
||||
timeToStart?: number,
|
||||
onSuccessCb: ?() => void
|
||||
): void => {
|
||||
apiLogView: (uri, outpoint, claimId, timeToStart, onSuccessCb) => {
|
||||
if (analyticsEnabled) {
|
||||
const params: {
|
||||
uri: string,
|
||||
|
|
|
@ -29,8 +29,12 @@ type Props = {
|
|||
token: string,
|
||||
};
|
||||
|
||||
class CardVerify extends React.Component {
|
||||
constructor(props) {
|
||||
type State = {
|
||||
open: boolean,
|
||||
};
|
||||
|
||||
class CardVerify extends React.Component<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
open: false,
|
||||
|
|
|
@ -16,15 +16,16 @@ type Props = {
|
|||
fileType: string,
|
||||
contentType: string,
|
||||
downloadPath: string,
|
||||
url: ?string,
|
||||
},
|
||||
currentTheme: string,
|
||||
};
|
||||
|
||||
class FileRender extends React.PureComponent<Props> {
|
||||
constructor(props) {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.escapeListener = this.escapeListener.bind(this);
|
||||
(this: any).escapeListener = this.escapeListener.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
@ -35,7 +36,8 @@ class FileRender extends React.PureComponent<Props> {
|
|||
window.removeEventListener('keydown', this.escapeListener, true);
|
||||
}
|
||||
|
||||
processSandboxRef(element) {
|
||||
// This should use React.createRef()
|
||||
processSandboxRef(element: any) {
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
@ -47,7 +49,7 @@ class FileRender extends React.PureComponent<Props> {
|
|||
console.log('permissionrequest', e);
|
||||
});
|
||||
|
||||
element.addEventListener('console-message', e => {
|
||||
element.addEventListener('console-message', (e: { message: string }) => {
|
||||
if (/^\$LBRY_IPC:/.test(e.message)) {
|
||||
// Process command
|
||||
let message = {};
|
||||
|
@ -71,7 +73,7 @@ class FileRender extends React.PureComponent<Props> {
|
|||
});
|
||||
}
|
||||
|
||||
escapeListener(e) {
|
||||
escapeListener(e: SyntheticKeyboardEvent<*>) {
|
||||
if (e.keyCode === 27) {
|
||||
e.preventDefault();
|
||||
|
||||
|
@ -97,7 +99,7 @@ class FileRender extends React.PureComponent<Props> {
|
|||
// Supported mediaTypes
|
||||
const mediaTypes = {
|
||||
'3D-file': <ThreeViewer source={{ fileType, downloadPath }} theme={currentTheme} />,
|
||||
application: (
|
||||
application: !source.url ? null : (
|
||||
<webview
|
||||
ref={element => this.processSandboxRef(element)}
|
||||
title=""
|
||||
|
|
|
@ -5,7 +5,7 @@ import Button from 'component/button';
|
|||
import * as ICONS from 'constants/icons';
|
||||
|
||||
type Props = {
|
||||
play: () => void,
|
||||
play: (SyntheticInputEvent<*>) => void,
|
||||
isLoading: boolean,
|
||||
mediaType: string,
|
||||
fileInfo: ?{},
|
||||
|
|
|
@ -42,6 +42,7 @@ type Props = {
|
|||
searchBarFocused: boolean,
|
||||
mediaType: string,
|
||||
claimRewards: () => void,
|
||||
costInfo: ?{ cost: number },
|
||||
};
|
||||
|
||||
class FileViewer extends React.PureComponent<Props> {
|
||||
|
@ -96,7 +97,7 @@ class FileViewer extends React.PureComponent<Props> {
|
|||
this.props.playingUri !== prev.playingUri
|
||||
) {
|
||||
// suppress autoplay after download error
|
||||
if (!(this.props.uri in this.props.fileInfoErrors)) {
|
||||
if (!this.props.fileInfoErrors || !(this.props.uri in this.props.fileInfoErrors)) {
|
||||
this.handleAutoplay(this.props);
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +168,7 @@ class FileViewer extends React.PureComponent<Props> {
|
|||
}
|
||||
}
|
||||
|
||||
fireAnalyticsEvent(claim, startTime, playTime) {
|
||||
fireAnalyticsEvent(claim: Claim, startTime: ?number, playTime: ?number) {
|
||||
const { claimRewards } = this.props;
|
||||
const { name, claim_id: claimId, txid, nout } = claim;
|
||||
|
||||
|
@ -264,7 +265,7 @@ class FileViewer extends React.PureComponent<Props> {
|
|||
style={layoverStyle}
|
||||
>
|
||||
<PlayButton
|
||||
play={e => {
|
||||
play={(e: SyntheticInputEvent<*>) => {
|
||||
e.stopPropagation();
|
||||
this.playContent();
|
||||
}}
|
||||
|
|
|
@ -10,16 +10,21 @@ type Props = {
|
|||
|
||||
export default (props: Props) => {
|
||||
const { claimId, claimName } = props;
|
||||
|
||||
if (claimId && claimName) {
|
||||
const speechURL = claimName.startsWith('@')
|
||||
? `${claimName}:${claimId}`
|
||||
: `${claimId}/${claimName}`;
|
||||
|
||||
return claimId && claimName ? (
|
||||
return (
|
||||
<Button
|
||||
icon={ICONS.GLOBE}
|
||||
button="alt"
|
||||
label={__('Share')}
|
||||
href={`https://spee.ch/${speechURL}`}
|
||||
/>
|
||||
) : null;
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
|
|
@ -55,13 +55,10 @@ class WunderBar extends React.PureComponent<Props> {
|
|||
const { ctrlKey, metaKey, keyCode } = event;
|
||||
const { doFocus, doBlur, focused } = this.props;
|
||||
|
||||
if (!this.input) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.input) {
|
||||
if (focused && keyCode === ESC_KEY_CODE) {
|
||||
doBlur();
|
||||
this.input.blur();
|
||||
doBlur();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -71,8 +68,9 @@ class WunderBar extends React.PureComponent<Props> {
|
|||
: keyCode === L_KEY_CODE && ctrlKey;
|
||||
|
||||
if (shouldFocus) {
|
||||
doFocus();
|
||||
this.input.focus();
|
||||
doFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,11 +6,15 @@ import Button from 'component/button';
|
|||
type Props = {
|
||||
closeModal: () => void,
|
||||
decryptWallet: () => void,
|
||||
updateWalletStatus: () => void,
|
||||
walletDecryptSucceded: boolean,
|
||||
updateWalletStatus: boolean,
|
||||
};
|
||||
|
||||
class ModalWalletDecrypt extends React.PureComponent<Props> {
|
||||
type State = {
|
||||
submitted: boolean,
|
||||
};
|
||||
|
||||
class ModalWalletDecrypt extends React.PureComponent<Props, State> {
|
||||
state = {
|
||||
submitted: false, // Prior actions could be marked complete
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ type Props = {
|
|||
closeModal: () => void,
|
||||
walletEncryptSucceded: boolean,
|
||||
updateWalletStatus: boolean,
|
||||
encryptWallet: string => void,
|
||||
encryptWallet: (?string) => void,
|
||||
updateWalletStatus: () => void,
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@ type State = {
|
|||
understandConfirmed: boolean,
|
||||
understandError: boolean,
|
||||
submitted: boolean,
|
||||
failMessage: boolean,
|
||||
failMessage: ?string,
|
||||
};
|
||||
|
||||
class ModalWalletEncrypt extends React.PureComponent<Props, State> {
|
||||
|
@ -30,7 +30,7 @@ class ModalWalletEncrypt extends React.PureComponent<Props, State> {
|
|||
understandConfirmed: false,
|
||||
understandError: false,
|
||||
submitted: false, // Prior actions could be marked complete
|
||||
failMessage: false,
|
||||
failMessage: undefined,
|
||||
};
|
||||
|
||||
componentDidUpdate() {
|
||||
|
|
|
@ -6,7 +6,8 @@ import Button from 'component/button';
|
|||
|
||||
type Props = {
|
||||
quit: () => void,
|
||||
unlockWallet: string => void,
|
||||
closeModal: () => void,
|
||||
unlockWallet: (?string) => void,
|
||||
walletUnlockSucceded: boolean,
|
||||
};
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ class FilePage extends React.Component<Props> {
|
|||
// We will select the claim id before they publish
|
||||
let editUri;
|
||||
if (claimIsMine) {
|
||||
const uriObject: { contentName: string, claimId: string, channelName: ?string } = {
|
||||
const uriObject: { contentName: string, claimId: string, channelName?: string } = {
|
||||
contentName: claim.name,
|
||||
claimId: claim.claim_id,
|
||||
};
|
||||
|
|
|
@ -3,7 +3,9 @@ import React from 'react';
|
|||
import Page from 'component/page';
|
||||
import UserHistory from 'component/userHistory';
|
||||
|
||||
class UserHistoryPage extends React.PureComponent {
|
||||
type Props = {};
|
||||
|
||||
class UserHistoryPage extends React.PureComponent<Props> {
|
||||
render() {
|
||||
return (
|
||||
<Page>
|
||||
|
|
Loading…
Reference in a new issue