ActionPanel.tsx 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. import React from 'react';
  2. import { Button, Tooltip } from 'antd';
  3. import { DeleteOutlined } from '@ant-design/icons';
  4. import { useDispatch, useSelector } from 'react-redux';
  5. import { deleteWorkThunk } from '@/states/patient/worklist/slices/workSlice';
  6. import { FormattedMessage } from 'react-intl';
  7. import { AppDispatch, RootState } from '@/states/store';
  8. interface ActionButtonProps {
  9. icon: React.ReactNode;
  10. tooltip: React.ReactNode;
  11. onClick?: () => void;
  12. }
  13. const ActionButton: React.FC<ActionButtonProps> = ({
  14. icon,
  15. tooltip,
  16. onClick,
  17. }) => (
  18. <Tooltip title={tooltip}>
  19. <Button icon={icon} onClick={onClick} />
  20. </Tooltip>
  21. );
  22. const ActionPanel: React.FC = () => {
  23. const dispatch = useDispatch<AppDispatch>();
  24. const selectedIds = useSelector(
  25. (state: RootState) => state.workSelection.selectedIds
  26. );
  27. const handleDelete = () => {
  28. dispatch(deleteWorkThunk(selectedIds)); // Use the selected IDs from the Redux state
  29. };
  30. return (
  31. <div className="flex flex-wrap gap-2 w-full">
  32. <ActionButton
  33. icon={<DeleteOutlined />}
  34. tooltip={
  35. <FormattedMessage
  36. id="actionPanel.deleteTask"
  37. defaultMessage="actionPanel.deleteTask"
  38. />
  39. }
  40. onClick={handleDelete}
  41. />
  42. <ActionButton
  43. icon={<DeleteOutlined />}
  44. tooltip={
  45. <FormattedMessage
  46. id="actionPanel.editPatient"
  47. defaultMessage="actionPanel.editPatient"
  48. />
  49. }
  50. />
  51. <ActionButton
  52. icon={<DeleteOutlined />}
  53. tooltip={
  54. <FormattedMessage
  55. id="actionPanel.lockTask"
  56. defaultMessage="actionPanel.lockTask"
  57. />
  58. }
  59. />
  60. <ActionButton
  61. icon={<DeleteOutlined />}
  62. tooltip={
  63. <FormattedMessage
  64. id="actionPanel.risSync"
  65. defaultMessage="actionPanel.risSync"
  66. />
  67. }
  68. />
  69. <ActionButton
  70. icon={<DeleteOutlined />}
  71. tooltip={
  72. <FormattedMessage
  73. id="actionPanel.reRegister"
  74. defaultMessage="actionPanel.reRegister"
  75. />
  76. }
  77. />
  78. <ActionButton
  79. icon={<DeleteOutlined />}
  80. tooltip={
  81. <FormattedMessage
  82. id="actionPanel.saveLocal"
  83. defaultMessage="actionPanel.saveLocal"
  84. />
  85. }
  86. />
  87. <ActionButton
  88. icon={<DeleteOutlined />}
  89. tooltip={
  90. <FormattedMessage
  91. id="actionPanel.importXLS"
  92. defaultMessage="actionPanel.importXLS"
  93. />
  94. }
  95. />
  96. <ActionButton
  97. icon={<DeleteOutlined />}
  98. tooltip={
  99. <FormattedMessage
  100. id="actionPanel.sortList"
  101. defaultMessage="actionPanel.sortList"
  102. />
  103. }
  104. />
  105. <ActionButton
  106. icon={<DeleteOutlined />}
  107. tooltip={
  108. <FormattedMessage
  109. id="actionPanel.cloudShare"
  110. defaultMessage="actionPanel.cloudShare"
  111. />
  112. }
  113. />
  114. <ActionButton
  115. icon={<DeleteOutlined />}
  116. tooltip={
  117. <FormattedMessage
  118. id="actionPanel.imageExchange"
  119. defaultMessage="actionPanel.imageExchange"
  120. />
  121. }
  122. />
  123. <ActionButton
  124. icon={<DeleteOutlined />}
  125. tooltip={
  126. <FormattedMessage
  127. id="actionPanel.qrPrint"
  128. defaultMessage="actionPanel.qrPrint"
  129. />
  130. }
  131. />
  132. <ActionButton
  133. icon={<DeleteOutlined />}
  134. tooltip={
  135. <FormattedMessage
  136. id="actionPanel.send"
  137. defaultMessage="actionPanel.send"
  138. />
  139. }
  140. />
  141. <ActionButton
  142. icon={<DeleteOutlined />}
  143. tooltip={
  144. <FormattedMessage
  145. id="actionPanel.burn"
  146. defaultMessage="actionPanel.burn"
  147. />
  148. }
  149. />
  150. <ActionButton
  151. icon={<DeleteOutlined />}
  152. tooltip={
  153. <FormattedMessage
  154. id="actionPanel.export"
  155. defaultMessage="actionPanel.export"
  156. />
  157. }
  158. />
  159. <ActionButton
  160. icon={<DeleteOutlined />}
  161. tooltip={
  162. <FormattedMessage
  163. id="actionPanel.import"
  164. defaultMessage="actionPanel.import"
  165. />
  166. }
  167. />
  168. </div>
  169. );
  170. };
  171. export default ActionPanel;