Skip to content

Commit 497433a

Browse files
authored
Merge pull request #1639 from monocle/demo-fix
Fix routing to demo bug. Closes #1472
2 parents 25a376c + 3f60d43 commit 497433a

File tree

7 files changed

+138
-110
lines changed

7 files changed

+138
-110
lines changed

src/frontend/src/components/App/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import history from "../../service/history";
55
import Footer from "../Footer";
66
import Header from "../Header";
77
import RecordSearch from "../RecordSearch";
8-
import Demo from "../RecordSearch/Demo";
8+
import Demo from "../Demo";
99
import OeciLogin from "../OeciLogin";
1010
import Landing from "../Landing";
1111
import Manual from "../Manual";
@@ -36,7 +36,10 @@ class App extends React.Component {
3636
<Route component={PrivacyPolicy} path="/privacy-policy" />
3737
<Route component={FillForms} path="/fill-expungement-forms" />
3838
<Route component={PartnerInterest} path="/partner-interest" />
39-
<Route component={AccessibilityStatement} path="/accessibility-statement" />
39+
<Route
40+
component={AccessibilityStatement}
41+
path="/accessibility-statement"
42+
/>
4043
<Route component={About} path="/about" />
4144
<Route render={this.redirect} />
4245
</Switch>
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
import React from "react";
22
import { Link } from "react-router-dom";
3-
import { connect } from "react-redux";
4-
import { stopDemo } from "../../../redux/search/actions";
5-
import history from "../../../service/history";
6-
import store from "../../../redux/store";
73

8-
interface Props {
9-
stopDemo: Function;
10-
}
11-
class DemoInfo extends React.Component<Props> {
12-
toOeci = () => {
13-
store.dispatch(this.props.stopDemo());
14-
history.push("/oeci");
15-
};
16-
formattedInfo = (firstName: string, lastName: string, description: string[], dateOfBirth: string) => {
4+
class DemoInfo extends React.Component {
5+
formattedInfo = (
6+
firstName: string,
7+
lastName: string,
8+
description: string[],
9+
dateOfBirth: string
10+
) => {
1711
return (
1812
<div>
1913
<p className="flex lh-title mb3">
@@ -25,65 +19,66 @@ class DemoInfo extends React.Component<Props> {
2519
<div className="fw6">Last Name</div>
2620
<div>{lastName}</div>
2721
</div>
28-
{
29-
dateOfBirth && (
30-
<div>
31-
<div className="fw6">Date of Birth</div>
32-
<div>{dateOfBirth}</div>
33-
</div>
34-
)
35-
}
22+
{dateOfBirth && (
23+
<div>
24+
<div className="fw6">Date of Birth</div>
25+
<div>{dateOfBirth}</div>
26+
</div>
27+
)}
3628
</p>
37-
{description.map((line: string) => <p className="pb2">{line}</p>)}
29+
{description.map((line: string) => (
30+
<p className="pb2">{line}</p>
31+
))}
3832
</div>
3933
);
40-
}
34+
};
4135

4236
render() {
4337
const examplesData = [
4438
{
4539
name: "Single Conviction",
4640
firstName: "Single",
4741
lastName: "Conviction",
48-
description: ["As a simple example, if a person's record has only a single convicted charge, it is eligible after three years."]
42+
description: [
43+
"As a simple example, if a person's record has only a single convicted charge, it is eligible after three years.",
44+
],
4945
},
5046
{
5147
name: "Multiple Charges",
5248
firstName: "Multiple",
5349
lastName: "Charges",
5450
description: [
5551
"If a record has more than one case, the time restrictions quickly get more complex, as this example demonstrates. Eligibility dates depend on whether dismissals are on the same or a different case as a conviction. Searching OECI will also reveal traffic violations, which are always ineligible.",
56-
"This record also includes a case with an outstanding balance due for fines, which is indicated in both the record summary and on the case itself."
57-
]
52+
"This record also includes a case with an outstanding balance due for fines, which is indicated in both the record summary and on the case itself.",
53+
],
5854
},
5955
{
6056
name: "John Common",
6157
firstName: "John",
6258
lastName: "Common",
6359
description: [
6460
"Searching for a common name will often bring up records that belong to different individuals, leading to an incorrect analysis for the set of resulting cases. Another source of confusion is that each case may or may not incude a birth year, as well as middle name or initial.",
65-
"It is thus always recommended to provide a birth date in the search. You can also use the Enable Editing feature to remove cases or charges from the resulting record, and these charges will be excluded in the eligibility analysis."
61+
"It is thus always recommended to provide a birth date in the search. You can also use the Enable Editing feature to remove cases or charges from the resulting record, and these charges will be excluded in the eligibility analysis.",
6662
],
6763
},
6864
{
6965
name: "John Common – Class B Felony and Marijuana",
7066
firstName: "John",
7167
lastName: "Common",
7268
description: [
73-
"Most charges that are eligible are also subject to the same set of time restrictions. There are some exceptions to this, notably Class B Felonies, and possession of less than an ounce of marijuana."
69+
"Most charges that are eligible are also subject to the same set of time restrictions. There are some exceptions to this, notably Class B Felonies, and possession of less than an ounce of marijuana.",
7470
],
75-
dateOfBirth: "1/1/1970"
71+
dateOfBirth: "1/1/1970",
7672
},
7773
{
7874
name: "John Common – Needs More Analysis",
7975
firstName: "John",
8076
lastName: "Common",
8177
description: [
82-
"Some charges cannot be evaluated for eligibility until the user provides some follow-up information about the charge. RecordSponge deals with this ambiguity by showing the different possible outcomes for eligibility, and by asking the user for the required extra information in order to determine an exact analysis."
78+
"Some charges cannot be evaluated for eligibility until the user provides some follow-up information about the charge. RecordSponge deals with this ambiguity by showing the different possible outcomes for eligibility, and by asking the user for the required extra information in order to determine an exact analysis.",
8379
],
84-
dateOfBirth: "2/2/1985"
80+
dateOfBirth: "2/2/1985",
8581
},
86-
8782
];
8883
return (
8984
<article className="lh-copy">
@@ -117,19 +112,26 @@ class DemoInfo extends React.Component<Props> {
117112

118113
<p className="mb4">
119114
Or,{" "}
120-
<button className="link bb mid-gray hover-blue" onClick={this.toOeci}>
115+
<Link
116+
to="/oeci"
117+
className="link bb mid-gray hover-blue"
118+
onClick={() => window.scrollTo(0, 0)}
119+
>
121120
log in to OECI
122-
</button>
121+
</Link>
123122
.
124123
</p>
125124
<div>
126125
{examplesData.map((e: any) => (
127126
<div>
128-
<h2 className="fw9 bt b--light-gray pt2 mb3">
129-
{e.name}
130-
</h2>
127+
<h2 className="fw9 bt b--light-gray pt2 mb3">{e.name}</h2>
131128
<div className="mw7 mb4">
132-
{this.formattedInfo(e.firstName, e.lastName, e.description, e.dateOfBirth)}
129+
{this.formattedInfo(
130+
e.firstName,
131+
e.lastName,
132+
e.description,
133+
e.dateOfBirth
134+
)}
133135
</div>
134136
</div>
135137
))}
@@ -139,4 +141,5 @@ class DemoInfo extends React.Component<Props> {
139141
);
140142
}
141143
}
142-
export default connect(() => {}, { stopDemo })(DemoInfo);
144+
145+
export default DemoInfo;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from "react";
2+
import { connect } from "react-redux";
3+
import { RecordData } from "../RecordSearch/Record/types";
4+
import store, { AppState } from "../../redux/store";
5+
import { startDemo } from "../../redux/search/actions";
6+
import DemoInfo from "./DemoInfo";
7+
import SearchPanel from "../RecordSearch/SearchPanel";
8+
import Status from "../RecordSearch/Status";
9+
import Record from "../RecordSearch/Record";
10+
import Assumptions from "../RecordSearch/Assumptions";
11+
12+
interface Props {
13+
record?: RecordData;
14+
startDemo: Function;
15+
}
16+
17+
class Demo extends React.Component<Props> {
18+
componentDidMount() {
19+
document.title = "Demo - RecordSponge";
20+
store.dispatch(this.props.startDemo());
21+
}
22+
23+
render() {
24+
return (
25+
<main className="mw8 center f6 f5-l ph2">
26+
<DemoInfo />
27+
<SearchPanel />
28+
<Status record={this.props.record} />
29+
<Record record={this.props.record} />
30+
<Assumptions />
31+
</main>
32+
);
33+
}
34+
}
35+
36+
const mapStateToProps = (state: AppState) => {
37+
return {
38+
record: state.search.record,
39+
};
40+
};
41+
42+
export default connect(mapStateToProps, { startDemo })(Demo);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from "react";
2+
import { HashLink as Link } from "react-router-hash-link";
3+
4+
export default function Assumptions() {
5+
return (
6+
<div className="bg-white shadow mb6 pa4 br3">
7+
<h2 className="fw6 mb3">Assumptions</h2>
8+
<p className="mb3">
9+
We are only able to access your public Oregon records.
10+
</p>
11+
<p className="mb2">
12+
Your analysis may be different if you have had cases which were:
13+
</p>
14+
<ul className="lh-copy pl4 mw6 mb3">
15+
<li className="mb2">Previously expunged</li>
16+
<li className="mb2">
17+
From States besides Oregon within the last ten years
18+
</li>
19+
<li className="mb2">From Federal Court within the last ten years</li>
20+
<li className="mb2">
21+
From local District Courts, e.g. Medford Municipal Court (not Jackson
22+
County Circuit Court) from within the last ten years
23+
</li>
24+
</ul>
25+
<p>
26+
<Link className="link hover-blue underline" to="/manual#assumption1">
27+
Learn more in the Manual
28+
</Link>
29+
</p>
30+
</div>
31+
);
32+
}

src/frontend/src/components/RecordSearch/Demo/index.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,42 @@
1-
import React, { Component } from "react";
1+
import React from "react";
22
import { connect } from "react-redux";
3-
import { AppState } from "../../redux/store";
43
import { RecordData } from "./Record/types";
4+
import store, { AppState } from "../../redux/store";
5+
import { stopDemo } from "../../redux/search/actions";
6+
import { checkOeciRedirect } from "../../service/cookie-service";
57
import SearchPanel from "./SearchPanel";
68
import Record from "./Record";
79
import Status from "./Status";
8-
import DemoInfo from "./Demo/DemoInfo";
9-
import { checkOeciRedirect } from "../../service/cookie-service";
10-
import { HashLink as Link } from "react-router-hash-link";
10+
import Assumptions from "./Assumptions";
1111

1212
interface Props {
13-
demo: boolean;
1413
record?: RecordData;
14+
stopDemo: Function;
1515
}
1616

17-
class RecordSearch extends Component<Props> {
18-
17+
class RecordSearch extends React.Component<Props> {
1918
componentDidMount() {
20-
this.props.demo || checkOeciRedirect();
19+
checkOeciRedirect();
2120
document.title = "Search Records - RecordSponge";
21+
store.dispatch(this.props.stopDemo());
2222
}
2323

2424
render() {
2525
return (
26-
<>
27-
<main className="mw8 center f6 f5-l ph2">
28-
{this.props.demo && <DemoInfo />}
29-
<SearchPanel />
30-
<Status record={this.props.record} />
31-
<Record record={this.props.record} />
32-
<div className="bg-white shadow mb6 pa4 br3">
33-
<h2 className="fw6 mb3">Assumptions</h2>
34-
<p className="mb3">
35-
We are only able to access your public Oregon records.
36-
</p>
37-
<p className="mb2">
38-
Your analysis may be different if you have had cases which were:
39-
</p>
40-
<ul className="lh-copy pl4 mw6 mb3">
41-
<li className="mb2">Previously expunged</li>
42-
<li className="mb2">
43-
From States besides Oregon within the last ten years
44-
</li>
45-
<li className="mb2">
46-
From Federal Court within the last ten years
47-
</li>
48-
<li className="mb2">
49-
From local District Courts, e.g. Medford Municipal Court (not
50-
Jackson County Circuit Court) from within the last ten years
51-
</li>
52-
</ul>
53-
<p>
54-
<Link
55-
className="link hover-blue underline"
56-
to="/manual#assumption1"
57-
>
58-
Learn more in the Manual
59-
</Link>
60-
</p>
61-
</div>
62-
</main>
63-
</>
26+
<main className="mw8 center f6 f5-l ph2">
27+
<SearchPanel />
28+
<Status record={this.props.record} />
29+
<Record record={this.props.record} />
30+
<Assumptions />
31+
</main>
6432
);
6533
}
6634
}
6735

6836
const mapStateToProps = (state: AppState) => {
6937
return {
7038
record: state.search.record,
71-
demo: state.search.demo,
7239
};
7340
};
7441

75-
export default connect(mapStateToProps, {})(RecordSearch);
42+
export default connect(mapStateToProps, { stopDemo })(RecordSearch);

src/frontend/src/service/cookie-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ export function isAdmin() {
3535

3636
export function checkOeciRedirect() {
3737
if (!hasOeciToken()) {
38-
history.push("/oeci");
38+
history.replace("/oeci");
3939
}
4040
}

0 commit comments

Comments
 (0)