diff --git a/.env b/.env new file mode 100644 index 0000000..06f14a9 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +REACT_APP_API_URL = https://pynetti.duckdns.org \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d29575 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/Icon-sources.txt b/Icon-sources.txt old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/android/.gitignore b/android/.gitignore old mode 100755 new mode 100644 diff --git a/android/.idea/codeStyles/Project.xml b/android/.idea/codeStyles/Project.xml old mode 100755 new mode 100644 diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml old mode 100755 new mode 100644 diff --git a/android/.idea/runConfigurations.xml b/android/.idea/runConfigurations.xml old mode 100755 new mode 100644 diff --git a/android/app/.npmignore b/android/app/.npmignore old mode 100755 new mode 100644 diff --git a/android/app/build.gradle b/android/app/build.gradle old mode 100755 new mode 100644 diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle old mode 100755 new mode 100644 diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro old mode 100755 new mode 100644 diff --git a/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java b/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java old mode 100755 new mode 100644 diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml old mode 100755 new mode 100644 diff --git a/android/app/src/main/java/io/ionic/starter/MainActivity.java b/android/app/src/main/java/io/ionic/starter/MainActivity.java old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-land-hdpi/splash.png b/android/app/src/main/res/drawable-land-hdpi/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-land-mdpi/splash.png b/android/app/src/main/res/drawable-land-mdpi/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-land-xhdpi/splash.png b/android/app/src/main/res/drawable-land-xhdpi/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-land-xxhdpi/splash.png b/android/app/src/main/res/drawable-land-xxhdpi/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-land-xxxhdpi/splash.png b/android/app/src/main/res/drawable-land-xxxhdpi/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-port-hdpi/splash.png b/android/app/src/main/res/drawable-port-hdpi/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-port-mdpi/splash.png b/android/app/src/main/res/drawable-port-mdpi/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-port-xhdpi/splash.png b/android/app/src/main/res/drawable-port-xhdpi/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-port-xxhdpi/splash.png b/android/app/src/main/res/drawable-port-xxhdpi/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-port-xxxhdpi/splash.png b/android/app/src/main/res/drawable-port-xxxhdpi/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable/ic_launcher_background.xml b/android/app/src/main/res/drawable/ic_launcher_background.xml old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable/launch_splash.xml b/android/app/src/main/res/drawable/launch_splash.xml old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/drawable/splash.png b/android/app/src/main/res/drawable/splash.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/layout/activity_main.xml b/android/app/src/main/res/layout/activity_main.xml old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/values/ic_launcher_background.xml b/android/app/src/main/res/values/ic_launcher_background.xml old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml old mode 100755 new mode 100644 diff --git a/android/app/src/main/res/xml/file_paths.xml b/android/app/src/main/res/xml/file_paths.xml old mode 100755 new mode 100644 diff --git a/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java b/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java old mode 100755 new mode 100644 diff --git a/android/build.gradle b/android/build.gradle old mode 100755 new mode 100644 diff --git a/android/capacitor.settings.gradle b/android/capacitor.settings.gradle old mode 100755 new mode 100644 diff --git a/android/gradle.properties b/android/gradle.properties old mode 100755 new mode 100644 diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar old mode 100755 new mode 100644 diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties old mode 100755 new mode 100644 diff --git a/android/gradlew b/android/gradlew old mode 100755 new mode 100644 diff --git a/android/gradlew.bat b/android/gradlew.bat old mode 100755 new mode 100644 diff --git a/android/settings.gradle b/android/settings.gradle old mode 100755 new mode 100644 diff --git a/ionic.config.json b/ionic.config.json old mode 100755 new mode 100644 diff --git a/package-lock.json b/package-lock.json old mode 100755 new mode 100644 diff --git a/package.json b/package.json old mode 100755 new mode 100644 diff --git a/public/add.png b/public/add.png old mode 100755 new mode 100644 diff --git a/public/assets/icon/favicon.png b/public/assets/icon/favicon.png old mode 100755 new mode 100644 diff --git a/public/assets/icon/icon.png b/public/assets/icon/icon.png old mode 100755 new mode 100644 diff --git a/public/assets/shapes.svg b/public/assets/shapes.svg old mode 100755 new mode 100644 diff --git a/public/favicon.ico b/public/favicon.ico old mode 100755 new mode 100644 diff --git a/public/index.html b/public/index.html old mode 100755 new mode 100644 diff --git a/public/logo192.png b/public/logo192.png old mode 100755 new mode 100644 diff --git a/public/logo512.png b/public/logo512.png old mode 100755 new mode 100644 diff --git a/public/manifest.json b/public/manifest.json old mode 100755 new mode 100644 diff --git a/public/newField.png b/public/newField.png old mode 100755 new mode 100644 diff --git a/public/newMarker.png b/public/newMarker.png old mode 100755 new mode 100644 diff --git a/public/newPolygon.png b/public/newPolygon.png old mode 100755 new mode 100644 diff --git a/public/pinMarker.png b/public/pinMarker.png old mode 100755 new mode 100644 diff --git a/public/pinPolygon.png b/public/pinPolygon.png old mode 100755 new mode 100644 diff --git a/public/robots.txt b/public/robots.txt old mode 100755 new mode 100644 diff --git a/src/App.test.js b/src/App.test.js old mode 100755 new mode 100644 diff --git a/src/App.test.tsx b/src/App.test.tsx old mode 100755 new mode 100644 diff --git a/src/components/Map/BottomControls.js b/src/components/Map/BottomControls.js old mode 100755 new mode 100644 diff --git a/src/components/Map/FieldElements.js b/src/components/Map/FieldElements.js old mode 100755 new mode 100644 diff --git a/src/components/Map/MapControls.js b/src/components/Map/MapControls.js old mode 100755 new mode 100644 diff --git a/src/components/Map/TopControls.js b/src/components/Map/TopControls.js old mode 100755 new mode 100644 diff --git a/src/components/Map/index.js b/src/components/Map/index.js old mode 100755 new mode 100644 diff --git a/src/components/SidePanel/Button.js b/src/components/SidePanel/Button.js old mode 100755 new mode 100644 diff --git a/src/components/SidePanel/ButtonRow.js b/src/components/SidePanel/ButtonRow.js old mode 100755 new mode 100644 index 2048b8f..6ae7b84 --- a/src/components/SidePanel/ButtonRow.js +++ b/src/components/SidePanel/ButtonRow.js @@ -6,6 +6,21 @@ const ButtonRow = () => { const dispatch = useDispatch(); const addBoundaryMode = e => { console.log("AddBoundaryMode clicked"); + dispatch({ + type: "ADD_BOUNDARY", + payload: { + text: "Set name", + data: "", + editing: true, + expanded: true, + selected: false, + checkable: true, + cascade: true, + child: [], + checked: true, + indeterminate: false + } + }); dispatch({ type: "SET_CLICKMODE", payload: "SETPOLYGON" @@ -13,6 +28,23 @@ const ButtonRow = () => { }; const addMarkerMode = e => { console.log("AddMarkerMode clicked"); + dispatch({ + type: "ADD_MARKER", + payload: { + text: "Set name", + data: "", + editing: true, + expanded: true, + selected: false, + checkable: true, + cascade: true, + child: [], + checked: true, + indeterminate: false, + lat: 0, + lng: 0 + } + }); dispatch({ type: "SET_CLICKMODE", payload: "SETMARKER" @@ -30,7 +62,22 @@ const ButtonRow = () => { selected: false, checkable: true, cascade: true, - child: [], + child: [ + { + text: "Boundary", + data: ["14.54 hectares"], + checked: true, + selected: false + }, + { + text: "Markers", + data: ["2 items"], + selected: false, + checked: true, + expanded: true, + child: [] + } + ], checked: true, indeterminate: false } diff --git a/src/components/SidePanel/Draggable.js b/src/components/SidePanel/Draggable.js old mode 100755 new mode 100644 diff --git a/src/components/SidePanel/Droppable.js b/src/components/SidePanel/Droppable.js old mode 100755 new mode 100644 diff --git a/src/components/SidePanel/EditField.js b/src/components/SidePanel/EditField.js old mode 100755 new mode 100644 diff --git a/src/components/SidePanel/TreeView.js b/src/components/SidePanel/TreeView.js old mode 100755 new mode 100644 index a65151a..323331f --- a/src/components/SidePanel/TreeView.js +++ b/src/components/SidePanel/TreeView.js @@ -86,6 +86,7 @@ const Treeview = props => { parent = parent.parent; } if (props.node.editing) { + handleSelect(props.node); return ( { }); case "UPDATE_NAME": - /* return produce(state, draftState => { - console.log( - original(draftState.selected.path).reduce( - (prev, current, currentIndex) => { - console.log(prev, current, currentIndex); - const index = prev.findIndex(element => current === element.id); - prev = prev[index]; - }, - original(draftState.fieldsJSON) - ) - ); });*/ return produce(state, draftState => { + const path = state.selected.path; const index = draftState.fieldsJSON.findIndex( - field => state.selected[0] === field.id + field => path[0] === field.id ); - draftState.fieldsJSON[index].text = action.payload; - draftState.fieldsJSON[index].editing = false; + console.log(index, path, action.payload); + switch (state.selected.type) { + case "Markers": + const markerIndex = + state.fieldsJSON[index].child[1].child.length - 1; + console.log(markerIndex); + draftState.fieldsJSON[index].child[1].child[markerIndex].text = + action.payload; + draftState.fieldsJSON[index].child[1].child[ + markerIndex + ].editing = false; + return; + case "Boundary": + return; + default: + draftState.fieldsJSON[index].text = action.payload; + draftState.fieldsJSON[index].editing = false; + return; + } }); case "UPDATE": return produce(state, draftState => { action.path.reduce((prev, curr) => {}); }); case "ADD_MARKER": - return state; + return produce(state, draftState => { + const index = draftState.fieldsJSON.findIndex( + field => state.selected.path[0] === field.id + ); + console.log(index, state.selected.path[0]); + draftState.fieldsJSON[index].child[1].child.push(action.payload); + }); + case "ADD_POLYGON": return state; case "ADD_POLYGON_VERTEX": diff --git a/src/reducers/fileReducer.js b/src/reducers/fileReducer.js old mode 100755 new mode 100644 diff --git a/src/reducers/rootReducer.js b/src/reducers/rootReducer.js old mode 100755 new mode 100644 diff --git a/src/reducers/treeReducer.js b/src/reducers/treeReducer.js old mode 100755 new mode 100644 diff --git a/src/reducers/userReducer.js b/src/reducers/userReducer.js old mode 100755 new mode 100644 diff --git a/src/routes/App.css b/src/routes/App.css old mode 100755 new mode 100644 diff --git a/src/routes/App.tsx b/src/routes/App.tsx old mode 100755 new mode 100644 diff --git a/src/routes/Auth.tsx b/src/routes/Auth.tsx old mode 100755 new mode 100644 diff --git a/src/routes/Login.css b/src/routes/Login.css old mode 100755 new mode 100644 diff --git a/src/routes/PrivateRoute.js b/src/routes/PrivateRoute.js old mode 100755 new mode 100644 diff --git a/src/serviceWorker.js b/src/serviceWorker.js old mode 100755 new mode 100644 diff --git a/src/serviceWorker.ts b/src/serviceWorker.ts old mode 100755 new mode 100644 diff --git a/src/storage/storage.js b/src/storage/storage.js old mode 100755 new mode 100644 diff --git a/src/theme.css b/src/theme.css old mode 100755 new mode 100644 diff --git a/src/theme/variables.css b/src/theme/variables.css old mode 100755 new mode 100644 diff --git a/tsconfig.json b/tsconfig.json old mode 100755 new mode 100644 diff --git a/tslint.json b/tslint.json old mode 100755 new mode 100644