diff --git a/packages/boxel-ui/addon/raw-icons/google-color.svg b/packages/boxel-ui/addon/raw-icons/google-color.svg new file mode 100644 index 00000000000..ce52e793d31 --- /dev/null +++ b/packages/boxel-ui/addon/raw-icons/google-color.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/boxel-ui/addon/src/icons.gts b/packages/boxel-ui/addon/src/icons.gts index b3c82ba6da7..7c86c31da58 100644 --- a/packages/boxel-ui/addon/src/icons.gts +++ b/packages/boxel-ui/addon/src/icons.gts @@ -36,6 +36,7 @@ import Fitted from './icons/fitted.gts'; import Folder from './icons/folder.gts'; import Form from './icons/form.gts'; import FourLines from './icons/four-lines.gts'; +import GoogleColor from './icons/google-color.gts'; import Grid3x3 from './icons/grid-3x3.gts'; import Group from './icons/group.gts'; import Head from './icons/head.gts'; @@ -116,6 +117,7 @@ export const ALL_ICON_COMPONENTS = [ Folder, Form, FourLines, + GoogleColor, Grid3x3, Group, Head, @@ -198,6 +200,7 @@ export { Folder, Form, FourLines, + GoogleColor, Grid3x3, Group, Head, diff --git a/packages/boxel-ui/addon/src/icons/google-color.gts b/packages/boxel-ui/addon/src/icons/google-color.gts new file mode 100644 index 00000000000..2bf167f6083 --- /dev/null +++ b/packages/boxel-ui/addon/src/icons/google-color.gts @@ -0,0 +1,30 @@ +// This file is auto-generated by 'pnpm rebuild:icons' +import type { TemplateOnlyComponent } from '@ember/component/template-only'; + +import type { Signature } from './types.ts'; + +const IconComponent: TemplateOnlyComponent = ; + +// @ts-expect-error this is the only way to set a name on a Template Only Component currently +IconComponent.name = 'GoogleColor'; +export default IconComponent; diff --git a/packages/host/app/components/matrix/auth-button.gts b/packages/host/app/components/matrix/auth-button.gts new file mode 100644 index 00000000000..23743b12384 --- /dev/null +++ b/packages/host/app/components/matrix/auth-button.gts @@ -0,0 +1,84 @@ +import type { TemplateOnlyComponent } from '@ember/component/template-only'; + +import { Button } from '@cardstack/boxel-ui/components'; +import { eq } from '@cardstack/boxel-ui/helpers'; + +export type AuthButtonVariant = 'primary' | 'secondary' | 'google'; + +interface Signature { + Element: HTMLButtonElement; + Args: { + variant?: AuthButtonVariant; + disabled?: boolean; + loading?: boolean; + }; + Blocks: { default: [] }; +} + +const AuthButton: TemplateOnlyComponent = ; + +export default AuthButton; diff --git a/packages/host/app/components/matrix/auth-container.gts b/packages/host/app/components/matrix/auth-container.gts index 37abe7a243a..42f45e6a53f 100644 --- a/packages/host/app/components/matrix/auth-container.gts +++ b/packages/host/app/components/matrix/auth-container.gts @@ -1,6 +1,5 @@ import type { TemplateOnlyComponent } from '@ember/component/template-only'; -import { CardContainer, BoxelHeader } from '@cardstack/boxel-ui/components'; import { BoxelIcon } from '@cardstack/boxel-ui/icons'; interface Signature { @@ -11,54 +10,77 @@ interface Signature { const AuthContainer: TemplateOnlyComponent = ; diff --git a/packages/host/app/components/matrix/auth-form-field.gts b/packages/host/app/components/matrix/auth-form-field.gts new file mode 100644 index 00000000000..3b5eb56ad41 --- /dev/null +++ b/packages/host/app/components/matrix/auth-form-field.gts @@ -0,0 +1,60 @@ +import type { TemplateOnlyComponent } from '@ember/component/template-only'; + +import { FieldContainer } from '@cardstack/boxel-ui/components'; + +interface Signature { + Element: HTMLElement; + Args: { + label: string; + }; + Blocks: { default: [] }; +} + +const AuthFormField: TemplateOnlyComponent = ; + +export default AuthFormField; diff --git a/packages/host/app/components/matrix/forgot-password.gts b/packages/host/app/components/matrix/forgot-password.gts index 2097560f296..7ab1328fcd8 100644 --- a/packages/host/app/components/matrix/forgot-password.gts +++ b/packages/host/app/components/matrix/forgot-password.gts @@ -11,19 +11,19 @@ import perform from 'ember-concurrency/helpers/perform'; import { v4 as uuidv4 } from 'uuid'; -import { - Button, - FieldContainer, - BoxelInput, -} from '@cardstack/boxel-ui/components'; +import { BoxelInput } from '@cardstack/boxel-ui/components'; import { eq, or } from '@cardstack/boxel-ui/helpers'; import { isMatrixError, isValidPassword, } from '@cardstack/host/lib/matrix-utils'; + import type MatrixService from '@cardstack/host/services/matrix-service'; +import AuthButton from './auth-button'; +import AuthFormField from './auth-form-field'; + import type { AuthMode } from './auth'; export type ResetPasswordParams = { @@ -46,12 +46,7 @@ export default class ForgotPassword extends Component { }} Forgot your password?

Enter email to receive a reset password link.

- + { @value={{this.email}} @onInput={{this.setEmail}} /> - +
- - or - + >Back to login
{{else if (eq this.state.type 'waitForEmailValidation')}} Please check your email to @@ -87,22 +80,16 @@ export default class ForgotPassword extends Component {
  • We've sent an email to {{this.state.email}}
  • Click on the link within the email to reset your password
  • - + >Resend Email {{else if (eq this.state.type 'resetPassword')}} Reset your password - + { @onInput={{this.setPassword}} @onBlur={{this.checkPassword}} /> - - + + { @onInput={{this.setConfirmPassword}} @onBlur={{this.checkConfirmPassword}} /> - +
    - + >Reset Password
    {{#if this.isResetPasswordParamsError}} Unable to reset your @@ -159,18 +140,18 @@ export default class ForgotPassword extends Component {

    Your password has been successfully reset. You can use the link below to sign into your Boxel account with your new password.

    - + >Sign In to Boxel
    {{/if}} @@ -290,18 +231,18 @@ export default class ForgotPassword extends Component { } private get isForgotPasswordBtnDisabled() { - return ( - !this.email || this.emailError || this.sendEmailValidationTask.isRunning + return Boolean( + !this.email || this.emailError || this.sendEmailValidationTask.isRunning, ); } private get isResetPasswordBtnDisabled() { - return ( + return Boolean( !this.password || !this.confirmPassword || this.passwordError || this.confirmPasswordError || - this.resetPassword.isRunning + this.resetPassword.isRunning, ); } diff --git a/packages/host/app/components/matrix/login.gts b/packages/host/app/components/matrix/login.gts index 0be36a1a342..da587a7e741 100644 --- a/packages/host/app/components/matrix/login.gts +++ b/packages/host/app/components/matrix/login.gts @@ -16,9 +16,10 @@ import moment from 'moment'; import { Button, - FieldContainer, BoxelInput, + LoadingIndicator, } from '@cardstack/boxel-ui/components'; +import { GoogleColor } from '@cardstack/boxel-ui/icons'; import { isMatrixError, @@ -27,6 +28,9 @@ import { import type EnvironmentService from '@cardstack/host/services/environment-service'; import type MatrixService from '@cardstack/host/services/matrix-service'; +import AuthButton from './auth-button'; +import AuthFormField from './auth-form-field'; + import type { AuthMode } from './auth'; import type { LoginResponse } from 'matrix-js-sdk'; @@ -41,80 +45,87 @@ interface Signature { export default class Login extends Component { @@ -211,8 +269,8 @@ export default class Login extends Component { } private get isLoginButtonDisabled() { - return ( - !this.username || !this.password || this.error || this.doLogin.isRunning + return Boolean( + !this.username || !this.password || this.error || this.doLogin.isRunning, ); } diff --git a/packages/host/app/components/matrix/register-user.gts b/packages/host/app/components/matrix/register-user.gts index 3def39659d2..7673e56eeb0 100644 --- a/packages/host/app/components/matrix/register-user.gts +++ b/packages/host/app/components/matrix/register-user.gts @@ -12,13 +12,10 @@ import { restartableTask, timeout } from 'ember-concurrency'; import { v4 as uuidv4 } from 'uuid'; -import { LoadingIndicator } from '@cardstack/boxel-ui/components'; - import { BoxelInput, BoxelInputGroup, - Button, - FieldContainer, + LoadingIndicator, } from '@cardstack/boxel-ui/components'; import { eq } from '@cardstack/boxel-ui/helpers'; import { CheckMark } from '@cardstack/boxel-ui/icons'; @@ -33,6 +30,9 @@ import { } from '@cardstack/host/lib/matrix-utils'; import type MatrixService from '@cardstack/host/services/matrix-service'; +import AuthButton from './auth-button'; +import AuthFormField from './auth-form-field'; + import type { AuthMode } from './auth'; import type { RegisterResponse, @@ -60,93 +60,76 @@ export default class RegisterUser extends Component {