Details.jsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. var React = require('react');
  2. var dateToString = require('../util').dateToString;
  3. var empty = <i>none</i>;
  4. var DetailEntry = React.createClass({
  5. render: function() {
  6. return (
  7. <tr>
  8. <td>{this.props.name}</td>
  9. <td>{this.props.children || empty}</td>
  10. </tr>
  11. )
  12. }
  13. });
  14. function join(arr) {
  15. if(arr) {
  16. return arr.join(', ');
  17. }
  18. }
  19. var Details = React.createClass({
  20. render: function() {
  21. var details = this.props.details.val();
  22. return (
  23. <div>
  24. <table className="table">
  25. <tbody>
  26. <DetailEntry name="Plan">
  27. {details.plan.name} ({details.plan.price} {details.plan.currency})
  28. </DetailEntry>
  29. <DetailEntry name="Type">
  30. {details.type}
  31. </DetailEntry>
  32. <DetailEntry name="Status">
  33. {details.status}
  34. </DetailEntry>
  35. <DetailEntry name="Created on">
  36. {dateToString(new Date(details.created_on))}
  37. </DetailEntry>
  38. <DetailEntry name="Modified on">
  39. {dateToString(new Date(details.modified_on))}
  40. </DetailEntry>
  41. <DetailEntry name="Nameservers">
  42. {join(details.name_servers)}
  43. </DetailEntry>
  44. <DetailEntry name="Original Nameservers">
  45. {join(details.original_name_servers)}
  46. </DetailEntry>
  47. <DetailEntry name="Original DNS Host">
  48. {details.original_dnshost}
  49. </DetailEntry>
  50. <DetailEntry name="Original Registrar">
  51. {details.original_registrar}
  52. </DetailEntry>
  53. </tbody>
  54. </table>
  55. </div>
  56. );
  57. }
  58. });
  59. module.exports = Details;