NodeRender.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use client';
  2. import React, { useMemo } from 'react'
  3. import { BsArrowLeft, BsArrowRight } from "react-icons/bs";
  4. import Agent from './NodeType/Agent';
  5. import Form from './NodeType/Form';
  6. import Unsupport from './NodeType/Unsupport';
  7. import * as R from 'ramda'
  8. const NodeRender = ({ node }) => {
  9. const Comp = useMemo(() => {
  10. return R.cond([
  11. [R.propEq('form_card', 'type'), R.always(Form)],
  12. [R.propEq('UserTask', 'type'), R.always(Agent)],
  13. [R.T, R.always(Unsupport)],
  14. ])(node)
  15. }, [node?.id])
  16. return (
  17. // <div className="flex-1 shadow-xl rounded-box p-2">node render</div>
  18. <div className="card card-compact shadow-xl flex-1">
  19. <div className="card-body">
  20. <div className="card-title rounded-box bg-slate-200 p-2">
  21. <h2 className="flex-1">
  22. Card title!
  23. </h2>
  24. <button className='btn btn-circle btn-sm'><BsArrowLeft /></button>
  25. <button className='btn btn-circle btn-sm'><BsArrowRight /></button>
  26. </div>
  27. <Comp node={node}></Comp>
  28. {/* TODO */}
  29. {/* <div className="card-actions justify-end">
  30. <button className="btn btn-primary">确认,下一步</button>
  31. </div> */}
  32. </div>
  33. </div>
  34. )
  35. }
  36. export default React.memo(React.forwardRef(NodeRender))