Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | import React from "react"; import { useDispatch } from "react-redux"; import { toggleNotesVisibility } from "../../../store/features/playbook/playbookSlice.ts"; import Notes from "./Notes.js"; import useIsPrefetched from "../../../hooks/playbooks/useIsPrefetched.ts"; import useCurrentStep from "../../../hooks/playbooks/step/useCurrentStep.ts"; function HandleNotesRender({ id }) { const dispatch = useDispatch(); const isPrefetched = useIsPrefetched(); const [step] = useCurrentStep(id); const toggleNotes = () => { dispatch(toggleNotesVisibility({ id })); }; Iif (!step) return; return ( <div> {!isPrefetched ? ( step.notes ? ( <> <div className="mt-2 text-sm cursor-pointer text-violet-500"> <b>Notes</b> </div> <Notes id={id} /> </> ) : ( <> <div className="mt-2 text-sm cursor-pointer text-violet-500 mb-2" onClick={toggleNotes}> <b>{step.ui_requirement.showNotes ? "-" : "+"}</b> Add Notes about this step </div> {step.ui_requirement.showNotes && <Notes id={id} />} </> ) ) : ( step.notes && ( <> <div className="mt-2 text-sm cursor-pointer text-violet-500"> <b>Notes</b> </div> <Notes id={id} /> </> ) )} </div> ); } export default HandleNotesRender; |