@corpsmap/corpsmap 4.1.5 → 4.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corpsmap/corpsmap",
3
- "version": "4.1.5",
3
+ "version": "4.1.9",
4
4
  "main": "dist/corpsmap.umd.js",
5
5
  "module": "dist/corpsmap.es.js",
6
6
  "type": "module",
@@ -5,8 +5,7 @@ export default {
5
5
 
6
6
  getReducer: () => {
7
7
  const initialData = {
8
- // root: process.env.REACT_APP_CM_ENV
9
- root: import.meta.env.VITE_APP_CM_ENV,
8
+ root: window.CM_ENV || "",
10
9
  };
11
10
 
12
11
  return (state = initialData, { type, payload }) => {
@@ -3,13 +3,7 @@ let defaultMapboxToken =
3
3
  // Set value REACT_APP_MAPBOX_TOKEN in application. For instance, Corpsmap-orm, FUDSMIS
4
4
  // For localhost create .env.development REACT_APP_MAPBOX_TOKEN="mapboxToken"
5
5
  // use token if it is undefined
6
- // let mapboxTokenEnvVariable = `${process.env.REACT_APP_MAPBOX_TOKEN}`;
7
- let mapboxTokenEnvVariable = `${import.meta.env.VITE_APP_CM_ENV_MAPBOX_TOKEN}`;
8
-
9
- let mapboxToken =
10
- mapboxTokenEnvVariable === "undefined"
11
- ? defaultMapboxToken
12
- : mapboxTokenEnvVariable;
6
+ let mapboxToken = window.CM_ENV_MAPBOX_TOKEN || defaultMapboxToken;
13
7
 
14
8
  const config = {
15
9
  map: {
@@ -1,6 +1,7 @@
1
1
  import ChangeLogModal from "./change-log-modal";
2
- // const url = `${process.env.REACT_APP_FUDS_CHANGE_LOG_URL}`;
3
- const url = `${import.meta.env.VITE_APP_FUDS_CHANGE_LOG_URL}`;
2
+ function getChangeLogUrl() {
3
+ return window.FUDS_CHANGE_LOG_URL || "";
4
+ }
4
5
  export default {
5
6
  name: "changeLog",
6
7
 
@@ -88,7 +89,7 @@ export default {
88
89
  doGetChangeLogData:
89
90
  () =>
90
91
  ({ dispatch, store, anonGet }) => {
91
- anonGet(url, (err, response, body) => {
92
+ anonGet(getChangeLogUrl(), (err, response, body) => {
92
93
  if (err || response.statusCode !== 200) {
93
94
  } else {
94
95
  try {
@@ -0,0 +1,197 @@
1
+ import React from "react";
2
+ import { connect } from "redux-bundler-react";
3
+ import { SearchInput, SearchResultsList } from "../../application-controls";
4
+ import SelectDistrict from "./select-district";
5
+
6
+ class ChangeLogModal extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+
10
+ this.handleChange = this.handleChange.bind(this);
11
+ this.close = this.close.bind(this);
12
+ this.fomatDate = this.formatDate.bind(this);
13
+ }
14
+
15
+ handleChange(event) {
16
+ const { doSetSearchBarFilter } = this.props;
17
+ doSetSearchBarFilter(event.target.value);
18
+ }
19
+
20
+ close() {
21
+ const { doModalClose } = this.props;
22
+ doModalClose();
23
+ }
24
+
25
+ formatDate(oldDate) {
26
+ let newDate = new Date(oldDate);
27
+ let offset = newDate.getTimezoneOffset() * 60000;
28
+ let newDate2 = new Date(newDate.getTime() + offset);
29
+ newDate2 = newDate2.toLocaleDateString("default", {
30
+ month: "long",
31
+ day: "numeric",
32
+ year: "numeric",
33
+ });
34
+ return newDate2;
35
+ }
36
+
37
+ render() {
38
+ const {
39
+ theme,
40
+ doGetChangeLogData,
41
+ changeLogItems,
42
+ allChangeLogItems,
43
+ searchBarFilter,
44
+ } = this.props;
45
+ const loginDataWk = changeLogItems;
46
+ let districtCodes = [
47
+ ...new Set(allChangeLogItems.map((feature) => feature.district_code)),
48
+ ];
49
+ let options = [];
50
+
51
+ districtCodes.sort().forEach((item, index) => {
52
+ if (item) {
53
+ options.push({
54
+ label: `${item}`,
55
+ value: `${item}`,
56
+ });
57
+ }
58
+ });
59
+
60
+ options.unshift({ label: "All Districts", value: "All" });
61
+
62
+ const arrayDataItems = loginDataWk.map((data) => (
63
+ <div
64
+ key={data.id + data.id + 9876}
65
+ style={
66
+ Object.keys(data).length > 0
67
+ ? { listStyleType: "disc" }
68
+ : { listStyleType: "none" }
69
+ }
70
+ >
71
+ {data.change_date ? (
72
+ <li key={data.change_date + data.id}>
73
+ <b>{this.formatDate(data.change_date)}</b>
74
+ </li>
75
+ ) : null}
76
+ {data.environment ? (
77
+ <li
78
+ key={data.environment + data.id}
79
+ style={{ listStyleType: "none" }}
80
+ >
81
+ <b>Environment:</b> {data.environment}{" "}
82
+ </li>
83
+ ) : null}
84
+ {data.change_type ? (
85
+ <li
86
+ key={data.change_type + data.id}
87
+ style={{ listStyleType: "none" }}
88
+ >
89
+ <b>Change Type:</b> {data.change_type}
90
+ </li>
91
+ ) : null}
92
+ {data.district_code ? (
93
+ <li
94
+ key={data.district_code + data.id}
95
+ style={{ listStyleType: "none" }}
96
+ >
97
+ <b>District:</b> {data.district_code}
98
+ </li>
99
+ ) : null}
100
+ {data.description ? (
101
+ <li
102
+ key={data.description + data.id}
103
+ style={{ listStyleType: "none" }}
104
+ >
105
+ <b>Description:</b> {data.description}
106
+ </li>
107
+ ) : null}
108
+ <br></br>
109
+ </div>
110
+ ));
111
+
112
+ const filterStyle = {
113
+ // paddingLeft: "25px",
114
+ display: "flex",
115
+ justifyContent: "center",
116
+ alignItems: "center",
117
+ gap: "40px",
118
+ width: "700px",
119
+ alignItems: "flex-end",
120
+ // textAlign: "right",
121
+ // alignItems: "flex-end" /* Aligns content to the right */,
122
+ // width: 300px; /* Example width for the container */
123
+ // border: "1px solid lightgray" /* For visualization */,
124
+ padding: "5px",
125
+ };
126
+
127
+ return (
128
+ <div>
129
+ <div className={"cm-modal-header " + theme}>Change Log</div>
130
+
131
+ <div className="cm-modal-body">
132
+ <div style={filterStyle}>
133
+ <label style={{ fontSize: "18px", fontWeight: "bold" }}>
134
+ Change Log
135
+ </label>
136
+ </div>
137
+
138
+ <div style={filterStyle}>
139
+ <label htmlFor="select-district">
140
+ <b>Filter by District:</b>
141
+ </label>
142
+ <SelectDistrict options={options} />
143
+ </div>
144
+
145
+ <div style={filterStyle}>
146
+ <label htmlFor="select-district">
147
+ <b>Search:</b>
148
+ </label>
149
+
150
+ <input
151
+ placeholder="Change Log Search..."
152
+ style={{ width: "200px" }}
153
+ value={searchBarFilter}
154
+ onChange={this.handleChange}
155
+ ></input>
156
+ </div>
157
+ <div
158
+ style={{
159
+ overflow: "auto scroll",
160
+ width: "875px",
161
+ height: "400px",
162
+ whiteSpace: "pre-wrap",
163
+ }}
164
+ >
165
+ <ul>{arrayDataItems}</ul>
166
+ </div>
167
+ </div>
168
+ <div className="cm-modal-footer">
169
+ <br></br>
170
+ <br></br>
171
+ <br></br>
172
+ <button
173
+ style={{ textAlign: "left" }}
174
+ type="Close"
175
+ className={"cm-btn cm-btn-theme " + theme}
176
+ onClick={this.close}
177
+ >
178
+ Close
179
+ </button>
180
+ </div>
181
+ </div>
182
+ );
183
+ }
184
+ }
185
+
186
+ export default connect(
187
+ "selectTheme",
188
+ "selectChangeLogItems",
189
+ "selectAllChangeLogItems",
190
+ "selectSearchBarFilter",
191
+ "doModalClose",
192
+ "doSubmitNotification",
193
+ "doGetChangeLogData",
194
+ "doSearchChangeLogData",
195
+ "doSetSearchBarFilter",
196
+ ChangeLogModal
197
+ );
@@ -22,14 +22,25 @@ class ChangeLogModal extends React.Component {
22
22
  doModalClose();
23
23
  }
24
24
 
25
+ // formatDate(oldDate) {
26
+ // let newDate = new Date(oldDate);
27
+ // newDate = newDate.toLocaleDateString("default", {
28
+ // month: "long",
29
+ // day: "numeric",
30
+ // year: "numeric",
31
+ // });
32
+ // return newDate;
33
+ // }
25
34
  formatDate(oldDate) {
26
35
  let newDate = new Date(oldDate);
27
- newDate = newDate.toLocaleDateString("default", {
36
+ let offset = newDate.getTimezoneOffset() * 60000;
37
+ let newDate2 = new Date(newDate.getTime() + offset);
38
+ newDate2 = newDate2.toLocaleDateString("default", {
28
39
  month: "long",
29
40
  day: "numeric",
30
41
  year: "numeric",
31
42
  });
32
- return newDate;
43
+ return newDate2;
33
44
  }
34
45
 
35
46
  render() {
@@ -1,8 +1,9 @@
1
1
  import ResourcesModal from "./resources-modal";
2
2
  import { createResourceGroup } from "../../openlayers-utils/resource-utilities";
3
3
 
4
- // const url = `${process.env.REACT_APP_FUDS_RESOURCES_URL}`;
5
- const url = `${import.meta.env.VITE_APP_FUDS_RESOURCES_URL}`;
4
+ function getResourcesUrl() {
5
+ return window.FUDS_RESOURCES_URL || "";
6
+ }
6
7
  const defaultHtml = [
7
8
  {
8
9
  name: "FUDSMIS Portal - Default",
@@ -39,7 +40,7 @@ export default {
39
40
  doGetResourceData:
40
41
  () =>
41
42
  ({ dispatch, store, anonGet }) => {
42
- anonGet(url, (err, response, body) => {
43
+ anonGet(getResourcesUrl(), (err, response, body) => {
43
44
  if (err || response.statusCode !== 200) {
44
45
  // On Error Load Test Data
45
46
  dispatch({
@@ -27,15 +27,8 @@ class ResourcesModal extends React.Component {
27
27
  let groups = [];
28
28
 
29
29
  groups = resourceGroups.map((item) => {
30
- // let url =
31
- // `${process.env.REACT_APP_FUDS_RESOURCE_GROUP_IMAGE_URL}` + item.groupId;
32
- let url =
33
- `${import.meta.env.VITE_APP_FUDS_RESOURCE_GROUP_IMAGE_URL}` +
34
- item.groupId;
35
- // let documentURL = `${process.env.REACT_APP_FUDS_RESOURCE_DOCUMENT_URL}`;
36
- let documentURL = `${
37
- import.meta.env.VITE_APP_FUDS_RESOURCE_DOCUMENT_URL
38
- }`;
30
+ let url = (window.FUDS_RESOURCE_GROUP_IMAGE_URL || "") + item.groupId;
31
+ let documentURL = window.FUDS_RESOURCE_DOCUMENT_URL || "";
39
32
 
40
33
  return (
41
34
  <div