refactor: flow typing (#1012)
* fix: padding * fix: Minor button alignment issues * feat: Add icon to invite people button * WIP
This commit is contained in:
@@ -83,7 +83,7 @@ class CollectionScene extends React.Component<Props> {
|
||||
this.isFetching = false;
|
||||
};
|
||||
|
||||
onNewDocument = (ev: SyntheticEvent<*>) => {
|
||||
onNewDocument = (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
|
||||
if (this.collection) {
|
||||
@@ -91,7 +91,7 @@ class CollectionScene extends React.Component<Props> {
|
||||
}
|
||||
};
|
||||
|
||||
onPermissions = (ev: SyntheticEvent<*>) => {
|
||||
onPermissions = (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
this.permissionsModalOpen = true;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withRouter, type RouterHistory } from 'react-router-dom';
|
||||
import { observable } from 'mobx';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import { homeUrl } from 'utils/routeHelpers';
|
||||
@@ -12,7 +12,7 @@ import CollectionsStore from 'stores/CollectionsStore';
|
||||
import UiStore from 'stores/UiStore';
|
||||
|
||||
type Props = {
|
||||
history: Object,
|
||||
history: RouterHistory,
|
||||
collection: Collection,
|
||||
collections: CollectionsStore,
|
||||
ui: UiStore,
|
||||
@@ -23,7 +23,7 @@ type Props = {
|
||||
class CollectionDelete extends React.Component<Props> {
|
||||
@observable isDeleting: boolean;
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
this.isDeleting = true;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withRouter, type RouterHistory } from 'react-router-dom';
|
||||
import { observable } from 'mobx';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import Input from 'components/Input';
|
||||
@@ -13,7 +13,7 @@ import Collection from 'models/Collection';
|
||||
import UiStore from 'stores/UiStore';
|
||||
|
||||
type Props = {
|
||||
history: Object,
|
||||
history: RouterHistory,
|
||||
collection: Collection,
|
||||
ui: UiStore,
|
||||
onSubmit: () => void,
|
||||
@@ -31,7 +31,7 @@ class CollectionEdit extends React.Component<Props> {
|
||||
this.description = this.props.collection.description;
|
||||
}
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
this.isSaving = true;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ type Props = {
|
||||
class CollectionExport extends React.Component<Props> {
|
||||
@observable isLoading: boolean = false;
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
|
||||
this.isLoading = true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withRouter, type RouterHistory } from 'react-router-dom';
|
||||
import { observable } from 'mobx';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import Button from 'components/Button';
|
||||
@@ -15,7 +15,7 @@ import CollectionsStore from 'stores/CollectionsStore';
|
||||
import UiStore from 'stores/UiStore';
|
||||
|
||||
type Props = {
|
||||
history: Object,
|
||||
history: RouterHistory,
|
||||
ui: UiStore,
|
||||
collections: CollectionsStore,
|
||||
onSubmit: () => void,
|
||||
@@ -29,7 +29,7 @@ class CollectionNew extends React.Component<Props> {
|
||||
@observable private: boolean = false;
|
||||
@observable isSaving: boolean;
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
this.isSaving = true;
|
||||
const collection = new Collection(
|
||||
|
||||
@@ -12,7 +12,7 @@ import { DropdownMenu, DropdownMenuItem } from 'components/DropdownMenu';
|
||||
type Props = {
|
||||
user: User,
|
||||
showRemove: boolean,
|
||||
onRemove: () => *,
|
||||
onRemove: () => void,
|
||||
};
|
||||
|
||||
const MemberListItem = ({ user, onRemove, showRemove }: Props) => {
|
||||
|
||||
@@ -8,7 +8,7 @@ import User from 'models/User';
|
||||
type Props = {
|
||||
user: User,
|
||||
showAdd: boolean,
|
||||
onAdd: () => *,
|
||||
onAdd: () => void,
|
||||
};
|
||||
|
||||
const UserListItem = ({ user, onAdd, showAdd }: Props) => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import breakpoint from 'styled-components-breakpoint';
|
||||
import { observable } from 'mobx';
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import { Prompt, Route, withRouter } from 'react-router-dom';
|
||||
import type { Location } from 'react-router-dom';
|
||||
import type { Location, RouterHistory } from 'react-router-dom';
|
||||
import keydown from 'react-keydown';
|
||||
import Flex from 'shared/components/Flex';
|
||||
import {
|
||||
@@ -59,7 +59,7 @@ Are you sure you want to discard them?
|
||||
|
||||
type Props = {
|
||||
match: Object,
|
||||
history: Object,
|
||||
history: RouterHistory,
|
||||
location: Location,
|
||||
documents: DocumentsStore,
|
||||
revisions: RevisionsStore,
|
||||
|
||||
@@ -10,7 +10,6 @@ type Props = {
|
||||
document: Document,
|
||||
anchor: string,
|
||||
showCollection?: boolean,
|
||||
ref?: *,
|
||||
};
|
||||
|
||||
const DocumentLink = styled(Link)`
|
||||
|
||||
@@ -26,12 +26,12 @@ type Props = {
|
||||
documents: DocumentsStore,
|
||||
collections: CollectionsStore,
|
||||
ui: UiStore,
|
||||
onRequestClose: *,
|
||||
onRequestClose: () => void,
|
||||
};
|
||||
|
||||
@observer
|
||||
class DocumentMove extends React.Component<Props> {
|
||||
firstDocument: *;
|
||||
firstDocument: ?PathToDocument;
|
||||
@observable searchTerm: ?string;
|
||||
@observable isSaving: boolean;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ type Props = {
|
||||
};
|
||||
|
||||
class DocumentEditor extends React.Component<Props> {
|
||||
editor: *;
|
||||
editor: ?Editor;
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.props.defaultValue) {
|
||||
|
||||
@@ -32,12 +32,12 @@ type Props = {
|
||||
isPublishing: boolean,
|
||||
publishingIsDisabled: boolean,
|
||||
savingIsDisabled: boolean,
|
||||
onDiscard: () => *,
|
||||
onDiscard: () => void,
|
||||
onSave: ({
|
||||
done?: boolean,
|
||||
publish?: boolean,
|
||||
autosave?: boolean,
|
||||
}) => *,
|
||||
}) => void,
|
||||
auth: AuthStore,
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ class Header extends React.Component<Props> {
|
||||
this.props.onSave({ done: true, publish: true });
|
||||
};
|
||||
|
||||
handleShareLink = async (ev: SyntheticEvent<*>) => {
|
||||
handleShareLink = async (ev: SyntheticEvent<>) => {
|
||||
const { document } = this.props;
|
||||
if (!document.shareUrl) await document.share();
|
||||
this.showShareModal = true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withRouter, type RouterHistory } from 'react-router-dom';
|
||||
import { observable } from 'mobx';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import Button from 'components/Button';
|
||||
@@ -12,7 +12,7 @@ import UiStore from 'stores/UiStore';
|
||||
import { collectionUrl } from 'utils/routeHelpers';
|
||||
|
||||
type Props = {
|
||||
history: Object,
|
||||
history: RouterHistory,
|
||||
document: Document,
|
||||
documents: DocumentsStore,
|
||||
ui: UiStore,
|
||||
@@ -23,7 +23,7 @@ type Props = {
|
||||
class DocumentDelete extends React.Component<Props> {
|
||||
@observable isDeleting: boolean;
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
this.isDeleting = true;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import Document from 'models/Document';
|
||||
|
||||
type Props = {
|
||||
document?: Document,
|
||||
onSubmit: () => *,
|
||||
onSubmit: () => void,
|
||||
};
|
||||
|
||||
@observer
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withRouter, type RouterHistory } from 'react-router-dom';
|
||||
import { observable } from 'mobx';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import { CloseIcon } from 'outline-icons';
|
||||
@@ -21,7 +21,7 @@ const MAX_INVITES = 20;
|
||||
type Props = {
|
||||
auth: AuthStore,
|
||||
users: UsersStore,
|
||||
history: Object,
|
||||
history: RouterHistory,
|
||||
ui: UiStore,
|
||||
onSubmit: () => void,
|
||||
};
|
||||
@@ -37,7 +37,7 @@ class Invite extends React.Component<Props> {
|
||||
{ email: '', name: '' },
|
||||
];
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
this.isSaving = true;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import ReactDOM from 'react-dom';
|
||||
import keydown from 'react-keydown';
|
||||
import Waypoint from 'react-waypoint';
|
||||
import { withRouter, Link } from 'react-router-dom';
|
||||
import type { Location, RouterHistory } from 'react-router-dom';
|
||||
import { observable, action } from 'mobx';
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import { debounce } from 'lodash';
|
||||
@@ -32,9 +33,9 @@ import UserFilter from './components/UserFilter';
|
||||
import DateFilter from './components/DateFilter';
|
||||
|
||||
type Props = {
|
||||
history: Object,
|
||||
history: RouterHistory,
|
||||
match: Object,
|
||||
location: Object,
|
||||
location: Location,
|
||||
documents: DocumentsStore,
|
||||
users: UsersStore,
|
||||
notFound: ?boolean,
|
||||
|
||||
@@ -5,18 +5,18 @@ import { SearchIcon } from 'outline-icons';
|
||||
import Flex from 'shared/components/Flex';
|
||||
|
||||
type Props = {
|
||||
onChange: string => *,
|
||||
onChange: string => void,
|
||||
theme: Object,
|
||||
};
|
||||
|
||||
class SearchField extends React.Component<Props> {
|
||||
input: ?HTMLInputElement;
|
||||
|
||||
handleChange = (ev: SyntheticEvent<*>) => {
|
||||
handleChange = (ev: SyntheticEvent<HTMLInputElement>) => {
|
||||
this.props.onChange(ev.currentTarget.value ? ev.currentTarget.value : '');
|
||||
};
|
||||
|
||||
focusInput = (ev: SyntheticEvent<*>) => {
|
||||
focusInput = (ev: SyntheticEvent<>) => {
|
||||
if (this.input) this.input.focus();
|
||||
};
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class Details extends React.Component<Props> {
|
||||
clearTimeout(this.timeout);
|
||||
}
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
|
||||
try {
|
||||
|
||||
@@ -22,7 +22,7 @@ class Export extends React.Component<Props> {
|
||||
@observable isLoading: boolean = false;
|
||||
@observable isExporting: boolean = false;
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
this.isLoading = true;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class Notifications extends React.Component<Props> {
|
||||
this.props.notificationSettings.fetchPage();
|
||||
}
|
||||
|
||||
handleChange = async (ev: SyntheticInputEvent<*>) => {
|
||||
handleChange = async (ev: SyntheticInputEvent<>) => {
|
||||
const { notificationSettings } = this.props;
|
||||
const setting = notificationSettings.getByEvent(ev.target.name);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class Profile extends React.Component<Props> {
|
||||
clearTimeout(this.timeout);
|
||||
}
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
|
||||
await this.props.auth.updateUser({
|
||||
|
||||
@@ -28,7 +28,7 @@ class Tokens extends React.Component<Props> {
|
||||
this.name = ev.target.value;
|
||||
};
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
await this.props.apiKeys.create({ name: this.name });
|
||||
this.name = '';
|
||||
|
||||
@@ -4,7 +4,6 @@ import { observable } from 'mobx';
|
||||
import { observer } from 'mobx-react';
|
||||
import styled from 'styled-components';
|
||||
import Dropzone from 'react-dropzone';
|
||||
|
||||
import LoadingIndicator from 'components/LoadingIndicator';
|
||||
import Flex from 'shared/components/Flex';
|
||||
import Modal from 'components/Modal';
|
||||
@@ -14,8 +13,8 @@ import { uploadFile, dataUrlToBlob } from 'utils/uploadFile';
|
||||
|
||||
type Props = {
|
||||
children?: React.Node,
|
||||
onSuccess: string => *,
|
||||
onError: string => *,
|
||||
onSuccess: string => void | Promise<void>,
|
||||
onError: string => void,
|
||||
submitText: string,
|
||||
borderRadius: number,
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ type Props = {
|
||||
event: string,
|
||||
description: string,
|
||||
disabled: boolean,
|
||||
onChange: *,
|
||||
onChange: (ev: SyntheticInputEvent<>) => void | Promise<void>,
|
||||
};
|
||||
|
||||
const NotificationListItem = ({
|
||||
|
||||
@@ -6,7 +6,7 @@ import ApiKey from 'models/ApiKey';
|
||||
|
||||
type Props = {
|
||||
token: ApiKey,
|
||||
onDelete: (tokenId: string) => *,
|
||||
onDelete: (tokenId: string) => void,
|
||||
};
|
||||
|
||||
const TokenListItem = ({ token, onDelete }: Props) => {
|
||||
|
||||
@@ -10,14 +10,14 @@ import AuthStore from 'stores/AuthStore';
|
||||
|
||||
type Props = {
|
||||
auth: AuthStore,
|
||||
onRequestClose: () => *,
|
||||
onRequestClose: () => void,
|
||||
};
|
||||
|
||||
@observer
|
||||
class UserDelete extends React.Component<Props> {
|
||||
@observable isDeleting: boolean;
|
||||
|
||||
handleSubmit = async (ev: SyntheticEvent<*>) => {
|
||||
handleSubmit = async (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
this.isDeleting = true;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withRouter, type RouterHistory } from 'react-router-dom';
|
||||
import { EditIcon } from 'outline-icons';
|
||||
import Flex from 'shared/components/Flex';
|
||||
import HelpText from 'components/HelpText';
|
||||
@@ -22,8 +22,8 @@ type Props = {
|
||||
user: User,
|
||||
auth: AuthStore,
|
||||
documents: DocumentsStore,
|
||||
history: Object,
|
||||
onRequestClose: () => *,
|
||||
history: RouterHistory,
|
||||
onRequestClose: () => void,
|
||||
};
|
||||
|
||||
@observer
|
||||
|
||||
Reference in New Issue
Block a user