Skip to content

Commit 7ee8245

Browse files
BrianL3Brian Ledbetter
andauthored
feature/matter-page (#222)
Creates the matters/:id route and corresponding page Co-authored-by: Brian Ledbetter <[email protected]>
1 parent d67bc17 commit 7ee8245

File tree

17 files changed

+298
-45
lines changed

17 files changed

+298
-45
lines changed

src/app/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { EventPage } from "../pages/EventPage";
1616
import { EventsPage } from "../pages/EventsPage";
1717
import { PersonPage } from "../pages/PersonPage";
1818
import { PeoplePage } from "../pages/PeoplePage";
19+
import { MatterPage } from "../pages/MatterPage";
1920
import { ErrorPage } from "../pages/ErrorPage";
2021

2122
import { SEARCH_TYPE } from "../pages/SearchPage/types";
@@ -102,6 +103,9 @@ function App() {
102103
<Route exact path="/people/:id">
103104
<PersonPage />
104105
</Route>
106+
<Route exact path="/matters/:id">
107+
<MatterPage />
108+
</Route>
105109
<Route path="*" component={ErrorPage} />
106110
</Switch>
107111
</Main>

src/assets/LocalizedStrings.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export interface MasterStringsList extends LocalizedStringsMethods {
101101
latest_vote: string;
102102
history: string;
103103
minutes: string;
104+
go_to_matter_details: string;
104105
}
105106

106107
// Note: Add languages to video.js in /src/pages/EventPage/utils when adding new languages

src/assets/strings/de.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const de = {
9090
latest_vote: "Letzte Abstimmung",
9191
history: "Geschichte",
9292
minutes: "Protokoll",
93+
go_to_matter_details: "Gehen Sie zu den vollständigen Rechtsvorschriften",
9394
};
9495

9596
export default de;

src/assets/strings/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const en = {
8989
latest_vote: "Latest Vote",
9090
history: "History",
9191
minutes: "Minutes",
92+
go_to_matter_details: "Go to Full Legislation Details",
9293
};
9394

9495
export default en;

src/assets/strings/es.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const es = {
8989
latest_vote: "Último Voto",
9090
history: "Historia",
9191
minutes: "Protocolo",
92+
go_to_matter_details: "Ir a los detalles completos de la legislación",
9293
};
9394

9495
export default es;

src/components/Details/Legislation/LegislationIntroduction.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ const LegislationIntroduction: FC<LegislationIntroductionProps> = ({
3838
flex: 1,
3939
}}
4040
>
41-
{indexedMatterGrams.map((indexedMatterGram) => (
42-
<div key={indexedMatterGram.id}>
43-
<p style={{ display: "inline", paddingLeft: 11, paddingRight: 11 }}></p>
44-
<p style={{ display: "inline" }}>{indexedMatterGram.unstemmed_gram}</p>
45-
</div>
46-
))}
41+
{indexedMatterGrams &&
42+
indexedMatterGrams.map((indexedMatterGram) => (
43+
<div key={indexedMatterGram.id}>
44+
<p style={{ display: "inline", paddingLeft: 11, paddingRight: 11 }}></p>
45+
<p style={{ display: "inline" }}>{indexedMatterGram.unstemmed_gram}</p>
46+
</div>
47+
))}
4748
</div>
4849
</div>
4950
</div>

src/components/Details/Legislation/LegislationOverview.tsx

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ export interface LegislationOverviewProps {
6363
/** The latest matter status of the matter */
6464
matterStatus: MatterStatus;
6565
/** The latest event where the matter was a minutes item */
66-
event: Event;
66+
event?: Event;
6767
/** The persons who sponsored the matter */
6868
sponsors: Person[];
6969
/** The latest document of the matter */
70-
document: { name: string; url: string };
70+
document?: { name: string; url: string };
7171
}
7272

7373
const LegislationOverview: FC<LegislationOverviewProps> = ({
@@ -103,27 +103,31 @@ const LegislationOverview: FC<LegislationOverviewProps> = ({
103103
<ProgressBar status={matterStatus.status} />
104104
</dd>
105105
</div>
106-
<div>
107-
<dt>Latest Meeting:</dt>
108-
<dd>
109-
<Link to={`/events/${event.id}`}>
110-
{event.event_datetime.toLocaleDateString(language, {
111-
timeZone: municipality.timeZone,
112-
month: "short",
113-
day: "numeric",
114-
year: "numeric",
115-
})}
116-
</Link>
117-
</dd>
118-
</div>
119-
<div>
120-
<dt>Latest Document:</dt>
121-
<dd>
122-
<a target="_blank" rel="noopener noreferrer" href={document.url}>
123-
{document.name}
124-
</a>
125-
</dd>
126-
</div>
106+
{event && (
107+
<div>
108+
<dt>Latest Meeting:</dt>
109+
<dd>
110+
<Link to={`/events/${event.id}`}>
111+
{event.event_datetime.toLocaleDateString(language, {
112+
timeZone: municipality.timeZone,
113+
month: "short",
114+
day: "numeric",
115+
year: "numeric",
116+
})}
117+
</Link>
118+
</dd>
119+
</div>
120+
)}
121+
{document && (
122+
<div>
123+
<dt>Latest Document:</dt>
124+
<dd>
125+
<a target="_blank" rel="noopener noreferrer" href={document.url}>
126+
{document.name}
127+
</a>
128+
</dd>
129+
</div>
130+
)}
127131
<div>
128132
<dt>Sponsored by:</dt>
129133
<dd>

src/components/Details/MinutesItemsList/MinutesItemsList.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React, { FC } from "react";
22
import styled from "@emotion/styled";
3-
/* import { Link } from "react-router-dom"; */
3+
import { Link } from "react-router-dom";
44

55
import DocumentsList from "./DocumentsList";
6-
/* import ChevronDownIcon from "../../Shared/ChevronDownIcon"; */
6+
import ChevronDownIcon from "../../Shared/ChevronDownIcon";
77

88
import { Item } from "./types";
9+
import { strings } from "../../../assets/LocalizedStrings";
910

1011
const ListItem = styled.li({
1112
"& > div:first-of-type": {
@@ -37,11 +38,11 @@ const MinutesItemsList: FC<MinutesItemsListProps> = ({ minutesItems }: MinutesIt
3738
return (
3839
<ListItem key={elem.name}>
3940
<div>{elem.name}</div>
40-
{/* {elem.matter_ref && (
41+
{elem.matter_ref && (
4142
<Link to={`/matters/${elem.matter_ref}`}>
42-
{"Go to Full Legislation Details"} <ChevronDownIcon />
43+
{strings.go_to_matter_details} <ChevronDownIcon />
4344
</Link>
44-
)} */}
45+
)}
4546
{elem.description && <div>{elem.description}</div>}
4647
<DocumentsList documents={elem.documents} />
4748
</ListItem>

src/components/Tables/MeetingVotesTableRow/MeetingVotesTableRow.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function VoteCell(isExpanded: boolean, votes: IndividualMeetingVote[], isMobile:
9898

9999
const MeetingVotesTableRow = ({
100100
index,
101-
/* legislationLink, */
101+
legislationLink,
102102
legislationName,
103103
legislationDescription,
104104
councilDecision,
@@ -120,10 +120,11 @@ const MeetingVotesTableRow = ({
120120
}}
121121
>
122122
<div>
123-
{/* <Link to={legislationLink}>{legislationName}</Link> */}
124-
<p className="mzp-c-card-desc" style={{ fontWeight: 600, marginBottom: 0 }}>
125-
{legislationName}
126-
</p>
123+
<Link to={legislationLink}>
124+
<p className="mzp-c-card-desc" style={{ fontWeight: 600, marginBottom: 0 }}>
125+
{legislationName}
126+
</p>
127+
</Link>
127128
{!isMobile && <p>{legislationDescription}</p>}
128129
</div>
129130
<DecisionResult result={councilDecision} />

src/components/Tables/VotingTableRow/VotingTableRow.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export type VotingTableRowProps = {
3535

3636
const VotingTableRow = ({
3737
index,
38-
/* legislationLink, */
38+
legislationLink,
3939
legislationName,
4040
legislationTags,
4141
voteDecision,
@@ -67,10 +67,11 @@ const VotingTableRow = ({
6767
columnDistribution={columnDistribution}
6868
>
6969
<React.Fragment>
70-
{/* <Link to={legislationLink}>{legislationName}</Link> */}
71-
<p className="mzp-c-card-desc" style={{ fontWeight: 600, marginBottom: 0 }}>
72-
{legislationName}
73-
</p>
70+
<Link to={legislationLink}>
71+
<p className="mzp-c-card-desc" style={{ fontWeight: 600, marginBottom: 0 }}>
72+
{legislationName}
73+
</p>
74+
</Link>
7475
{!isMobile && <p className="mzp-c-card-desc">{legislationTagsString}</p>}
7576
</React.Fragment>
7677
<DecisionResult result={voteDecision} />

0 commit comments

Comments
 (0)