Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creates the matters/:id route and corresponding page Co-authored-by: Brian Ledbetter <Brian.Ledbetter@gettyimages.com>
- Loading branch information
Showing
17 changed files
with
298 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from "react"; | ||
import styled from "@emotion/styled"; | ||
|
||
import MatterStatus from "../../models/MatterStatus"; | ||
import Event from "../../models/Event"; | ||
import Person from "../../models/Person"; | ||
import Vote from "../../models/Vote"; | ||
import IndexedMatterGram from "../../models/IndexedMatterGram"; | ||
import EventMinutesItem from "../../models/EventMinutesItem"; | ||
|
||
import LegislationIntroduction from "../../components/Details/Legislation/LegislationIntroduction"; | ||
import LegislationOverview from "../../components/Details/Legislation/LegislationOverview"; | ||
import { LegislationLatestVote } from "../../components/Details/Legislation/LegislationLatestVote"; | ||
import { LegislationHistory } from "../../components/Details/Legislation/LegislationHistory"; | ||
|
||
const Matter = styled.div({ | ||
display: "grid", | ||
gridTemplateColumns: "1fr", | ||
rowGap: 64, | ||
}); | ||
interface MatterContainerProps { | ||
matterStatus: MatterStatus; | ||
indexedMatterGrams: IndexedMatterGram[]; | ||
event?: Event; | ||
sponsors: Person[]; | ||
votes?: Vote[]; | ||
legislationHistory?: EventMinutesItem[]; | ||
} | ||
|
||
const MatterContainer = ({ | ||
matterStatus, | ||
indexedMatterGrams, | ||
event, | ||
sponsors, | ||
votes, | ||
legislationHistory, | ||
}: MatterContainerProps) => { | ||
return ( | ||
<Matter> | ||
<LegislationIntroduction | ||
matterStatus={matterStatus} | ||
indexedMatterGrams={indexedMatterGrams} | ||
/> | ||
<LegislationOverview matterStatus={matterStatus} event={event} sponsors={sponsors} /> | ||
{votes && <LegislationLatestVote votes={votes} />} | ||
{legislationHistory && <LegislationHistory eventMinutesItems={legislationHistory} />} | ||
</Matter> | ||
); | ||
}; | ||
|
||
export default MatterContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as MatterContainer } from "./MatterContainer"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import ModelService from "./ModelService"; | ||
import { where, orderBy, doc } from "@firebase/firestore"; | ||
import { | ||
COLLECTION_NAME, | ||
Populate, | ||
PopulationOptions, | ||
REF_PROPERTY_NAME, | ||
} from "./PopulationOptions"; | ||
import { ORDER_DIRECTION, WHERE_OPERATOR } from "./constants"; | ||
import { NetworkService } from "./NetworkService"; | ||
|
||
import MatterStatus from "../models/MatterStatus"; | ||
import { FirebaseConfig } from "../app/AppConfigContext"; | ||
|
||
export default class MatterStatusService extends ModelService { | ||
constructor(firebaseConfig: FirebaseConfig) { | ||
super(COLLECTION_NAME.MatterStatus, firebaseConfig); | ||
} | ||
|
||
async getMatterStatusesByMatterId(matterId: string): Promise<MatterStatus[]> { | ||
const populateEventMinutesItems = new Populate( | ||
COLLECTION_NAME.MatterStatus, | ||
REF_PROPERTY_NAME.MatterStatusEventMinutesItemRef | ||
); | ||
|
||
const networkQueryResponse = this.networkService.getDocuments( | ||
COLLECTION_NAME.MatterStatus, | ||
[ | ||
where( | ||
REF_PROPERTY_NAME.MatterStatusMatterRef, | ||
WHERE_OPERATOR.eq, | ||
doc(NetworkService.getDb(), COLLECTION_NAME.Matter, matterId) | ||
), | ||
orderBy("update_datetime", ORDER_DIRECTION.desc), | ||
], | ||
new PopulationOptions([populateEventMinutesItems]) | ||
); | ||
return this.createModels( | ||
networkQueryResponse, | ||
MatterStatus, | ||
`getMatterStatusByMatterId(${matterId})` | ||
) as Promise<MatterStatus[]>; | ||
} | ||
} |
Oops, something went wrong.