Skip to content

Commit

Permalink
Fix adding fields and markers
Browse files Browse the repository at this point in the history
  • Loading branch information
Pynee committed Jan 6, 2020
1 parent abd1eb3 commit b9fdfe2
Show file tree
Hide file tree
Showing 114 changed files with 102 additions and 16 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_API_URL = https://pynetti.duckdns.org
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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*
Empty file modified Icon-sources.txt
100755 → 100644
Empty file.
Empty file modified README.md
100755 → 100644
Empty file.
Empty file modified android/.gitignore
100755 → 100644
Empty file.
Empty file modified android/.idea/codeStyles/Project.xml
100755 → 100644
Empty file.
Empty file modified android/.idea/misc.xml
100755 → 100644
Empty file.
Empty file modified android/.idea/runConfigurations.xml
100755 → 100644
Empty file.
Empty file modified android/app/.npmignore
100755 → 100644
Empty file.
Empty file modified android/app/build.gradle
100755 → 100644
Empty file.
Empty file modified android/app/capacitor.build.gradle
100755 → 100644
Empty file.
Empty file modified android/app/proguard-rules.pro
100755 → 100644
Empty file.
Empty file.
Empty file modified android/app/src/main/AndroidManifest.xml
100755 → 100644
Empty file.
Empty file modified android/app/src/main/java/io/ionic/starter/MainActivity.java
100755 → 100644
Empty file.
Empty file modified android/app/src/main/res/drawable-land-hdpi/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/drawable-land-mdpi/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/drawable-land-xhdpi/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/drawable-land-xxhdpi/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/drawable-land-xxxhdpi/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/drawable-port-hdpi/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/drawable-port-mdpi/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/drawable-port-xhdpi/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/drawable-port-xxhdpi/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/drawable-port-xxxhdpi/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file modified android/app/src/main/res/drawable/ic_launcher_background.xml
100755 → 100644
Empty file.
Empty file modified android/app/src/main/res/drawable/launch_splash.xml
100755 → 100644
Empty file.
Empty file modified android/app/src/main/res/drawable/splash.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/layout/activity_main.xml
100755 → 100644
Empty file.
Empty file modified android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
100755 → 100644
Empty file.
Empty file.
Empty file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
100755 → 100644
Empty file modified android/app/src/main/res/values/ic_launcher_background.xml
100755 → 100644
Empty file.
Empty file modified android/app/src/main/res/values/strings.xml
100755 → 100644
Empty file.
Empty file modified android/app/src/main/res/values/styles.xml
100755 → 100644
Empty file.
Empty file modified android/app/src/main/res/xml/file_paths.xml
100755 → 100644
Empty file.
Empty file.
Empty file modified android/build.gradle
100755 → 100644
Empty file.
Empty file modified android/capacitor.settings.gradle
100755 → 100644
Empty file.
Empty file modified android/gradle.properties
100755 → 100644
Empty file.
Empty file modified android/gradle/wrapper/gradle-wrapper.jar
100755 → 100644
Empty file.
Empty file modified android/gradle/wrapper/gradle-wrapper.properties
100755 → 100644
Empty file.
Empty file modified android/gradlew
100755 → 100644
Empty file.
Empty file modified android/gradlew.bat
100755 → 100644
Empty file.
Empty file modified android/settings.gradle
100755 → 100644
Empty file.
Empty file modified ionic.config.json
100755 → 100644
Empty file.
Empty file modified package-lock.json
100755 → 100644
Empty file.
Empty file modified package.json
100755 → 100644
Empty file.
Empty file modified public/add.png
100755 → 100644
Empty file modified public/assets/icon/favicon.png
100755 → 100644
Empty file modified public/assets/icon/icon.png
100755 → 100644
Empty file modified public/assets/shapes.svg
100755 → 100644
Empty file modified public/favicon.ico
100755 → 100644
Empty file.
Empty file modified public/index.html
100755 → 100644
Empty file.
Empty file modified public/logo192.png
100755 → 100644
Empty file modified public/logo512.png
100755 → 100644
Empty file modified public/manifest.json
100755 → 100644
Empty file.
Empty file modified public/newField.png
100755 → 100644
Empty file modified public/newMarker.png
100755 → 100644
Empty file modified public/newPolygon.png
100755 → 100644
Empty file modified public/pinMarker.png
100755 → 100644
Empty file modified public/pinPolygon.png
100755 → 100644
Empty file modified public/robots.txt
100755 → 100644
Empty file.
Empty file modified src/App.test.js
100755 → 100644
Empty file.
Empty file modified src/App.test.tsx
100755 → 100644
Empty file.
Empty file modified src/components/Map/BottomControls.js
100755 → 100644
Empty file.
Empty file modified src/components/Map/FieldElements.js
100755 → 100644
Empty file.
Empty file modified src/components/Map/MapControls.js
100755 → 100644
Empty file.
Empty file modified src/components/Map/TopControls.js
100755 → 100644
Empty file.
Empty file modified src/components/Map/index.js
100755 → 100644
Empty file.
Empty file modified src/components/SidePanel/Button.js
100755 → 100644
Empty file.
49 changes: 48 additions & 1 deletion src/components/SidePanel/ButtonRow.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,45 @@ 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"
});
};
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"
Expand All @@ -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
}
Expand Down
Empty file modified src/components/SidePanel/Draggable.js
100755 → 100644
Empty file.
Empty file modified src/components/SidePanel/Droppable.js
100755 → 100644
Empty file.
Empty file modified src/components/SidePanel/EditField.js
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions src/components/SidePanel/TreeView.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const Treeview = props => {
parent = parent.parent;
}
if (props.node.editing) {
handleSelect(props.node);
return (
<InputField
className="treeview-inputfield"
Expand Down
Empty file modified src/components/SidePanel/createTree.js
100755 → 100644
Empty file.
Empty file modified src/components/SidePanel/index.js
100755 → 100644
Empty file.
Empty file modified src/components/UserFileUpload.js
100755 → 100644
Empty file.
Empty file modified src/index.css
100755 → 100644
Empty file.
Empty file modified src/index.tsx
100755 → 100644
Empty file.
Empty file modified src/react-app-env.d.ts
100755 → 100644
Empty file.
44 changes: 29 additions & 15 deletions src/reducers/fieldReducer.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,44 @@ const fieldReducer = (state = initialState.fieldReducer, action) => {
});

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":
Expand Down
Empty file modified src/reducers/fileReducer.js
100755 → 100644
Empty file.
Empty file modified src/reducers/rootReducer.js
100755 → 100644
Empty file.
Empty file modified src/reducers/treeReducer.js
100755 → 100644
Empty file.
Empty file modified src/reducers/userReducer.js
100755 → 100644
Empty file.
Empty file modified src/routes/App.css
100755 → 100644
Empty file.
Empty file modified src/routes/App.tsx
100755 → 100644
Empty file.
Empty file modified src/routes/Auth.tsx
100755 → 100644
Empty file.
Empty file modified src/routes/Login.css
100755 → 100644
Empty file.
Empty file modified src/routes/PrivateRoute.js
100755 → 100644
Empty file.
Empty file modified src/serviceWorker.js
100755 → 100644
Empty file.
Empty file modified src/serviceWorker.ts
100755 → 100644
Empty file.
Empty file modified src/storage/storage.js
100755 → 100644
Empty file.
Empty file modified src/theme.css
100755 → 100644
Empty file.
Empty file modified src/theme/variables.css
100755 → 100644
Empty file.
Empty file modified tsconfig.json
100755 → 100644
Empty file.
Empty file modified tslint.json
100755 → 100644
Empty file.

0 comments on commit b9fdfe2

Please sign in to comment.