From e2bd03494d0856ef97f4844149dbc99c53ab486e Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 9 Aug 2020 09:48:04 -0700 Subject: [PATCH] chore: Update syntax, improve more typing (#1439) * chore: to <> * flow types --- app/components/Avatar/AvatarWithPresence.js | 4 +- app/components/Breadcrumb.js | 24 ++--- app/components/Button.js | 2 +- app/components/Checkbox.js | 5 +- app/components/DocumentMeta.js | 4 +- app/components/DropdownMenu/DropdownMenu.js | 4 +- .../DropdownMenu/DropdownMenuItem.js | 4 +- app/components/Editor.js | 17 +-- app/components/GroupListItem.js | 8 +- app/components/HoverPreview.js | 6 +- app/components/InputRich.js | 4 +- app/components/Modal.js | 4 +- app/components/NudeButton.js | 2 +- app/components/PaginatedList.js | 8 +- .../Sidebar/components/Collections.js | 4 +- app/components/Sidebar/components/Version.js | 4 +- app/components/Theme.js | 4 +- app/components/Tooltip.js | 4 +- app/embeds/components/Frame.js | 9 +- app/index.js | 8 +- app/menus/AccountMenu.js | 4 +- app/menus/CollectionMenu.js | 8 +- app/menus/DocumentMenu.js | 12 +-- app/menus/GroupMenu.js | 8 +- app/models/BaseModel.js | 6 +- app/scenes/Collection.js | 20 ++-- .../CollectionMembers/CollectionMembers.js | 8 +- .../CollectionGroupMemberListItem.js | 4 +- .../components/MemberListItem.js | 8 +- .../components/UserListItem.js | 8 +- app/scenes/Document/components/DataLoader.js | 9 +- app/scenes/Document/components/Document.js | 12 +-- app/scenes/Document/components/Editor.js | 16 +-- app/scenes/Document/components/Header.js | 16 +-- .../components/KeyboardShortcutsButton.js | 4 +- app/scenes/Document/components/Loading.js | 4 +- app/scenes/DocumentShare.js | 4 +- app/scenes/GroupMembers/GroupMembers.js | 4 +- .../components/GroupMemberListItem.js | 8 +- .../GroupMembers/components/UserListItem.js | 8 +- app/scenes/GroupNew.js | 4 +- app/scenes/Invite.js | 4 +- app/scenes/Login/Notices.js | 4 +- app/scenes/Login/Service.js | 4 +- app/scenes/Login/index.js | 4 +- app/scenes/Search/Search.js | 2 +- app/scenes/Settings/Details.js | 4 +- app/scenes/Settings/Events.js | 4 +- app/scenes/Settings/People.js | 4 +- .../Settings/components/EventListItem.js | 100 +++++++++--------- .../components/NotificationListItem.js | 1 - .../Settings/components/ShareListItem.js | 4 +- .../Settings/components/TokenListItem.js | 2 +- .../Settings/components/UserListItem.js | 12 +-- app/types/index.js | 7 ++ 55 files changed, 239 insertions(+), 221 deletions(-) diff --git a/app/components/Avatar/AvatarWithPresence.js b/app/components/Avatar/AvatarWithPresence.js index c93f4e72..0f1e97b8 100644 --- a/app/components/Avatar/AvatarWithPresence.js +++ b/app/components/Avatar/AvatarWithPresence.js @@ -40,7 +40,7 @@ class AvatarWithPresence extends React.Component { } = this.props; return ( - + <> @@ -69,7 +69,7 @@ class AvatarWithPresence extends React.Component { isOpen={this.isOpen} onRequestClose={this.handleCloseProfile} /> - + ); } } diff --git a/app/components/Breadcrumb.js b/app/components/Breadcrumb.js index ee2ecbd1..08cc104e 100644 --- a/app/components/Breadcrumb.js +++ b/app/components/Breadcrumb.js @@ -33,11 +33,11 @@ const Breadcrumb = observer(({ document, collections, onlyText }: Props) => { if (onlyText === true) { return ( - + <> {collection.private && ( - + <> {" "} - + )} {collection.name} {path.map((n) => ( @@ -46,7 +46,7 @@ const Breadcrumb = observer(({ document, collections, onlyText }: Props) => { {n.title} ))} - + ); } @@ -59,24 +59,24 @@ const Breadcrumb = observer(({ document, collections, onlyText }: Props) => { return ( {isTemplate && ( - + <>   Templates - + )} {isDraft && ( - + <>   Drafts - + )} @@ -84,17 +84,17 @@ const Breadcrumb = observer(({ document, collections, onlyText }: Props) => { {collection.name} {isNestedDocument && ( - + <> } path={menuPath} /> - + )} {lastPath && ( - + <> {" "} {lastPath.title} - + )} ); diff --git a/app/components/Button.js b/app/components/Button.js index 6142d29c..ba18085f 100644 --- a/app/components/Button.js +++ b/app/components/Button.js @@ -155,6 +155,6 @@ function Button({ ); } -export default React.forwardRef((props, ref) => ( +export default React.forwardRef((props, ref) => ( - + ) : ( The {collection.name} collection is accessible by @@ -195,7 +195,7 @@ class CollectionMembers extends React.Component { )} {collection.private ? ( - + <> - + ) : ( Listing team members in the {group.name} group. diff --git a/app/scenes/GroupMembers/components/GroupMemberListItem.js b/app/scenes/GroupMembers/components/GroupMemberListItem.js index 72e1937d..f5fc97c1 100644 --- a/app/scenes/GroupMembers/components/GroupMemberListItem.js +++ b/app/scenes/GroupMembers/components/GroupMemberListItem.js @@ -27,17 +27,17 @@ const GroupMemberListItem = ({ + <> {user.lastActiveAt ? ( - + <> Active + ) : ( "Never signed in" )} {!user.lastActiveAt && Invited} {user.isAdmin && Admin} - + } image={} actions={ diff --git a/app/scenes/GroupMembers/components/UserListItem.js b/app/scenes/GroupMembers/components/UserListItem.js index 7bc94060..321368c2 100644 --- a/app/scenes/GroupMembers/components/UserListItem.js +++ b/app/scenes/GroupMembers/components/UserListItem.js @@ -20,17 +20,17 @@ const UserListItem = ({ user, onAdd, canEdit }: Props) => { title={user.name} image={} subtitle={ - + <> {user.lastActiveAt ? ( - + <> Active + ) : ( "Never signed in" )} {!user.lastActiveAt && Invited} {user.isAdmin && Admin} - + } actions={ canEdit ? ( diff --git a/app/scenes/GroupNew.js b/app/scenes/GroupNew.js index 95299426..20763196 100644 --- a/app/scenes/GroupNew.js +++ b/app/scenes/GroupNew.js @@ -51,7 +51,7 @@ class GroupNew extends React.Component { render() { return ( - + <>
Groups are for organizing your team. They work best when centered @@ -82,7 +82,7 @@ class GroupNew extends React.Component { > - + ); } } diff --git a/app/scenes/Invite.js b/app/scenes/Invite.js index ac1a54d5..dda540b1 100644 --- a/app/scenes/Invite.js +++ b/app/scenes/Invite.js @@ -111,10 +111,10 @@ class Invite extends React.Component { Invite team members to join your knowledge base. They will need to sign in with {team.signinMethods}.{" "} {can.update && ( - + <> As an admin you can also{" "} enable email sign-in. - + )} )} diff --git a/app/scenes/Login/Notices.js b/app/scenes/Login/Notices.js index 504deb5a..bef63de2 100644 --- a/app/scenes/Login/Notices.js +++ b/app/scenes/Login/Notices.js @@ -8,7 +8,7 @@ type Props = { export default function Notices({ notice }: Props) { return ( - + <> {notice === "google-hd" && ( Sorry, Google sign in cannot be used with a personal email. Please try @@ -51,6 +51,6 @@ export default function Notices({ notice }: Props) { please contact a team admin. )} - + ); } diff --git a/app/scenes/Login/Service.js b/app/scenes/Login/Service.js index 8001a8d2..633ffcb1 100644 --- a/app/scenes/Login/Service.js +++ b/app/scenes/Login/Service.js @@ -72,7 +72,7 @@ class Service extends React.Component { onSubmit={this.handleSubmitEmail} > {this.state.showEmailSignin ? ( - + <> { Sign In → - + ) : ( } fullwidth> Continue with Email diff --git a/app/scenes/Login/index.js b/app/scenes/Login/index.js index 3a5a498b..9769071d 100644 --- a/app/scenes/Login/index.js +++ b/app/scenes/Login/index.js @@ -125,12 +125,12 @@ class Login extends React.Component { {...defaultService} /> {hasMultipleServices && ( - + <> You signed in with {defaultService.name} last time. - + )} )} diff --git a/app/scenes/Search/Search.js b/app/scenes/Search/Search.js index 003772e0..d10fe357 100644 --- a/app/scenes/Search/Search.js +++ b/app/scenes/Search/Search.js @@ -46,7 +46,7 @@ type Props = { @observer class Search extends React.Component { - firstDocument: ?DocumentPreview; + firstDocument: ?typeof DocumentPreview; @observable query: string = decodeURIComponent(this.props.match.params.term || ""); diff --git a/app/scenes/Settings/Details.js b/app/scenes/Settings/Details.js index 65122a3a..a7cf92f6 100644 --- a/app/scenes/Settings/Details.js +++ b/app/scenes/Settings/Details.js @@ -117,7 +117,7 @@ class Details extends React.Component { short /> {env.SUBDOMAINS_ENABLED && ( - + <> { {this.subdomain}.getoutline.com )} - + )}