impaktapps-design 0.2.78 → 0.2.85
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/impaktapps-design.es.js +163 -179
- package/dist/impaktapps-design.es.js.map +1 -0
- package/dist/impaktapps-design.umd.js +11 -10
- package/dist/impaktapps-design.umd.js.map +1 -0
- package/dist/src/component/LineGraph/DrawLineGraph.d.ts +1 -1
- package/dist/src/utils/finalDataProvider.d.ts +1 -4
- package/dist/style.css +1 -1
- package/package.json +4 -1
- package/src/component/BottomAxis.tsx +1 -8
- package/src/component/Legend.tsx +2 -3
- package/src/component/LineGraph/DrawLineGraph.tsx +10 -11
- package/src/component/LineGraph/LineGraph.tsx +2 -18
- package/src/component/PieGraph/DrawPieGraph.tsx +1 -5
- package/src/component/PieGraph/PieGraph.tsx +1 -3
- package/src/component/ProgressBar/ProgressBar.tsx +63 -59
- package/src/component/SpeedoMeter/SpeedoMeter.tsx +9 -39
- package/src/component/Timer/Timer.tsx +13 -16
- package/src/utils/finalDataProvider.ts +44 -36
- package/src/Style/style.css +0 -20
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const DrawGraph: ({ value
|
|
1
|
+
declare const DrawGraph: ({ value }: any) => import("react/jsx-runtime").JSX.Element;
|
|
2
2
|
export default DrawGraph;
|
|
@@ -30,14 +30,11 @@ export declare const finalDataProvider: (type: string, value: any, theme?: any)
|
|
|
30
30
|
style: {
|
|
31
31
|
containerStyle: any;
|
|
32
32
|
headerStyle: any;
|
|
33
|
-
legendStyle: {
|
|
34
|
-
legend: any;
|
|
35
|
-
legendTitle: any;
|
|
36
|
-
};
|
|
37
33
|
labelStyle: any;
|
|
38
34
|
lineStyle: any;
|
|
39
35
|
tooltipStyle?: undefined;
|
|
40
36
|
barStyle?: undefined;
|
|
37
|
+
legendStyle?: undefined;
|
|
41
38
|
pieStyle?: undefined;
|
|
42
39
|
};
|
|
43
40
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@import"https://fonts.googleapis.com/css2?family=Roboto;600&display=swap";.
|
|
1
|
+
@import"https://fonts.googleapis.com/css2?family=Roboto;600&display=swap";.container{margin:0;box-sizing:border-box;font-family:Roboto,sans-serif}
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "impaktapps-design",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.85",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@babel/core": "^7.16.12",
|
|
6
|
+
"@emotion/react": "^11.11.4",
|
|
7
|
+
"@emotion/styled": "^11.11.5",
|
|
6
8
|
"@mui/material": "^5.14.3",
|
|
9
|
+
"@react-spring/web": "^9.7.3",
|
|
7
10
|
"@visx/visx": "^3.1.2",
|
|
8
11
|
"@vitejs/plugin-react": "^1.1.4",
|
|
9
12
|
"babel-loader": "^8.2.3",
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { AxisBottom } from "@visx/axis";
|
|
3
3
|
import { bottomAxisProps } from '../interface/interface';
|
|
4
|
-
import "../Style/style.css"
|
|
5
4
|
const BottomAxis = ({data,yMax,value,xScale,parentWidth,left}:bottomAxisProps) => {
|
|
5
|
+
|
|
6
6
|
return (
|
|
7
|
-
<>
|
|
8
7
|
<AxisBottom
|
|
9
8
|
numTicks={data?.length}
|
|
10
9
|
top={yMax}
|
|
11
10
|
left={left}
|
|
12
|
-
labelClassName='axisBottom'
|
|
13
|
-
tickClassName='axisBottom'
|
|
14
|
-
axisClassName='axisBottom'
|
|
15
11
|
hideTicks={value.main?.hideTicks}
|
|
16
12
|
hideAxisLine={value.main?.hideBottomAxisLine}
|
|
17
13
|
strokeWidth={value.style?.labelStyle?.bottomAxisWidth}
|
|
@@ -20,7 +16,6 @@ const BottomAxis = ({data,yMax,value,xScale,parentWidth,left}:bottomAxisProps) =
|
|
|
20
16
|
labelOffset={value.style?.labelStyle?.bottomLabelOffset}
|
|
21
17
|
label={value.main?.bottomLabel}
|
|
22
18
|
labelProps={{
|
|
23
|
-
|
|
24
19
|
fill: value.style?.labelStyle?.labelColor,
|
|
25
20
|
fontSize: value.style?.labelStyle?.fontSize,
|
|
26
21
|
fontWeight: value.style?.labelStyle?.fontWeight,
|
|
@@ -28,13 +23,11 @@ const BottomAxis = ({data,yMax,value,xScale,parentWidth,left}:bottomAxisProps) =
|
|
|
28
23
|
}}
|
|
29
24
|
tickStroke={value.style?.labelStyle?.tickColor}
|
|
30
25
|
tickLabelProps={() => ({
|
|
31
|
-
display:innerWidth<600?"none":"inline-block",
|
|
32
26
|
fill: value.style?.labelStyle?.tickLabelColor,
|
|
33
27
|
fontSize: value.style?.labelStyle?.tickFontSize ||11,
|
|
34
28
|
textAnchor: "middle",
|
|
35
29
|
})}
|
|
36
30
|
/>
|
|
37
|
-
</>
|
|
38
31
|
)
|
|
39
32
|
}
|
|
40
33
|
export default BottomAxis
|
package/src/component/Legend.tsx
CHANGED
|
@@ -5,8 +5,7 @@ export function Legend({ value ,colorRange,dataKeyArray}: any) {
|
|
|
5
5
|
const legendGlyphSize = value?.main?.legend?.colorRectWidth || 15;
|
|
6
6
|
const ordinalColorScale = scaleOrdinal({
|
|
7
7
|
domain:dataKeyArray||value?.main?.tooltipDataKey,
|
|
8
|
-
range: colorRange|| value?.style?.pieStyle?.colorRange
|
|
9
|
-
|
|
8
|
+
range:colorRange|| value?.style?.barStyle?.colorRange || value?.style?.pieStyle?.colorRange || value?.style?.lineStyle?.colorRange
|
|
10
9
|
});
|
|
11
10
|
return (
|
|
12
11
|
<div className="legend" style={{paddingLeft:"40px",paddingRight:"40px",...value?.style?.legendStyle?.legend}}>
|
|
@@ -29,7 +28,7 @@ export function Legend({ value ,colorRange,dataKeyArray}: any) {
|
|
|
29
28
|
key={`legend-quantile-${i}`}
|
|
30
29
|
margin="0 5px"
|
|
31
30
|
onClick={(events) => {
|
|
32
|
-
|
|
31
|
+
if (events) alert(`clicked: ${JSON.stringify(label)}`);
|
|
33
32
|
}}
|
|
34
33
|
>
|
|
35
34
|
<svg width={legendGlyphSize} height={legendGlyphSize}>
|
|
@@ -7,19 +7,18 @@ import {
|
|
|
7
7
|
AnimatedGrid
|
|
8
8
|
} from "@visx/xychart";
|
|
9
9
|
import Legend from "../Legend";
|
|
10
|
-
const DrawGraph = ({ value
|
|
10
|
+
const DrawGraph = ({ value }:any) => {
|
|
11
11
|
const data = value?.main?.data;
|
|
12
|
-
const arr = (value.main.xAxisValue && value.main.yAxisValue) ? [value.main.xAxisValue,value.main.yAxisValue] :
|
|
12
|
+
const arr = (value.main.xAxisValue && value.main.yAxisValue) ? [value.main.xAxisValue,value.main.yAxisValue] :Object.keys(data[0].value[0]);
|
|
13
13
|
const accessors = { xAccessor: (d:any) => d[arr[0]], yAccessor: (d:any) => d[arr[1]] };
|
|
14
|
-
|
|
14
|
+
const dataKeyArray = data.map((ele: any) => ele.key);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
|
|
17
|
+
<>
|
|
18
18
|
{value.main.legendAvailable &&
|
|
19
|
-
<Legend value={value}
|
|
20
|
-
colorRange={value?.style?.lineStyle?.colorRange}/>
|
|
19
|
+
<Legend value={value} dataKeyArray={dataKeyArray} />
|
|
21
20
|
}
|
|
22
|
-
<XYChart
|
|
21
|
+
<XYChart height={parseInt(value.style?.containerStyle?.height)} xScale={{ type: "band" }} yScale={{ type: "linear" }}>
|
|
23
22
|
<AnimatedAxis orientation="left" hideAxisLine={value.main.hideLeftAxisLine}
|
|
24
23
|
label={value.main.leftLabel}
|
|
25
24
|
left={value.style?.labelStyle?.leftLabelMargin||70}
|
|
@@ -45,13 +44,13 @@ const DrawGraph = ({ value,parentWidth, parentHeight }:any) => {
|
|
|
45
44
|
/>
|
|
46
45
|
<AnimatedGrid
|
|
47
46
|
columns={value.main.grid}
|
|
48
|
-
numTicks={value.main.numHidden?0:value.main?.data[0].length-1} />
|
|
47
|
+
numTicks={value.main.numHidden ? 0 : value.main?.data[0].value.length - 1} />
|
|
49
48
|
{
|
|
50
49
|
value.main?.data.map((elem:any, i:number) => {
|
|
51
50
|
return (
|
|
52
51
|
<AnimatedLineSeries
|
|
53
|
-
dataKey={
|
|
54
|
-
data={elem}
|
|
52
|
+
dataKey={elem.key}
|
|
53
|
+
data={elem.value}
|
|
55
54
|
fill={value.style?.lineStyle?.lineAreaColor}
|
|
56
55
|
fillOpacity={value.style?.lineStyle?.lineAreaOpacity}
|
|
57
56
|
|
|
@@ -80,7 +79,7 @@ const DrawGraph = ({ value,parentWidth, parentHeight }:any) => {
|
|
|
80
79
|
</div>
|
|
81
80
|
)}
|
|
82
81
|
/>
|
|
83
|
-
</XYChart
|
|
82
|
+
</XYChart></>
|
|
84
83
|
);
|
|
85
84
|
};
|
|
86
85
|
|
|
@@ -1,31 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import DrawLineGraph from "./DrawLineGraph";
|
|
3
3
|
import { finalDataProvider } from "../../utils/finalDataProvider";
|
|
4
|
-
import { ParentSize } from "@visx/responsive";
|
|
5
4
|
|
|
6
5
|
const LineGraph = ({ value,theme }:any) => {
|
|
7
6
|
const lineData = finalDataProvider("LineGraph", value,theme);
|
|
8
|
-
let LineRender = (
|
|
9
|
-
<ParentSize>
|
|
10
|
-
{(parent) => (
|
|
11
|
-
<DrawLineGraph
|
|
12
|
-
parentWidth={parent.width}
|
|
13
|
-
parentHeight={parseInt(lineData.style.containerStyle.height)}
|
|
14
|
-
//@ts-ignore
|
|
15
|
-
parentRef={parent.ref}
|
|
16
|
-
resizeParent={parent.resize}
|
|
17
|
-
value={lineData}
|
|
18
|
-
/>
|
|
19
|
-
)}
|
|
20
|
-
</ParentSize>
|
|
21
|
-
);
|
|
22
7
|
return (
|
|
23
|
-
<div style={
|
|
8
|
+
<div style={lineData?.style?.containerStyle}>
|
|
24
9
|
{lineData?.main?.header && (
|
|
25
10
|
<div style={lineData?.style?.headerStyle}>{lineData?.main?.header}</div>
|
|
26
11
|
)}
|
|
27
|
-
{
|
|
28
|
-
{/* <DrawLineGraph value={lineData} /> */}
|
|
12
|
+
<DrawLineGraph value={lineData} />
|
|
29
13
|
</div>
|
|
30
14
|
);
|
|
31
15
|
};
|
|
@@ -9,15 +9,13 @@ import ToolTip from "../ToolTip";
|
|
|
9
9
|
|
|
10
10
|
const DrawPieGraph = ({ value, parentWidth, parentHeight }: any) => {
|
|
11
11
|
const letters = value?.main?.data;
|
|
12
|
-
// ["branch","value"]
|
|
13
12
|
const arr =
|
|
14
13
|
value?.main?.xAxisValue && value?.main?.yAxisValue
|
|
15
14
|
? [value?.main?.xAxisValue, value?.main?.yAxisValue]
|
|
16
15
|
: Object.keys(letters[0]);
|
|
17
16
|
const frequency = (d: any) => d[arr[1]];
|
|
18
|
-
const labelArray = letters.map((l:[any]) => l[arr[0]]);
|
|
19
17
|
const getLetterFrequencyColor = scaleOrdinal({
|
|
20
|
-
domain:
|
|
18
|
+
domain: letters.map((l:[any]) => l[arr[0]]),
|
|
21
19
|
range: value?.style?.pieStyle?.colorRange,
|
|
22
20
|
});
|
|
23
21
|
|
|
@@ -49,8 +47,6 @@ const DrawPieGraph = ({ value, parentWidth, parentHeight }: any) => {
|
|
|
49
47
|
{value?.main?.legendAvailable && (
|
|
50
48
|
<Legend
|
|
51
49
|
value={value}
|
|
52
|
-
colorRange={value?.style?.pieStyle?.colorRange}
|
|
53
|
-
dataKeyArray={labelArray}
|
|
54
50
|
/>
|
|
55
51
|
)}
|
|
56
52
|
<svg
|
|
@@ -21,9 +21,7 @@ const PieGraph = ({ value,theme }: any) => {
|
|
|
21
21
|
);
|
|
22
22
|
return (
|
|
23
23
|
<div style={pieData.style.containerStyle}>
|
|
24
|
-
{pieData?.main?.header &&
|
|
25
|
-
<div style={pieData.style.headerStyle}>{pieData?.main?.header}</div>
|
|
26
|
-
</>}
|
|
24
|
+
{pieData?.main?.header && <div style={pieData.style.headerStyle}>{pieData?.main?.header}</div>}
|
|
27
25
|
{PieRender}
|
|
28
26
|
</div>
|
|
29
27
|
);
|
|
@@ -1,55 +1,54 @@
|
|
|
1
|
-
import React, { useState, useEffect } from "react";
|
|
1
|
+
import React, { useState , useEffect } from "react";
|
|
2
2
|
import "./style.css";
|
|
3
3
|
|
|
4
|
-
const ProgressBar = ({
|
|
4
|
+
const ProgressBar = ({value,theme} : any) => {
|
|
5
5
|
const [progress, setProgress] = useState(
|
|
6
|
-
|
|
6
|
+
(value?.main?.data?.achieved / value?.main?.data?.total) *
|
|
7
|
+
100
|
|
7
8
|
);
|
|
8
|
-
useEffect(()
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
useEffect(()=>{
|
|
10
|
+
setProgress( (value?.main?.data?.achieved / value?.main?.data?.total) *
|
|
11
|
+
100)
|
|
12
|
+
},[value.main.data])
|
|
11
13
|
const getColor = () => {
|
|
12
14
|
if (progress < 40) {
|
|
13
|
-
return ["#e2b6b6",
|
|
15
|
+
return ["#e2b6b6","#ff0000"];
|
|
14
16
|
}
|
|
15
17
|
if (progress < 70) {
|
|
16
|
-
|
|
18
|
+
return ["#b6bce2","#3f51b5"];
|
|
17
19
|
} else {
|
|
18
|
-
return ["#b6e2c2",
|
|
20
|
+
return ["#b6e2c2","#2ecc71"];
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
|
-
if
|
|
22
|
-
return (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
></div>
|
|
45
|
-
</div>
|
|
46
|
-
);
|
|
23
|
+
if(value?.main?.developOnlyProgresBar){
|
|
24
|
+
return (<div
|
|
25
|
+
style={{
|
|
26
|
+
height: "6px",
|
|
27
|
+
margin: "auto",
|
|
28
|
+
borderRadius: "10px",
|
|
29
|
+
backgroundColor:value?.style?.progressBarColor|| getColor()[1],
|
|
30
|
+
|
|
31
|
+
marginBottom: "20px",
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
className="progress-bar-fill"
|
|
36
|
+
style={{
|
|
37
|
+
width: `${progress}%`,
|
|
38
|
+
backgroundColor:value?.style?.progressBarFillColor|| getColor()[1],
|
|
39
|
+
height: "100%",
|
|
40
|
+
borderRadius: "10px",
|
|
41
|
+
marginBottom: "20px",
|
|
42
|
+
transition: "width 0.5 ease-out",
|
|
43
|
+
}}
|
|
44
|
+
></div>
|
|
45
|
+
</div>)
|
|
47
46
|
}
|
|
48
47
|
return (
|
|
49
48
|
<div
|
|
50
49
|
className="container"
|
|
51
50
|
style={{
|
|
52
|
-
backgroundColor:
|
|
51
|
+
backgroundColor:theme?.palette?.secondary.main ,
|
|
53
52
|
color: theme?.palette?.text?.primary,
|
|
54
53
|
borderRadius: "20px",
|
|
55
54
|
width: "auto",
|
|
@@ -67,7 +66,7 @@ const ProgressBar = ({ value, theme }: any) => {
|
|
|
67
66
|
textAlign: "left",
|
|
68
67
|
fontFamily: "inherit",
|
|
69
68
|
fontSize: "18px",
|
|
70
|
-
color: theme?.palette?.text?.primary
|
|
69
|
+
color: theme?.palette?.text?.primary||"#121926",
|
|
71
70
|
}}
|
|
72
71
|
>
|
|
73
72
|
{value?.main?.heading}
|
|
@@ -91,7 +90,7 @@ const ProgressBar = ({ value, theme }: any) => {
|
|
|
91
90
|
fontWeight: 700,
|
|
92
91
|
marginBottom: "20px",
|
|
93
92
|
fontSize: "24px",
|
|
94
|
-
color:
|
|
93
|
+
color:"inherit"
|
|
95
94
|
}}
|
|
96
95
|
>
|
|
97
96
|
{progress.toFixed(2)}%
|
|
@@ -104,14 +103,14 @@ const ProgressBar = ({ value, theme }: any) => {
|
|
|
104
103
|
margin: "auto",
|
|
105
104
|
borderRadius: "10px",
|
|
106
105
|
backgroundColor: getColor()[0],
|
|
107
|
-
|
|
106
|
+
|
|
108
107
|
marginBottom: "20px",
|
|
109
108
|
}}
|
|
110
109
|
>
|
|
111
110
|
<div
|
|
112
111
|
className="progress-bar-fill"
|
|
113
112
|
style={{
|
|
114
|
-
width: `${progress
|
|
113
|
+
width: `${progress}%`,
|
|
115
114
|
backgroundColor: getColor()[1],
|
|
116
115
|
// backgroundColor: "#3f51b5",
|
|
117
116
|
height: "100%",
|
|
@@ -135,66 +134,69 @@ const ProgressBar = ({ value, theme }: any) => {
|
|
|
135
134
|
<div style={{ width: "33.33%" }}>
|
|
136
135
|
<div
|
|
137
136
|
style={{
|
|
138
|
-
textAlign:
|
|
137
|
+
textAlign:"left",
|
|
139
138
|
fontSize: "10px",
|
|
140
139
|
color: theme?.palette?.text?.inputLabel,
|
|
141
140
|
marginBottom: "10px",
|
|
142
141
|
}}
|
|
143
142
|
>
|
|
144
|
-
|
|
143
|
+
{value?.main?.bottomLabel_1||"Target"}
|
|
145
144
|
</div>
|
|
146
145
|
<div
|
|
147
146
|
style={{
|
|
148
|
-
color: theme?.palette?.text?.primary
|
|
149
|
-
textAlign:
|
|
147
|
+
color: theme?.palette?.text?.primary||"#121926",
|
|
148
|
+
textAlign:"left",
|
|
150
149
|
fontWeight: 500,
|
|
151
150
|
}}
|
|
152
151
|
>
|
|
153
|
-
{value?.main?.data?.total
|
|
154
|
-
value?.main?.data?.bottomLabel_1_value}
|
|
152
|
+
{value?.main?.data?.total||value?.main?.data?.bottomLabel_1_value}
|
|
155
153
|
</div>
|
|
156
154
|
</div>
|
|
157
155
|
<div style={{ width: "33.33%" }}>
|
|
158
156
|
<div
|
|
159
157
|
style={{
|
|
160
|
-
textAlign:
|
|
161
|
-
color: theme?.palette?.text?.inputLabel
|
|
158
|
+
textAlign:"center",
|
|
159
|
+
color: theme?.palette?.text?.inputLabel||"#697586",
|
|
162
160
|
fontSize: "10px",
|
|
163
161
|
marginBottom: "10px",
|
|
164
162
|
}}
|
|
165
163
|
>
|
|
166
|
-
|
|
164
|
+
{value?.main?.bottomLabel_2||"Achieved"}
|
|
167
165
|
</div>
|
|
168
166
|
<div
|
|
169
167
|
style={{
|
|
170
|
-
textAlign:
|
|
171
|
-
color: theme?.palette?.text?.primary
|
|
168
|
+
textAlign:"center",
|
|
169
|
+
color: theme?.palette?.text?.primary|| "#121926",
|
|
172
170
|
fontWeight: 500,
|
|
173
171
|
}}
|
|
174
172
|
>
|
|
175
|
-
{value?.main?.data?.achieved
|
|
176
|
-
value?.main?.data?.bottomLabel_2_value}
|
|
173
|
+
{value?.main?.data?.achieved||value?.main?.data?.bottomLabel_2_value}
|
|
177
174
|
</div>
|
|
178
175
|
</div>
|
|
179
176
|
<div style={{ width: "33.33%" }}>
|
|
180
177
|
<div
|
|
181
178
|
style={{
|
|
182
|
-
textAlign:
|
|
183
|
-
color: theme?.palette?.text?.inputLabel
|
|
179
|
+
textAlign:"right",
|
|
180
|
+
color: theme?.palette?.text?.inputLabel||"#697586",
|
|
184
181
|
fontSize: "10px",
|
|
185
182
|
marginBottom: "10px",
|
|
186
183
|
}}
|
|
187
184
|
>
|
|
188
|
-
|
|
185
|
+
{value?.main?.bottomLabel_3||"Average"}
|
|
189
186
|
</div>
|
|
190
187
|
<div
|
|
191
188
|
style={{
|
|
192
|
-
textAlign:
|
|
193
|
-
color: theme?.palette?.text?.primary
|
|
189
|
+
textAlign:"right",
|
|
190
|
+
color: theme?.palette?.text?.primary||"#121926",
|
|
194
191
|
fontWeight: 500,
|
|
195
192
|
}}
|
|
196
193
|
>
|
|
197
|
-
{value?.main?.
|
|
194
|
+
{value?.main?.daysCount?
|
|
195
|
+
Math.round(
|
|
196
|
+
(value?.main?.data?.achieved / value?.main?.daysCount)
|
|
197
|
+
)+ value?.main?.bottomLabel_3_averageLabel||"/day"
|
|
198
|
+
:value?.main?.data?.bottomLabel_3_value
|
|
199
|
+
}
|
|
198
200
|
</div>
|
|
199
201
|
</div>
|
|
200
202
|
</div>
|
|
@@ -204,3 +206,5 @@ const ProgressBar = ({ value, theme }: any) => {
|
|
|
204
206
|
};
|
|
205
207
|
|
|
206
208
|
export default ProgressBar;
|
|
209
|
+
|
|
210
|
+
|
|
@@ -3,30 +3,11 @@ import ReactSpeedometer from "react-d3-speedometer";
|
|
|
3
3
|
|
|
4
4
|
const SpeedoMeter = ({ value,theme }: any) => {
|
|
5
5
|
return (
|
|
6
|
-
<div style={{
|
|
7
|
-
|
|
8
|
-
width:"100%",
|
|
9
|
-
// position:"relative",
|
|
10
|
-
display:"flex",
|
|
11
|
-
justifyContent:"center",
|
|
12
|
-
alignItems:"center",
|
|
13
|
-
paddingTop:"50px",
|
|
14
|
-
paddingBottom:"50px",
|
|
15
|
-
marginLeft:"auto",
|
|
16
|
-
marginRight:"auto",
|
|
17
|
-
height:'auto',
|
|
18
|
-
// minWidth:window.innerWidth-30,
|
|
19
|
-
// width:"100vw",
|
|
20
|
-
|
|
21
|
-
// maxWidth:"600%",
|
|
22
|
-
background:theme.palette.secondary.main ,
|
|
23
|
-
// height:window.innerWidth>750?400:300,
|
|
24
|
-
}}>
|
|
25
|
-
{/* {value?.main?.header && (
|
|
6
|
+
<div style={{ ...value?.style?.containerStyle,background:theme.palette.secondary.main }}>
|
|
7
|
+
{value?.main?.header && (
|
|
26
8
|
<div
|
|
27
9
|
style={{
|
|
28
10
|
fontWeight: 700,
|
|
29
|
-
|
|
30
11
|
textAlign: "left",
|
|
31
12
|
fontFamily: "inherit",
|
|
32
13
|
fontSize: "18px",
|
|
@@ -36,39 +17,28 @@ const SpeedoMeter = ({ value,theme }: any) => {
|
|
|
36
17
|
>
|
|
37
18
|
{value.main.header}
|
|
38
19
|
</div>
|
|
39
|
-
)}
|
|
40
|
-
<div style={{ width:"100%",
|
|
41
|
-
// position:"absolute",'
|
|
42
|
-
// top:"10%",
|
|
43
|
-
display:"flex",
|
|
44
|
-
justifyContent:"center",
|
|
45
|
-
alignItems:"center"
|
|
46
|
-
|
|
47
|
-
// left:window.innerWidth>750?"calc(50% - 225px)":"calc(50% - 140px)"
|
|
48
|
-
,overflowX:"auto"}}>
|
|
20
|
+
)}
|
|
21
|
+
<div style={{ width:"100%",minWidth:500,display: "flex", justifyContent: "center",overflow:"auto" }}>
|
|
49
22
|
<ReactSpeedometer
|
|
50
|
-
|
|
51
23
|
forceRender={true}
|
|
52
24
|
segmentColors={value?.style?.segmentColors}
|
|
53
25
|
maxValue={value?.main?.data?.maxValue || 500}
|
|
54
|
-
width={
|
|
55
|
-
// value?.style?.width || 350
|
|
56
|
-
}
|
|
26
|
+
width={value?.style?.width || 450}
|
|
57
27
|
needleHeightRatio={value?.style?.needleHeightRatio || 0.7}
|
|
58
|
-
currentValueText={value?.main?.currentValueText
|
|
59
|
-
customSegmentLabels={value?.main?.
|
|
28
|
+
currentValueText={value?.main?.currentValueText}
|
|
29
|
+
customSegmentLabels={value?.main?.customSegmentLabel}
|
|
60
30
|
ringWidth={value?.style?.ringWidth || 37}
|
|
61
31
|
needleTransitionDuration={
|
|
62
32
|
value?.style?.needleTransitionDuration || 5333
|
|
63
33
|
}
|
|
64
34
|
// fluidWidth={true}
|
|
65
|
-
|
|
35
|
+
height={value?.style?.height}
|
|
66
36
|
needleTransition={value?.style?.needleTransition || "easeElastic"}
|
|
67
37
|
value={value?.main?.data?.value || 473}
|
|
68
38
|
needleColor={value?.style?.needleColor || "red"}
|
|
69
39
|
minValue={value?.main?.data?.minValue || 0}
|
|
70
40
|
startColor={value?.style?.startColor || "red"}
|
|
71
|
-
segments={
|
|
41
|
+
segments={value?.main?.segments || 5}
|
|
72
42
|
endColor={value?.style?.endColor || "green"}
|
|
73
43
|
textColor={value?.style?.textColor || "black"}
|
|
74
44
|
/>
|
|
@@ -11,11 +11,14 @@ const CustomTimer = ({ value }) => {
|
|
|
11
11
|
const [interval, setInter] = useState<any>();
|
|
12
12
|
|
|
13
13
|
useEffect(() => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (
|
|
15
|
+
new Date(data.startDate).getTime() <
|
|
16
|
+
new Date().getTime() &&
|
|
17
|
+
new Date(data.startDate).getTime() <
|
|
18
|
+
new Date(data.endDate).getTime()
|
|
19
|
+
) {
|
|
17
20
|
let currentDate = new Date();
|
|
18
|
-
const Difference_In_Time = new Date(data
|
|
21
|
+
const Difference_In_Time = new Date(data.endDate).getTime() - currentDate.getTime();
|
|
19
22
|
const Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24);
|
|
20
23
|
setDays(Math.floor(Difference_In_Days));
|
|
21
24
|
setInter(
|
|
@@ -26,22 +29,16 @@ const CustomTimer = ({ value }) => {
|
|
|
26
29
|
setSec(currdate.getSeconds());
|
|
27
30
|
}, 1000)
|
|
28
31
|
);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
return () => {
|
|
33
|
+
clearInterval(interval);
|
|
34
|
+
};
|
|
35
|
+
} else {
|
|
32
36
|
setDays(0);
|
|
33
37
|
setHours(0);
|
|
34
38
|
setMin(0);
|
|
35
39
|
setSec(0);
|
|
36
40
|
}
|
|
37
|
-
|
|
38
|
-
clearInterval(interval);
|
|
39
|
-
setDays(0);
|
|
40
|
-
setHours(0);
|
|
41
|
-
setMin(0);
|
|
42
|
-
setSec(0);
|
|
43
|
-
};
|
|
44
|
-
},[data?.startDate, data?.endDate]);
|
|
41
|
+
},[data]);
|
|
45
42
|
|
|
46
43
|
const containerStyle = {display: "flex",flexDirection: "column",backgroundColor: "rgb(15,15,15)",justifyContent: "center",alignItems: "center",height: "40vh",gap: "10px",...uischemaStyle?.container};
|
|
47
44
|
const boxStyle = {backgroundColor : "rgb(51,51,51)", width: "22%",minWidth:"40px",height:"100px", padding : "10px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...uischemaStyle?.digitContainer};
|
|
@@ -54,7 +51,7 @@ return (
|
|
|
54
51
|
<Box component="div" sx={containerStyle}
|
|
55
52
|
>
|
|
56
53
|
<Box component="h1" style={containerLabelColor}>
|
|
57
|
-
{ new Date().getTime() >= new Date(data?.startDate).getTime() && new Date().getTime() <= new Date(data
|
|
54
|
+
{ new Date().getTime() >= new Date(data?.startDate).getTime() && new Date().getTime() <= new Date(data.endDate).getTime() ? 'Contest ends in...' : (new Date().getTime() < new Date(data.startDate).getTime()) ? 'Program Not Started Yet' : 'Program Over' }
|
|
58
55
|
</Box>
|
|
59
56
|
<Box style={{display:"flex", gap: "15px",width:"80%",maxWidth:"650px",marginLeft:"auto",marginRight:"auto"}} >
|
|
60
57
|
<Box style={boxStyle}>
|