{errorText}
16 | 19 |{displayText}
23 |Contents of Page 1
, 18 |Contents of Page 2
, 19 |Contents of Page 3
, 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "extends": [ 3 | "plugin:react/recommended", 4 | "plugin:@typescript-eslint/recommended", 5 | "prettier", 6 | "prettier/@typescript-eslint", 7 | "plugin:react-hooks/recommended", 8 | ], 9 | "env": { 10 | "mocha": true 11 | }, 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "project": "tsconfig.json" 15 | }, 16 | "plugins": ["@typescript-eslint"], 17 | "root": true, 18 | "rules": { 19 | "@typescript-eslint/explicit-function-return-type": "off", 20 | "@typescript-eslint/explicit-member-accessibility": "off", 21 | "@typescript-eslint/no-explicit-any": "off", 22 | "@typescript-eslint/no-var-requires": "off", 23 | "@typescript-eslint/camelcase": "off", 24 | } 25 | }; -------------------------------------------------------------------------------- /src/components/Filters/SelectTextFilterOptions/getSelectedOptions.test.ts: -------------------------------------------------------------------------------- 1 | import getSelectedOptions from "./getSelectedOptions"; 2 | 3 | describe("getSelectedOptions", () => { 4 | test("Returns no selections with default state", () => { 5 | const selectedOptions = getSelectedOptions({}); 6 | expect(selectedOptions).toHaveLength(0); 7 | }); 8 | 9 | test("Returns correct selections", () => { 10 | const selectedOptions = getSelectedOptions({ a: true, b: false }); 11 | expect(selectedOptions).toHaveLength(1); 12 | expect(selectedOptions).toContainEqual("a"); 13 | }); 14 | 15 | test("Return no selections with all false state", () => { 16 | const selectedOptions = getSelectedOptions({ a: false, b: false }); 17 | expect(selectedOptions).toHaveLength(0); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /src/stories/model-mocks/sentence.ts: -------------------------------------------------------------------------------- 1 | import { ECSentence } from "../../containers/EventContainer/types"; 2 | 3 | export function mockSentences(numSessions: number, numSentences: number) { 4 | const sentences: ECSentence[] = []; 5 | for (let sessionIndex = 0; sessionIndex < numSessions; sessionIndex++) { 6 | for (let sentenceIndex = 0; sentenceIndex < numSentences; sentenceIndex++) { 7 | sentences.push({ 8 | session_index: sessionIndex, 9 | index: sessionIndex * numSentences + sentenceIndex, 10 | start_time: sentenceIndex, 11 | text: `This is a sentence ${sessionIndex * numSentences + sentenceIndex}.`, 12 | speaker_index: sentenceIndex, 13 | speaker_name: `Speaker ${sentenceIndex}`, 14 | }); 15 | } 16 | } 17 | return sentences; 18 | } 19 | -------------------------------------------------------------------------------- /src/components/Shared/PlayIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const PlayIcon = () => { 4 | return ( 5 | 27 | ); 28 | }; 29 | 30 | export default PlayIcon; 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Create a report to help us improve cdp-frontend 4 | labels: bug 5 | --- 6 | 7 | ### Describe the Bug 8 | 9 | _A clear and concise description of what the bug is._ 10 | 11 | ### Reproduction 12 | 13 | _Steps to reproduce the behavior:_ 14 | 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | ### Expected Behavior 21 | 22 | _A clear and concise description of what you expected to happen._ 23 | 24 | ### Screenshots 25 | 26 | _If applicable, add screenshots to help explain your problem._ 27 | 28 | ### Environment 29 | 30 | _Any additional information about your environment._ 31 | 32 | - OS Version: _[e.g. macOS 11.3.1]_ 33 | - Browser Version: _[e.g. Chrome 89.0]_ 34 | - CDP Frontend Version: _[e.g. 0.5.0]_ 35 | -------------------------------------------------------------------------------- /src/components/Details/EventVideo/utils.ts: -------------------------------------------------------------------------------- 1 | import { VideoMediaType } from "./constants"; 2 | 3 | export function getMediaTypeFromUri(uri: string) { 4 | let type: string | undefined; 5 | if (uri.match(/youtu?.be/)) { 6 | type = VideoMediaType.youtube; 7 | } else { 8 | // uri must have media type webm or mp4 9 | const matches = uri.match(new RegExp(`(${VideoMediaType.webm}|${VideoMediaType.mp4})$`)); 10 | if (matches) { 11 | type = matches[0]; 12 | } 13 | } 14 | return type; 15 | } 16 | 17 | interface Source { 18 | src: string; 19 | type?: string; 20 | } 21 | 22 | export function getSource(uri: string) { 23 | const mediaType = getMediaTypeFromUri(uri); 24 | const source: Source = { src: uri }; 25 | if (mediaType) { 26 | source.type = `video/${mediaType}`; 27 | } 28 | return source; 29 | } 30 | -------------------------------------------------------------------------------- /src/stories/model-mocks/person.ts: -------------------------------------------------------------------------------- 1 | import Person from "../../models/Person"; 2 | import { mockImageFile } from "./file"; 3 | 4 | const basicPerson: Person = { 5 | id: "test-id", 6 | name: "R.J. Person", 7 | email: "test-person@test.com", 8 | phone: "206-867-5309", 9 | website: "https://www.google.com", 10 | picture: mockImageFile(400, 400, "Avatar Face"), 11 | router_string: "test.person", 12 | is_active: true, 13 | }; 14 | 15 | const realPerson: Person = { 16 | id: "975edb7a71f6", 17 | name: "Teresa Mosqueda", 18 | email: "Teresa.Mosqueda@seattle.gov", 19 | phone: "206-867-5309", 20 | website: "http://www.seattle.gov/council/mosqueda", 21 | picture: undefined, 22 | picture_ref: "e2ac924a1884", 23 | router_string: "teresa-mosqueda", 24 | is_active: true, 25 | }; 26 | 27 | export { basicPerson, realPerson }; 28 | -------------------------------------------------------------------------------- /src/components/Cards/PersonCard/PersonCard.stories.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Story, Meta } from "@storybook/react"; 3 | 4 | import PersonCard, { PersonCardProps } from "./PersonCard"; 5 | import { realPerson } from "../../../stories/model-mocks/person"; 6 | import { realSeat, realSeatNoImage } from "../../../stories/model-mocks/seat"; 7 | 8 | export default { 9 | component: PersonCard, 10 | title: "Library/Cards/Person", 11 | } as Meta; 12 | 13 | const Template: Story{`Fetching ${data}...`}
; 22 | } 23 | if (error) { 24 | return{error.message}
; 25 | } 26 | if (notFound) { 27 | return{`No ${data} found.`}
; 28 | } 29 | return <>{children}>; 30 | }; 31 | 32 | export default LazyFetchDataContainer; 33 | -------------------------------------------------------------------------------- /src/models/MatterFile.ts: -------------------------------------------------------------------------------- 1 | import Matter from "./Matter"; 2 | import { ResponseData } from "../networking/NetworkResponse"; 3 | import { Model } from "./Model"; 4 | import { DocumentReference } from "firebase/firestore"; 5 | export default class MatterFile implements Model { 6 | id: string; 7 | external_source_id?: string; 8 | matter_ref: string; 9 | matter?: Matter; 10 | name: string; 11 | uri: string; 12 | 13 | constructor(jsonData: ResponseData) { 14 | this.id = jsonData["id"]; 15 | this.matter_ref = jsonData["matter_ref"].id; 16 | this.name = jsonData["name"]; 17 | this.uri = jsonData["uri"]; 18 | 19 | if (jsonData["external_source_id"]) { 20 | this.external_source_id = jsonData["external_source_id"]; 21 | } 22 | 23 | if ( 24 | typeof jsonData["matter_ref"] === "object" && 25 | !(jsonData["matter_ref"] instanceof DocumentReference) 26 | ) { 27 | this.matter = new Matter(jsonData["matter_ref"]); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/components/Shared/CopyIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const CopyIcon = () => { 4 | return ( 5 | 21 | ); 22 | }; 23 | 24 | export default CopyIcon; 25 | -------------------------------------------------------------------------------- /src/components/Details/TranscriptFull/TranscriptFull.stories.tsx: -------------------------------------------------------------------------------- 1 | import React, { createRef } from "react"; 2 | 3 | import { action } from "@storybook/addon-actions"; 4 | import { Story, Meta } from "@storybook/react"; 5 | 6 | import TranscriptFull, { TranscriptFullProps } from "./TranscriptFull"; 7 | import { TranscriptItemRef } from "../TranscriptItem/TranscriptItem"; 8 | 9 | import { mockSentences } from "../../../stories/model-mocks/sentence"; 10 | 11 | export default { 12 | component: TranscriptFull, 13 | title: "Library/Details/Transcript Full", 14 | } as Meta; 15 | 16 | const Template: Story{`No ${searchType} found.`}
62 | )} 63 |