Commit dd4b1011 authored by TJHeeringa's avatar TJHeeringa

Various fixes, Closes #66

parent 484c5e17
......@@ -1403,6 +1403,12 @@
"loader-utils": "^1.1.0"
}
},
"@types/color-name": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
"dev": true
},
"@types/cookie": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz",
......@@ -1422,6 +1428,12 @@
"resolved": "https://registry.npmjs.org/@types/object-assign/-/object-assign-4.0.30.tgz",
"integrity": "sha1-iUk3HVqZ9Dge4PHfCpt6GH4H5lI="
},
"@types/parse-json": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
"integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==",
"dev": true
},
"@types/prop-types": {
"version": "15.7.3",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz",
......@@ -3908,6 +3920,12 @@
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs="
},
"compare-versions": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz",
"integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==",
"dev": true
},
"component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
......@@ -6762,6 +6780,15 @@
"pinkie-promise": "^2.0.0"
}
},
"find-versions": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz",
"integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==",
"dev": true,
"requires": {
"semver-regex": "^2.0.0"
}
},
"flat-cache": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz",
......@@ -8616,6 +8643,193 @@
"resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz",
"integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM="
},
"husky": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/husky/-/husky-4.2.3.tgz",
"integrity": "sha512-VxTsSTRwYveKXN4SaH1/FefRJYCtx+wx04sSVcOpD7N2zjoHxa+cEJ07Qg5NmV3HAK+IRKOyNVpi2YBIVccIfQ==",
"dev": true,
"requires": {
"chalk": "^3.0.0",
"ci-info": "^2.0.0",
"compare-versions": "^3.5.1",
"cosmiconfig": "^6.0.0",
"find-versions": "^3.2.0",
"opencollective-postinstall": "^2.0.2",
"pkg-dir": "^4.2.0",
"please-upgrade-node": "^3.2.0",
"slash": "^3.0.0",
"which-pm-runs": "^1.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"dev": true,
"requires": {
"@types/color-name": "^1.1.1",
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"ci-info": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
"integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==",
"dev": true
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"cosmiconfig": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz",
"integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==",
"dev": true,
"requires": {
"@types/parse-json": "^4.0.0",
"import-fresh": "^3.1.0",
"parse-json": "^5.0.0",
"path-type": "^4.0.0",
"yaml": "^1.7.2"
}
},
"find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
"dev": true,
"requires": {
"locate-path": "^5.0.0",
"path-exists": "^4.0.0"
}
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true
},
"import-fresh": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz",
"integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==",
"dev": true,
"requires": {
"parent-module": "^1.0.0",
"resolve-from": "^4.0.0"
}
},
"locate-path": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
"dev": true,
"requires": {
"p-locate": "^4.1.0"
}
},
"p-limit": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz",
"integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==",
"dev": true,
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
"dev": true,
"requires": {
"p-limit": "^2.2.0"
}
},
"p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"dev": true
},
"parse-json": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz",
"integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
"error-ex": "^1.3.1",
"json-parse-better-errors": "^1.0.1",
"lines-and-columns": "^1.1.6"
}
},
"path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"dev": true
},
"path-type": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
"dev": true
},
"pkg-dir": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
"integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==",
"dev": true,
"requires": {
"find-up": "^4.0.0"
}
},
"resolve-from": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
"dev": true
},
"slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
"dev": true
},
"supports-color": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
"integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
"dev": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"hyphenate-style-name": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.3.tgz",
......@@ -10952,6 +11166,12 @@
"type-check": "~0.3.2"
}
},
"lines-and-columns": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
"integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=",
"dev": true
},
"load-json-file": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
......@@ -15775,6 +15995,12 @@
"resolved": "https://registry.npmjs.org/openapi3-ts/-/openapi3-ts-0.12.0.tgz",
"integrity": "sha512-bFRzDbtuyMj9D8hEhB70MADATtMhfi6qQ36VRHzrc6XUYDc9C2NN6Gcq3ncIsjpY36EL5D7rdCLvhpXaFufR8A=="
},
"opencollective-postinstall": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz",
"integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==",
"dev": true
},
"opn": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/opn/-/opn-5.4.0.tgz",
......@@ -16175,6 +16401,15 @@
}
}
},
"please-upgrade-node": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz",
"integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==",
"dev": true,
"requires": {
"semver-compare": "^1.0.0"
}
},
"pluralize": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz",
......@@ -20884,6 +21119,21 @@
"react-lifecycles-compat": "^3.0.2"
}
},
"react-icons": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-3.9.0.tgz",
"integrity": "sha512-gKbYKR+4QsD3PmIHLAM9TDDpnaTsr3XZeK1NTAb6WQQ+gxEdJ0xuCgLq0pxXdS7Utg2AIpcVhM1ut/jlDhcyNg==",
"requires": {
"camelcase": "^5.0.0"
},
"dependencies": {
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
}
}
},
"react-image-webp": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/react-image-webp/-/react-image-webp-0.2.2.tgz",
......@@ -22833,6 +23083,12 @@
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
},
"semver-compare": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",
"integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=",
"dev": true
},
"semver-diff": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz",
......@@ -22841,6 +23097,12 @@
"semver": "^5.0.3"
}
},
"semver-regex": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz",
"integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==",
"dev": true
},
"send": {
"version": "0.17.1",
"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
......@@ -25467,6 +25729,12 @@
"resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz",
"integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8="
},
"which-pm-runs": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz",
"integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=",
"dev": true
},
"wide-align": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
......@@ -25752,6 +26020,32 @@
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
},
"yaml": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.8.2.tgz",
"integrity": "sha512-omakb0d7FjMo3R1D2EbTKVIk6dAVLRxFXdLZMEUToeAvuqgG/YuHMuQOZ5fgk+vQ8cx+cnGKwyg+8g8PNT0xQg==",
"dev": true,
"requires": {
"@babel/runtime": "^7.8.7"
},
"dependencies": {
"@babel/runtime": {
"version": "7.8.7",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.8.7.tgz",
"integrity": "sha512-+AATMUFppJDw6aiR5NVPHqIQBlV/Pj8wY/EZH+lmvRdUo9xBaz/rF3alAwFJQavvKfeOlPE7oaaDHVbcySbCsg==",
"dev": true,
"requires": {
"regenerator-runtime": "^0.13.4"
}
},
"regenerator-runtime": {
"version": "0.13.5",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz",
"integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==",
"dev": true
}
}
},
"yaml-js": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/yaml-js/-/yaml-js-0.2.3.tgz",
......@@ -38,6 +38,7 @@
"react-data-grid": "^5.0.5",
"react-datepicker": "^2.12.1",
"react-dom": "^16.12.0",
"react-icons": "^3.9.0",
"react-material-ui-form-validator": "^2.0.10",
"react-modal": "^3.11.1",
"react-numeric-input": "^2.2.3",
......@@ -74,6 +75,12 @@
],
"devDependencies": {
"babel-plugin-root-import": "^6.4.1",
"husky": "^4.2.3",
"react-image-webp": "^0.2.2"
},
"husky": {
"hooks": {
"post-merge": "npm install"
}
}
}
......@@ -11,7 +11,7 @@ import MenuIcon from '@material-ui/icons/Menu';
import PeopleRoundedIcon from '@material-ui/icons/PeopleRounded';
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
import logo from "../../../img/logo oud.png";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { FaRegistered, FaSignOutAlt, FaSignInAlt, FaUser } from "react-icons/fa";
import AccountCircle from '@material-ui/icons/AccountCircle';
import MenuItem from '@material-ui/core/MenuItem';
import Menu from '@material-ui/core/Menu';
......@@ -135,6 +135,19 @@ class PageLayout extends Component {
const { classes } = this.props;
const openAccount = Boolean(this.state.anchorEl);
let list_link_menu_items = [];
if (localStorage.getItem("authenticated") === 'true') {
list_link_menu_items.push(
{to: "/protected/settings", icon: <FaUser/>, primary: 'Profile'},
{to: "/account/logout", icon: <FaSignOutAlt/>, primary: 'Logout'},
)
} else {
list_link_menu_items.push(
{to: "/account/login", icon: <FaSignInAlt/>, primary: 'Login'},
{to: "/account/register", icon: <FaRegistered/>, primary: 'Register'},
)
}
return (
<div className={classes.root}>
<CssBaseline/>
......@@ -185,77 +198,60 @@ class PageLayout extends Component {
open={openAccount}
onClose={this.handleClose}
>
{localStorage.getItem("authenticated") === 'true' ? (
<>
<ListItemLink to={"/protected/settings"}
icon={<FontAwesomeIcon icon="user"/>}
primary={'Profile'}/>
<ListItemLink to={"/account/logout"}
icon={<FontAwesomeIcon icon="sign-out-alt"/>}
primary={'Logout'}/>
</>
) : (
<>
<ListItemLink
icon={<FontAwesomeIcon className="iconBars" icon="sign-out-alt"/>}
to={'/account/login'}
primary={'login'}/>
<ListItemLink
icon={<FontAwesomeIcon className="iconBars" icon="sign-out-alt"/>}
to={'/register'}
primary={'register'}/>
</>
)
}
{list_link_menu_items.map((list_link_menu_item, id)=>{
return <ListItemLink
key={"list_link_menu_item"+id}
icon={list_link_menu_item.icon}
to={list_link_menu_item.to}
primary={list_link_menu_item.primary}/>
})}
</Menu>
</div>
}
</div>
</Toolbar>
</AppBar>
{this.props.sidebar &&
<nav className={classes.drawer}>
<Hidden smUp implementation="js">
<Drawer
variant="temporary"
anchor='left'
open={this.state.openDrawer}
onClose={this.handleDrawerClose}
classes={{
paper: classes.drawerPaper,
}}
ModalProps={{
keepMounted: true, // Better open performance on mobile.
}}
>
<div className={classes.drawerHeader}>
<IconButton onClick={this.handleDrawerClose}>
<ChevronLeftIcon/>
</IconButton>
</div>
<Divider/>
<Sidebar {...this.props} component={this.props.sidebar}/>
</Drawer>
</Hidden>
<Hidden smDown implementation="js">
<Drawer
classes={{
paper: classes.drawerPaper,
}}
variant="persistent"
open={this.state.openDrawer}
>
<div className={classes.drawerHeader}>
<IconButton onClick={this.handleDrawerClose}>
<ChevronLeftIcon/>
</IconButton>
</div>
<Divider/>
<Sidebar {...this.props} component={this.props.sidebar}/>
</Drawer>
</Hidden>
</nav>
}
<nav className={classes.drawer}>
<Hidden smUp implementation="js">
<Drawer
variant="temporary"
anchor='left'
open={this.state.openDrawer}
onClose={this.handleDrawerClose}
classes={{
paper: classes.drawerPaper,
}}
ModalProps={{
keepMounted: true, // Better open performance on mobile.
}}
>
<div className={classes.drawerHeader}>
<IconButton onClick={this.handleDrawerClose}>
<ChevronLeftIcon/>
</IconButton>
</div>
<Divider/>
<Sidebar {...this.props} component={this.props.sidebar}/>
</Drawer>
</Hidden>
<Hidden smDown implementation="js">
<Drawer
classes={{
paper: classes.drawerPaper,
}}
variant="persistent"
open={this.state.openDrawer}
>
<div className={classes.drawerHeader}>
<IconButton onClick={this.handleDrawerClose}>
<ChevronLeftIcon/>
</IconButton>
</div>
<Divider/>
<Sidebar {...this.props} component={this.props.sidebar}/>
</Drawer>
</Hidden>
</nav>
<main
className={clsx(classes.content, {
[classes.contentShift]: this.state.openDrawer,
......
......@@ -147,9 +147,9 @@ class ProfileFormWithContainer extends Component {
class ProfileFormWithoutContainer extends Component {
handleValidSubmit = (event, values) => {
if (this.props.update) {
this.patchProfile(this.state.profile);
this.patchProfile(this.props.profile);
} else {
this.postProfile(this.state.profile);
this.postProfile(this.props.profile);
}
};
......
......@@ -29,7 +29,8 @@ export class Authorized extends Component {
};
redirect(data) {
if (data.association_memberships_claimed.length > 0) {
console.log(data.association_memberships);
if (data.association_memberships.filter(membership=>membership.status==='claimed').length > 0) {
if (this.props.location.pathname !== "/protected/memberships/resolve") {
return <Redirect exact to={"/protected/memberships/resolve"}/>
}
......@@ -87,11 +88,12 @@ export class Authorized extends Component {
<>{this.onError()}</>
) : (
<div className="Authorized">
{console.log(data)}
{this.redirect(data)}
<Route exact path={url + "/memberships/resolve"}
render={() =>
<ResolveMembershipWithRouter
claimed_memberships={data.association_memberships_claimed}
claimed_memberships={data.association_memberships.filter(membership=>membership.status==='claimed')}
refreshSunmemberMe={this.refreshSunmemberMe}
/>}
/>
......@@ -149,7 +151,6 @@ export class Authorized extends Component {
render={() =>
<NoProfileYetWithRouter
url={url}
profiles={data.profiles}
refreshSunmemberMe={this.refreshSunmemberMe}
/>}
/>
......
......@@ -43,16 +43,12 @@ class AssociationCalendar extends Component {
Helper.api_call(this.props.association.url + "/events", "GET", undefined, "json",
(data)=>this.setState({events: data.results.map(event_data=>this.morphDataToEvent(event_data))})
);
// Helper.api_call(this.props.association.url + "/event_types", "GET", undefined, "json",
// (data)=>this.setState({event_types: data.results})
// )
Helper.api_call(process.env.REACT_APP_API_URL + "/event_types", "GET", undefined, "json",
// (data)=>this.setState({event_types: data.results})
(data)=>this.setState({event_types: data.results.filter(event_type=>event_type.association===this.props.association.url)})
)
// Helper.api_call(process.env.REACT_APP_API_URL + "/enrollments?association=" + this.props.association.slug, "GET", undefined, "json",
// (data)=>this.setState({enrollments: data.results})
// );
Helper.api_call(process.env.REACT_APP_API_URL + "/event_types?association__slug="+this.props.association.slug, "GET", undefined, "json",
(data)=>this.setState({event_types: data.results})
);
Helper.api_call(process.env.REACT_APP_API_URL + "/enrollments?association__slug=" + this.props.association.slug, "GET", undefined, "json",
(data)=>this.setState({enrollments: data.results})
);
}