@geowiki/evoland 0.15.0-dev.1
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/LICENSE +201 -0
- package/README.md +52 -0
- package/dist/Projects/Details.d.mts +8 -0
- package/dist/Projects/Details.mjs +1 -0
- package/dist/Projects/ProjectList.d.mts +5 -0
- package/dist/Projects/ProjectList.mjs +1 -0
- package/dist/Projects/ProjectMap.d.mts +16 -0
- package/dist/Projects/ProjectMap.mjs +11 -0
- package/dist/Tasks/TaskPerLocationList.d.mts +7 -0
- package/dist/Tasks/TaskPerLocationList.mjs +1 -0
- package/dist/chunk-KGI5BCCH.mjs +11 -0
- package/dist/chunk-LGVI2HUZ.mjs +8 -0
- package/dist/chunk-Z3RFB5I2.mjs +13 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +4 -0
- package/dist/styles.css +1 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @geowiki/evoland
|
|
2
|
+
|
|
3
|
+
EvoLand satellite imagery annotation and project management components for agricultural monitoring.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @geowiki/evoland
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @geowiki/evoland
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Peer Dependencies
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install react react-dom next leaflet react-leaflet @geowiki/api-proxy @geowiki/core @geowiki/evoland-api-proxy @geowiki/evoland-orval-api-proxy @geowiki/map @geowiki/ui
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## CSS Setup
|
|
20
|
+
|
|
21
|
+
Import the pre-built Tailwind CSS file in your app entry point:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import "@geowiki/evoland/styles.css";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { ProjectList, TaskPerLocationList } from "@geowiki/evoland";
|
|
31
|
+
|
|
32
|
+
function ProjectsPage() {
|
|
33
|
+
return <ProjectList />;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function TasksPage({ locationId }) {
|
|
37
|
+
return <TaskPerLocationList locationId={locationId} />;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## What's Included
|
|
42
|
+
|
|
43
|
+
- **Project components** -- `ProjectList`, `ProjectMap`, `Details` for EvoLand project management
|
|
44
|
+
- **Task components** -- `TaskPerLocationList` for location-based annotation tasks
|
|
45
|
+
|
|
46
|
+
## Dependencies
|
|
47
|
+
|
|
48
|
+
This package depends on `@geowiki/core`, `@geowiki/map`, and `@geowiki/ui` for shared components and utilities, plus `@geowiki/evoland-api-proxy` and `@geowiki/evoland-orval-api-proxy` for API communication.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface ProjectDetailsProps {
|
|
4
|
+
userRole: string;
|
|
5
|
+
}
|
|
6
|
+
declare const ProjectDetails: (props: ProjectDetailsProps) => react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { ProjectDetails, ProjectDetails as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as ProjectDetails, b as default } from '../chunk-Z3RFB5I2.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as ProjectList } from '../chunk-LGVI2HUZ.mjs';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { LocationElement } from '@geowiki/evoland-api-proxy';
|
|
3
|
+
|
|
4
|
+
interface ProjectMapProps {
|
|
5
|
+
projectId: number;
|
|
6
|
+
clusterColor: string;
|
|
7
|
+
annotatedClusterColor: string;
|
|
8
|
+
pinColor: string;
|
|
9
|
+
annotatedPinColor: string;
|
|
10
|
+
userRole: string;
|
|
11
|
+
handleClusterExpand: (e: LocationElement) => void;
|
|
12
|
+
handleStart: (toFix: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const ProjectMap: (props: ProjectMapProps) => react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { ProjectMap as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MapContainer, ZoomControl, TileLayer, Marker, Tooltip, useMap, useMapEvents } from 'react-leaflet';
|
|
2
|
+
import 'leaflet/dist/leaflet.css';
|
|
3
|
+
import { LatLngBounds, icon, LatLng, DivIcon } from 'leaflet';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { Button, Checkbox } from '@geowiki/ui';
|
|
6
|
+
import { useLocationsForProject, useRandomTasksPerLocation } from '@geowiki/core';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var Z=e=>{let[k,f]=useState(4),[n,r]=useState(new LatLngBounds({lat:-90,lng:-180},{lat:90,lng:180})),[a,C]=useState(false),[u,v]=useState(Date.now()),{data:c}=useLocationsForProject({minx:n.getSouthWest().lng<-180?-180:n.getSouthWest().lng,miny:n.getSouthWest().lat<-90?-90:n.getSouthWest().lat,maxx:n.getNorthEast().lng>180?180:n.getNorthEast().lng,maxy:n.getNorthEast().lat>90?90:n.getNorthEast().lat,project_id:e.projectId,only_annotated:a}),{data:d}=useRandomTasksPerLocation({taskForReview:true,pageIdx:0,pageSize:1,locationProjectId:e.projectId}),[w,x]=useState(false),y=icon({iconUrl:'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6" style="fill:'+(a?e.annotatedPinColor:e.pinColor)+';color:transparent"><path stroke-linecap="round" stroke-linejoin="round" d="M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z" /></svg>',iconSize:[25,35]});w||(r(n),x(true));function N(){let t=useMap(),m=useMapEvents({zoomend:()=>{f(m.getZoom()),r(t.getBounds());let g=Date.now();g-u>1e3&&(v(g),console.log("Call API to fetch points",g,u),r(t.getBounds()));}});return null}return jsxs("div",{children:[jsx(Button,{className:"mb-4",onClick:()=>{c?.elements.length>0?e.handleStart(false):alert("No location to annotate");},children:"Start Annotation"}),jsx(Button,{className:"mb-4 ml-4",onClick:()=>{window.location.href="/evoland/tasks?projectId="+e.projectId;},children:"View Tasks"}),jsx(Button,{className:"mb-4 ml-4",onClick:()=>{c?.elements.length>0?e.handleStart(true):alert("No location to fix annotation");},children:"Start Fixing"}),e.userRole=="admin"&&jsx(Button,{className:"mb-4 ml-4",onClick:()=>{d?.task?window.location.href=`/map?projectId=${e.projectId}&locationId=${d?.task?.location_id}&taskId=${d?.task?.task_id}&review=true`:alert("No more tasks to review");},children:"Start Targeted Review"}),jsxs("div",{className:"inline-flex px-4 py-2 float-right",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Show only annotated"}),jsx("dd",{className:"ml-2 leading-6 font-bold text-gray-700",children:jsx(Checkbox,{onClick:()=>C(!a)})})]}),jsxs(MapContainer,{center:new LatLng(.56,46.2),zoom:k,style:{height:"500px",width:"100%"},scrollWheelZoom:true,zoomControl:false,children:[jsx(ZoomControl,{position:"bottomleft"}),jsx(N,{}),jsx(TileLayer,{attribution:'\xA9 <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',url:"https://clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"}),c?.elements.map((t,m)=>jsx(Marker,{title:t.location_id,icon:t.location_id===null?new DivIcon({iconSize:[30,30],html:`<div class='marker-pin-outer' style="background:#00337C;"><div class='marker-pin-inner' style="background:`+(a?e.annotatedClusterColor:e.clusterColor)+`;">${t.n_locations}</div></div>`,className:"custom-div-icon"}):y,position:new LatLng(parseFloat(t.geometry.geometry.coordinates[1]),parseFloat(t.geometry.geometry.coordinates[0])),eventHandlers:{click:()=>{t.location_id!==null&&e.handleClusterExpand(t);}},children:t.location_id===null?jsxs(Tooltip,{children:["count: ",t.n_locations]}):jsx(Tooltip,{direction:"right",offset:[10,1],eventHandlers:{click:()=>{t.location_id!==null&&e.handleClusterExpand(t);}},children:a?jsx("a",{className:"text-xs",children:"Click to Open"}):jsx("a",{className:"text-xs",children:"Click to Annotate"})})},m))]})]})},D=Z;
|
|
10
|
+
|
|
11
|
+
export { D as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as TaskPerLocationList } from '../chunk-KGI5BCCH.mjs';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useTasksPerLocation, useTaskComments, TaskStatus, TaskStatusColor } from '@geowiki/core';
|
|
3
|
+
import L from 'react-data-table-component';
|
|
4
|
+
import { OldCustomInput, Button, Tabs, TabsList, TabsTrigger } from '@geowiki/ui';
|
|
5
|
+
import B from 'next/link';
|
|
6
|
+
import { useRouter } from 'next/router';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var K=b=>{let h=useRouter(),[a,g]=useState("All");var[n,T]=useState(0);let l=10;var[c,v]=useState(),[r,u]=useState();let[s,k]=useState("-last_update_time"),o=h.query.projectId,I=[{name:"Task ID",sortField:"id",selector:e=>e.task_id,cell:e=>jsx(B,{className:"text-xs underline text-primary-600 hover:bg-primary-700",href:a=="Review"?`/map?projectId=${o}&locationId=${e.location_id}&taskId=${e.task_id}&review=true`:`/map?projectId=${o}&locationId=${e.location_id}&taskId=${e.task_id}`,target:"_blank",children:e.task_id}),sortable:true},{name:"Group",sortField:"group_name",selector:e=>e.location_group,sortable:true},{name:"Last Update",sortField:"last_update_time",selector:e=>new Date(e.last_update_time).toLocaleDateString()+" "+(new Date(e.last_update_time).getHours()<10?"0"+new Date(e.last_update_time).getHours():new Date(e.last_update_time).getHours())+":"+(new Date(e.last_update_time).getMinutes()<10?"0"+new Date(e.last_update_time).getMinutes():new Date(e.last_update_time).getMinutes()),sortable:true},{name:"User",sortField:"user_alias",selector:e=>e.user_alias,sortable:true},{name:"Project",selector:e=>e.project_id},{name:"Location",sortField:"location_id",selector:e=>e.location_id,sortable:true},{name:"Status",sortField:"status",selector:e=>e.status,cell:e=>jsx("div",{style:{backgroundColor:TaskStatusColor[e.status]},className:"rounded-lg text-xs pl-1 pr-1",children:TaskStatus[e.status]}),sortable:true},{name:"Comment",cell:(e,m)=>jsx("div",{children:y!==void 0?y.comments[m]:e.index})}],{data:d,isLoading:_}=useTasksPerLocation(s?.includes("location")?{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),locationOrderBy:s,search:r||null}:s?.includes("user")?{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),userOrderBy:s,search:r||null}:s?.includes("group")?{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),groupOrderBy:s.split("group_")[1],search:r||null}:{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),orderBy:s,search:r||null}),{data:y}=useTaskComments(d?.tasks.map(e=>e.task_id)||[]),S=e=>{var m=e-1;T(m);},C=e=>{s.includes(e.sortField)?k(s.includes("-")?e.sortField:"-"+e.sortField):k(e.sortField);},w=()=>d?.tasks,F={noRowsPerPage:true};return _?null:jsx("div",{className:" mx-auto px-2 h-auto",children:jsxs("div",{className:"items-center p-4",children:[jsx("div",{className:"flex",children:jsx("div",{className:"text-md font-semibold text-center leading-7 text-gray-900",children:"Tasks per Location"})}),jsx("div",{className:"flex",children:jsxs("div",{className:"text-md font-semibold text-center leading-7 text-gray-900 flex",children:[jsx(OldCustomInput,{name:"Search",type:"text",value:c,onKeyDown:e=>{e=="Enter"&&u(c);},onChange:e=>{v(e);}}),jsx(Button,{className:"ml-5 mt-2",onClick:()=>{u(c);},children:"Search"}),jsx(Button,{className:"ml-5 mt-2",onClick:()=>{v(""),u(null);},children:"Clear"})]})}),b.userRole=="admin"&&jsx(Tabs,{value:a,orientation:"vertical",className:"mt-2",children:jsxs(TabsList,{className:"w-30",children:[jsx(TabsTrigger,{value:"All",className:(a=="All"?"bg-primary text-secondary ":"bg-white text-primary ")+"w-full",asChild:true,children:jsx("div",{onClick:()=>g("All"),className:a=="All"?"pointer-events: none":"hover:cursor-pointer",children:"All"})}),jsx(TabsTrigger,{value:"Review",className:(a=="Review"?"bg-primary text-secondary ":"bg-white text-primary ")+"w-full",asChild:true,children:jsx("div",{onClick:()=>g("Review"),className:a=="Review"?"pointer-events: none":"hover:cursor-pointer",children:"Review"})})]})}),jsx("div",{className:"mx-auto px-4 py-5",children:jsx(L,{columns:I,data:d?.tasks??[],paginationTotalRows:d?.total_tasks,progressPending:_,paginationComponentOptions:F,pagination:true,paginationServer:true,onChangePage:S,sortFunction:w,onSort:C})})]})})};
|
|
10
|
+
|
|
11
|
+
export { K as a };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useProjects } from '@geowiki/core';
|
|
2
|
+
import r from '@geowiki/map/src/store/evoland';
|
|
3
|
+
import { AuthenticationFailure } from '@geowiki/ui';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var u=()=>{let s=r(),{data:i,isLoading:d,error:o}=useProjects(true,0,50);return d?null:(o?.message==="Unauthorized"&&(s.sessionTimeOut==false||s.sessionTimeOut==null)&&s.setSessionTimeOut(true),jsxs("div",{className:" mx-auto px-2 h-auto",children:[s.sessionTimeOut&&jsx(AuthenticationFailure,{}),jsx("div",{className:"md:flex md:items-center md:justify-between p-4",children:jsx("div",{className:"min-w-0 flex-1",children:jsx("h2",{className:"text-2xl font-bold text-center leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight",children:"Projects"})})}),jsx("ul",{role:"list",className:"mx-auto max-w-6xl grid grid-cols-1 gap-x-6 gap-y-8 lg:grid-cols-4 xl:gap-x-2 w-70 h-48 px-2 ",children:i?.projects?.map(t=>jsx("li",{className:"overflow-hidden border border-gray-700 ",children:jsxs("button",{onClick:()=>{location.href="/evoland/projects?projectId="+t.project_id;},className:"w-full h-auto",children:[jsx("div",{className:"flex items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-6 ",children:jsx("div",{className:"text-sm font-medium leading-6 text-gray-900",children:t.project_name})}),jsxs("dl",{className:"-my-3 divide-y divide-gray-100 px-6 py-4 text-sm leading-6",children:[jsxs("div",{className:"flex justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500",children:"Created on"}),jsx("dd",{className:"text-gray-700",children:jsx("time",{dateTime:t.creation_date,children:t.creation_date})})]}),jsxs("div",{className:"flex justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500",children:"No of Points"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:t.n_locations})})]})]})]},t.project_id)},t.project_id))})]}))};
|
|
7
|
+
|
|
8
|
+
export { u as a };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useRouter } from 'next/router';
|
|
2
|
+
import { useProjectDetails, useGroupsInProject, useProjectUsers, useProjectsPointsDownload, useLocationBulkUpload, useTaskBulkUpload, useReviewTaskBulkUpload, useProjectResultSet, useProjectStatisticsByUser, useContractStatisticsByUser, useUpdateActiveGroupInProject, downloadJSON, downloadData } from '@geowiki/core';
|
|
3
|
+
import { TaskService } from '@geowiki/evoland-api-proxy';
|
|
4
|
+
import { LoaderFull, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, OldCustomInput, PieChart } from '@geowiki/ui';
|
|
5
|
+
import Ae from 'next/dynamic';
|
|
6
|
+
import Fe from '@geowiki/map/src/store/evoland';
|
|
7
|
+
import { useState, useRef } from 'react';
|
|
8
|
+
import { createTask } from '@geowiki/map/src/utils/EvolandUtils';
|
|
9
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var Ee=Ae(()=>import('./Projects/ProjectMap.mjs'),{loading:()=>jsx("p",{children:"Loading..."}),ssr:false}),Be=n=>{let v=useRouter(),i=parseInt(v.query.projectId),f=Fe(),[w,T]=useState(false),[de,ne]=useState(true),[U,M]=useState(false),[x,A]=useState(true),{data:s}=useProjectDetails(i,x),{data:d}=useGroupsInProject(i,w),{data:m}=useProjectUsers(i),{data:F}=useProjectsPointsDownload(i,U,n.userRole),[b,G]=useState(null),[u,k]=useState("2024-01-01"),[p,E]=useState(new Date().toISOString().split("T")[0]),h=useRef(null),j=useRef(null),C=useRef(null),[B,O]=useState(false),[D,V]=useState([0,"Select Group"]),[W,$]=useState(null),[q,Y]=useState(null),[J,z]=useState(null),[H,Q]=useState(null),[K,X]=useState(null),{data:Z,isLoading:ce}=useLocationBulkUpload(B,W,i,D[0]),{data:ee,isLoading:me}=useTaskBulkUpload(q,J,i),{data:te,isLoading:ue}=useReviewTaskBulkUpload(H,K,i),[I,R]=useState(false),[se,ae]=useState(false),{data:P,isLoading:pe}=useProjectResultSet(I,i,se),_=[{clusterColor:"#03C988",annotatedClusterColor:"#d5a6bd",pinColor:"brown",annotatedPinColor:"yellow"},{clusterColor:"#45818e",annotatedClusterColor:"#f1c232",pinColor:"blue",annotatedPinColor:"white"},{clusterColor:"#660000",annotatedClusterColor:"#c90076",pinColor:"green",annotatedPinColor:"indigo"},{clusterColor:"#5f6600",annotatedClusterColor:"#0068c9",pinColor:"pink",annotatedPinColor:"aqua"},{clusterColor:"#8703c9",annotatedClusterColor:"#61c900",pinColor:"orange",annotatedPinColor:"purple"}];n.userRole=="admin"&&s&&de&&(k(s?.start_date),ne(false));let{data:y}=useProjectStatisticsByUser(i,u,p,b),{data:ge}=useContractStatisticsByUser(i,u,p,b);s!==void 0&&x&&!w&&A(!x);let L=(e,o="data.xlsx")=>{g?.length==0||g?.filter(r=>r.value!==0).length==0?alert("No data to download"):downloadData(e,o);},g=[{label:"Submitted",value:y?.statistics?.reduce((e,o)=>e+o.submitted_tasks,0)},{label:"Accepted",value:y?.statistics?.reduce((e,o)=>e+o.accepted_tasks,0)},{label:"In Review",value:y?.statistics?.reduce((e,o)=>e+o.in_review_tasks,0)}],[c,ve]=useState(d?.filter(e=>e.is_active===true)[0]?(d?.filter(e=>e.is_active===true)[0]).group_id:0),{data:oe,isLoading:le}=useUpdateActiveGroupInProject(i,c,w);if(!le&&oe?.success&&(T(false),alert(oe?.success?"Active group updated successfully as "+d?.filter(e=>e.group_id==c)[0].group_name:"Please try again")),le)return jsx(LoaderFull,{});if(n.userRole=="admin"&&F&&(L(F,s?.project_name+"_locations.xlsx"),M(false)),Z&&!ce){let e=new Date(Date.now());O(false),$(null),downloadJSON(Z,"locations_uploaded_on_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".json"),V([0,"Select Group"]);}if(ee&&!me){let e=new Date(Date.now());Y(false),z(null),downloadJSON(ee,"tasks_uploaded_on_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".json");}if(te&&!ue){let e=new Date(Date.now());Q(false),X(null),downloadJSON(te,"review_tasks_uploaded_on_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".json");}if(P&&!pe){let e=new Date(Date.now());R(false),se?downloadJSON(P,s.project_name+"_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".geojson"):downloadData(P,s.project_name+"_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".csv");}return jsxs("div",{className:"bg-white lg:px-2",children:[jsxs("div",{className:"flex",children:[n.userRole=="admin"&&jsxs("div",{className:"w-[25%] flex-col",children:[jsx("div",{className:"w-50 text-md text-center font-bold tracking-tight text-gray-900 m-5 sm:text-2xl",children:"Manage"}),jsxs("fieldset",{className:"border p-4 rounded m-4",children:[jsx("legend",{children:"Upload"}),jsxs("div",{className:"flex",children:["Locations",jsxs("div",{className:"ml-5",children:[jsx("input",{ref:h,type:"file",className:"block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-violet-50 file:text-violet-700 hover:file:bg-violet-100",onChange:e=>$(e.target.files[0])}),jsxs("div",{className:"flex flex-row pb-3",children:[jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{className:"w-full text-sm p-2 bg-primary h-8 text-secondary",children:D[1]}),jsx(DropdownMenuContent,{children:d?.sort((e,o)=>o.is_active-e.is_active).map((e,o)=>jsx(DropdownMenuItem,{className:"text-xs",id:""+e.group_id,onSelect:()=>{V([e.group_id,e.group_name]);},children:e.group_name},o))})]}),jsx("div",{className:"w-6 h-6 ml-2",children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"size-6 "+(D[0]!=0&&W&&!B?"hover:cursor-pointer":"pointer-events-none"),onClick:()=>{O(true),h.current&&(h.current.value="");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"}),jsx("title",{children:"Upload locations for selected group"})]})})]})]})]}),jsxs("div",{className:"flex pt-3",children:["Tasks",jsxs("div",{className:"ml-5 flex",children:[jsx("input",{ref:j,type:"file",className:"block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-violet-50 file:text-violet-700 hover:file:bg-violet-100",onChange:e=>z(e.target.files[0])}),jsx("div",{className:"w-6 h-6 ml-1",children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"size-6 "+(J&&!q?"hover:cursor-pointer":"pointer-events-none"),onClick:()=>{Y(true),j.current&&(j.current.value="");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"}),jsx("title",{children:"Upload tasks for this project"})]})})]})]}),jsxs("div",{className:"flex pt-3",children:["Review",jsxs("div",{className:"ml-5 flex",children:[jsx("input",{ref:C,type:"file",className:"block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-violet-50 file:text-violet-700 hover:file:bg-violet-100",onChange:e=>X(e.target.files[0])}),jsx("div",{className:"w-6 h-6 ml-1",children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"size-6 "+(K&&!H?"hover:cursor-pointer":"pointer-events-none"),onClick:()=>{Q(true),C.current&&(C.current.value="");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"}),jsx("title",{children:"Upload review tasks for this project"})]})})]})]})]}),jsxs("fieldset",{className:"border p-4 rounded m-4",children:[jsx("legend",{children:"Download"}),s?.meta_data?.QUESTIONNAIRE&&s?.meta_data?.QUESTIONNAIRE==true&&jsxs("div",{className:"flex",children:[jsx("div",{children:"Questionnaire"}),jsx("a",{className:"pl-2 w-10 underline text-primary "+(I?"pointer-events-none":"hover:cursor-pointer"),onClick:()=>{R(true),ae(false);},children:"CSV"}),jsx("a",{className:"pl-2 underline text-primary "+(I?"pointer-events-none":"hover:cursor-pointer"),onClick:()=>{R(true),ae(true);},children:"Geo Json"})]})]})]}),jsxs("div",{className:"items-center justify-center flex flex-col border-gray-200 border-2 "+(n.userRole=="admin"?"w-[55%]":"w-full"),children:[jsx("div",{className:"text-md text-center font-bold tracking-tight text-gray-900 m-5 sm:text-2xl",children:"Details"}),jsxs("div",{className:"px-4 sm:px-0 w-full",children:[jsx("div",{className:"mt-6 border-t border-gray-100 w-full",children:jsxs("dl",{className:"divide-y divide-gray-100 text-left lg:px-8 xl:px-12 ",children:[jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Title"}),jsx("dd",{className:"mt-1 leading-6 font-bold text-lg text-gray-700 sm:col-span-2 sm:mt-0",children:s?.project_name})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Id"}),jsx("dd",{title:n.userRole=="admin"?"Download all location's coordinates for this project":"",className:"mt-1 leading-6 font-bold text-gray-700 sm:col-span-2 sm:mt-0"+(n.userRole=="admin"&&!U?" underline text-primary hover:cursor-pointer":""),onClick:()=>{M(true);},children:s?.project_id})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"No of Points in group"}),jsx("dd",{className:"mt-1 leading-6 font-bold text-gray-700 sm:col-span-2 sm:mt-0",children:s?.n_locations_group})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Overall project progress"}),jsxs("dd",{className:"mt-1 sm:col-span-2 sm:mt-0 flex flex-row ",children:[jsx("div",{style:{width:(s?.proj_completed_locations||0)/(s?.n_locations||1)*100+"%"},className:"bg-primary text-xs",title:"Completed: "+s?.proj_completed_locations}),jsx("div",{style:{width:(s?.proj_submitted_locations||0)/(s?.n_locations||1)*100+"%"},className:"bg-green-300 text-xs",title:"Submitted: "+s?.proj_submitted_locations}),jsx("div",{style:{width:100-((s?.proj_completed_locations||0)+(s?.proj_submitted_locations||0))/(s?.n_locations||1)*100+"%"},className:"bg-gray-300 text-xs",title:"Remaining: "+((s?.n_locations||0)-((s?.proj_completed_locations||0)+(s?.proj_submitted_locations||0)))}),jsxs("div",{className:"text-xs flex items-center",children:[(s?.proj_completed_locations||0)+(s?.proj_submitted_locations||0),"/",s?.n_locations]})]})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Overall group progress"}),jsxs("dd",{className:"mt-1 sm:col-span-2 sm:mt-0 flex flex-row ",children:[jsx("div",{style:{width:(s?.group_completed_locations||0)/(s?.n_locations_group||1)*100+"%"},className:"bg-primary text-xs",title:"Completed: "+s?.group_completed_locations}),jsx("div",{style:{width:(s?.group_submitted_locations||0)/(s?.n_locations_group||1)*100+"%"},className:"bg-green-300 text-xs",title:"Submitted: "+s?.group_submitted_locations}),jsx("div",{style:{width:100-((s?.group_completed_locations||0)+(s?.group_submitted_locations||0))/(s?.n_locations_group||1)*100+"%"},className:"bg-gray-300 text-xs",title:"Remaining: "+((s?.n_locations_group||0)-((s?.group_completed_locations||0)+(s?.group_submitted_locations||0)))}),jsxs("div",{className:"text-xs flex items-center",children:[(s?.group_completed_locations||0)+(s?.group_submitted_locations||0),"/",s?.n_locations_group]})]})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"My progress in current group"}),jsx("dd",{className:"mt-1 leading-6 font-bold text-gray-700 sm:col-span-2 sm:mt-0",children:s?.user_contributions})]})]})}),jsxs("ul",{role:"list",className:"px-2 w-full",children:[jsxs("li",{className:"border border-gray-700 m-5 flex",children:[jsx("div",{className:"items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-4",children:jsx("div",{className:"text-sm font-semibold leading-6 text-gray-900",children:"My Statistics"})}),jsxs("dl",{className:"-my-3 divide-y divide-gray-100 px-3 py-4 text-sm leading-6 flex",children:[jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"All submissions"}),jsx("dd",{className:"text-gray-700",children:jsx("div",{className:"font-medium text-gray-900",children:Math.round((s?.user_tasks_in_review||0)+(s?.user_tasks_to_fix||0)+(s?.user_discarded_tasks||0)+(s?.user_tasks_accepted||0)+(s?.user_task_submitted||0))})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"In Review"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_tasks_in_review})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"To Fix"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_tasks_to_fix})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"Discarded"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_discarded_tasks})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"Accepted"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_tasks_accepted})})]})]})]},"userStats"),n.userRole=="admin"&&jsxs(Fragment,{children:[jsxs("li",{className:"flex border border-gray-700 m-5",children:[jsx("div",{className:"items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-4",children:jsx("div",{className:"text-sm font-semibold leading-6 text-gray-900",children:"Project Statistics"})}),jsxs("dl",{className:"-my-3 divide-y divide-gray-100 px-6 py-4 text-sm leading-6 flex",children:[jsxs("div",{className:"flex items-center mr-2 justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"In Review"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.project_tasks_in_review})})]}),jsxs("div",{className:"flex items-center ml-4 mr-2 justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"To Fix"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.project_tasks_to_fix})})]}),jsxs("div",{className:"flex items-center ml-4 mr-2 justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"Accepted"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.project_tasks_accepted})})]})]})]},"projectStats"),jsxs("li",{className:"border border-gray-700 m-5 h-50 overflow-y-scroll",children:[jsx("div",{className:"flex items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-4",children:jsx("div",{className:"text-sm font-semibold leading-4 text-gray-900",children:"Groups in Project"})}),jsxs("dl",{className:"flex flex-row px-6 py-2 text-sm leading-6 bg-gray-200",children:[jsx("div",{className:"mr-2 w-full",children:jsx("dt",{className:"text-gray-500",children:"Name"})}),jsx("div",{className:"ml-2 mr-2 w-full",children:jsx("dt",{className:"text-gray-500",children:"Locations"})}),jsx("div",{className:"ml-2 w-full",children:jsx("dt",{className:"text-gray-500",children:"Status"})})]}),d?.sort((e,o)=>o.is_active-e.is_active).map((e,o)=>jsxs("dl",{className:"flex flex-row px-6 py-4 text-sm leading-6 -my-3 divide-y divide-gray-100",children:[jsx("dt",{className:"mr-2 font-medium text-gray-900 w-full",children:e.group_name}),jsx("dt",{className:"ml-2 mr-2 font-medium text-gray-900 w-full",children:e.n_locations}),jsx("dt",{className:"ml-2 font-medium text-gray-900 w-full",children:jsx("div",{className:e.is_active?"":"underline text-blue-500 hover:cursor-pointer",title:e.is_active?"":"Make this current active group",onClick:()=>{e.is_active||(T(true),A(!x),ve(e.group_id));},children:e.is_active?"Active":"Not Active"})})]},o))]},"groupsInProject")]})]})]})]}),jsxs("div",{className:"w-[20%] ml-5 flex-col",children:[jsx("div",{className:"text-md text-center font-bold tracking-tight text-gray-900 m-5 sm:text-2xl",children:"Data"}),jsxs("div",{className:"mb-2 text-xs",children:[jsxs("div",{className:"mt-1 inline-flex",children:[jsx("div",{children:"From"}),jsx(OldCustomInput,{cssClass:"h-5 flex text-xs text-black ml-1",displayText:"From",noDisplayTextAsLabel:true,type:"date",value:u,onChange:e=>{k(e.toString());}})]}),jsxs("div",{className:"inline-flex ml-1 mt-1",children:[jsx("div",{className:"w-6",children:"To"}),jsx(OldCustomInput,{cssClass:"h-5 flex text-xs text-black ml-1",displayText:"To",noDisplayTextAsLabel:true,type:"date",value:p,onChange:e=>{E(e.toString());}})]})]}),jsx("div",{className:"inline-flex",children:m&&jsxs("select",{className:"text-xs",onChange:e=>{e.target.selectedIndex!==0?(G(m[e.target.selectedIndex-1].user_alias),k(m[e.target.selectedIndex-1].contract_start_date?m[e.target.selectedIndex-1].contract_start_date:u),E(m[e.target.selectedIndex-1].contract_end_date?m[e.target.selectedIndex-1].contract_end_date:p),localStorage.setItem("searchUser",m[e.target.selectedIndex-1].user_alias)):(G(null),localStorage.removeItem("searchUser"));},children:[jsx("option",{value:"0",children:"Select User"}),m?.map((e,o)=>jsx("option",{value:e.user_id,selected:b==e.user_alias,children:e.user_alias},o))]})}),jsxs("div",{className:"ml-2 inline-flex",children:[jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 pt-1 hover:cursor-pointer",onClick:()=>{L(y?.statistics.map(e=>({user_id:e.user_id,user_alias:e.user_alias,submitted_tasks:e.submitted_tasks,in_review_tasks:e.in_review_tasks,accepted_tasks:e.accepted_tasks,skipped_tasks:e.skipped_tasks,user_discarded_tasks:e.user_discarded_tasks,discarded_tasks:e.discarded_tasks,to_fix_tasks:e.to_fix_tasks,all_finished_tasks:e.all_finished_tasks,min_time:e.min_time,max_time:e.max_time,mean_time:e.mean_time})),"Project_data_"+u+"_"+p+".xlsx");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}),jsx("title",{children:"Download Project data"})]}),n.userRole=="admin"&&jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 pt-1 bg-primary rounded text-white hover:cursor-pointer",onClick:()=>L(ge?.statistics,"Contractual_data.xlsx"),children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}),jsx("title",{children:"Download Contractual data"})]})]}),jsxs("div",{children:[g?.length==0||g?.filter(e=>e.value!==0).length==0&&jsx("div",{className:"pt-5 text-center",children:"No Data"}),jsx(PieChart,{innerRadius:0,outerRadius:100,data:g?.filter(e=>e.value!==0)})]})]})]}),jsx("div",{className:"mx-auto max-w-screen pt-4 text-center",children:jsx(Ee,{projectId:i,userRole:n.userRole,handleClusterExpand:e=>{createTask(e.location_id,i,s.project_reference_date.toString()).then(({location:o,currentTask:r,annotation_dates:fe})=>{o&&f.setLocation(o),r?(f.setCurrentTask(r),f.setAnnotationDates(fe),v.push(`/map?projectId=${i}&locationId=${e.location_id}&taskId=${r?.task_id}`).then()):alert("No task for you on this location");});},clusterColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].clusterColor,annotatedClusterColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].annotatedClusterColor,pinColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].pinColor,annotatedPinColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].annotatedPinColor,handleStart:async e=>{let o={project_id:i,only_not_submitted:true,reference_date:s?.project_reference_date.toString(),to_fix:e};var r=await TaskService.getNextLocationNexttaskPost(o);r!=null&&(r.exists==false&&r.location==null?(alert("No more locations are left to "+(e?"fix":"annotate")+" for you"),v.push("/evoland/projects")):r.location!=null&&r.task==null?alert("Please try again"):(f.setTimerReset(true),v.push(`/map?projectId=${i}&locationId=${r.location?.location_id}&taskId=${r.task?.task_id}`).then()));}})})]})},Xe=Be;
|
|
12
|
+
|
|
13
|
+
export { Be as a, Xe as b };
|
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
package/dist/styles.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pointer-events-none{pointer-events:none}.float-right{float:right}.m-4{margin:1rem}.m-5{margin:1.25rem}.-my-3{margin-top:-.75rem;margin-bottom:-.75rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-5{margin-left:1.25rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-6{margin-top:1.5rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-auto{height:auto}.w-10{width:2.5rem}.w-6{width:1.5rem}.w-\[20\%\]{width:20%}.w-\[25\%\]{width:25%}.w-\[55\%\]{width:55%}.w-full{width:100%}.min-w-0{min-width:0}.max-w-6xl{max-width:72rem}.flex-1{flex:1 1 0%}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.gap-y-8{row-gap:2rem}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px*var(--tw-divide-y-reverse))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(243 244 246/var(--tw-divide-opacity))}.overflow-hidden{overflow:hidden}.overflow-y-scroll{overflow-y:scroll}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity))}.border-gray-900\/5{border-color:#1118270d}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.bg-green-300{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity))}.bg-primary{background-color:var(--primary)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.pb-3{padding-bottom:.75rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pr-1{padding-right:.25rem}.pt-1{padding-top:.25rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-4{line-height:1rem}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.tracking-tight{letter-spacing:-.025em}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-primary{color:var(--primary)}.text-primary-600{color:var(--primary-600)}.text-secondary{color:var(--secondary)}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.underline{text-decoration-line:underline}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.file\:mr-4::file-selector-button{margin-right:1rem}.file\:rounded-full::file-selector-button{border-radius:9999px}.file\:border-0::file-selector-button{border-width:0}.file\:bg-violet-50::file-selector-button{--tw-bg-opacity:1;background-color:rgb(245 243 255/var(--tw-bg-opacity))}.file\:px-4::file-selector-button{padding-left:1rem;padding-right:1rem}.file\:py-2::file-selector-button{padding-top:.5rem;padding-bottom:.5rem}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-semibold::file-selector-button{font-weight:600}.file\:text-violet-700::file-selector-button{--tw-text-opacity:1;color:rgb(109 40 217/var(--tw-text-opacity))}.hover\:cursor-pointer:hover{cursor:pointer}.hover\:bg-primary-700:hover{background-color:var(--primary-700)}.hover\:file\:bg-violet-100::file-selector-button:hover{--tw-bg-opacity:1;background-color:rgb(237 233 254/var(--tw-bg-opacity))}@media (min-width:640px){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:mt-0{margin-top:0}.sm\:grid{display:grid}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:gap-4{gap:1rem}.sm\:truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sm\:px-0{padding-left:0;padding-right:0}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:tracking-tight{letter-spacing:-.025em}}@media (min-width:768px){.md\:flex{display:flex}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}}@media (min-width:1024px){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:px-2{padding-left:.5rem;padding-right:.5rem}.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width:1280px){.xl\:gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.xl\:px-12{padding-left:3rem;padding-right:3rem}}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@geowiki/evoland",
|
|
3
|
+
"version": "0.15.0-dev.1",
|
|
4
|
+
"main": "./dist/index.mjs",
|
|
5
|
+
"types": "./dist/index.d.mts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"README.md"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"next": "15.5.3",
|
|
16
|
+
"react": "^18.2.0",
|
|
17
|
+
"leaflet": "^1.9.4",
|
|
18
|
+
"react-leaflet": "^4.2.1",
|
|
19
|
+
"react-dom": "^18.2.0",
|
|
20
|
+
"@geowiki/api-proxy": "0.15.0-dev.1",
|
|
21
|
+
"@geowiki/core": "0.15.0-dev.1",
|
|
22
|
+
"@geowiki/evoland-api-proxy": "0.15.0-dev.1",
|
|
23
|
+
"@geowiki/evoland-orval-api-proxy": "0.15.0-dev.1",
|
|
24
|
+
"@geowiki/map": "0.15.0-dev.1",
|
|
25
|
+
"@geowiki/ui": "0.15.0-dev.1"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@headlessui/react": "^1.7.16",
|
|
29
|
+
"react-data-table-component": "^7.5.3",
|
|
30
|
+
"@heroicons/react": "^2.0.18"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "18.11.18",
|
|
34
|
+
"@types/react": "^18.2.0",
|
|
35
|
+
"@types/leaflet": "^1.9.0",
|
|
36
|
+
"eslint": "^8.34.0",
|
|
37
|
+
"postcss": "^8.4.21",
|
|
38
|
+
"tailwindcss": "^3.3.3",
|
|
39
|
+
"@tailwindcss/typography": "^0.5.9",
|
|
40
|
+
"@tailwindcss/forms": "^0.5.3",
|
|
41
|
+
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
42
|
+
"tailwindcss-animate": "^1.0.7",
|
|
43
|
+
"autoprefixer": "^10.4.14",
|
|
44
|
+
"tsup": "^8.0.2",
|
|
45
|
+
"typescript": "5.4.2",
|
|
46
|
+
"eslint-config-custom": "0.0.0",
|
|
47
|
+
"tailwind-config": "0.0.0",
|
|
48
|
+
"tsconfig": "0.0.0"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup && tailwindcss -i src/styles.css -o dist/styles.css --minify",
|
|
52
|
+
"check-types": "tsc --noEmit",
|
|
53
|
+
"type-check": "tsc --noEmit"
|
|
54
|
+
},
|
|
55
|
+
"module": "./dist/index.mjs",
|
|
56
|
+
"exports": {
|
|
57
|
+
".": {
|
|
58
|
+
"import": "./dist/index.mjs",
|
|
59
|
+
"types": "./dist/index.d.mts"
|
|
60
|
+
},
|
|
61
|
+
"./styles.css": "./dist/styles.css"
|
|
62
|
+
}
|
|
63
|
+
}
|