RedemptionsActions.jsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 { Button } from '@douyinfe/semi-ui';
  17. const RedemptionsActions = ({
  18. selectedKeys,
  19. setEditingRedemption,
  20. setShowEdit,
  21. batchCopyRedemptions,
  22. batchDeleteRedemptions,
  23. t,
  24. }) => {
  25. // Add new redemption code
  26. const handleAddRedemption = () => {
  27. setEditingRedemption({
  28. id: undefined,
  29. });
  30. setShowEdit(true);
  31. };
  32. return (
  33. <div className='flex flex-wrap gap-2 w-full md:w-auto order-2 md:order-1'>
  34. <Button
  35. type='primary'
  36. className='flex-1 md:flex-initial'
  37. onClick={handleAddRedemption}
  38. size='small'
  39. >
  40. {t('添加兑换码')}
  41. </Button>
  42. <Button
  43. type='tertiary'
  44. className='flex-1 md:flex-initial'
  45. onClick={batchCopyRedemptions}
  46. size='small'
  47. >
  48. {t('复制所选兑换码到剪贴板')}
  49. </Button>
  50. <Button
  51. type='danger'
  52. className='w-full md:w-auto'
  53. onClick={batchDeleteRedemptions}
  54. size='small'
  55. >
  56. {t('清除失效兑换码')}
  57. </Button>
  58. </div>
  59. );
  60. };
  61. export default RedemptionsActions;