️ This Gitlab will be shut down at 2021-12-31 23:59:59.
Students and staff can migrate to gitlab.utwente.nl.
SNT members can migrate to gitlab.snt.utwente.nl.
Contact bestuur@snt.utwente.nl for more information.

Migrate your projects today!
Export your project using the webinterface or use a script.

Commit 1d142218 authored by TJHeeringa's avatar TJHeeringa

Minor stuff

parent c877a77a
......@@ -3,7 +3,7 @@ import List from "@material-ui/core/List";
import ListItem from "@material-ui/core/ListItem";
import ListItemIcon from "@material-ui/core/ListItemIcon";
import ListItemText from "@material-ui/core/ListItemText";
import { makeStyles, useTheme } from "@material-ui/core/styles";
import { useTheme } from "@material-ui/core/styles";
import ExpandLess from "@material-ui/icons/ExpandLess";
import ExpandMore from "@material-ui/icons/ExpandMore";
import PropTypes from "prop-types";
......@@ -12,9 +12,6 @@ import React from "react";
import Link from "./Link";
const useStyles = makeStyles(theme => ({
}));
/**
*
* @param primary
......@@ -26,7 +23,6 @@ const useStyles = makeStyles(theme => ({
*/
const Dropdown = ({primary, icon, depth, items}) => {
const theme = useTheme();
const classes = useStyles(theme);
const [open, setOpen] = React.useState(false);
......@@ -54,7 +50,7 @@ Dropdown.propTypes = {
depth: PropTypes.number.isRequired,
icon: PropTypes.object.isRequired,
primary: PropTypes.string.isRequired,
items:PropTypes.array
items:PropTypes.array.isRequired
};
export default Dropdown;
\ No newline at end of file
......@@ -23,7 +23,7 @@ import SubjectIcon from "@material-ui/icons/Subject";
import SupervisedUserCircleIcon from "@material-ui/icons/SupervisedUserCircle";
import WcIcon from "@material-ui/icons/Wc";
import Drawer from "App/Components/Lists/Drawer/Drawer";
import React from "react";
import React, {useMemo} from "react";
import {useLocation} from "react-router-dom";
const AssociationBoardSideBar = (props) => {
......@@ -37,7 +37,7 @@ const AssociationBoardDrawer = (props) => {
let url = location.pathname;
url = url.substring(0, url.indexOf("boardmember") + 11);
const data = [
const data = useMemo(()=>[
{
icon: <HomeWorkIcon />,
primary: "Association",
......@@ -200,7 +200,7 @@ const AssociationBoardDrawer = (props) => {
// // }
// ]
// },
];
], [url]);
return (
<Drawer items={data}/>
);
......
import AccountBoxIcon from "@material-ui/icons/AccountBox";
import BookIcon from "@material-ui/icons/Book";
import EuroIcon from "@material-ui/icons/Euro";
import EventIcon from "@material-ui/icons/Event";
import GradeIcon from "@material-ui/icons/Grade";
import HomeIcon from "@material-ui/icons/Home";
import HomeWorkIcon from "@material-ui/icons/HomeWork";
import InfoIcon from "@material-ui/icons/Info";
import ShareIcon from "@material-ui/icons/Share";
import SupervisedUserCircleIcon from "@material-ui/icons/SupervisedUserCircle";
import Drawer from "App/Components/Lists/Drawer/Drawer";
import React from "react";
import React, {useMemo} from "react";
import {useLocation} from "react-router-dom";
import {useAPI} from "../../../Contexts/API";
......@@ -26,15 +24,7 @@ const AssociationMemberDrawer = (props) => {
let url = location.pathname;
url = url.substring(0, url.indexOf("member") + 6);
// Extract the slug from the url, and use that to check whether someone is a current member or not. If not, render
// an empty sidebar.
const url_segments = url.split("/");
const slug = url_segments[url_segments.length-2];
const currentMembership = API.sunmember && API.sunmember.association_memberships.find(membership=>membership.association.slug===slug).current;
if (!currentMembership) {
return null;
}
const data = [
const data = useMemo(()=>[
{
icon: <HomeIcon />,
primary: "Home",
......@@ -91,7 +81,17 @@ const AssociationMemberDrawer = (props) => {
// },
// ]
// },
];
], [url]);
// Extract the slug from the url, and use that to check whether someone is a current member or not. If not, render
// an empty sidebar.
const url_segments = url.split("/");
const slug = url_segments[url_segments.length-2];
const currentMembership = API.sunmember && API.sunmember.association_memberships.find(membership=>membership.association.slug===slug).current;
if (!currentMembership) {
return null;
}
return (
<Drawer items={data}/>
);
......
const EmptySideBar = (props) => null;
const EmptySideBar = () => null;
export default EmptySideBar;
......@@ -9,24 +9,24 @@ export default function PublicSideBar(props){
return PublicDrawer(props);
}
const PublicDrawer = (props) => {
const data = [
{
icon: <HomeIcon />,
primary: "Home",
to: "/protected/home"
},
// {
// icon: <EventIcon />,
// primary: "Calendar",
// to: "/protected/calendar"
// },
// {
// icon: <PaymentIcon />,
// primary: "Campus Card",
// to: "/protected/campus-card"
// }
];
const data = [
{
icon: <HomeIcon />,
primary: "Home",
to: "/protected/home"
},
// {
// icon: <EventIcon />,
// primary: "Calendar",
// to: "/protected/calendar"
// },
// {
// icon: <PaymentIcon />,
// primary: "Campus Card",
// to: "/protected/campus-card"
// }
];
const PublicDrawer = () => {
return (
<Drawer items={data}/>
);
......
......@@ -9,8 +9,6 @@ import Block from "../../Components/PageLayout/Content/Block";
import PageContent from "../../Components/PageLayout/Content/Content";
const AssociationDetail = ({ slug }) => {
let { data: association, loading: loadingAssociation } = useGet({
path: "/associations/" + slug,
......
......@@ -5,7 +5,7 @@ import { Route, Switch } from "react-router-dom";
import useCollectionAPI from "../../Components/Hooks/useCollectionAPI";
/* Work in progress */
export const AssociationsRouter = ({ path, association, board, profile }) => {
const AssociationsRouter = ({ path }) => {
const associationsAPI = useCollectionAPI("/associations", {limit: 10000});
return (
......@@ -18,6 +18,6 @@ export const AssociationsRouter = ({ path, association, board, profile }) => {
AssociationsRouter.propTypes = {
path: PropTypes.string.isRequired,
association: PropTypes.object.isRequired,
board: PropTypes.bool.isRequired
};
export default AssociationsRouter;
\ No newline at end of file
......@@ -12,6 +12,7 @@ import Settings from "../../Pages/Profile/Settings";
import SharedProfile from "../../Pages/Profile/SharedProfile";
import { Associations } from "../../Pages/Search/Associations";
import AssociationRoutes from "./MyAssociations/Association";
import AssociationsRouter from "../../Pages/Search/AssociationsRouter";
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment