From bace76decc9f63a516b40b183e9332cce52eae45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Curcio?= Date: Tue, 21 Aug 2018 22:47:39 -0300 Subject: [PATCH] changes --- src/core/client/auth/components/App.css | 1 + .../client/auth/components/ForgotPassword.css | 6 --- .../client/auth/components/ForgotPassword.tsx | 10 ++--- .../client/auth/components/ResetPassword.css | 6 --- .../client/auth/components/ResetPassword.tsx | 10 ++--- src/core/client/auth/components/SignIn.css | 1 - src/core/client/auth/components/SignIn.tsx | 2 +- src/core/client/auth/components/SignUp.css | 1 - src/core/client/auth/components/SignUp.tsx | 2 +- .../client/auth/mutations/SignInMutation.ts | 2 +- .../client/auth/mutations/SignUpMutation.ts | 2 +- .../framework/lib/errors/exceptionError.ts | 4 -- src/core/client/framework/lib/errors/index.ts | 1 - src/core/client/framework/lib/rest.ts | 2 + src/core/client/stream/components/Auth.css | 14 ------- .../client/ui/components/Spinner/Spinner.css | 5 --- .../client/ui/components/Spinner/Spinner.tsx | 38 +++++++++---------- .../ui/components/TextField/TextField.tsx | 9 +++-- 18 files changed, 38 insertions(+), 78 deletions(-) delete mode 100644 src/core/client/framework/lib/errors/exceptionError.ts delete mode 100644 src/core/client/stream/components/Auth.css diff --git a/src/core/client/auth/components/App.css b/src/core/client/auth/components/App.css index 3f61a7cae..dadd4d308 100644 --- a/src/core/client/auth/components/App.css +++ b/src/core/client/auth/components/App.css @@ -12,4 +12,5 @@ .root { width: 100%; + padding-top: calc(5 * var(--spacing-unit)); } diff --git a/src/core/client/auth/components/ForgotPassword.css b/src/core/client/auth/components/ForgotPassword.css index 8489081c1..667e35b7a 100644 --- a/src/core/client/auth/components/ForgotPassword.css +++ b/src/core/client/auth/components/ForgotPassword.css @@ -1,9 +1,3 @@ .root { width: 330px; - padding-top: calc(5 * var(--spacing-unit)); -} - -.footer { - padding-top: var(--spacing-unit); - width: 100%; } diff --git a/src/core/client/auth/components/ForgotPassword.tsx b/src/core/client/auth/components/ForgotPassword.tsx index e99230c9e..eb198aa0e 100644 --- a/src/core/client/auth/components/ForgotPassword.tsx +++ b/src/core/client/auth/components/ForgotPassword.tsx @@ -32,7 +32,7 @@ const ForgotPassword: StatelessComponent = props => {
{({ handleSubmit }) => ( - + Forgot Password @@ -62,11 +62,9 @@ const ForgotPassword: StatelessComponent = props => { )} -
- -
+
)} diff --git a/src/core/client/auth/components/ResetPassword.css b/src/core/client/auth/components/ResetPassword.css index 8489081c1..667e35b7a 100644 --- a/src/core/client/auth/components/ResetPassword.css +++ b/src/core/client/auth/components/ResetPassword.css @@ -1,9 +1,3 @@ .root { width: 330px; - padding-top: calc(5 * var(--spacing-unit)); -} - -.footer { - padding-top: var(--spacing-unit); - width: 100%; } diff --git a/src/core/client/auth/components/ResetPassword.tsx b/src/core/client/auth/components/ResetPassword.tsx index a108d5e39..e58553e85 100644 --- a/src/core/client/auth/components/ResetPassword.tsx +++ b/src/core/client/auth/components/ResetPassword.tsx @@ -35,7 +35,7 @@ const ResetPassword: StatelessComponent = props => {
{({ handleSubmit }) => ( - + Reset Password @@ -96,11 +96,9 @@ const ResetPassword: StatelessComponent = props => { )} -
- -
+
)} diff --git a/src/core/client/auth/components/SignIn.css b/src/core/client/auth/components/SignIn.css index 8110981fc..47bd21255 100644 --- a/src/core/client/auth/components/SignIn.css +++ b/src/core/client/auth/components/SignIn.css @@ -1,6 +1,5 @@ .root { width: 330px; - padding-top: calc(5 * var(--spacing-unit)); } .forgotPassword { diff --git a/src/core/client/auth/components/SignIn.tsx b/src/core/client/auth/components/SignIn.tsx index db73e76bd..0c9191a5a 100644 --- a/src/core/client/auth/components/SignIn.tsx +++ b/src/core/client/auth/components/SignIn.tsx @@ -38,7 +38,7 @@ const SignIn: StatelessComponent = props => {
{({ handleSubmit, submitting }) => ( - + Sign in to join the conversation diff --git a/src/core/client/auth/components/SignUp.css b/src/core/client/auth/components/SignUp.css index 2b939d10f..1003a63c7 100644 --- a/src/core/client/auth/components/SignUp.css +++ b/src/core/client/auth/components/SignUp.css @@ -2,7 +2,6 @@ width: 330px; } -.footer, .subFooter { padding-top: var(--spacing-unit); width: 100%; diff --git a/src/core/client/auth/components/SignUp.tsx b/src/core/client/auth/components/SignUp.tsx index c1454fb16..b80837a1d 100644 --- a/src/core/client/auth/components/SignUp.tsx +++ b/src/core/client/auth/components/SignUp.tsx @@ -42,7 +42,7 @@ const SignUp: StatelessComponent = props => { {({ handleSubmit, submitting }) => ( - + Sign up to join the conversation diff --git a/src/core/client/auth/mutations/SignInMutation.ts b/src/core/client/auth/mutations/SignInMutation.ts index 16fbf52d4..de02a33f5 100644 --- a/src/core/client/auth/mutations/SignInMutation.ts +++ b/src/core/client/auth/mutations/SignInMutation.ts @@ -17,7 +17,7 @@ export async function commit( window.close(); } catch (err) { postMessage.send("authError", err.toString(), window.opener); - throw Error(err.message); + throw err; } } diff --git a/src/core/client/auth/mutations/SignUpMutation.ts b/src/core/client/auth/mutations/SignUpMutation.ts index 76e6442c2..f5afbaa77 100644 --- a/src/core/client/auth/mutations/SignUpMutation.ts +++ b/src/core/client/auth/mutations/SignUpMutation.ts @@ -17,7 +17,7 @@ export async function commit( window.close(); } catch (err) { postMessage.send("authError", err.toString(), window.opener); - throw Error(err.toString()); + throw err; } } diff --git a/src/core/client/framework/lib/errors/exceptionError.ts b/src/core/client/framework/lib/errors/exceptionError.ts deleted file mode 100644 index 16e79eaa6..000000000 --- a/src/core/client/framework/lib/errors/exceptionError.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface ExceptionError { - message: string; - stack: string; -} diff --git a/src/core/client/framework/lib/errors/index.ts b/src/core/client/framework/lib/errors/index.ts index 2d58d8d08..8372f3429 100644 --- a/src/core/client/framework/lib/errors/index.ts +++ b/src/core/client/framework/lib/errors/index.ts @@ -2,6 +2,5 @@ export { default as NetworkError } from "./networkError"; export { default as UnknownServerError } from "./unknownServerError"; export { default as BadUserInputError } from "./badUserInputError"; export { default as GraphQLError } from "./graphqlError"; -export { default as ExceptionError } from "./exceptionError"; export * from "./graphqlError"; diff --git a/src/core/client/framework/lib/rest.ts b/src/core/client/framework/lib/rest.ts index b071aedb4..9808a4555 100644 --- a/src/core/client/framework/lib/rest.ts +++ b/src/core/client/framework/lib/rest.ts @@ -17,6 +17,8 @@ const buildOptions = (inputOptions: RequestInit = {}) => { return options; }; +// TODO (bc): Wrap response errors into error objects once server errors have been defined + const handleResp = async (res: Response) => { if (res.status === 404) { const response = await res.text(); diff --git a/src/core/client/stream/components/Auth.css b/src/core/client/stream/components/Auth.css deleted file mode 100644 index 35aeadf26..000000000 --- a/src/core/client/stream/components/Auth.css +++ /dev/null @@ -1,14 +0,0 @@ -.root { - padding: var(--spacing-unit); - color: var(--palette-text-primary); -} - -.text { - padding-right: calc(0.5 * var(--spacing-unit)); - line-height: 1px; -} - -.horizontalSeparator { - font-size: 1.3em; - color: var(--palette-text-primary); -} diff --git a/src/core/client/ui/components/Spinner/Spinner.css b/src/core/client/ui/components/Spinner/Spinner.css index 5dd6c6acf..4115e48a1 100644 --- a/src/core/client/ui/components/Spinner/Spinner.css +++ b/src/core/client/ui/components/Spinner/Spinner.css @@ -1,8 +1,3 @@ -.root { - display: block; - text-align: center; -} - .spinner { animation: rotator 1.4s linear infinite; } diff --git a/src/core/client/ui/components/Spinner/Spinner.tsx b/src/core/client/ui/components/Spinner/Spinner.tsx index 2edb5e029..1531a8caf 100644 --- a/src/core/client/ui/components/Spinner/Spinner.tsx +++ b/src/core/client/ui/components/Spinner/Spinner.tsx @@ -17,28 +17,26 @@ export interface SpinnerProps { const Spinner: StatelessComponent = props => { const { className, classes } = props; - const rootClassName = cn(classes.root, className); + const rootClassName = cn(classes.spinner, className); return ( -
- - - -
+ + + ); }; diff --git a/src/core/client/ui/components/TextField/TextField.tsx b/src/core/client/ui/components/TextField/TextField.tsx index 05b1f7bc6..46d223ff3 100644 --- a/src/core/client/ui/components/TextField/TextField.tsx +++ b/src/core/client/ui/components/TextField/TextField.tsx @@ -1,5 +1,5 @@ import cn from "classnames"; -import React from "react"; +import React, { ChangeEvent, EventHandler } from "react"; import { StatelessComponent } from "react"; import { withStyles } from "talk-ui/hocs"; import * as styles from "./TextField.css"; @@ -42,13 +42,13 @@ export interface TextFieldProps { */ name?: string; /** - * type + * type: Here we only allow text type values */ - type?: string; + type?: "email" | "number" | "password" | "search" | "tel" | "text" | "url"; /** * onChange */ - onChange?: (event: any) => void; + onChange?: EventHandler>; } const TextField: StatelessComponent = props => { @@ -85,6 +85,7 @@ const TextField: StatelessComponent = props => { TextField.defaultProps = { color: "regular", placeholder: "", + type: "text", }; const enhanced = withStyles(styles)(TextField);