datastake-daf 0.6.185 → 0.6.187

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/.env ADDED
@@ -0,0 +1,8 @@
1
+ REACT_APP_API_KEY=
2
+ REACT_APP_AUTH_DOMAIN=
3
+ REACT_APP_PROJECT_ID=
4
+ REACT_APP_STORAGE_BUCKED=
5
+ REACT_APP_SENDER_ID=
6
+ REACT_APP_APP_ID=
7
+ REACT_APP_MEASUREMENT_ID=
8
+ REACT_APP_VAPID_KEY=
@@ -0,0 +1,13 @@
1
+ {
2
+ "cSpell.words": ["cukura"],
3
+ "files.autoSave": "afterDelay",
4
+ "editor.wordWrap": "on",
5
+ "editor.autoClosingBrackets": "always",
6
+ "editor.autoClosingComments": "always",
7
+ "editor.autoClosingQuotes": "always",
8
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
9
+ "editor.formatOnPaste": true,
10
+ "editor.formatOnSave": true,
11
+ "notebook.defaultFormatter": "esbenp.prettier-vscode",
12
+ "javascript.format.semicolons": "insert"
13
+ }
@@ -18410,7 +18410,12 @@ function SliderItem({
18410
18410
  const marks = React.useMemo(() => {
18411
18411
  const marksObj = {};
18412
18412
  for (let i = min; i <= max; i += step) {
18413
- marksObj[i] = `${i}%`;
18413
+ marksObj[i] = /*#__PURE__*/jsxRuntime.jsxs("span", {
18414
+ style: {
18415
+ fontSize: "10px"
18416
+ },
18417
+ children: [i, "%"]
18418
+ });
18414
18419
  }
18415
18420
  return marksObj;
18416
18421
  }, [min, max, step]);
@@ -18715,8 +18720,18 @@ const Style$A = dt.div`
18715
18720
  flex-direction: row;
18716
18721
  position: relative;
18717
18722
  width: 100%;
18718
- height: 100%;
18719
- min-height: 400px;
18723
+ height: 472px;
18724
+ min-height: 300px;
18725
+
18726
+ @media (max-width: 768px) {
18727
+ height: 350px;
18728
+ min-height: 250px;
18729
+ }
18730
+
18731
+ @media (max-width: 480px) {
18732
+ height: 300px;
18733
+ min-height: 200px;
18734
+ }
18720
18735
 
18721
18736
  .filter-cont {
18722
18737
  position: absolute;
@@ -18807,8 +18822,6 @@ const Style$A = dt.div`
18807
18822
  flex: 1;
18808
18823
  background: rgb(0, 0, 0);
18809
18824
  z-index: 1;
18810
- width: 100%;
18811
- height: 100%;
18812
18825
 
18813
18826
  /* Mapbox GL JS specific styles */
18814
18827
  .mapboxgl-ctrl-top-right {
@@ -20006,22 +20019,6 @@ const useGlobe = ({
20006
20019
  };
20007
20020
  };
20008
20021
 
20009
- typeof localStorage.getItem('is_collapsed') === 'string' ? localStorage.getItem('is_collapsed') === 'true' ? true : false : true;
20010
- typeof localStorage.getItem('is_nested_sidebar_collapsed') === 'string' ? localStorage.getItem('is_nested_sidebar_collapsed') === 'true' : true;
20011
- const ResizeContext = /*#__PURE__*/React.createContext({
20012
- resizeLoading: false,
20013
- windowWidth: 0,
20014
- resizeDif: 0,
20015
- isCollapsed: false,
20016
- setIsCollapsed: () => {},
20017
- isNestedSidebarCollapsed: false,
20018
- setIsNestedSidebarCollapsed: () => {}
20019
- });
20020
- const useResizeContext = () => {
20021
- const values = React.useContext(ResizeContext);
20022
- return values;
20023
- };
20024
-
20025
20022
  function Globe(_ref) {
20026
20023
  var _activeMarker$data, _activeMarker$data2;
20027
20024
  let {
@@ -20062,11 +20059,6 @@ function Globe(_ref) {
20062
20059
  });
20063
20060
  }), [data]);
20064
20061
 
20065
- // Get resize context for sidebar state changes
20066
- const {
20067
- isCollapsed
20068
- } = useResizeContext();
20069
-
20070
20062
  // Use custom hook to configure globe functionality
20071
20063
  const {
20072
20064
  container,
@@ -20110,33 +20102,6 @@ function Globe(_ref) {
20110
20102
  return () => clearTimeout(timer);
20111
20103
  }
20112
20104
  }, [forceResize]);
20113
-
20114
- // Force resize when sidebar state changes (handles width changes)
20115
- React.useEffect(() => {
20116
- if (forceResize) {
20117
- // Trigger resize when sidebar collapses/expands
20118
- const timer = setTimeout(() => {
20119
- forceResize();
20120
- }, 100);
20121
- return () => clearTimeout(timer);
20122
- }
20123
- }, [isCollapsed, forceResize]);
20124
-
20125
- // Add window resize listener as backup
20126
- React.useEffect(() => {
20127
- const handleWindowResize = () => {
20128
- if (forceResize) {
20129
- // Small delay to ensure DOM has updated
20130
- setTimeout(() => {
20131
- forceResize();
20132
- }, 100);
20133
- }
20134
- };
20135
- window.addEventListener('resize', handleWindowResize);
20136
- return () => {
20137
- window.removeEventListener('resize', handleWindowResize);
20138
- };
20139
- }, [forceResize]);
20140
20105
  return /*#__PURE__*/jsxRuntime.jsx(ComponentWithFocus, {
20141
20106
  children: /*#__PURE__*/jsxRuntime.jsxs(Style$A, {
20142
20107
  className: formatClassname([showSider && activeMarker && "with-sider"]),
@@ -51535,6 +51500,22 @@ function useConfig(data) {
51535
51500
  return config;
51536
51501
  }
51537
51502
 
51503
+ typeof localStorage.getItem('is_collapsed') === 'string' ? localStorage.getItem('is_collapsed') === 'true' ? true : false : true;
51504
+ typeof localStorage.getItem('is_nested_sidebar_collapsed') === 'string' ? localStorage.getItem('is_nested_sidebar_collapsed') === 'true' : true;
51505
+ const ResizeContext = /*#__PURE__*/React.createContext({
51506
+ resizeLoading: false,
51507
+ windowWidth: 0,
51508
+ resizeDif: 0,
51509
+ isCollapsed: false,
51510
+ setIsCollapsed: () => {},
51511
+ isNestedSidebarCollapsed: false,
51512
+ setIsNestedSidebarCollapsed: () => {}
51513
+ });
51514
+ const useResizeContext = () => {
51515
+ const values = React.useContext(ResizeContext);
51516
+ return values;
51517
+ };
51518
+
51538
51519
  const DAYS = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
51539
51520
  function UserActivity({
51540
51521
  loading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.185",
3
+ "version": "0.6.187",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -15,7 +15,7 @@
15
15
  "buffer": "^6.0.3",
16
16
  "countries-list": "^2.6.1",
17
17
  "country-city-location": "^1.0.13",
18
- "datastake-daf": "0.6.184",
18
+ "datastake-daf": "^0.5.780",
19
19
  "dayjs": "^1.11.12",
20
20
  "deepmerge": "^4.3.1",
21
21
  "dot-object": "^2.1.5",
@@ -8,7 +8,6 @@ import CustomIcon from "../../Icon/CustomIcon.jsx";
8
8
  import ComponentWithFocus from "../ComponentWithFocus/index.jsx";
9
9
  import { formatClassname } from "../../../../../helpers/ClassesHelper";
10
10
  import Filters from "../../Filters/FloatingFilters/index.js";
11
- import { useResizeContext } from "../../../context/Resize/index.js";
12
11
 
13
12
  /**
14
13
  * Globe Component
@@ -130,9 +129,6 @@ function Globe({
130
129
  [data],
131
130
  );
132
131
 
133
- // Get resize context for sidebar state changes
134
- const { isCollapsed } = useResizeContext();
135
-
136
132
  // Use custom hook to configure globe functionality
137
133
  const { container, activeMarker, mapOptionsButtonsConfig, forceResize } = useGlobe({
138
134
  data: mappedData,
@@ -175,36 +171,6 @@ function Globe({
175
171
  }
176
172
  }, [forceResize]);
177
173
 
178
- // Force resize when sidebar state changes (handles width changes)
179
- useEffect(() => {
180
- if (forceResize) {
181
- // Trigger resize when sidebar collapses/expands
182
- const timer = setTimeout(() => {
183
- forceResize();
184
- }, 100);
185
-
186
- return () => clearTimeout(timer);
187
- }
188
- }, [isCollapsed, forceResize]);
189
-
190
- // Add window resize listener as backup
191
- useEffect(() => {
192
- const handleWindowResize = () => {
193
- if (forceResize) {
194
- // Small delay to ensure DOM has updated
195
- setTimeout(() => {
196
- forceResize();
197
- }, 100);
198
- }
199
- };
200
-
201
- window.addEventListener('resize', handleWindowResize);
202
-
203
- return () => {
204
- window.removeEventListener('resize', handleWindowResize);
205
- };
206
- }, [forceResize]);
207
-
208
174
  return (
209
175
  <ComponentWithFocus>
210
176
  <Style className={formatClassname([showSider && activeMarker && "with-sider"])}>
@@ -5,8 +5,18 @@ const Style = styled.div`
5
5
  flex-direction: row;
6
6
  position: relative;
7
7
  width: 100%;
8
- height: 100%;
9
- min-height: 400px;
8
+ height: 472px;
9
+ min-height: 300px;
10
+
11
+ @media (max-width: 768px) {
12
+ height: 350px;
13
+ min-height: 250px;
14
+ }
15
+
16
+ @media (max-width: 480px) {
17
+ height: 300px;
18
+ min-height: 200px;
19
+ }
10
20
 
11
21
  .filter-cont {
12
22
  position: absolute;
@@ -97,8 +107,6 @@ const Style = styled.div`
97
107
  flex: 1;
98
108
  background: rgb(0, 0, 0);
99
109
  z-index: 1;
100
- width: 100%;
101
- height: 100%;
102
110
 
103
111
  /* Mapbox GL JS specific styles */
104
112
  .mapboxgl-ctrl-top-right {
@@ -5,241 +5,243 @@ import MoreTags from "../../Table/MoreTags";
5
5
  const isMineSite = true;
6
6
 
7
7
  export const storyConfig = {
8
- data: [
9
- {
10
- gps: {
11
- latitude: -1.545726158025555,
12
- longitude: 28.875630614904935,
13
- },
14
- name: "Rubaya",
15
- datastakeId: "LOC-00000000241",
16
- data: [
17
- {
18
- _id: "68af116e2cb57a4e3dd2e056",
19
- createdBy: "4274fdb4-2798-46ea-a0a6-b4af5d92566e",
20
- form: "event",
21
- id: "91c3176a-d312-4259-9ddf-9d286ff6df87",
22
- datastakeId: "EV-000000000150",
23
- name: "Eboulement",
24
- authorId: "7e17f076-09e7-4668-927c-11c12ccd1346",
25
- collectId: "d78271301d04f76dfe0f70ce3c9e114ffe4dc4e0",
26
- country: "CD",
27
- date: "2025-08-25",
28
- typeOfEvent: "incident",
29
- implementers: [],
30
- associatedSubjects: [],
31
- testimonialsSource: [],
32
- pictures: [],
33
- documents: [],
34
- channels: ["NAS-00000000105"],
35
- published: true,
36
- version: 1,
37
- identifiedPerpetrators: [],
38
- identifiedVictims: [],
39
- assistedVictims: [],
40
- mitigationMeasures: [],
41
- createdAt: "2025-08-27T00:00:00.000Z",
42
- updatedAt: "2025-08-27T14:12:21.395Z",
43
- __v: 0,
44
- percentageCompletion: 40,
45
- eventCategory: "conflict",
46
- incindentType: null,
47
- initiative: null,
48
- meta: null,
49
- namespace: "incident",
50
- primarySource: null,
51
- severity: "moderate",
52
- sources: ["7e17f076-09e7-4668-927c-11c12ccd1346"],
53
- type: "minor_incident",
54
- },
55
- {
56
- _id: "68af1fb6b52f86d82f57e945",
57
- createdBy: "b1e3f288-01a2-4cea-95d2-03f65dfede99",
58
- form: "event",
59
- id: "5bee0d0f-39da-4bd1-85a4-e66276c82303",
60
- datastakeId: "EV-000000000153",
61
- name: "Request of security equipment",
62
- authorId: "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
63
- collectId: "2142bd9f3306c9ec3c823f63bbbbb8fe3ebad7fa",
64
- country: "CD",
65
- date: "2025-08-11",
66
- typeOfEvent: "testimonials",
67
- implementers: [],
68
- typeOfTestimonials: "request",
69
- associatedSubjects: [],
70
- testimonialsSource: [],
71
- pictures: [],
72
- documents: [],
73
- channels: [],
74
- published: true,
75
- version: 1,
76
- identifiedPerpetrators: [],
77
- identifiedVictims: [],
78
- assistedVictims: [],
79
- mitigationMeasures: [],
80
- createdAt: "2025-08-27T00:00:00.000Z",
81
- updatedAt: "2025-08-27T15:10:00.619Z",
82
- __v: 0,
83
- percentageCompletion: 50,
84
- meta: null,
85
- namespace: "testimonials",
86
- sources: ["fc4ca5c6-f46d-424f-a948-d66b031a82c3"],
87
- type: "correctiveActions",
88
- },
89
- {
90
- _id: "68af5d45b52f86d82f580fc8",
91
- createdBy: "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
92
- form: "event",
93
- id: "97348b4c-f7cf-4124-9b70-0f6891a40a15",
94
- datastakeId: "EV-000000000161",
95
- name: "76867485768",
96
- authorId: "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
97
- collectId: "33b9aea707761a7a735aee81ebd29d5656f049fa",
98
- country: "CD",
99
- date: "2025-08-11",
100
- typeOfEvent: "incident",
101
- implementers: [],
102
- associatedSubjects: [],
103
- testimonialsSource: [],
104
- pictures: [],
105
- documents: [],
106
- channels: [],
107
- published: false,
108
- version: 1,
109
- identifiedPerpetrators: [],
110
- identifiedVictims: [],
111
- assistedVictims: [],
112
- mitigationMeasures: [],
113
- createdAt: "2025-08-27T00:00:00.000Z",
114
- updatedAt: "2025-08-27T00:00:00.000Z",
115
- __v: 0,
116
- percentageCompletion: 40,
117
- eventCategory: null,
118
- initiative: null,
119
- meta: null,
120
- namespace: "incident",
121
- primarySource: null,
122
- severity: "major",
123
- sources: ["fc4ca5c6-f46d-424f-a948-d66b031a82c3"],
124
- type: "major_incident",
125
- },
126
- ],
127
- type: "Mine site",
128
- total: 5,
129
- sources: 2,
130
- },
131
- ],
132
- filtersConfig: [
133
- {
134
- label: "Location type",
135
- placeholder: "Select",
136
- key: "type",
137
- type: "select",
138
- value: "A",
139
- options: [{ label: "Typ A", value: "A" }],
140
- },
141
- {
142
- label: "Location type",
143
- placeholder: "Select",
144
- key: "type2",
145
- type: "select",
146
- value: undefined,
147
- options: [{ label: "Typ A", value: "A" }],
148
- },
149
- ],
150
- onFilterChange: (v) => {
151
- console.log(v);
152
- },
153
- // tooltipAsText: true,
154
- primaryLink: true,
155
- renderSider: () =>
156
- isMineSite ? (
157
- <div className="body-list">
158
- <div className="body-row">
159
- <span className="label">Territory</span>
160
- <span>Territory</span>
161
- </div>
8
+ data: [
9
+ {
10
+ gps: {
11
+ latitude: -1.545726158025555,
12
+ longitude: 28.875630614904935,
13
+ },
14
+ name: "Rubaya",
15
+ datastakeId: "LOC-00000000241",
16
+ data: [
17
+ {
18
+ _id: "68af116e2cb57a4e3dd2e056",
19
+ createdBy: "4274fdb4-2798-46ea-a0a6-b4af5d92566e",
20
+ form: "event",
21
+ id: "91c3176a-d312-4259-9ddf-9d286ff6df87",
22
+ datastakeId: "EV-000000000150",
23
+ name: "Eboulement",
24
+ authorId: "7e17f076-09e7-4668-927c-11c12ccd1346",
25
+ collectId: "d78271301d04f76dfe0f70ce3c9e114ffe4dc4e0",
26
+ country: "CD",
27
+ date: "2025-08-25",
28
+ typeOfEvent: "incident",
29
+ implementers: [],
30
+ associatedSubjects: [],
31
+ testimonialsSource: [],
32
+ pictures: [],
33
+ documents: [],
34
+ channels: ["NAS-00000000105"],
35
+ published: true,
36
+ version: 1,
37
+ identifiedPerpetrators: [],
38
+ identifiedVictims: [],
39
+ assistedVictims: [],
40
+ mitigationMeasures: [],
41
+ createdAt: "2025-08-27T00:00:00.000Z",
42
+ updatedAt: "2025-08-27T14:12:21.395Z",
43
+ __v: 0,
44
+ percentageCompletion: 40,
45
+ eventCategory: "conflict",
46
+ incindentType: null,
47
+ initiative: null,
48
+ meta: null,
49
+ namespace: "incident",
50
+ primarySource: null,
51
+ severity: "moderate",
52
+ sources: ["7e17f076-09e7-4668-927c-11c12ccd1346"],
53
+ type: "minor_incident",
54
+ },
55
+ {
56
+ _id: "68af1fb6b52f86d82f57e945",
57
+ createdBy: "b1e3f288-01a2-4cea-95d2-03f65dfede99",
58
+ form: "event",
59
+ id: "5bee0d0f-39da-4bd1-85a4-e66276c82303",
60
+ datastakeId: "EV-000000000153",
61
+ name: "Request of security equipment",
62
+ authorId: "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
63
+ collectId: "2142bd9f3306c9ec3c823f63bbbbb8fe3ebad7fa",
64
+ country: "CD",
65
+ date: "2025-08-11",
66
+ typeOfEvent: "testimonials",
67
+ implementers: [],
68
+ typeOfTestimonials: "request",
69
+ associatedSubjects: [],
70
+ testimonialsSource: [],
71
+ pictures: [],
72
+ documents: [],
73
+ channels: [],
74
+ published: true,
75
+ version: 1,
76
+ identifiedPerpetrators: [],
77
+ identifiedVictims: [],
78
+ assistedVictims: [],
79
+ mitigationMeasures: [],
80
+ createdAt: "2025-08-27T00:00:00.000Z",
81
+ updatedAt: "2025-08-27T15:10:00.619Z",
82
+ __v: 0,
83
+ percentageCompletion: 50,
84
+ meta: null,
85
+ namespace: "testimonials",
86
+ sources: ["fc4ca5c6-f46d-424f-a948-d66b031a82c3"],
87
+ type: "correctiveActions",
88
+ },
89
+ {
90
+ _id: "68af5d45b52f86d82f580fc8",
91
+ createdBy: "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
92
+ form: "event",
93
+ id: "97348b4c-f7cf-4124-9b70-0f6891a40a15",
94
+ datastakeId: "EV-000000000161",
95
+ name: "76867485768",
96
+ authorId: "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
97
+ collectId: "33b9aea707761a7a735aee81ebd29d5656f049fa",
98
+ country: "CD",
99
+ date: "2025-08-11",
100
+ typeOfEvent: "incident",
101
+ implementers: [],
102
+ associatedSubjects: [],
103
+ testimonialsSource: [],
104
+ pictures: [],
105
+ documents: [],
106
+ channels: [],
107
+ published: false,
108
+ version: 1,
109
+ identifiedPerpetrators: [],
110
+ identifiedVictims: [],
111
+ assistedVictims: [],
112
+ mitigationMeasures: [],
113
+ createdAt: "2025-08-27T00:00:00.000Z",
114
+ updatedAt: "2025-08-27T00:00:00.000Z",
115
+ __v: 0,
116
+ percentageCompletion: 40,
117
+ eventCategory: null,
118
+ initiative: null,
119
+ meta: null,
120
+ namespace: "incident",
121
+ primarySource: null,
122
+ severity: "major",
123
+ sources: ["fc4ca5c6-f46d-424f-a948-d66b031a82c3"],
124
+ type: "major_incident",
125
+ },
126
+ ],
127
+ type: "Mine site",
128
+ total: 5,
129
+ sources: 2,
130
+ },
131
+ ],
132
+ filtersConfig: [
133
+ {
134
+ label: "Location type",
135
+ placeholder: "Select",
136
+ key: "type",
137
+ type: "select",
138
+ value: "A",
139
+ options: [{ label: "Typ A", value: "A" }],
140
+ },
141
+ {
142
+ label: "Location type",
143
+ placeholder: "Select",
144
+ key: "type2",
145
+ type: "select",
146
+ value: undefined,
147
+ options: [{ label: "Typ A", value: "A" }],
148
+ },
149
+ {
150
+ type: "slider",
151
+ label: "Rating",
152
+ key: "rating",
153
+ },
154
+ ],
155
+ onFilterChange: (v) => {
156
+ console.log(v);
157
+ },
158
+ // tooltipAsText: true,
159
+ primaryLink: true,
160
+ renderSider: () =>
161
+ isMineSite ? (
162
+ <div className="body-list">
163
+ <div className="body-row">
164
+ <span className="label">Territory</span>
165
+ <span>Territory</span>
166
+ </div>
162
167
 
163
- <div className="body-row">
164
- <span className="label">Territory</span>
165
- <span>Territory</span>
166
- </div>
168
+ <div className="body-row">
169
+ <span className="label">Territory</span>
170
+ <span>Territory</span>
171
+ </div>
167
172
 
168
- <div className="body-row">
169
- <span className="label">Territory</span>
170
- <span>Territory</span>
171
- </div>
172
- </div>
173
- ) : (
174
- <div className="daf-table-wrapper extra-small">
175
- <DAFTable
176
- loading={false}
177
- scroll={{ y: 300 }}
178
- className="no-padding no-margin"
179
- data={[
180
- { worker: "Redis RIra", activity: "1234", key: 0 },
181
- { empty: true, key: 1 },
182
- { empty: true, key: 2 },
183
- { empty: true, key: 3 },
184
- { empty: true, key: 4 },
185
- { empty: true, key: 5 },
186
- { empty: true, key: 6 },
187
- { empty: true, key: 7 },
188
- { empty: true, key: 8 },
189
- ]}
190
- pagination={false}
191
- columns={[
192
- {
193
- title: "Worker",
194
- dataIndex: "worker",
195
- key: "worker",
196
- ellipsis: true,
197
- width: 90,
198
- },
199
- {
200
- title: "Activity",
201
- dataIndex: "activity",
202
- key: "activity",
203
- width: 90,
204
- render: (_, all) => {
205
- if (all.empty) {
206
- return <div className="daf-default-cell md" />;
207
- }
173
+ <div className="body-row">
174
+ <span className="label">Territory</span>
175
+ <span>Territory</span>
176
+ </div>
177
+ </div>
178
+ ) : (
179
+ <div className="daf-table-wrapper extra-small">
180
+ <DAFTable
181
+ loading={false}
182
+ scroll={{ y: 300 }}
183
+ className="no-padding no-margin"
184
+ data={[
185
+ { worker: "Redis RIra", activity: "1234", key: 0 },
186
+ { empty: true, key: 1 },
187
+ { empty: true, key: 2 },
188
+ { empty: true, key: 3 },
189
+ { empty: true, key: 4 },
190
+ { empty: true, key: 5 },
191
+ { empty: true, key: 6 },
192
+ { empty: true, key: 7 },
193
+ { empty: true, key: 8 },
194
+ ]}
195
+ pagination={false}
196
+ columns={[
197
+ {
198
+ title: "Worker",
199
+ dataIndex: "worker",
200
+ key: "worker",
201
+ ellipsis: true,
202
+ width: 90,
203
+ },
204
+ {
205
+ title: "Activity",
206
+ dataIndex: "activity",
207
+ key: "activity",
208
+ width: 90,
209
+ render: (_, all) => {
210
+ if (all.empty) {
211
+ return <div className="daf-default-cell md" />;
212
+ }
208
213
 
209
- return (
210
- <MoreTags
211
- values={[{ label: "DDdadsdas" }]}
212
- maxTextCont={40}
213
- />
214
- );
215
- },
216
- },
217
- {
218
- title: "",
219
- dataIndex: "action",
220
- key: "action",
221
- width: 34,
222
- render: (_, all) => {
223
- if (all.empty) {
224
- return <div className="daf-default-cell md" />;
225
- }
214
+ return (
215
+ <MoreTags values={[{ label: "DDdadsdas" }]} maxTextCont={40} />
216
+ );
217
+ },
218
+ },
219
+ {
220
+ title: "",
221
+ dataIndex: "action",
222
+ key: "action",
223
+ width: 34,
224
+ render: (_, all) => {
225
+ if (all.empty) {
226
+ return <div className="daf-default-cell md" />;
227
+ }
226
228
 
227
- return <CustomIcon name="LinkNewTab" width={12} height={12} />;
228
- },
229
- },
230
- ]}
231
- rowKey="key"
232
- />
233
- </div>
234
- ),
235
- renderTooltip: (data) => {
236
- return [
237
- { label: "Workers", value: data?.administrativeLevel1 },
238
- { label: "Opinion", value: "RROFTE GERRDECI " },
239
- ];
240
- },
241
- link: true,
242
- onClickLink: (data) => {
243
- console.log(data);
244
- },
229
+ return <CustomIcon name="LinkNewTab" width={12} height={12} />;
230
+ },
231
+ },
232
+ ]}
233
+ rowKey="key"
234
+ />
235
+ </div>
236
+ ),
237
+ renderTooltip: (data) => {
238
+ return [
239
+ { label: "Workers", value: data?.administrativeLevel1 },
240
+ { label: "Opinion", value: "RROFTE GERRDECI " },
241
+ ];
242
+ },
243
+ link: true,
244
+ onClickLink: (data) => {
245
+ console.log(data);
246
+ },
245
247
  };
@@ -10,111 +10,116 @@ const DEFAULT_MAX = 100;
10
10
  const STEP_SISTERS = ["#F04438", "#FF7A45", "#FFA940", "#95DE64", "#12B76A"]; // NOT REAL STEP SISTERS, JUST COLORS. 😂
11
11
 
12
12
  export default function SliderItem({ filter, onFilterChange }) {
13
- const [range, setRange] = useState([DEFAULT_MIN, DEFAULT_MAX]);
14
-
15
- const min = filter?.min ?? DEFAULT_MIN;
16
- const max = filter?.max ?? DEFAULT_MAX;
17
- const step = filter?.step ?? DEFAULT_STEP;
18
-
19
- const marks = useMemo(() => {
20
- const marksObj = {};
21
- for (let i = min; i <= max; i += step) {
22
- marksObj[i] = `${i}%`;
23
- }
24
- return marksObj;
25
- }, [min, max, step]);
26
-
27
- const getColorForValue = (start, end) => {
28
- const s = Number(start);
29
- const e = Number(end);
30
- if (Number.isNaN(s) || Number.isNaN(e)) return "transparent";
31
-
32
- const valueToStartIndex = (v) => {
33
- let idx = Math.floor((v - min) / step);
34
- if (idx < 0) idx = 0;
35
- if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
36
- return idx;
37
- };
38
-
39
- const valueToEndIndex = (v) => {
40
- let idx = Math.ceil((v - min) / step) - 1;
41
- if (idx < 0) idx = 0;
42
- if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
43
- return idx;
44
- };
45
-
46
- let startIndex = valueToStartIndex(Math.min(s, e));
47
- let endIndex = valueToEndIndex(Math.max(s, e));
48
-
49
- if (endIndex < startIndex) endIndex = startIndex;
50
-
51
- const colorsInRange = STEP_SISTERS.slice(startIndex, endIndex + 1);
52
-
53
- if (colorsInRange.length === 0) return "transparent";
54
- if (colorsInRange.length === 1) return colorsInRange[0];
55
-
56
- const sliceSize = 100 / colorsInRange.length;
57
- const gradientStops = colorsInRange
58
- .map((color, i) => {
59
- const startPct = +(i * sliceSize).toFixed(4);
60
- const endPct = +((i + 1) * sliceSize).toFixed(4);
61
- return `${color} ${startPct}% ${endPct}%`;
62
- })
63
- .join(", ");
64
-
65
- return `linear-gradient(to right, ${gradientStops})`;
66
- };
67
-
68
- return (
69
- <div className="form-row">
70
- <label>{filter?.label}</label>
71
- <Select
72
- value={`${range[0]} - ${range[1]}`}
73
- dropdownRender={() => (
74
- <div style={{ padding: "10px" }}>
75
- <ConfigProvider
76
- theme={{
77
- components: {
78
- Slider: {
79
- dotSize: 13,
80
- },
81
- },
82
- }}
83
- >
84
- <Slider
85
- range
86
- min={min}
87
- max={max}
88
- value={range}
89
- step={null}
90
- onChange={(val) => {
91
- setRange(val);
92
- onFilterChange({ [filter?.key]: val });
93
- }}
94
- tooltip={{
95
- open: false,
96
- }}
97
- marks={marks}
98
- styles={{
99
- track: {
100
- background: "transparent",
101
- },
102
- tracks: {
103
- background: getColorForValue(range[0], range[1]),
104
- },
105
- }}
106
- />
107
- </ConfigProvider>
108
- </div>
109
- )}
110
- >
111
- <Option
112
- value={`${range[0]}-${range[1]}`}
113
- key={`${range[0]}-${range[1]}`}
114
- >
115
- {range[0]} - {range[1]}
116
- </Option>
117
- </Select>
118
- </div>
119
- );
13
+ const [range, setRange] = useState([DEFAULT_MIN, DEFAULT_MAX]);
14
+
15
+ const min = filter?.min ?? DEFAULT_MIN;
16
+ const max = filter?.max ?? DEFAULT_MAX;
17
+ const step = filter?.step ?? DEFAULT_STEP;
18
+
19
+ const marks = useMemo(() => {
20
+ const marksObj = {};
21
+ for (let i = min; i <= max; i += step) {
22
+ marksObj[i] = (
23
+ <span
24
+ style={{
25
+ fontSize: "10px",
26
+ }}
27
+ >
28
+ {i}%
29
+ </span>
30
+ );
31
+ }
32
+ return marksObj;
33
+ }, [min, max, step]);
34
+
35
+ const getColorForValue = (start, end) => {
36
+ const s = Number(start);
37
+ const e = Number(end);
38
+ if (Number.isNaN(s) || Number.isNaN(e)) return "transparent";
39
+
40
+ const valueToStartIndex = (v) => {
41
+ let idx = Math.floor((v - min) / step);
42
+ if (idx < 0) idx = 0;
43
+ if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
44
+ return idx;
45
+ };
46
+
47
+ const valueToEndIndex = (v) => {
48
+ let idx = Math.ceil((v - min) / step) - 1;
49
+ if (idx < 0) idx = 0;
50
+ if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
51
+ return idx;
52
+ };
53
+
54
+ let startIndex = valueToStartIndex(Math.min(s, e));
55
+ let endIndex = valueToEndIndex(Math.max(s, e));
56
+
57
+ if (endIndex < startIndex) endIndex = startIndex;
58
+
59
+ const colorsInRange = STEP_SISTERS.slice(startIndex, endIndex + 1);
60
+
61
+ if (colorsInRange.length === 0) return "transparent";
62
+ if (colorsInRange.length === 1) return colorsInRange[0];
63
+
64
+ const sliceSize = 100 / colorsInRange.length;
65
+ const gradientStops = colorsInRange
66
+ .map((color, i) => {
67
+ const startPct = +(i * sliceSize).toFixed(4);
68
+ const endPct = +((i + 1) * sliceSize).toFixed(4);
69
+ return `${color} ${startPct}% ${endPct}%`;
70
+ })
71
+ .join(", ");
72
+
73
+ return `linear-gradient(to right, ${gradientStops})`;
74
+ };
75
+
76
+ return (
77
+ <div className="form-row">
78
+ <label>{filter?.label}</label>
79
+ <Select
80
+ value={`${range[0]} - ${range[1]}`}
81
+ dropdownRender={() => (
82
+ <div style={{ padding: "10px" }}>
83
+ <ConfigProvider
84
+ theme={{
85
+ components: {
86
+ Slider: {
87
+ dotSize: 13,
88
+ },
89
+ },
90
+ }}
91
+ >
92
+ <Slider
93
+ range
94
+ min={min}
95
+ max={max}
96
+ value={range}
97
+ step={null}
98
+ onChange={(val) => {
99
+ setRange(val);
100
+ onFilterChange({ [filter?.key]: val });
101
+ }}
102
+ tooltip={{
103
+ open: false,
104
+ }}
105
+ marks={marks}
106
+ styles={{
107
+ track: {
108
+ background: "transparent",
109
+ },
110
+ tracks: {
111
+ background: getColorForValue(range[0], range[1]),
112
+ },
113
+ }}
114
+ />
115
+ </ConfigProvider>
116
+ </div>
117
+ )}
118
+ >
119
+ <Option value={`${range[0]}-${range[1]}`} key={`${range[0]}-${range[1]}`}>
120
+ {range[0]} - {range[1]}
121
+ </Option>
122
+ </Select>
123
+ </div>
124
+ );
120
125
  }