@ssa-ui-kit/widgets 1.0.12 → 1.1.55-canary-79b6b0d-20250224

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/dist/components/AccountBalance/AccountBalance.d.ts +1 -1
  2. package/dist/components/AccountBalance/BalancePieChart.d.ts +1 -1
  3. package/dist/components/AccountBalance/BalancePieChartTitle.d.ts +1 -1
  4. package/dist/components/AccountKeys/AccountKeys.d.ts +1 -1
  5. package/dist/components/AccountKeys/stories/StoryComponent.d.ts +1 -1
  6. package/dist/components/Activity/Activity.d.ts +1 -1
  7. package/dist/components/Activity/ActivityItem.d.ts +1 -1
  8. package/dist/components/Bmi/Bmi.d.ts +1 -1
  9. package/dist/components/Bmi/BmiLabels.d.ts +1 -1
  10. package/dist/components/BotsTable/BotsTable.d.ts +1 -1
  11. package/dist/components/BotsTable/stories/BotsTable/StoryComponent.d.ts +1 -1
  12. package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionIcon.d.ts +1 -1
  13. package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionItem.d.ts +1 -1
  14. package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionMore.d.ts +1 -1
  15. package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionRun.d.ts +1 -1
  16. package/dist/components/BotsTable/stories/BotsTable/components/Actions/Actions.d.ts +1 -1
  17. package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionsWrapper.d.ts +1 -1
  18. package/dist/components/BotsTable/stories/BotsTable/components/Actions/consts.d.ts +3 -3
  19. package/dist/components/BotsTable/stories/BotsTable/components/Exchange/Exchange.d.ts +1 -1
  20. package/dist/components/BotsTable/stories/BotsTable/components/Exchange/consts.d.ts +3 -3
  21. package/dist/components/BotsTable/stories/BotsTable/components/PNL.d.ts +1 -1
  22. package/dist/components/BotsTable/stories/BotsTable/components/ROI.d.ts +1 -1
  23. package/dist/components/BotsTable/stories/BotsTable/components/TableTag.d.ts +1 -1
  24. package/dist/components/BotsTable/stories/BotsTable/components/Trade/Trade.d.ts +1 -1
  25. package/dist/components/BotsTable/stories/NoControlOrders/StoryComponent.d.ts +1 -1
  26. package/dist/components/BotsTable/stories/NoControlOrders/components/ActionMore.d.ts +1 -1
  27. package/dist/components/BotsTable/stories/NoControlOrders/components/Reason.d.ts +1 -1
  28. package/dist/components/BotsTable/stories/NoControlOrders/components/TableList.d.ts +1 -1
  29. package/dist/components/BotsTable/stories/NoControlOrders/components/TableRow.d.ts +1 -1
  30. package/dist/components/Calories/Calories.d.ts +1 -1
  31. package/dist/components/Calories/innerContent.d.ts +1 -1
  32. package/dist/components/ExchangeAccount/ExchangeAccount.d.ts +1 -1
  33. package/dist/components/HeartRate/BPM.d.ts +1 -1
  34. package/dist/components/HeartRate/HeartRate.d.ts +1 -1
  35. package/dist/components/HeartRate/HeartRateLineChart.d.ts +1 -1
  36. package/dist/components/ListGoals/ListGoals.d.ts +1 -1
  37. package/dist/components/ListGoals/ListGoalsCard.d.ts +1 -1
  38. package/dist/components/MealNutrients/MealNutrients.d.ts +1 -1
  39. package/dist/components/MealNutrients/MealNutrientsLineChart.d.ts +1 -1
  40. package/dist/components/MealNutrients/MealNutrientsTooltip.d.ts +1 -1
  41. package/dist/components/MealPlanner/MealPlanner.d.ts +1 -1
  42. package/dist/components/MealPlanner/MealPlannerCard.d.ts +1 -1
  43. package/dist/components/StepsCounter/StepsCounter.d.ts +1 -1
  44. package/dist/components/TradingInfoCard/TradingInfoCard.d.ts +1 -1
  45. package/dist/components/TradingInfoCard/TradingInfoCardContent.d.ts +1 -1
  46. package/dist/components/TradingInfoCard/TradingInfoCardTooltip.d.ts +1 -1
  47. package/dist/components/TradingInfoCard/TradingInfoCardWrapper.d.ts +1 -1
  48. package/dist/components/TradingScoreboard/TradingScoreboard.d.ts +1 -1
  49. package/dist/components/TradingScoreboard/helpers.d.ts +4 -4
  50. package/dist/components/UpcomingWorkouts/UpcomingWorkoutCard.d.ts +1 -1
  51. package/dist/components/UpcomingWorkouts/UpcomingWorkouts.d.ts +1 -1
  52. package/dist/components/UserCard/UserCard.d.ts +1 -1
  53. package/dist/components/UserCard/UserCardBMI.d.ts +1 -1
  54. package/dist/components/UserCard/UserCardCredentials.d.ts +1 -1
  55. package/dist/components/UserCard/UserCardItem.d.ts +1 -1
  56. package/dist/components/WaterConsume/WaterConsume.d.ts +1 -1
  57. package/dist/index.js +2439 -1
  58. package/dist/index.js.map +1 -1
  59. package/package.json +24 -27
  60. package/.babelrc.js +0 -4
  61. package/.env +0 -7
  62. package/.storybook/main.ts +0 -47
  63. package/.storybook/preview.tsx +0 -22
  64. package/.storybook/style.css +0 -40
  65. package/custom-shots/widgets-bots-table--no-control-orders--menu-opened_[w1920px].png +0 -0
  66. package/custom-shots/widgets-bots-table--no-control-orders--run-reason-modal_[w1920px].png +0 -0
  67. package/custom-shots/widgets-heart-rate--hint-opened__[w1440px].png +0 -0
  68. package/custom-shots/widgets-heart-rate--hint-opened__[w1920px].png +0 -0
  69. package/custom-shots/widgets-heart-rate--hint-opened__[w390px].png +0 -0
  70. package/custom-shots/widgets-heart-rate--hint-opened__[w900px].png +0 -0
  71. package/custom-shots/widgets-meal-nutrients--hint-opened__[w1440px].png +0 -0
  72. package/custom-shots/widgets-meal-nutrients--hint-opened__[w1920px].png +0 -0
  73. package/custom-shots/widgets-meal-nutrients--hint-opened__[w390px].png +0 -0
  74. package/custom-shots/widgets-meal-nutrients--hint-opened__[w900px].png +0 -0
  75. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w1440px].png +0 -0
  76. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w1920px].png +0 -0
  77. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w390px].png +0 -0
  78. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w900px].png +0 -0
  79. package/custom-shots/widgets-trading-info-card--hover__[w1920px].png +0 -0
  80. package/customTest.tsx +0 -35
  81. package/jest-setup.ts +0 -20
  82. package/lostpixel.config.ts +0 -29
  83. package/playwright.config.ts +0 -7
  84. package/src/components/AccountBalance/AccountBalance.specBackup.tsx +0 -105
  85. package/src/components/AccountBalance/AccountBalance.stories.tsx +0 -138
  86. package/src/components/AccountBalance/AccountBalance.tsx +0 -60
  87. package/src/components/AccountBalance/BalancePieChart.tsx +0 -127
  88. package/src/components/AccountBalance/BalancePieChartTitle.tsx +0 -54
  89. package/src/components/AccountBalance/index.ts +0 -4
  90. package/src/components/AccountBalance/stories/fixtures.ts +0 -26
  91. package/src/components/AccountBalance/types.ts +0 -41
  92. package/src/components/AccountKeys/AccountKeys.specBackup.tsx +0 -43
  93. package/src/components/AccountKeys/AccountKeys.stories.tsx +0 -14
  94. package/src/components/AccountKeys/AccountKeys.tsx +0 -73
  95. package/src/components/AccountKeys/helpers.ts +0 -7
  96. package/src/components/AccountKeys/index.ts +0 -2
  97. package/src/components/AccountKeys/stories/StoryComponent.tsx +0 -33
  98. package/src/components/AccountKeys/styles.ts +0 -87
  99. package/src/components/AccountKeys/types.ts +0 -8
  100. package/src/components/Activity/Activity.specBackup.tsx +0 -79
  101. package/src/components/Activity/Activity.stories.tsx +0 -15
  102. package/src/components/Activity/Activity.tsx +0 -83
  103. package/src/components/Activity/ActivityItem.tsx +0 -38
  104. package/src/components/Activity/index.tsx +0 -2
  105. package/src/components/Activity/mockActivityRequest.ts +0 -106
  106. package/src/components/Activity/styles.ts +0 -12
  107. package/src/components/Activity/types.ts +0 -10
  108. package/src/components/Bmi/Bmi.spec.Backup.tsx +0 -68
  109. package/src/components/Bmi/Bmi.stories.tsx +0 -10
  110. package/src/components/Bmi/Bmi.tsx +0 -96
  111. package/src/components/Bmi/BmiHeatbar.tsx +0 -18
  112. package/src/components/Bmi/BmiInfo.tsx +0 -11
  113. package/src/components/Bmi/BmiLabel.tsx +0 -9
  114. package/src/components/Bmi/BmiLabels.tsx +0 -33
  115. package/src/components/Bmi/BmiPointer.tsx +0 -15
  116. package/src/components/Bmi/index.tsx +0 -2
  117. package/src/components/Bmi/styles.ts +0 -18
  118. package/src/components/Bmi/types.ts +0 -4
  119. package/src/components/BotsTable/BotsTable.e2e.ts +0 -77
  120. package/src/components/BotsTable/BotsTable.specBackup.tsx +0 -125
  121. package/src/components/BotsTable/BotsTable.tsx +0 -32
  122. package/src/components/BotsTable/BotsTableCell.tsx +0 -13
  123. package/src/components/BotsTable/BotsTableHead.tsx +0 -13
  124. package/src/components/BotsTable/BotsTableRow.tsx +0 -17
  125. package/src/components/BotsTable/BotsTableWrapper.tsx +0 -23
  126. package/src/components/BotsTable/index.ts +0 -5
  127. package/src/components/BotsTable/stories/BotsTable/StoryComponent.tsx +0 -59
  128. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionIcon.tsx +0 -11
  129. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionItem.tsx +0 -40
  130. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionMore.tsx +0 -89
  131. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionRun.tsx +0 -133
  132. package/src/components/BotsTable/stories/BotsTable/components/Actions/Actions.tsx +0 -13
  133. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionsWrapper.tsx +0 -21
  134. package/src/components/BotsTable/stories/BotsTable/components/Actions/consts.tsx +0 -118
  135. package/src/components/BotsTable/stories/BotsTable/components/Actions/index.ts +0 -6
  136. package/src/components/BotsTable/stories/BotsTable/components/Exchange/Exchange.tsx +0 -26
  137. package/src/components/BotsTable/stories/BotsTable/components/Exchange/consts.tsx +0 -157
  138. package/src/components/BotsTable/stories/BotsTable/components/Exchange/index.ts +0 -1
  139. package/src/components/BotsTable/stories/BotsTable/components/Exchange/types.ts +0 -6
  140. package/src/components/BotsTable/stories/BotsTable/components/PNL.tsx +0 -27
  141. package/src/components/BotsTable/stories/BotsTable/components/ROI.tsx +0 -25
  142. package/src/components/BotsTable/stories/BotsTable/components/TableTag.tsx +0 -22
  143. package/src/components/BotsTable/stories/BotsTable/components/Trade/Trade.tsx +0 -8
  144. package/src/components/BotsTable/stories/BotsTable/components/Trade/consts.ts +0 -14
  145. package/src/components/BotsTable/stories/BotsTable/components/Trade/index.ts +0 -1
  146. package/src/components/BotsTable/stories/BotsTable/components/Trade/types.ts +0 -5
  147. package/src/components/BotsTable/stories/BotsTable/components/index.ts +0 -6
  148. package/src/components/BotsTable/stories/BotsTable/index.ts +0 -1
  149. package/src/components/BotsTable/stories/BotsTable/mockData.ts +0 -84
  150. package/src/components/BotsTable/stories/BotsTable.stories.tsx +0 -39
  151. package/src/components/BotsTable/stories/NoControlOrders/StoryComponent.tsx +0 -35
  152. package/src/components/BotsTable/stories/NoControlOrders/components/ActionMore.tsx +0 -95
  153. package/src/components/BotsTable/stories/NoControlOrders/components/Reason.tsx +0 -11
  154. package/src/components/BotsTable/stories/NoControlOrders/components/TableList.tsx +0 -45
  155. package/src/components/BotsTable/stories/NoControlOrders/components/TableRow.tsx +0 -31
  156. package/src/components/BotsTable/stories/NoControlOrders/components/index.ts +0 -4
  157. package/src/components/BotsTable/stories/NoControlOrders/mockData.ts +0 -23
  158. package/src/components/BotsTable/stories/NoControlOrders/types.ts +0 -16
  159. package/src/components/BotsTable/types.ts +0 -31
  160. package/src/components/Calories/Calories.specBackup.tsx +0 -11
  161. package/src/components/Calories/Calories.stories.tsx +0 -26
  162. package/src/components/Calories/Calories.tsx +0 -54
  163. package/src/components/Calories/index.tsx +0 -2
  164. package/src/components/Calories/innerContent.tsx +0 -30
  165. package/src/components/Calories/types.ts +0 -4
  166. package/src/components/ExchangeAccount/ExchangeAccount.specBackup.tsx +0 -104
  167. package/src/components/ExchangeAccount/ExchangeAccount.stories.tsx +0 -108
  168. package/src/components/ExchangeAccount/ExchangeAccount.tsx +0 -90
  169. package/src/components/ExchangeAccount/helpers.tsx +0 -153
  170. package/src/components/ExchangeAccount/index.ts +0 -2
  171. package/src/components/ExchangeAccount/styles.ts +0 -115
  172. package/src/components/ExchangeAccount/types.ts +0 -14
  173. package/src/components/HeartRate/BPM.tsx +0 -43
  174. package/src/components/HeartRate/HeartRate.e2e.ts +0 -78
  175. package/src/components/HeartRate/HeartRate.specBackup.tsx +0 -91
  176. package/src/components/HeartRate/HeartRate.stories.tsx +0 -36
  177. package/src/components/HeartRate/HeartRate.tsx +0 -105
  178. package/src/components/HeartRate/HeartRateLineChart.tsx +0 -53
  179. package/src/components/HeartRate/index.ts +0 -2
  180. package/src/components/HeartRate/mockHeartRateRequest.ts +0 -15
  181. package/src/components/HeartRate/types.ts +0 -15
  182. package/src/components/HeartRate/utils.tsx +0 -8
  183. package/src/components/ListGoals/ListGoals.specBackup.tsx +0 -82
  184. package/src/components/ListGoals/ListGoals.stories.tsx +0 -58
  185. package/src/components/ListGoals/ListGoals.tsx +0 -29
  186. package/src/components/ListGoals/ListGoalsCard.tsx +0 -61
  187. package/src/components/ListGoals/index.ts +0 -2
  188. package/src/components/ListGoals/styles.tsx +0 -11
  189. package/src/components/ListGoals/types.ts +0 -25
  190. package/src/components/MealNutrients/MealNutrients.e2e.ts +0 -68
  191. package/src/components/MealNutrients/MealNutrients.specBackup.tsx +0 -134
  192. package/src/components/MealNutrients/MealNutrients.stories.tsx +0 -37
  193. package/src/components/MealNutrients/MealNutrients.tsx +0 -84
  194. package/src/components/MealNutrients/MealNutrientsLineChart.tsx +0 -89
  195. package/src/components/MealNutrients/MealNutrientsTooltip.tsx +0 -30
  196. package/src/components/MealNutrients/chartDefaultConfig.tsx +0 -87
  197. package/src/components/MealNutrients/index.tsx +0 -2
  198. package/src/components/MealNutrients/mockMealNutrientsRequest.ts +0 -1246
  199. package/src/components/MealNutrients/types.ts +0 -37
  200. package/src/components/MealNutrients/useChartConfig.ts +0 -69
  201. package/src/components/MealPlanner/MealPlanner.specBackup.tsx +0 -77
  202. package/src/components/MealPlanner/MealPlanner.stories.tsx +0 -15
  203. package/src/components/MealPlanner/MealPlanner.tsx +0 -100
  204. package/src/components/MealPlanner/MealPlannerBadge.tsx +0 -15
  205. package/src/components/MealPlanner/MealPlannerBars.tsx +0 -19
  206. package/src/components/MealPlanner/MealPlannerCard.tsx +0 -73
  207. package/src/components/MealPlanner/MealPlannerLegends.tsx +0 -22
  208. package/src/components/MealPlanner/index.ts +0 -2
  209. package/src/components/MealPlanner/mockMealPlannerRequest.ts +0 -70
  210. package/src/components/MealPlanner/types.ts +0 -21
  211. package/src/components/StepsCounter/StepsCounter.specBackup.tsx +0 -14
  212. package/src/components/StepsCounter/StepsCounter.stories.tsx +0 -16
  213. package/src/components/StepsCounter/StepsCounter.tsx +0 -74
  214. package/src/components/StepsCounter/index.ts +0 -2
  215. package/src/components/StepsCounter/types.ts +0 -4
  216. package/src/components/TradingInfoCard/TradingInfoCard.e2e.ts +0 -18
  217. package/src/components/TradingInfoCard/TradingInfoCard.specBackup.tsx +0 -116
  218. package/src/components/TradingInfoCard/TradingInfoCard.stories.tsx +0 -118
  219. package/src/components/TradingInfoCard/TradingInfoCard.tsx +0 -49
  220. package/src/components/TradingInfoCard/TradingInfoCardContent.tsx +0 -32
  221. package/src/components/TradingInfoCard/TradingInfoCardTooltip.tsx +0 -47
  222. package/src/components/TradingInfoCard/TradingInfoCardWrapper.tsx +0 -72
  223. package/src/components/TradingInfoCard/index.ts +0 -3
  224. package/src/components/TradingInfoCard/types.ts +0 -27
  225. package/src/components/TradingScoreboard/TradingScoreboard.specBackup.tsx +0 -119
  226. package/src/components/TradingScoreboard/TradingScoreboard.stories.tsx +0 -119
  227. package/src/components/TradingScoreboard/TradingScoreboard.tsx +0 -41
  228. package/src/components/TradingScoreboard/TradingScoreboardBase.tsx +0 -17
  229. package/src/components/TradingScoreboard/helpers.tsx +0 -134
  230. package/src/components/TradingScoreboard/index.ts +0 -2
  231. package/src/components/TradingScoreboard/types.ts +0 -18
  232. package/src/components/UpcomingWorkouts/UpcomingWorkoutCard.tsx +0 -64
  233. package/src/components/UpcomingWorkouts/UpcomingWorkouts.specBackup.tsx +0 -56
  234. package/src/components/UpcomingWorkouts/UpcomingWorkouts.stories.tsx +0 -32
  235. package/src/components/UpcomingWorkouts/UpcomingWorkouts.tsx +0 -27
  236. package/src/components/UpcomingWorkouts/index.ts +0 -2
  237. package/src/components/UpcomingWorkouts/style.ts +0 -12
  238. package/src/components/UpcomingWorkouts/types.ts +0 -23
  239. package/src/components/UserCard/UserCard.tsx +0 -46
  240. package/src/components/UserCard/UserCardBMI.tsx +0 -37
  241. package/src/components/UserCard/UserCardCredentials.tsx +0 -56
  242. package/src/components/UserCard/UserCardItem.tsx +0 -42
  243. package/src/components/UserCard/index.tsx +0 -2
  244. package/src/components/UserCard/types.ts +0 -8
  245. package/src/components/WaterConsume/WaterConsume.specBackup.tsx +0 -62
  246. package/src/components/WaterConsume/WaterConsume.stories.tsx +0 -36
  247. package/src/components/WaterConsume/WaterConsume.tsx +0 -188
  248. package/src/components/WaterConsume/index.ts +0 -2
  249. package/src/components/WaterConsume/types.ts +0 -11
  250. package/src/consts.ts +0 -18
  251. package/src/index.ts +0 -36
  252. package/src/injectGlobal.ts +0 -41
  253. package/test-results/.last-run.json +0 -21
  254. package/tsbuildcache +0 -1
  255. package/tsconfig.build.json +0 -44
  256. package/tsconfig.json +0 -17
  257. package/webpack.config.js +0 -28
@@ -1,125 +0,0 @@
1
- import { fireEvent, waitFor } from '@testing-library/dom';
2
- import userEvent from '@testing-library/user-event';
3
- import { BotsTableStory } from './stories/BotsTable/StoryComponent';
4
- import { NoControlOrdersStory } from './stories/NoControlOrders/StoryComponent';
5
-
6
- describe('BotsTable', () => {
7
- it('Should be correctly rendered', () => {
8
- const { getByText, getAllByText } = render(<BotsTableStory />);
9
-
10
- getByText('Bot name 1');
11
- getAllByText('27.07.23');
12
- getByText('Bittrex');
13
- getByText('Pending');
14
- getAllByText('ETH/USD');
15
- getByText('-70 USD');
16
- getByText('-10%');
17
- });
18
-
19
- it('Should be alert shown after clicking a table row', () => {
20
- const { container } = render(<BotsTableStory />);
21
-
22
- const firstBodyRow = container.querySelector('tbody > tr');
23
-
24
- const alertMock = jest.spyOn(window, 'alert').mockImplementation();
25
- fireEvent.click(firstBodyRow as Node);
26
- expect(alertMock).toHaveBeenCalledWith(
27
- JSON.stringify({
28
- id: 1,
29
- name: 'Bot name 1',
30
- creationDate: '27.07.23',
31
- exchange: 'binance',
32
- status: 'trade',
33
- pair: 'ETH/USD',
34
- pnl: { amount: 300, currency: 'USD', isIncreasing: true },
35
- roi: { amount: 25, isIncreasing: true },
36
- isDisabled: false,
37
- }),
38
- );
39
- });
40
-
41
- it('Should be modal "Run Reason" shown after clicking the icon for "pending" or "liquidation" status', () => {
42
- const { container, getByText } = render(<BotsTableStory />);
43
-
44
- const button = container.querySelector(
45
- 'tbody > tr:nth-child(6) > td:last-child button',
46
- );
47
-
48
- fireEvent.click(button as Node);
49
-
50
- getByText('Run Reason');
51
- });
52
-
53
- it('Should be submitted "Run Reason" modal', async () => {
54
- const consoleMock = jest.spyOn(console, 'log').mockImplementation();
55
- const { container, getByText, getByPlaceholderText } = render(
56
- <BotsTableStory />,
57
- );
58
- const button = container.querySelector(
59
- 'tbody > tr:nth-child(6) > td:last-child button',
60
- );
61
- fireEvent.click(button as Node);
62
- const input = getByPlaceholderText('Enter');
63
- fireEvent.change(input, { target: { value: 'reason' } });
64
- const runButton = getByText('Run');
65
- fireEvent.click(runButton);
66
-
67
- await waitFor(() => {
68
- expect(consoleMock).toHaveBeenCalledWith(
69
- 'Submitting... ' +
70
- JSON.stringify({
71
- reason: 'reason',
72
- }),
73
- );
74
- });
75
- });
76
-
77
- it('Should have the three dots button clicked', async () => {
78
- const user = userEvent.setup();
79
- const alertMock = jest.spyOn(window, 'alert');
80
- const { container } = render(<BotsTableStory />);
81
- const threeDotsButton = container.querySelector(
82
- 'tbody > tr:nth-child(6) > td:last-child button:last-child',
83
- );
84
- fireEvent.click(threeDotsButton as Node);
85
- fireEvent.keyDown(threeDotsButton as Node, {
86
- key: 'ArrowDown',
87
- code: 'ArrowDown',
88
- });
89
- await user.keyboard('{ArrowDown}');
90
- await user.keyboard('{Enter}');
91
- expect(alertMock).toHaveBeenCalledWith('action copy');
92
- });
93
- });
94
-
95
- describe('BotsTable: NoControlOrdersStory', () => {
96
- it('Should be correctly rendered', () => {
97
- const { getAllByText } = render(<NoControlOrdersStory />);
98
-
99
- getAllByText('Yevgen 2');
100
- getAllByText('bot1');
101
- getAllByText('New Run - 12/8/2023');
102
- getAllByText('1A2B3C');
103
- getAllByText('Active');
104
- getAllByText('Less than minute ago');
105
- getAllByText('BTC/TUSD');
106
- getAllByText('0.003 BTC');
107
- });
108
-
109
- it('Should have the three dots button clicked', async () => {
110
- const user = userEvent.setup();
111
- const alertMock = jest.spyOn(window, 'alert');
112
- const { container } = render(<NoControlOrdersStory />);
113
- const threeDotsButton = container.querySelector(
114
- 'tbody > tr:nth-child(6) > td:last-child button:last-child',
115
- );
116
- fireEvent.click(threeDotsButton as Node);
117
- fireEvent.keyDown(threeDotsButton as Node, {
118
- key: 'ArrowDown',
119
- code: 'ArrowDown',
120
- });
121
- await user.keyboard('{ArrowDown}');
122
- await user.keyboard('{Enter}');
123
- expect(alertMock).toHaveBeenCalledWith('action liquidate');
124
- });
125
- });
@@ -1,32 +0,0 @@
1
- import { Children, cloneElement, isValidElement } from 'react';
2
- import { TableBody } from '@ssa-ui-kit/core';
3
- import { BotsTableProps } from './types';
4
- import {
5
- BotsTableWrapper,
6
- BotsTableCell,
7
- BotsTableHead,
8
- BotsTableRow,
9
- } from '.';
10
-
11
- export const BotsTable = ({ children, columns, className }: BotsTableProps) => (
12
- <BotsTableWrapper className={className}>
13
- <BotsTableHead>
14
- <BotsTableRow>
15
- {columns.map((columnName) => (
16
- <BotsTableCell key={`column-${columnName.toLowerCase()}`}>
17
- {columnName}
18
- </BotsTableCell>
19
- ))}
20
- </BotsTableRow>
21
- </BotsTableHead>
22
- <TableBody>
23
- {Children.map(children, (child) => {
24
- if (isValidElement(child)) {
25
- return cloneElement(child, {
26
- key: child.props.id,
27
- });
28
- }
29
- })}
30
- </TableBody>
31
- </BotsTableWrapper>
32
- );
@@ -1,13 +0,0 @@
1
- import styled from '@emotion/styled';
2
- import { TableCell } from '@ssa-ui-kit/core';
3
-
4
- export const BotsTableCell = styled(TableCell)`
5
- border: none;
6
- padding: 0 16px;
7
- background: #fff;
8
- font-size: 12px;
9
- font-weight: 500;
10
- ${({ theme }) => theme.mediaQueries.lg} {
11
- font-size: 14px;
12
- }
13
- `;
@@ -1,13 +0,0 @@
1
- import styled from '@emotion/styled';
2
- import { TableHead } from '@ssa-ui-kit/core';
3
-
4
- export const BotsTableHead = styled(TableHead)`
5
- background: none;
6
- font-size: 12px;
7
- ${({ theme }) => theme.mediaQueries.lg} {
8
- font-size: 14px;
9
- }
10
- & tr td:first-of-type {
11
- padding-left: 16px;
12
- }
13
- `;
@@ -1,17 +0,0 @@
1
- import styled from '@emotion/styled';
2
- import { TableRow } from '@ssa-ui-kit/core';
3
-
4
- export const BotsTableRow = styled(TableRow)<{ isDisabled?: boolean }>`
5
- border: none;
6
- padding: 0 16px;
7
- height: 44px;
8
- ${({ isDisabled }) =>
9
- isDisabled && {
10
- opacity: 0.6,
11
- cursor: 'default',
12
- userSelect: 'none',
13
- }}
14
- & tr:first-of-type {
15
- padding-left: 18px;
16
- }
17
- `;
@@ -1,23 +0,0 @@
1
- import styled from '@emotion/styled';
2
- import { Table } from '@ssa-ui-kit/core';
3
-
4
- export const BotsTableWrapper = styled(Table)`
5
- background: none;
6
- & thead td:first-of-type {
7
- border-top-left-radius: 20px;
8
- }
9
- & thead td:last-child {
10
- border-top-right-radius: 20px;
11
- }
12
- & tbody tr:last-child td:first-of-type {
13
- border-bottom-left-radius: 20px;
14
- }
15
- & tbody tr:last-child td:last-child {
16
- border-bottom-right-radius: 20px;
17
- }
18
- & tbody tr:not([aria-disabled='true']):hover {
19
- & td {
20
- background-color: #eef1f7;
21
- }
22
- }
23
- `;
@@ -1,5 +0,0 @@
1
- export * from './BotsTableWrapper';
2
- export * from './BotsTable';
3
- export * from './BotsTableCell';
4
- export * from './BotsTableHead';
5
- export * from './BotsTableRow';
@@ -1,59 +0,0 @@
1
- import { Wrapper } from '@ssa-ui-kit/core';
2
- import { BotsTable, BotsTableCell, BotsTableRow } from '@components/BotsTable';
3
- import { BotsTableItem } from '@components/BotsTable/types';
4
- import { Exchange, PNL, ROI, Trade, Actions } from './components';
5
- import { botsTableData } from './mockData';
6
-
7
- export const BotsTableStory = () => {
8
- const handleRowClick = (row: BotsTableItem) => () => {
9
- alert(JSON.stringify(row));
10
- };
11
-
12
- const columns = [
13
- 'Name',
14
- 'Creation Date',
15
- 'Exchange',
16
- 'Status',
17
- 'Pair',
18
- 'PNL',
19
- 'ROI',
20
- '',
21
- ];
22
-
23
- return (
24
- <Wrapper
25
- css={{
26
- width: '100%',
27
- height: '100%',
28
- }}>
29
- <BotsTable columns={columns}>
30
- {botsTableData.map((item) => (
31
- <BotsTableRow
32
- aria-disabled={item.isDisabled}
33
- key={item.id}
34
- isDisabled={item.isDisabled}
35
- onClick={item.isDisabled ? undefined : handleRowClick(item)}>
36
- <BotsTableCell>{item.name}</BotsTableCell>
37
- <BotsTableCell>{item.creationDate}</BotsTableCell>
38
- <BotsTableCell>
39
- <Exchange exchangeType={item.exchange} />
40
- </BotsTableCell>
41
- <BotsTableCell>
42
- <Trade tradeType={item.status} />
43
- </BotsTableCell>
44
- <BotsTableCell>{item.pair}</BotsTableCell>
45
- <BotsTableCell>
46
- <PNL {...item.pnl} />
47
- </BotsTableCell>
48
- <BotsTableCell>
49
- <ROI {...item.roi} />
50
- </BotsTableCell>
51
- <BotsTableCell>
52
- <Actions row={item} />
53
- </BotsTableCell>
54
- </BotsTableRow>
55
- ))}
56
- </BotsTable>
57
- </Wrapper>
58
- );
59
- };
@@ -1,11 +0,0 @@
1
- import { useTheme } from '@emotion/react';
2
- import { Icon } from '@ssa-ui-kit/core';
3
-
4
- export const ActionIcon = ({
5
- name,
6
- }: {
7
- name: Parameters<typeof Icon>[0]['name'];
8
- }) => {
9
- const theme = useTheme();
10
- return <Icon name={name} size={15} color={theme.colors.greyFilterIcon} />;
11
- };
@@ -1,40 +0,0 @@
1
- import { Button } from '@ssa-ui-kit/core';
2
-
3
- export const ActionItem = ({
4
- children,
5
- ...rest
6
- }: Parameters<typeof Button>[0]) => (
7
- <Button
8
- css={{
9
- background: 'none',
10
- padding: '5px 10px',
11
- color: '#2b2d31',
12
- fontWeight: 500,
13
- fontSize: 14,
14
- gap: 0,
15
- width: '100%',
16
- height: 'auto',
17
- borderRadius: 0,
18
- textIndent: 10,
19
- '&:fist-child': {
20
- paddingTop: 10,
21
- },
22
- '&:last-child': {
23
- paddingBottom: 10,
24
- },
25
- '&:hover,&:active,&:focus': {
26
- background: 'none',
27
- boxShadow: 'none',
28
- },
29
- '&:hover,&:active': {
30
- background: '#eef1f7',
31
- },
32
- '&:hover svg path': {
33
- background: 'none',
34
- fill: '#2b2d31',
35
- },
36
- }}
37
- {...rest}>
38
- {children}
39
- </Button>
40
- );
@@ -1,89 +0,0 @@
1
- import { MouseEventHandler, useState } from 'react';
2
- import { useTheme } from '@emotion/react';
3
- import {
4
- Icon,
5
- Popover,
6
- PopoverContent,
7
- PopoverDescription,
8
- PopoverTrigger,
9
- } from '@ssa-ui-kit/core';
10
- import { BotsTableItem } from '@components/BotsTable/types';
11
- import { ActionItem } from './ActionItem';
12
- import { ActionsWrapper } from './ActionsWrapper';
13
-
14
- export const ActionMore = ({ row: { isDisabled } }: { row: BotsTableItem }) => {
15
- const theme = useTheme();
16
- const [open, setOpen] = useState(false);
17
-
18
- const onOpenChange = (open: boolean) => {
19
- setOpen(open);
20
- };
21
- const actionMoreHandler: MouseEventHandler<HTMLElement> = (event) => {
22
- event.stopPropagation();
23
- };
24
-
25
- const actionHandler =
26
- (actionName: string): MouseEventHandler<HTMLElement> =>
27
- (event) => {
28
- event.stopPropagation();
29
- alert(`action ${actionName}`);
30
- setOpen(false);
31
- };
32
-
33
- return (
34
- <Popover
35
- floatingOptions={{
36
- onOpenChange,
37
- open,
38
- }}
39
- placement="top-start">
40
- <PopoverTrigger
41
- variant="custom"
42
- isDisabled={isDisabled}
43
- dataTestId="more-trigger-button"
44
- css={{
45
- marginLeft: 10,
46
- padding: '0 10px',
47
- cursor: isDisabled ? 'default' : 'pointer',
48
- backgroundColor: 'unset',
49
- }}
50
- startIcon={
51
- <Icon
52
- name="more-vertical"
53
- size={15}
54
- color={theme.colors.greyDropdownFocused}
55
- />
56
- }
57
- onClick={actionMoreHandler}
58
- />
59
- <PopoverContent>
60
- <PopoverDescription>
61
- <ActionsWrapper>
62
- <ActionItem
63
- startIcon={
64
- <Icon
65
- name="copy"
66
- size={15}
67
- color={theme.colors.greyFilterIcon}
68
- />
69
- }
70
- onClick={actionHandler('copy')}>
71
- Copy
72
- </ActionItem>
73
- <ActionItem
74
- startIcon={
75
- <Icon
76
- name="archive"
77
- size={15}
78
- color={theme.colors.greyFilterIcon}
79
- />
80
- }
81
- onClick={actionHandler('archive')}>
82
- Archive
83
- </ActionItem>
84
- </ActionsWrapper>
85
- </PopoverDescription>
86
- </PopoverContent>
87
- </Popover>
88
- );
89
- };
@@ -1,133 +0,0 @@
1
- import { MouseEventHandler, useEffect, useState } from 'react';
2
- import { useForm, FieldValues } from 'react-hook-form';
3
- import {
4
- Button,
5
- Input,
6
- Popover,
7
- PopoverContent,
8
- PopoverDescription,
9
- PopoverTrigger,
10
- Typography,
11
- Wrapper,
12
- } from '@ssa-ui-kit/core';
13
- import { BotsTableItem } from '@components/BotsTable/types';
14
- import { actionsIcons } from './consts';
15
-
16
- export const ActionRun = ({ row }: { row: BotsTableItem }) => {
17
- const { status, isDisabled } = row;
18
- const ActionIcon = actionsIcons[status];
19
-
20
- const [open, setOpen] = useState(false);
21
- const { register, handleSubmit, resetField } = useForm<FieldValues>();
22
-
23
- const onOpenChange = (open: boolean) => {
24
- if (['pending', 'liquidation'].includes(status)) {
25
- setOpen(open);
26
- }
27
- };
28
- const actionRunHandler: MouseEventHandler<HTMLElement> = (event) => {
29
- event.stopPropagation();
30
- };
31
- useEffect(() => {
32
- return () => {
33
- resetField('reason');
34
- };
35
- }, []);
36
-
37
- return (
38
- <Popover
39
- floatingOptions={{
40
- onOpenChange,
41
- open,
42
- }}
43
- placement="top-start">
44
- <PopoverTrigger
45
- variant="custom"
46
- isDisabled={isDisabled}
47
- dataTestId="run-reason-trigger-button"
48
- css={{
49
- marginLeft: 10,
50
- padding: '0 10px',
51
- cursor: isDisabled ? 'default' : 'pointer',
52
- backgroundColor: 'unset',
53
- '& > span': {
54
- height: '100%',
55
- alignItems: 'center',
56
- },
57
- }}
58
- startIcon={<ActionIcon />}
59
- onClick={actionRunHandler}
60
- />
61
- <PopoverContent>
62
- <PopoverDescription>
63
- <Wrapper
64
- css={{
65
- width: 307,
66
- height: 85,
67
- borderRadius: 6,
68
- padding: 10,
69
- background: '#fff',
70
- boxShadow: '0px 4px 10px 0px rgba(0, 0, 0, 0.10)',
71
- }}
72
- onClick={(event) => event.stopPropagation()}>
73
- <form
74
- onSubmit={(event) => {
75
- event.stopPropagation();
76
- handleSubmit((data) => {
77
- alert('Submitting... ' + JSON.stringify(data));
78
- console.log('Submitting... ' + JSON.stringify(data));
79
- })(event);
80
- setOpen(false);
81
- resetField('reason');
82
- }}>
83
- <Typography
84
- variant="h6"
85
- css={{
86
- marginBottom: 6,
87
- lineHeight: '18px',
88
- textIndent: 4,
89
- }}>
90
- Run Reason
91
- </Typography>
92
- <Wrapper
93
- css={{
94
- gap: 7,
95
- }}>
96
- <Input
97
- name="reason"
98
- register={register}
99
- placeholder="Enter"
100
- css={{
101
- borderRadius: 6,
102
- '&:hover': {
103
- margin: '-0.4px',
104
- },
105
- '&:focus': {
106
- margin: '-1px',
107
- },
108
- }}
109
- />
110
- <Button
111
- variant="info"
112
- type="submit"
113
- css={{
114
- width: 90,
115
- height: 40,
116
- padding: '0 14px',
117
- borderRadius: 6,
118
- fontSize: 14,
119
- fontWeight: 700,
120
- justifyContent: 'center',
121
- background:
122
- 'linear-gradient(247deg, #7599DE 14.71%, #4178E1 85.29%)',
123
- }}>
124
- Run
125
- </Button>
126
- </Wrapper>
127
- </form>
128
- </Wrapper>
129
- </PopoverDescription>
130
- </PopoverContent>
131
- </Popover>
132
- );
133
- };
@@ -1,13 +0,0 @@
1
- import { Wrapper } from '@ssa-ui-kit/core';
2
- import { BotsTableItem } from '@components/BotsTable/types';
3
- import { ActionMore } from './ActionMore';
4
- import { ActionRun } from './ActionRun';
5
-
6
- export const Actions = ({ row }: { row: BotsTableItem }) => {
7
- return (
8
- <Wrapper>
9
- <ActionRun row={row} />
10
- <ActionMore row={row} />
11
- </Wrapper>
12
- );
13
- };
@@ -1,21 +0,0 @@
1
- import { Wrapper } from '@ssa-ui-kit/core';
2
-
3
- export const ActionsWrapper = ({
4
- children,
5
- ...rest
6
- }: Parameters<typeof Wrapper>[0]) => (
7
- <Wrapper
8
- direction="column"
9
- alignItems="flex-start"
10
- css={{
11
- background: '#fff',
12
- width: 140,
13
- color: '#2b2d31',
14
- fontWeight: 500,
15
- borderRadius: 5,
16
- boxShadow: '0px 4px 8px 0px rgba(0, 0, 0, 0.25)',
17
- }}
18
- {...rest}>
19
- {children}
20
- </Wrapper>
21
- );