@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.
- package/dist/components/AccountBalance/AccountBalance.d.ts +1 -1
- package/dist/components/AccountBalance/BalancePieChart.d.ts +1 -1
- package/dist/components/AccountBalance/BalancePieChartTitle.d.ts +1 -1
- package/dist/components/AccountKeys/AccountKeys.d.ts +1 -1
- package/dist/components/AccountKeys/stories/StoryComponent.d.ts +1 -1
- package/dist/components/Activity/Activity.d.ts +1 -1
- package/dist/components/Activity/ActivityItem.d.ts +1 -1
- package/dist/components/Bmi/Bmi.d.ts +1 -1
- package/dist/components/Bmi/BmiLabels.d.ts +1 -1
- package/dist/components/BotsTable/BotsTable.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/StoryComponent.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionIcon.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionItem.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionMore.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionRun.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/Actions.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionsWrapper.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/consts.d.ts +3 -3
- package/dist/components/BotsTable/stories/BotsTable/components/Exchange/Exchange.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Exchange/consts.d.ts +3 -3
- package/dist/components/BotsTable/stories/BotsTable/components/PNL.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/ROI.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/TableTag.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Trade/Trade.d.ts +1 -1
- package/dist/components/BotsTable/stories/NoControlOrders/StoryComponent.d.ts +1 -1
- package/dist/components/BotsTable/stories/NoControlOrders/components/ActionMore.d.ts +1 -1
- package/dist/components/BotsTable/stories/NoControlOrders/components/Reason.d.ts +1 -1
- package/dist/components/BotsTable/stories/NoControlOrders/components/TableList.d.ts +1 -1
- package/dist/components/BotsTable/stories/NoControlOrders/components/TableRow.d.ts +1 -1
- package/dist/components/Calories/Calories.d.ts +1 -1
- package/dist/components/Calories/innerContent.d.ts +1 -1
- package/dist/components/ExchangeAccount/ExchangeAccount.d.ts +1 -1
- package/dist/components/HeartRate/BPM.d.ts +1 -1
- package/dist/components/HeartRate/HeartRate.d.ts +1 -1
- package/dist/components/HeartRate/HeartRateLineChart.d.ts +1 -1
- package/dist/components/ListGoals/ListGoals.d.ts +1 -1
- package/dist/components/ListGoals/ListGoalsCard.d.ts +1 -1
- package/dist/components/MealNutrients/MealNutrients.d.ts +1 -1
- package/dist/components/MealNutrients/MealNutrientsLineChart.d.ts +1 -1
- package/dist/components/MealNutrients/MealNutrientsTooltip.d.ts +1 -1
- package/dist/components/MealPlanner/MealPlanner.d.ts +1 -1
- package/dist/components/MealPlanner/MealPlannerCard.d.ts +1 -1
- package/dist/components/StepsCounter/StepsCounter.d.ts +1 -1
- package/dist/components/TradingInfoCard/TradingInfoCard.d.ts +1 -1
- package/dist/components/TradingInfoCard/TradingInfoCardContent.d.ts +1 -1
- package/dist/components/TradingInfoCard/TradingInfoCardTooltip.d.ts +1 -1
- package/dist/components/TradingInfoCard/TradingInfoCardWrapper.d.ts +1 -1
- package/dist/components/TradingScoreboard/TradingScoreboard.d.ts +1 -1
- package/dist/components/TradingScoreboard/helpers.d.ts +4 -4
- package/dist/components/UpcomingWorkouts/UpcomingWorkoutCard.d.ts +1 -1
- package/dist/components/UpcomingWorkouts/UpcomingWorkouts.d.ts +1 -1
- package/dist/components/UserCard/UserCard.d.ts +1 -1
- package/dist/components/UserCard/UserCardBMI.d.ts +1 -1
- package/dist/components/UserCard/UserCardCredentials.d.ts +1 -1
- package/dist/components/UserCard/UserCardItem.d.ts +1 -1
- package/dist/components/WaterConsume/WaterConsume.d.ts +1 -1
- package/dist/index.js +2439 -1
- package/dist/index.js.map +1 -1
- package/package.json +24 -27
- package/.babelrc.js +0 -4
- package/.env +0 -7
- package/.storybook/main.ts +0 -47
- package/.storybook/preview.tsx +0 -22
- package/.storybook/style.css +0 -40
- package/custom-shots/widgets-bots-table--no-control-orders--menu-opened_[w1920px].png +0 -0
- package/custom-shots/widgets-bots-table--no-control-orders--run-reason-modal_[w1920px].png +0 -0
- package/custom-shots/widgets-heart-rate--hint-opened__[w1440px].png +0 -0
- package/custom-shots/widgets-heart-rate--hint-opened__[w1920px].png +0 -0
- package/custom-shots/widgets-heart-rate--hint-opened__[w390px].png +0 -0
- package/custom-shots/widgets-heart-rate--hint-opened__[w900px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w1440px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w1920px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w390px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w900px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w1440px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w1920px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w390px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w900px].png +0 -0
- package/custom-shots/widgets-trading-info-card--hover__[w1920px].png +0 -0
- package/customTest.tsx +0 -35
- package/jest-setup.ts +0 -20
- package/lostpixel.config.ts +0 -29
- package/playwright.config.ts +0 -7
- package/src/components/AccountBalance/AccountBalance.specBackup.tsx +0 -105
- package/src/components/AccountBalance/AccountBalance.stories.tsx +0 -138
- package/src/components/AccountBalance/AccountBalance.tsx +0 -60
- package/src/components/AccountBalance/BalancePieChart.tsx +0 -127
- package/src/components/AccountBalance/BalancePieChartTitle.tsx +0 -54
- package/src/components/AccountBalance/index.ts +0 -4
- package/src/components/AccountBalance/stories/fixtures.ts +0 -26
- package/src/components/AccountBalance/types.ts +0 -41
- package/src/components/AccountKeys/AccountKeys.specBackup.tsx +0 -43
- package/src/components/AccountKeys/AccountKeys.stories.tsx +0 -14
- package/src/components/AccountKeys/AccountKeys.tsx +0 -73
- package/src/components/AccountKeys/helpers.ts +0 -7
- package/src/components/AccountKeys/index.ts +0 -2
- package/src/components/AccountKeys/stories/StoryComponent.tsx +0 -33
- package/src/components/AccountKeys/styles.ts +0 -87
- package/src/components/AccountKeys/types.ts +0 -8
- package/src/components/Activity/Activity.specBackup.tsx +0 -79
- package/src/components/Activity/Activity.stories.tsx +0 -15
- package/src/components/Activity/Activity.tsx +0 -83
- package/src/components/Activity/ActivityItem.tsx +0 -38
- package/src/components/Activity/index.tsx +0 -2
- package/src/components/Activity/mockActivityRequest.ts +0 -106
- package/src/components/Activity/styles.ts +0 -12
- package/src/components/Activity/types.ts +0 -10
- package/src/components/Bmi/Bmi.spec.Backup.tsx +0 -68
- package/src/components/Bmi/Bmi.stories.tsx +0 -10
- package/src/components/Bmi/Bmi.tsx +0 -96
- package/src/components/Bmi/BmiHeatbar.tsx +0 -18
- package/src/components/Bmi/BmiInfo.tsx +0 -11
- package/src/components/Bmi/BmiLabel.tsx +0 -9
- package/src/components/Bmi/BmiLabels.tsx +0 -33
- package/src/components/Bmi/BmiPointer.tsx +0 -15
- package/src/components/Bmi/index.tsx +0 -2
- package/src/components/Bmi/styles.ts +0 -18
- package/src/components/Bmi/types.ts +0 -4
- package/src/components/BotsTable/BotsTable.e2e.ts +0 -77
- package/src/components/BotsTable/BotsTable.specBackup.tsx +0 -125
- package/src/components/BotsTable/BotsTable.tsx +0 -32
- package/src/components/BotsTable/BotsTableCell.tsx +0 -13
- package/src/components/BotsTable/BotsTableHead.tsx +0 -13
- package/src/components/BotsTable/BotsTableRow.tsx +0 -17
- package/src/components/BotsTable/BotsTableWrapper.tsx +0 -23
- package/src/components/BotsTable/index.ts +0 -5
- package/src/components/BotsTable/stories/BotsTable/StoryComponent.tsx +0 -59
- package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionIcon.tsx +0 -11
- package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionItem.tsx +0 -40
- package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionMore.tsx +0 -89
- package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionRun.tsx +0 -133
- package/src/components/BotsTable/stories/BotsTable/components/Actions/Actions.tsx +0 -13
- package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionsWrapper.tsx +0 -21
- package/src/components/BotsTable/stories/BotsTable/components/Actions/consts.tsx +0 -118
- package/src/components/BotsTable/stories/BotsTable/components/Actions/index.ts +0 -6
- package/src/components/BotsTable/stories/BotsTable/components/Exchange/Exchange.tsx +0 -26
- package/src/components/BotsTable/stories/BotsTable/components/Exchange/consts.tsx +0 -157
- package/src/components/BotsTable/stories/BotsTable/components/Exchange/index.ts +0 -1
- package/src/components/BotsTable/stories/BotsTable/components/Exchange/types.ts +0 -6
- package/src/components/BotsTable/stories/BotsTable/components/PNL.tsx +0 -27
- package/src/components/BotsTable/stories/BotsTable/components/ROI.tsx +0 -25
- package/src/components/BotsTable/stories/BotsTable/components/TableTag.tsx +0 -22
- package/src/components/BotsTable/stories/BotsTable/components/Trade/Trade.tsx +0 -8
- package/src/components/BotsTable/stories/BotsTable/components/Trade/consts.ts +0 -14
- package/src/components/BotsTable/stories/BotsTable/components/Trade/index.ts +0 -1
- package/src/components/BotsTable/stories/BotsTable/components/Trade/types.ts +0 -5
- package/src/components/BotsTable/stories/BotsTable/components/index.ts +0 -6
- package/src/components/BotsTable/stories/BotsTable/index.ts +0 -1
- package/src/components/BotsTable/stories/BotsTable/mockData.ts +0 -84
- package/src/components/BotsTable/stories/BotsTable.stories.tsx +0 -39
- package/src/components/BotsTable/stories/NoControlOrders/StoryComponent.tsx +0 -35
- package/src/components/BotsTable/stories/NoControlOrders/components/ActionMore.tsx +0 -95
- package/src/components/BotsTable/stories/NoControlOrders/components/Reason.tsx +0 -11
- package/src/components/BotsTable/stories/NoControlOrders/components/TableList.tsx +0 -45
- package/src/components/BotsTable/stories/NoControlOrders/components/TableRow.tsx +0 -31
- package/src/components/BotsTable/stories/NoControlOrders/components/index.ts +0 -4
- package/src/components/BotsTable/stories/NoControlOrders/mockData.ts +0 -23
- package/src/components/BotsTable/stories/NoControlOrders/types.ts +0 -16
- package/src/components/BotsTable/types.ts +0 -31
- package/src/components/Calories/Calories.specBackup.tsx +0 -11
- package/src/components/Calories/Calories.stories.tsx +0 -26
- package/src/components/Calories/Calories.tsx +0 -54
- package/src/components/Calories/index.tsx +0 -2
- package/src/components/Calories/innerContent.tsx +0 -30
- package/src/components/Calories/types.ts +0 -4
- package/src/components/ExchangeAccount/ExchangeAccount.specBackup.tsx +0 -104
- package/src/components/ExchangeAccount/ExchangeAccount.stories.tsx +0 -108
- package/src/components/ExchangeAccount/ExchangeAccount.tsx +0 -90
- package/src/components/ExchangeAccount/helpers.tsx +0 -153
- package/src/components/ExchangeAccount/index.ts +0 -2
- package/src/components/ExchangeAccount/styles.ts +0 -115
- package/src/components/ExchangeAccount/types.ts +0 -14
- package/src/components/HeartRate/BPM.tsx +0 -43
- package/src/components/HeartRate/HeartRate.e2e.ts +0 -78
- package/src/components/HeartRate/HeartRate.specBackup.tsx +0 -91
- package/src/components/HeartRate/HeartRate.stories.tsx +0 -36
- package/src/components/HeartRate/HeartRate.tsx +0 -105
- package/src/components/HeartRate/HeartRateLineChart.tsx +0 -53
- package/src/components/HeartRate/index.ts +0 -2
- package/src/components/HeartRate/mockHeartRateRequest.ts +0 -15
- package/src/components/HeartRate/types.ts +0 -15
- package/src/components/HeartRate/utils.tsx +0 -8
- package/src/components/ListGoals/ListGoals.specBackup.tsx +0 -82
- package/src/components/ListGoals/ListGoals.stories.tsx +0 -58
- package/src/components/ListGoals/ListGoals.tsx +0 -29
- package/src/components/ListGoals/ListGoalsCard.tsx +0 -61
- package/src/components/ListGoals/index.ts +0 -2
- package/src/components/ListGoals/styles.tsx +0 -11
- package/src/components/ListGoals/types.ts +0 -25
- package/src/components/MealNutrients/MealNutrients.e2e.ts +0 -68
- package/src/components/MealNutrients/MealNutrients.specBackup.tsx +0 -134
- package/src/components/MealNutrients/MealNutrients.stories.tsx +0 -37
- package/src/components/MealNutrients/MealNutrients.tsx +0 -84
- package/src/components/MealNutrients/MealNutrientsLineChart.tsx +0 -89
- package/src/components/MealNutrients/MealNutrientsTooltip.tsx +0 -30
- package/src/components/MealNutrients/chartDefaultConfig.tsx +0 -87
- package/src/components/MealNutrients/index.tsx +0 -2
- package/src/components/MealNutrients/mockMealNutrientsRequest.ts +0 -1246
- package/src/components/MealNutrients/types.ts +0 -37
- package/src/components/MealNutrients/useChartConfig.ts +0 -69
- package/src/components/MealPlanner/MealPlanner.specBackup.tsx +0 -77
- package/src/components/MealPlanner/MealPlanner.stories.tsx +0 -15
- package/src/components/MealPlanner/MealPlanner.tsx +0 -100
- package/src/components/MealPlanner/MealPlannerBadge.tsx +0 -15
- package/src/components/MealPlanner/MealPlannerBars.tsx +0 -19
- package/src/components/MealPlanner/MealPlannerCard.tsx +0 -73
- package/src/components/MealPlanner/MealPlannerLegends.tsx +0 -22
- package/src/components/MealPlanner/index.ts +0 -2
- package/src/components/MealPlanner/mockMealPlannerRequest.ts +0 -70
- package/src/components/MealPlanner/types.ts +0 -21
- package/src/components/StepsCounter/StepsCounter.specBackup.tsx +0 -14
- package/src/components/StepsCounter/StepsCounter.stories.tsx +0 -16
- package/src/components/StepsCounter/StepsCounter.tsx +0 -74
- package/src/components/StepsCounter/index.ts +0 -2
- package/src/components/StepsCounter/types.ts +0 -4
- package/src/components/TradingInfoCard/TradingInfoCard.e2e.ts +0 -18
- package/src/components/TradingInfoCard/TradingInfoCard.specBackup.tsx +0 -116
- package/src/components/TradingInfoCard/TradingInfoCard.stories.tsx +0 -118
- package/src/components/TradingInfoCard/TradingInfoCard.tsx +0 -49
- package/src/components/TradingInfoCard/TradingInfoCardContent.tsx +0 -32
- package/src/components/TradingInfoCard/TradingInfoCardTooltip.tsx +0 -47
- package/src/components/TradingInfoCard/TradingInfoCardWrapper.tsx +0 -72
- package/src/components/TradingInfoCard/index.ts +0 -3
- package/src/components/TradingInfoCard/types.ts +0 -27
- package/src/components/TradingScoreboard/TradingScoreboard.specBackup.tsx +0 -119
- package/src/components/TradingScoreboard/TradingScoreboard.stories.tsx +0 -119
- package/src/components/TradingScoreboard/TradingScoreboard.tsx +0 -41
- package/src/components/TradingScoreboard/TradingScoreboardBase.tsx +0 -17
- package/src/components/TradingScoreboard/helpers.tsx +0 -134
- package/src/components/TradingScoreboard/index.ts +0 -2
- package/src/components/TradingScoreboard/types.ts +0 -18
- package/src/components/UpcomingWorkouts/UpcomingWorkoutCard.tsx +0 -64
- package/src/components/UpcomingWorkouts/UpcomingWorkouts.specBackup.tsx +0 -56
- package/src/components/UpcomingWorkouts/UpcomingWorkouts.stories.tsx +0 -32
- package/src/components/UpcomingWorkouts/UpcomingWorkouts.tsx +0 -27
- package/src/components/UpcomingWorkouts/index.ts +0 -2
- package/src/components/UpcomingWorkouts/style.ts +0 -12
- package/src/components/UpcomingWorkouts/types.ts +0 -23
- package/src/components/UserCard/UserCard.tsx +0 -46
- package/src/components/UserCard/UserCardBMI.tsx +0 -37
- package/src/components/UserCard/UserCardCredentials.tsx +0 -56
- package/src/components/UserCard/UserCardItem.tsx +0 -42
- package/src/components/UserCard/index.tsx +0 -2
- package/src/components/UserCard/types.ts +0 -8
- package/src/components/WaterConsume/WaterConsume.specBackup.tsx +0 -62
- package/src/components/WaterConsume/WaterConsume.stories.tsx +0 -36
- package/src/components/WaterConsume/WaterConsume.tsx +0 -188
- package/src/components/WaterConsume/index.ts +0 -2
- package/src/components/WaterConsume/types.ts +0 -11
- package/src/consts.ts +0 -18
- package/src/index.ts +0 -36
- package/src/injectGlobal.ts +0 -41
- package/test-results/.last-run.json +0 -21
- package/tsbuildcache +0 -1
- package/tsconfig.build.json +0 -44
- package/tsconfig.json +0 -17
- package/webpack.config.js +0 -28
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
import type { Meta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import { MealNutrients } from './index';
|
|
5
|
-
import { MealNutrientsProps } from './types';
|
|
6
|
-
|
|
7
|
-
import { mockStaticApi } from './mockMealNutrientsRequest';
|
|
8
|
-
const { getData, getOptions } = mockStaticApi;
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
title: 'Fitness/MealNutrients',
|
|
12
|
-
component: MealNutrients,
|
|
13
|
-
} as Meta<typeof MealNutrients>;
|
|
14
|
-
|
|
15
|
-
export const Default = () => {
|
|
16
|
-
const [options, setOptions] = useState<MealNutrientsProps['options']>([]);
|
|
17
|
-
const [data, setData] = useState<MealNutrientsProps['data']>([]);
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
getOptions()
|
|
21
|
-
.then((respOptions) => {
|
|
22
|
-
setOptions(respOptions);
|
|
23
|
-
return getData(respOptions[0].value);
|
|
24
|
-
})
|
|
25
|
-
.then(setData);
|
|
26
|
-
}, []);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<MealNutrients
|
|
30
|
-
data={data}
|
|
31
|
-
options={options}
|
|
32
|
-
onOptionChange={({ value }) => {
|
|
33
|
-
getData(String(value) as 'd' | 'w' | 'm').then(setData);
|
|
34
|
-
}}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, useRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Card,
|
|
5
|
-
CardContent,
|
|
6
|
-
CardHeader,
|
|
7
|
-
Typography,
|
|
8
|
-
Dropdown,
|
|
9
|
-
DropdownOption,
|
|
10
|
-
} from '@ssa-ui-kit/core';
|
|
11
|
-
|
|
12
|
-
import { MealNutrientsLineChart } from './MealNutrientsLineChart';
|
|
13
|
-
import useChartConfig from './useChartConfig';
|
|
14
|
-
import { MealNutrientsProps, UseChartConfig, OptionType } from './types';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* UI Component that shows the nutrients consumed by the user
|
|
19
|
-
*/
|
|
20
|
-
export const MealNutrients = ({
|
|
21
|
-
caption = 'Meal Nutrients',
|
|
22
|
-
options,
|
|
23
|
-
data,
|
|
24
|
-
onOptionChange,
|
|
25
|
-
}: MealNutrientsProps) => {
|
|
26
|
-
const [selectedOption, setSelectedOption] = useState<OptionType>();
|
|
27
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
28
|
-
|
|
29
|
-
const chartConfig = useChartConfig(
|
|
30
|
-
containerRef,
|
|
31
|
-
data,
|
|
32
|
-
selectedOption?.precision as Parameters<UseChartConfig>[2],
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (options?.length > 0 && selectedOption == null) {
|
|
37
|
-
handleChange(options[0]);
|
|
38
|
-
}
|
|
39
|
-
}, [options]);
|
|
40
|
-
|
|
41
|
-
const handleChange = (e: OptionType) => {
|
|
42
|
-
const item = options.filter((item) => item.value === e.value)[0];
|
|
43
|
-
|
|
44
|
-
setSelectedOption(item);
|
|
45
|
-
onOptionChange && onOptionChange(item);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div ref={containerRef}>
|
|
50
|
-
<CardHeader transparent>
|
|
51
|
-
<Typography variant="h4" weight="bold" css={{ lineHeight: 'normal' }}>
|
|
52
|
-
{caption}
|
|
53
|
-
</Typography>
|
|
54
|
-
|
|
55
|
-
{options?.length > 0 && (
|
|
56
|
-
<Dropdown selectedItem={options[0]} onChange={handleChange}>
|
|
57
|
-
{options.map((item) => (
|
|
58
|
-
<DropdownOption
|
|
59
|
-
key={item.value}
|
|
60
|
-
value={item.value}
|
|
61
|
-
label={item.label}
|
|
62
|
-
/>
|
|
63
|
-
))}
|
|
64
|
-
</Dropdown>
|
|
65
|
-
)}
|
|
66
|
-
</CardHeader>
|
|
67
|
-
<Card>
|
|
68
|
-
<CardContent direction="column" css={{ width: '100%' }}>
|
|
69
|
-
<div
|
|
70
|
-
css={{
|
|
71
|
-
height: '227px',
|
|
72
|
-
svg: {
|
|
73
|
-
overflow: 'visible',
|
|
74
|
-
},
|
|
75
|
-
}}>
|
|
76
|
-
{data?.length > 0 && (
|
|
77
|
-
<MealNutrientsLineChart data={data} {...chartConfig} />
|
|
78
|
-
)}
|
|
79
|
-
</div>
|
|
80
|
-
</CardContent>
|
|
81
|
-
</Card>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { ResponsiveLine, LineSvgProps, LineProps } from '@nivo/line';
|
|
3
|
-
import { useTheme } from '@emotion/react';
|
|
4
|
-
import type { ColorsKeys, MainColors } from '@ssa-ui-kit/core';
|
|
5
|
-
|
|
6
|
-
import { defaults } from './chartDefaultConfig';
|
|
7
|
-
import { MealNutrientsTooltip } from './MealNutrientsTooltip';
|
|
8
|
-
|
|
9
|
-
const colorPalette = ['pink', 'purple', 'turquoise', 'yellow', 'green', 'blue'];
|
|
10
|
-
|
|
11
|
-
export const MealNutrientsLineChart = ({ data, ...props }: LineSvgProps) => {
|
|
12
|
-
const theme = useTheme();
|
|
13
|
-
|
|
14
|
-
const defaultColorMapping = useMemo(
|
|
15
|
-
() =>
|
|
16
|
-
colorPalette.reduce<Record<string, keyof MainColors>>(
|
|
17
|
-
(res, colorName) => {
|
|
18
|
-
const colorValue = theme.colors[
|
|
19
|
-
`${colorName}Lighter` as ColorsKeys
|
|
20
|
-
] as string;
|
|
21
|
-
res[colorValue] = colorName as keyof MainColors;
|
|
22
|
-
return res;
|
|
23
|
-
},
|
|
24
|
-
{},
|
|
25
|
-
),
|
|
26
|
-
[theme.colors],
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const defaultSettings = useMemo(
|
|
30
|
-
() =>
|
|
31
|
-
Object.assign<Omit<LineProps, 'data'>, Omit<LineProps, 'data'>>(
|
|
32
|
-
defaults,
|
|
33
|
-
{
|
|
34
|
-
colors: colorPalette.map(
|
|
35
|
-
(color) => theme.colors[`${color}Lighter` as ColorsKeys] as string,
|
|
36
|
-
),
|
|
37
|
-
tooltip: ({ point }) => {
|
|
38
|
-
const color: keyof MainColors = defaultColorMapping[point.color];
|
|
39
|
-
return <MealNutrientsTooltip point={point} colorName={color} />;
|
|
40
|
-
},
|
|
41
|
-
theme: {
|
|
42
|
-
axis: {
|
|
43
|
-
ticks: {
|
|
44
|
-
text: {
|
|
45
|
-
fontSize: '0.833rem',
|
|
46
|
-
fontWeight: 500,
|
|
47
|
-
fill: theme.colors.greyDarker,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
grid: {
|
|
52
|
-
line: {
|
|
53
|
-
stroke: theme.colors.greyLighter,
|
|
54
|
-
strokeWidth: 1,
|
|
55
|
-
strokeDasharray: '8 8',
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
text: {
|
|
59
|
-
fontFamily: "'Manrope', sans-serif",
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
),
|
|
64
|
-
[theme.colors, defaultColorMapping],
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<ResponsiveLine
|
|
69
|
-
data={data}
|
|
70
|
-
curve="catmullRom"
|
|
71
|
-
axisTop={null}
|
|
72
|
-
axisLeft={null}
|
|
73
|
-
enableGridX={false}
|
|
74
|
-
enableGridY={true}
|
|
75
|
-
lineWidth={1}
|
|
76
|
-
enablePoints={true}
|
|
77
|
-
pointSize={8}
|
|
78
|
-
pointBorderWidth={0}
|
|
79
|
-
pointLabelYOffset={-12}
|
|
80
|
-
enableArea={false}
|
|
81
|
-
areaOpacity={0.1}
|
|
82
|
-
enableCrosshair={false}
|
|
83
|
-
useMesh={true}
|
|
84
|
-
animate={false}
|
|
85
|
-
{...defaultSettings}
|
|
86
|
-
{...props}
|
|
87
|
-
/>
|
|
88
|
-
);
|
|
89
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ProgressChartTooltip } from '@ssa-ui-kit/core';
|
|
2
|
-
import type { MapIconsType } from '@ssa-ui-kit/core';
|
|
3
|
-
|
|
4
|
-
import { MealNutrientsTooltipProps } from './types';
|
|
5
|
-
|
|
6
|
-
const capitalize = (str: string) =>
|
|
7
|
-
`${str[0].toUpperCase()}${str.substring(1)}`;
|
|
8
|
-
|
|
9
|
-
export const MealNutrientsTooltip = ({
|
|
10
|
-
colorName,
|
|
11
|
-
point,
|
|
12
|
-
}: MealNutrientsTooltipProps) => {
|
|
13
|
-
const caption = capitalize(String(point.serieId));
|
|
14
|
-
const {
|
|
15
|
-
data: { y, comp, unit },
|
|
16
|
-
} = point;
|
|
17
|
-
const iconName =
|
|
18
|
-
((comp && `arrow-${comp > 0 ? 'up' : 'down'}`) as keyof MapIconsType) ||
|
|
19
|
-
undefined;
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<ProgressChartTooltip
|
|
23
|
-
caption={caption}
|
|
24
|
-
value={y as number}
|
|
25
|
-
valueFormatted={`${comp}${unit}`}
|
|
26
|
-
iconName={iconName}
|
|
27
|
-
barProps={{ color: colorName }}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { LineProps } from '@nivo/line';
|
|
2
|
-
import { DotsItem, useTheme as useNivoTheme } from '@nivo/core';
|
|
3
|
-
|
|
4
|
-
import { dateFormatters } from '@ssa-ui-kit/utils';
|
|
5
|
-
|
|
6
|
-
import { CustomPointLayerProps } from './types';
|
|
7
|
-
|
|
8
|
-
const { formatDayOfWeek } = dateFormatters;
|
|
9
|
-
|
|
10
|
-
const CustomPointLayer = ({
|
|
11
|
-
currentPoint,
|
|
12
|
-
pointSize,
|
|
13
|
-
pointBorderWidth,
|
|
14
|
-
...props
|
|
15
|
-
}: CustomPointLayerProps) => {
|
|
16
|
-
const theme = useNivoTheme();
|
|
17
|
-
|
|
18
|
-
if (!currentPoint) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const point = currentPoint;
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<g>
|
|
26
|
-
<DotsItem
|
|
27
|
-
key={point.id}
|
|
28
|
-
x={point.x}
|
|
29
|
-
y={point.y}
|
|
30
|
-
color={point.color}
|
|
31
|
-
borderColor={point.borderColor}
|
|
32
|
-
datum={point.data}
|
|
33
|
-
theme={theme}
|
|
34
|
-
size={pointSize || 0}
|
|
35
|
-
borderWidth={pointBorderWidth || 0}
|
|
36
|
-
{...props}
|
|
37
|
-
/>
|
|
38
|
-
</g>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const tickValues = [0, 20, 40, 60, 80, 100];
|
|
43
|
-
|
|
44
|
-
export const defaults: Omit<LineProps, 'data'> = {
|
|
45
|
-
margin: { top: 28, right: 50, bottom: 50, left: 5 },
|
|
46
|
-
xScale: { type: 'time', format: '%L', precision: 'day' },
|
|
47
|
-
yScale: {
|
|
48
|
-
type: 'linear',
|
|
49
|
-
min: 'auto',
|
|
50
|
-
max: 'auto',
|
|
51
|
-
stacked: false,
|
|
52
|
-
reverse: false,
|
|
53
|
-
},
|
|
54
|
-
axisRight: {
|
|
55
|
-
tickSize: 0,
|
|
56
|
-
tickPadding: 10,
|
|
57
|
-
tickRotation: 0,
|
|
58
|
-
tickValues,
|
|
59
|
-
format: (tick) => `${tick}%`,
|
|
60
|
-
legend: '',
|
|
61
|
-
legendOffset: 0,
|
|
62
|
-
},
|
|
63
|
-
axisBottom: {
|
|
64
|
-
tickSize: 0,
|
|
65
|
-
tickPadding: 30,
|
|
66
|
-
tickRotation: 0,
|
|
67
|
-
legend: '',
|
|
68
|
-
tickValues: 'every day',
|
|
69
|
-
format: formatDayOfWeek,
|
|
70
|
-
},
|
|
71
|
-
pointColor: { from: 'color', modifiers: [] },
|
|
72
|
-
pointBorderColor: { from: 'color', modifiers: [] },
|
|
73
|
-
legends: [],
|
|
74
|
-
gridYValues: tickValues,
|
|
75
|
-
layers: [
|
|
76
|
-
'grid',
|
|
77
|
-
'markers',
|
|
78
|
-
'axes',
|
|
79
|
-
'areas',
|
|
80
|
-
'crosshair',
|
|
81
|
-
'lines',
|
|
82
|
-
CustomPointLayer,
|
|
83
|
-
'slices',
|
|
84
|
-
'mesh',
|
|
85
|
-
'legends',
|
|
86
|
-
],
|
|
87
|
-
};
|