Timeline.js 1.9 KB

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