Timeline.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import moment from "moment";
  2. function Timeline({ data }) {
  3. const date = [...new Set(data.data.map((e) => moment(e.createdAt).format("DD MMMM YYYY")))];
  4. return (
  5. <ul className="timeline">
  6. {date.map((value) => (
  7. <>
  8. <li className="timeline-separator" data-datetime={value}></li>
  9. {data.data
  10. .filter((e) => moment(e.createdAt).format("DD MMMM YYYY") === value)
  11. .map((data, i) => (
  12. <>
  13. <li className={data.role === "PT" ? "timeline-inverted" : ""}>
  14. <div className="timeline-badge info">
  15. <em className="far fa-file"></em>
  16. </div>
  17. <div className="timeline-card">
  18. <div className="popover right">
  19. <div className="arrow"></div>
  20. <div className="popover-body">
  21. <div className="d-flex align-items-center mb-3">
  22. <img className="mr-3 rounded-circle thumb48" src="/static/img/user/admin.png" alt="Avatar" />
  23. <p className="m-0">
  24. <strong>{data.role}</strong>
  25. <br />
  26. {data.description}
  27. </p>
  28. </div>
  29. {data.data.files ? (
  30. <>
  31. <p className="text-muted my-2">Dokumen</p>
  32. {data.data.files.map((e) => (
  33. <div className="media bb p-2">
  34. <div className="media-body">
  35. <p className="m-0">
  36. <a href={`data:${e.type};base64, ${Buffer.from(e.data).toString("base64")}`} download={e.name}>
  37. <strong>{e.name}</strong>
  38. </a>
  39. </p>
  40. </div>
  41. </div>
  42. ))}
  43. </>
  44. ) : (
  45. ""
  46. )}
  47. </div>
  48. </div>
  49. </div>
  50. </li>
  51. </>
  52. ))}
  53. </>
  54. ))}
  55. <li className="timeline-end">
  56. <a className="timeline-badge">
  57. <em className="fa fa-plus"></em>
  58. </a>
  59. </li>
  60. </ul>
  61. );
  62. }
  63. export default Timeline;