diff --git a/frontend/app/components/Session_/BugReport/BugReportModal.tsx b/frontend/app/components/Session_/BugReport/BugReportModal.tsx index 414ef678c..cb0610398 100644 --- a/frontend/app/components/Session_/BugReport/BugReportModal.tsx +++ b/frontend/app/components/Session_/BugReport/BugReportModal.tsx @@ -76,6 +76,8 @@ function BugReportModal({ hideModal, session, width, height, account, xrayProps }, }; + console.log(bugReportStore) + React.useEffect(() => { bugReportStore.updateReportDefaults(defaults); bugReportStore.setDefaultSteps(mapEvents(events)); diff --git a/frontend/app/components/Session_/BugReport/components/Steps.tsx b/frontend/app/components/Session_/BugReport/components/Steps.tsx index f757de460..d44435300 100644 --- a/frontend/app/components/Session_/BugReport/components/Steps.tsx +++ b/frontend/app/components/Session_/BugReport/components/Steps.tsx @@ -6,6 +6,7 @@ import SectionTitle from './SectionTitle'; import XRay from './StepsComponents/XRay'; import StepRenderer from './StepsComponents/StepRenderer'; import StepRadius from './StepsComponents/StepRadius' +import SubModal from './StepsComponents/SubModal' interface Props { xrayProps: { @@ -75,6 +76,9 @@ function Steps({ xrayProps }: Props) { : bugReportStore.chosenEventSteps } /> + {bugReportStore.isSubStepModalOpen ? ( + + ) : null} ); } diff --git a/frontend/app/components/Session_/BugReport/components/StepsComponents/EventStep.tsx b/frontend/app/components/Session_/BugReport/components/StepsComponents/EventStep.tsx index a1b88ca0a..6d578c292 100644 --- a/frontend/app/components/Session_/BugReport/components/StepsComponents/EventStep.tsx +++ b/frontend/app/components/Session_/BugReport/components/StepsComponents/EventStep.tsx @@ -11,9 +11,9 @@ function Step({ step, ind, isDefault }: { step: IStep; ind: number; isDefault?: const [menuOpen, setMenu] = React.useState(false); const menuItems = [ - { icon: 'quotes', text: 'Add Note', onClick: () => console.log('note') }, - { icon: 'info-circle', text: `Add Error`, onClick: () => console.log('note') }, - { icon: 'network', text: 'Add Fetch/XHR', onClick: () => console.log('note') }, + { icon: 'quotes', text: 'Add Note', onClick: () => bugReportStore.toggleSubStepModal(true, 'note') }, + { icon: 'info-circle', text: `Add Error`, onClick: () => bugReportStore.toggleSubStepModal(true, 'error') }, + { icon: 'network', text: 'Add Fetch/XHR', onClick: () => bugReportStore.toggleSubStepModal(true, 'network') }, ]; return ( diff --git a/frontend/app/components/Session_/BugReport/components/StepsComponents/SubModal.tsx b/frontend/app/components/Session_/BugReport/components/StepsComponents/SubModal.tsx new file mode 100644 index 000000000..728fc9b9a --- /dev/null +++ b/frontend/app/components/Session_/BugReport/components/StepsComponents/SubModal.tsx @@ -0,0 +1,65 @@ +import React from 'react'; +import { Icon, Button } from 'UI'; +import cn from 'classnames'; + +const Titles = { + note: 'Note', + network: 'Fetch/XHR', + error: 'Console Error', +}; + +interface Props { + type: 'note' | 'network' | 'error'; +} + +function ModalContent(props: Props) { + const [selected, setSelected] = React.useState([]); + return ( +
+
+
+ +
+
{`Select ${Titles[props.type]}`}
+
+
+
item1
+
item2
+
+ +
+ + +
+
+ ); +} + +interface ModalProps { + xrayProps: { + currentLocation: Record[]; + resourceList: Record[]; + exceptionsList: Record[]; + eventsList: Record[]; + endTime: number; + }; + type: 'note' | 'network' | 'error'; +} + +function SubModal(props: ModalProps) { + return ( +
+ +
+ ); +} + +export default SubModal; diff --git a/frontend/app/mstore/bugReportStore.ts b/frontend/app/mstore/bugReportStore.ts index 0b555becf..450a6fb38 100644 --- a/frontend/app/mstore/bugReportStore.ts +++ b/frontend/app/mstore/bugReportStore.ts @@ -1,84 +1,97 @@ -import { makeAutoObservable } from "mobx" -import { BugReportPdf, ReportDefaults, Step } from 'Components/Session_/BugReport/types' +import { makeAutoObservable } from 'mobx'; +import { BugReportPdf, ReportDefaults, Step } from 'Components/Session_/BugReport/types'; export enum SeverityLevels { Low, Medium, - High + High, } export default class BugReportStore { - reportTitle = 'Untitled Report' - comment = '' - severity = SeverityLevels.High + reportTitle = 'Untitled Report'; + comment = ''; + severity = SeverityLevels.High; - isCommentEdit = false - isTitleEdit = false + isCommentEdit = false; + isTitleEdit = false; + isSubStepModalOpen = false; - bugReport: Partial - sessionEventSteps: Step[] = [] - chosenEventSteps: Step[] = [] + bugReport: Partial; + sessionEventSteps: Step[] = []; + chosenEventSteps: Step[] = []; + subModalType: 'note' | 'network' | 'error'; constructor() { - makeAutoObservable(this) + makeAutoObservable(this); } clearStore() { - this.reportTitle = 'Untitled Report' - this.comment = '' - this.severity = SeverityLevels.High + this.reportTitle = 'Untitled Report'; + this.comment = ''; + this.severity = SeverityLevels.High; - this.isCommentEdit = false - this.isTitleEdit = false + this.isCommentEdit = false; + this.isTitleEdit = false; - this.bugReport = undefined - this.sessionEventSteps = [] - this.chosenEventSteps = [] + this.bugReport = undefined; + this.sessionEventSteps = []; + this.chosenEventSteps = []; + this.subModalType = undefined; + this.isSubStepModalOpen = false; } toggleTitleEdit(isEdit: boolean) { - this.isTitleEdit = isEdit + this.isTitleEdit = isEdit; } setTitle(title: string) { - this.reportTitle = title + this.reportTitle = title; - this.bugReport = Object.assign(this.bugReport, { title: this.reportTitle }) + this.bugReport = Object.assign(this.bugReport, { title: this.reportTitle }); } setSeverity(severity: SeverityLevels) { - this.severity = severity + this.severity = severity; - this.bugReport = Object.assign(this.bugReport, { severity: this.severity }) + this.bugReport = Object.assign(this.bugReport, { severity: this.severity }); } toggleCommentEditing(isEdit: boolean) { - this.isCommentEdit = isEdit + this.isCommentEdit = isEdit; } setComment(comment: string) { - this.comment = comment + this.comment = comment; - this.bugReport = Object.assign(this.bugReport, { comment: this.comment.length > 0 ? this.comment : undefined }) + this.bugReport = Object.assign(this.bugReport, { + comment: this.comment.length > 0 ? this.comment : undefined, + }); } updateReportDefaults(defaults: ReportDefaults) { - this.bugReport = Object.assign(this.bugReport || {}, defaults) + this.bugReport = Object.assign(this.bugReport || {}, defaults); } setDefaultSteps(steps: Step[]) { - this.sessionEventSteps = steps + this.sessionEventSteps = steps; } setSteps(steps: Step[]) { - this.chosenEventSteps = steps + this.chosenEventSteps = steps; } removeStep(step: Step) { - this.chosenEventSteps = this.chosenEventSteps.filter(chosenStep => chosenStep.key !== step.key) + this.chosenEventSteps = this.chosenEventSteps.filter( + (chosenStep) => chosenStep.key !== step.key + ); + } + + toggleSubStepModal(isOpen: boolean, type: 'note' | 'network' | 'error') { + this.isSubStepModalOpen = isOpen; + this.subModalType = type; } resetSteps() { - this.chosenEventSteps = [] + this.chosenEventSteps = []; } }