Skip to content

Commit

Permalink
10007: WIP Add submitLoginSequence.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Rogers committed Dec 7, 2023
1 parent 8952802 commit 13de580
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 58 deletions.
2 changes: 2 additions & 0 deletions web-client/src/presenter/presenter-public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { showMaintenancePageDecorator } from './utilities/showMaintenancePageDec
import { showMoreResultsSequence } from './sequences/showMoreResultsSequence';
import { sortTodaysOrdersSequence } from './sequences/Public/sortTodaysOrdersSequence';
import { submitCreatePetitionerAccountFormSequence } from '@web-client/presenter/sequences/submitCreatePetitionerAccountFormSequence';
import { submitLoginSequence } from '@web-client/presenter/sequences/Login/submitLoginSequence';
import { submitPublicCaseAdvancedSearchSequence } from './sequences/Public/submitPublicCaseAdvancedSearchSequence';
import { submitPublicCaseDocketNumberSearchSequence } from './sequences/Public/submitPublicCaseDocketNumberSearchSequence';
import { submitPublicOpinionAdvancedSearchSequence } from './sequences/Public/submitPublicOpinionAdvancedSearchSequence';
Expand Down Expand Up @@ -106,6 +107,7 @@ export const presenterSequences = {
showMoreResultsSequence,
sortTodaysOrdersSequence,
submitCreatePetitionerAccountFormSequence,
submitLoginSequence,
submitPublicCaseAdvancedSearchSequence,
submitPublicCaseDocketNumberSearchSequence,
submitPublicOpinionAdvancedSearchSequence,
Expand Down
2 changes: 2 additions & 0 deletions web-client/src/presenter/presenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ import { submitExternalDocumentSequence } from './sequences/submitExternalDocume
import { submitFilePetitionSequence } from './sequences/submitFilePetitionSequence';
import { submitJudgeActivityReportSequence } from './sequences/JudgeActivityReport/submitJudgeActivityReportSequence';
import { submitLocalLoginSequence } from './sequences/submitLocalLoginSequence';
import { submitLoginSequence } from '@web-client/presenter/sequences/Login/submitLoginSequence';
import { submitOpinionAdvancedSearchSequence } from './sequences/submitOpinionAdvancedSearchSequence';
import { submitOrderAdvancedSearchSequence } from './sequences/submitOrderAdvancedSearchSequence';
import { submitPaperFilingSequence } from './sequences/submitPaperFilingSequence';
Expand Down Expand Up @@ -1252,6 +1253,7 @@ export const presenterSequences = {
submitJudgeActivityReportSequence:
submitJudgeActivityReportSequence as unknown as Function,
submitLocalLoginSequence: submitLocalLoginSequence as unknown as Function,
submitLoginSequence,
submitOpinionAdvancedSearchSequence:
submitOpinionAdvancedSearchSequence as unknown as Function,
submitOrderAdvancedSearchSequence:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { state } from '@web-client/presenter/app-public.cerebral';

export const submitLoginSequence = [
({ get }) => {
console.log('in submitLoginSequence');
console.log(get(state.form));
},
] as unknown as (props) => void;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { changePasswordLocalAction } from '../actions/changePasswordLocalAction';
import { gotoLoginSequence } from './gotoLoginSequence';
import { gotoLoginSequence } from '@web-client/presenter/sequences/Login/goToLoginSequence';
import { setAlertSuccessAction } from '../actions/setAlertSuccessAction';
import { setSaveAlertsForNavigationAction } from '../actions/setSaveAlertsForNavigationAction';
import { showProgressSequenceDecorator } from '../utilities/showProgressSequenceDecorator';
Expand Down
4 changes: 2 additions & 2 deletions web-client/src/views/AppComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import { IdleLogout } from './IdleLogout';
import { Interstitial } from './Interstitial';
import { JudgeActivityReport } from './JudgeActivityReport/JudgeActivityReport';
import { Loading } from './Loading';
import { LogIn } from './LogIn';
import { Login } from '@web-client/views/Public/Login/Login';
import { MessageDetail } from './Messages/MessageDetail';
import { Messages } from './Messages/Messages';
import { MyAccount } from './MyAccount';
Expand Down Expand Up @@ -150,7 +150,7 @@ const pages = {
Interstitial,
JudgeActivityReport,
Loading,
LogIn,
Login,
MessageDetail,
Messages,
MyAccount,
Expand Down
137 changes: 82 additions & 55 deletions web-client/src/views/Public/Login/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,90 @@
import { Button } from '@web-client/ustc-ui/Button/Button';
import { connect } from '@cerebral/react';
import { connect } from '@web-client/presenter/shared.cerebral';
import { sequences, state } from '@web-client/presenter/app-public.cerebral';
import React from 'react';

export const Login = connect({}, () => {
return (
<>
<div className="grid-container">
<div className="grid-row bg-white padding-x-5 padding-y-3">
<div className="grid-col">
<h1 className="margin-bottom-1">Log in to DAWSON</h1>
<span>Email address and password are case sensitive.</span>
<form className="margin-top-4">
<label className="usa-label" htmlFor="email">
Email address
</label>
<input
required
autoCapitalize="off"
autoCorrect="off"
className="usa-input"
id="email"
name="email"
type="text"
/>
<label className="usa-label" htmlFor="password">
Password
</label>
<input
required
className="usa-input"
id="password"
name="password"
/>
<button
className="usa-show-password"
data-hide-text="Hide password"
data-show-text="Show password"
type="button"
>
Show password
</button>
<Button className="usa-button margin-top-3">Log in</Button>
</form>
<div>
<Button className="margin-top-1" link={true} type="button">
Forgot password?
</Button>
</div>
<div>
<span>Don&apos;t have an account?</span>{' '}
<Button className="padding-top-0" link={true} type="button">
Create your account now.
</Button>
export const Login = connect(
{
form: state.form,
submitLoginSequence: sequences.submitLoginSequence,
updateFormValueSequence: sequences.updateFormValueSequence,
},
({ form, submitLoginSequence, updateFormValueSequence }) => {
return (
<>
<div className="grid-container">
<div className="grid-row bg-white padding-x-5 padding-y-3">
<div className="grid-col">
<h1 className="margin-bottom-1">Log in to DAWSON</h1>
<span>Email address and password are case sensitive.</span>
<form className="margin-top-4">
<label className="usa-label" htmlFor="email">
Email address
</label>
<input
required
autoCapitalize="off"
autoCorrect="off"
className="usa-input"
id="email"
name="email"
type="text"
value={form.email}
onChange={e => {
updateFormValueSequence({
key: e.target.name,
value: e.target.value,
});
}}
/>
<label className="usa-label" htmlFor="password">
Password
</label>
<input
required
className="usa-input"
id="password"
name="password"
value={form.password}
onChange={e => {
updateFormValueSequence({
key: e.target.name,
value: e.target.value,
});
}}
/>
<button
className="usa-show-password"
data-hide-text="Hide password"
data-show-text="Show password"
type="button"
>
Show password
</button>
<Button
className="usa-button margin-top-3"
onClick={() => submitLoginSequence()}
>
Log in
</Button>
</form>
<div>
<Button className="margin-top-1" link={true} type="button">
Forgot password?
</Button>
</div>
<div>
<span>Don&apos;t have an account?</span>{' '}
<Button className="padding-top-0" link={true} type="button">
Create your account now.
</Button>
</div>
</div>
</div>
</div>
</div>
</>
);
});
</>
);
},
);

Login.displayName = 'Login';

0 comments on commit 13de580

Please sign in to comment.