datastake-daf 0.6.149 → 0.6.150
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/index.js +115 -262
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/PdfView/index.jsx +59 -44
- package/src/@daf/core/components/Dashboard/Widget/ExpandableMapWidget/ExpandableMapWidget.stories.js +1693 -0
- package/src/@daf/core/components/Dashboard/Widget/ExpandableMapWidget/hook.js +44 -0
- package/src/@daf/core/components/Dashboard/Widget/ExpandableMapWidget/index.js +55 -0
- package/src/@daf/core/components/Dashboard/Widget/index.jsx +2 -1
- package/.vscode/settings.json +0 -13
- package/public/assets/images/SVG/403.svg +0 -20
- package/public/assets/images/SVG/404.svg +0 -11
- package/public/assets/images/SVG/CADD.svg +0 -27
- package/public/assets/images/SVG/InDevelopment.svg +0 -24
- package/public/assets/images/SVG/PME.svg +0 -21
- package/public/assets/images/SVG/comment-alt.svg +0 -3
- package/public/assets/images/SVG/comment.svg +0 -3
- package/public/assets/images/SVG/coordinator.svg +0 -3
- package/public/assets/images/SVG/implementer.svg +0 -3
- package/public/assets/images/SVG/logo-horizontal.svg +0 -1
- package/public/assets/images/SVG/partner-building.svg +0 -3
- package/public/assets/images/SVG/partner.svg +0 -5
- package/public/assets/images/SVG/unavailable-info.svg +0 -16
- package/public/assets/images/SVG/vault.svg +0 -6
- package/public/assets/images/app-navigation/mmt-logo.svg +0 -32
- package/public/assets/images/app-navigation/tazama-logo.svg +0 -31
- package/public/assets/images/app-navigation/tif-logo.svg +0 -33
- package/public/assets/images/applications/arm-prev.png +0 -0
- package/public/assets/images/applications/asm-icon.svg +0 -29
- package/public/assets/images/applications/kota-logo.svg +0 -4
- package/public/assets/images/applications/mmt-logo-2.svg +0 -5
- package/public/assets/images/applications/mmt-logo.svg +0 -6
- package/public/assets/images/applications/mmt-prev.png +0 -0
- package/public/assets/images/applications/sbgi_logo.png +0 -0
- package/public/assets/images/applications/tazama-home-img.jpeg +0 -0
- package/public/assets/images/applications/tazama-logo.svg +0 -9
- package/public/assets/images/applications/tif-app.png +0 -0
- package/public/assets/images/applications/tif-logo.svg +0 -9
- package/public/assets/images/auth-bg-2.svg +0 -296
- package/public/assets/images/auth-bg.svg +0 -303
- package/public/assets/images/countries/fr.png +0 -0
- package/public/assets/images/countries/gb.png +0 -0
- package/public/assets/images/countries/sp.png +0 -0
- package/public/assets/images/dashboard/amp-dashboard/empty.png +0 -0
- package/public/assets/images/dashboard/map-icons/amp.svg +0 -28
- package/public/assets/images/dashboard/map-icons/amp_focused.svg +0 -28
- package/public/assets/images/dashboard/map-icons/amp_location_pin.svg +0 -4
- package/public/assets/images/dashboard/map-icons/datachain-icon.svg +0 -21
- package/public/assets/images/dashboard/map-icons/ellipse.svg +0 -3
- package/public/assets/images/dashboard/map-icons/lir-icon.svg +0 -3
- package/public/assets/images/dashboard/map-icons/major-incident-events-icon.svg +0 -3
- package/public/assets/images/dashboard/map-icons/minesites-location-icon.svg +0 -21
- package/public/assets/images/dashboard/map-icons/minor-incident-events-icon.svg +0 -3
- package/public/assets/images/dashboard/map-icons/moderate-incident-events-icon.svg +0 -3
- package/public/assets/images/dashboard/map-icons/other-events-icon.svg +0 -3
- package/public/assets/images/dashboard/map-icons/other-location-icon.svg +0 -21
- package/public/assets/images/dashboard/map-icons/risk-mitigation-events-icon.svg +0 -3
- package/public/assets/images/dashboard/map-icons/sca_location_pin.svg +0 -4
- package/public/assets/images/dashboard/map-icons/villages-location-icon.svg +0 -21
- package/public/assets/images/dashboard/mine-site.svg +0 -7
- package/public/assets/images/dashboard/programs/key-data.svg +0 -12
- package/public/assets/images/dashboard/programs/key-projects.svg +0 -12
- package/public/assets/images/dashboard/scl-icons/close-icon.svg +0 -4
- package/public/assets/images/dashboard/scl-icons/dot.svg +0 -3
- package/public/assets/images/dashboard/scl-icons/empty-gallery.svg +0 -5
- package/public/assets/images/dashboard/scl-icons/location-icon.svg +0 -14
- package/public/assets/images/dashboard/scl-icons/town-dot.svg +0 -3
- package/public/assets/images/dashboard/scl-icons/town-icon.svg +0 -4
- package/public/assets/images/dashboard/scl-icons/village-icon.svg +0 -6
- package/public/assets/images/dashboard/tif-products/cobalt-bg.png +0 -0
- package/public/assets/images/dashboard/tif-products/cobalt-logo.png +0 -0
- package/public/assets/images/dashboard/tif-products/gold-bg.png +0 -0
- package/public/assets/images/dashboard/tif-products/gold-logo.png +0 -0
- package/public/assets/images/datastake-logo.svg +0 -20
- package/public/assets/images/datastake-white.svg +0 -20
- package/public/assets/images/empty-box.svg +0 -5
- package/public/assets/images/find-information/business-entity.svg +0 -4
- package/public/assets/images/find-information/civil-society.svg +0 -4
- package/public/assets/images/find-information/government.svg +0 -4
- package/public/assets/images/find-information/graphs.png +0 -0
- package/public/assets/images/find-information/individual.svg +0 -11
- package/public/assets/images/find-information/non-stated-arm-group.svg +0 -4
- package/public/assets/images/find-information/other-organisation.svg +0 -4
- package/public/assets/images/find-information/state-security.svg +0 -4
- package/public/assets/images/info-channels/investor.svg +0 -4
- package/public/assets/images/info-channels/mine.svg +0 -4
- package/public/assets/images/info-channels/source.png +0 -0
- package/public/assets/images/kota-bg.jpg +0 -0
- package/public/assets/images/kota-logo-small.svg +0 -2
- package/public/assets/images/kota-logo.svg +0 -2
- package/public/assets/images/logo-new-white-icon.svg +0 -5
- package/public/assets/images/logo-new-white.svg +0 -8
- package/public/assets/images/logo-white.svg +0 -67
- package/public/assets/images/map/assessed.png +0 -0
- package/public/assets/images/map/connected.png +0 -0
- package/public/assets/images/map/disabled.png +0 -0
- package/public/assets/images/map/identified.png +0 -0
- package/public/assets/images/map/position.png +0 -0
- package/public/assets/images/map/treasure-map.png +0 -0
- package/public/assets/images/project-share-info/due-dilligence.svg +0 -3
- package/public/assets/images/project-share-info/event.svg +0 -3
- package/public/assets/images/project-share-info/location.svg +0 -3
- package/public/assets/images/project-share-info/network.svg +0 -3
- package/public/assets/images/project-share-info/stakeholder.svg +0 -10
- package/public/assets/images/tif/antelope-mine-people.png +0 -0
- package/public/assets/images/tif/gesagu-people.png +0 -0
- package/public/assets/images/tif/ironstep-people.png +0 -0
- package/public/assets/images/tif-bg.png +0 -0
- package/public/assets/images/tif-logo-small.svg +0 -3
- package/public/assets/images/tif-logo.svg +0 -9
- package/public/assets/images/verified-user-tif.png +0 -0
- package/public/assets/images/verified-user.svg +0 -100
- package/public/favicons/android-chrome-192x192.png +0 -0
- package/public/favicons/android-chrome-512x512.png +0 -0
- package/public/favicons/apple-touch-icon.png +0 -0
- package/public/favicons/favicon-16x16.png +0 -0
- package/public/favicons/favicon-32x32.png +0 -0
- package/public/favicons/favicon.ico +0 -0
- package/public/favicons/tazama/android-chrome-192x192.png +0 -0
- package/public/favicons/tazama/android-chrome-512x512.png +0 -0
- package/public/favicons/tazama/apple-touch-icon.png +0 -0
- package/public/favicons/tazama/favicon-16x16.png +0 -0
- package/public/favicons/tazama/favicon-32x32.png +0 -0
- package/public/favicons/tazama/favicon.ico +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
// Dashboard/PdfView/index.jsx
|
|
1
2
|
import moment from "moment";
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
5
|
import { formatClassname } from "../../../../../helpers/ClassesHelper";
|
|
5
6
|
|
|
6
7
|
const PAGE_HEIGHT = 1587;
|
|
7
|
-
// margin-top: 20, bottom: 20;
|
|
8
8
|
const FOOTER_HEIGHT = 70;
|
|
9
9
|
const HEADER_HEIGHT = 100;
|
|
10
|
+
const ROW_SPACING = 24; // Spacing between content rows
|
|
11
|
+
const CONTENT_BOTTOM_PADDING = 30; // Extra padding at the very bottom of the last section of the document
|
|
10
12
|
|
|
11
13
|
const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
|
|
12
14
|
const ref = useRef();
|
|
@@ -55,49 +57,81 @@ export default function PdfView({
|
|
|
55
57
|
let _pages = [1];
|
|
56
58
|
let _page = 1;
|
|
57
59
|
|
|
60
|
+
// The total vertical space available for flowing content on each page,
|
|
61
|
+
// considering that HEADER_HEIGHT and FOOTER_HEIGHT are for absolutely positioned elements
|
|
62
|
+
// and content should flow between them.
|
|
63
|
+
const usableContentHeightPerPage = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
64
|
+
|
|
58
65
|
if (keys.length === config.length) {
|
|
59
|
-
let
|
|
66
|
+
let currentFlowHeight = 0; // Tracks height accumulated within the `usableContentHeightPerPage` for the current page
|
|
60
67
|
|
|
68
|
+
// Reset all margins/paddings first for a clean slate
|
|
61
69
|
keys.forEach(k => {
|
|
62
70
|
const { ref } = sectionsConfig[k];
|
|
63
|
-
ref.current
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
if (ref.current) {
|
|
72
|
+
ref.current.style.marginBottom = '0px';
|
|
73
|
+
ref.current.style.marginTop = '0px';
|
|
74
|
+
ref.current.style.paddingBottom = '0px';
|
|
75
|
+
}
|
|
76
|
+
});
|
|
66
77
|
|
|
67
78
|
keys.forEach((k, i) => {
|
|
68
79
|
const { height, ref } = sectionsConfig[k];
|
|
80
|
+
if (!ref.current) return; // Skip if ref is not available yet
|
|
69
81
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
let sectionTopMargin = ROW_SPACING; // Default margin for sections that follow another on the same page
|
|
83
|
+
|
|
84
|
+
// The first section on *any* page (either global first or first on a new page)
|
|
85
|
+
// needs to be offset by HEADER_HEIGHT from the top of the page.
|
|
86
|
+
if (i === 0 || currentFlowHeight === 0) {
|
|
87
|
+
sectionTopMargin = HEADER_HEIGHT;
|
|
73
88
|
}
|
|
74
89
|
|
|
75
|
-
|
|
90
|
+
// Calculate the total height this section would occupy *including its immediate top margin and its own height*.
|
|
91
|
+
let totalHeightForThisSection = sectionTopMargin + height;
|
|
76
92
|
|
|
77
|
-
|
|
78
|
-
|
|
93
|
+
// If it's not the very last section of the document, add the standard row spacing.
|
|
94
|
+
if (i < keys.length - 1) {
|
|
95
|
+
totalHeightForThisSection += ROW_SPACING;
|
|
96
|
+
} else {
|
|
97
|
+
// For the very last section, add the document-level bottom padding.
|
|
98
|
+
totalHeightForThisSection += CONTENT_BOTTOM_PADDING;
|
|
79
99
|
}
|
|
80
100
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
// Check if placing this section (with its calculated space) on the current page
|
|
102
|
+
// would exceed the usable content area for a theoretical page.
|
|
103
|
+
if (currentFlowHeight + totalHeightForThisSection > usableContentHeightPerPage) {
|
|
104
|
+
// This section overflows, so it starts on a new page.
|
|
84
105
|
_page += 1;
|
|
85
106
|
_pages.push(_page);
|
|
86
107
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
108
|
+
// Reset flow height for the new page.
|
|
109
|
+
// This section is now the first on a new page, so its top margin is HEADER_HEIGHT.
|
|
110
|
+
ref.current.style.marginTop = `${HEADER_HEIGHT}px`;
|
|
111
|
+
currentFlowHeight = HEADER_HEIGHT + height; // Start accumulated height for new page
|
|
112
|
+
|
|
113
|
+
// Add row spacing or bottom padding for this section on its new page
|
|
114
|
+
if (i < keys.length - 1) {
|
|
115
|
+
currentFlowHeight += ROW_SPACING;
|
|
116
|
+
} else {
|
|
117
|
+
ref.current.style.paddingBottom = `${CONTENT_BOTTOM_PADDING}px`;
|
|
118
|
+
currentFlowHeight += CONTENT_BOTTOM_PADDING;
|
|
92
119
|
}
|
|
120
|
+
|
|
93
121
|
} else {
|
|
94
|
-
|
|
122
|
+
// This section fits on the current page.
|
|
123
|
+
ref.current.style.marginTop = `${sectionTopMargin}px`;
|
|
124
|
+
currentFlowHeight += totalHeightForThisSection; // Accumulate the height this section takes
|
|
125
|
+
|
|
126
|
+
// Apply special padding for the very last section of the document if it fits on current page
|
|
127
|
+
if (i === keys.length - 1) {
|
|
128
|
+
ref.current.style.paddingBottom = `${CONTENT_BOTTOM_PADDING}px`;
|
|
129
|
+
}
|
|
95
130
|
}
|
|
96
|
-
|
|
97
|
-
})
|
|
131
|
+
});
|
|
98
132
|
setPages(_pages);
|
|
99
133
|
}
|
|
100
|
-
}, [sectionsConfig]);
|
|
134
|
+
}, [sectionsConfig, config.length]);
|
|
101
135
|
|
|
102
136
|
useEffect(() => {
|
|
103
137
|
doSizing();
|
|
@@ -128,22 +162,13 @@ export default function PdfView({
|
|
|
128
162
|
);
|
|
129
163
|
}, [config, onChangeHeight]);
|
|
130
164
|
|
|
131
|
-
// <div className="daf-analysis">
|
|
132
|
-
// <Header title={t('Dashboard Title')} />
|
|
133
|
-
|
|
134
|
-
// <div className="content">
|
|
135
|
-
// <div className="view-content">
|
|
136
|
-
// <div className="daf-analysis-layout">
|
|
137
|
-
// <div className='sections-cont w-pt'>
|
|
138
|
-
// <section>
|
|
139
|
-
|
|
140
165
|
return (
|
|
141
166
|
<div className={contClassName} style={{ position: 'relative' }}>
|
|
142
167
|
{renderDashboard()}
|
|
143
168
|
{pages.map((page) => (
|
|
144
169
|
<>
|
|
145
170
|
<div
|
|
146
|
-
style={{ top: ((page - 1) * PAGE_HEIGHT), width: '100%', height: HEADER_HEIGHT
|
|
171
|
+
style={{ top: ((page - 1) * PAGE_HEIGHT), width: '100%', height: HEADER_HEIGHT, position: 'absolute', left: 0, zIndex: 1000000 }} // Changed height from HEADER_HEIGHT - 24 to HEADER_HEIGHT for consistency
|
|
147
172
|
key={`headers-${page}`}
|
|
148
173
|
className="flex-row dashboard-header"
|
|
149
174
|
>
|
|
@@ -194,14 +219,4 @@ export default function PdfView({
|
|
|
194
219
|
))}
|
|
195
220
|
</div>
|
|
196
221
|
);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
PdfView.propTypes = {
|
|
200
|
-
config: PropTypes.array,
|
|
201
|
-
customClassName: PropTypes.any,
|
|
202
|
-
title: PropTypes.string,
|
|
203
|
-
imgSrc: PropTypes.string,
|
|
204
|
-
userId: PropTypes.string,
|
|
205
|
-
accountId: PropTypes.string,
|
|
206
|
-
documentId: PropTypes.string,
|
|
207
|
-
}
|
|
222
|
+
}
|