index.jsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. Copyright (C) 2025 QuantumNous
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. For commercial licensing, please contact support@quantumnous.com
  14. */
  15. import React from 'react';
  16. import CardPro from '../../common/ui/CardPro';
  17. import RedemptionsTable from './RedemptionsTable.jsx';
  18. import RedemptionsActions from './RedemptionsActions.jsx';
  19. import RedemptionsFilters from './RedemptionsFilters.jsx';
  20. import RedemptionsDescription from './RedemptionsDescription.jsx';
  21. import EditRedemptionModal from './modals/EditRedemptionModal';
  22. import { useRedemptionsData } from '../../../hooks/redemptions/useRedemptionsData';
  23. const RedemptionsPage = () => {
  24. const redemptionsData = useRedemptionsData();
  25. const {
  26. // Edit state
  27. showEdit,
  28. editingRedemption,
  29. closeEdit,
  30. refresh,
  31. // Actions state
  32. selectedKeys,
  33. setEditingRedemption,
  34. setShowEdit,
  35. batchCopyRedemptions,
  36. batchDeleteRedemptions,
  37. // Filters state
  38. formInitValues,
  39. setFormApi,
  40. searchRedemptions,
  41. loading,
  42. searching,
  43. // UI state
  44. compactMode,
  45. setCompactMode,
  46. // Translation
  47. t,
  48. } = redemptionsData;
  49. return (
  50. <>
  51. <EditRedemptionModal
  52. refresh={refresh}
  53. editingRedemption={editingRedemption}
  54. visiable={showEdit}
  55. handleClose={closeEdit}
  56. />
  57. <CardPro
  58. type="type1"
  59. descriptionArea={
  60. <RedemptionsDescription
  61. compactMode={compactMode}
  62. setCompactMode={setCompactMode}
  63. t={t}
  64. />
  65. }
  66. actionsArea={
  67. <div className="flex flex-col md:flex-row justify-between items-center gap-2 w-full">
  68. <RedemptionsActions
  69. selectedKeys={selectedKeys}
  70. setEditingRedemption={setEditingRedemption}
  71. setShowEdit={setShowEdit}
  72. batchCopyRedemptions={batchCopyRedemptions}
  73. batchDeleteRedemptions={batchDeleteRedemptions}
  74. t={t}
  75. />
  76. <div className="w-full md:w-full lg:w-auto order-1 md:order-2">
  77. <RedemptionsFilters
  78. formInitValues={formInitValues}
  79. setFormApi={setFormApi}
  80. searchRedemptions={searchRedemptions}
  81. loading={loading}
  82. searching={searching}
  83. t={t}
  84. />
  85. </div>
  86. </div>
  87. }
  88. t={t}
  89. >
  90. <RedemptionsTable {...redemptionsData} />
  91. </CardPro>
  92. </>
  93. );
  94. };
  95. export default RedemptionsPage;