Commit 2c9c1a00 authored by TJHeeringa's avatar TJHeeringa

Various fixes

parent 6c3f9144
......@@ -35,7 +35,7 @@ const useStyles = makeStyles(theme => ({
},
media: {
minWidth: 100,
maxWidth: 200,
maxWidth: 250,
width: "88%",
marginLeft: 10,
marginRight: 10,
......
import { makeStyles, useTheme } from "@material-ui/core/styles";
import TextField from "App/Components/Fields/TextField";
import PropTypes from "prop-types";
import React from "react";
import TextField from "App/Components/Fields/TextField";
const useStyles = makeStyles(theme => ({
}));
......
const isUnique = {name: "isUnique", validate: (value)=> value};
export default isUnique;
\ No newline at end of file
......@@ -12,7 +12,6 @@ import PageContent from "../../Components/PageLayout/Content/Content";
const useStyles = makeStyles(theme => ({
}));
......@@ -21,27 +20,27 @@ export const BoardInfo = (props) => {
const classes = useStyles(theme);
let { data: boards, loading: loadingBoard } = useGet({
path: process.env.REACT_APP_API_URL+"/associations/student-union/boards",
queryParams: {limit: 10000},
path: "/groups",
queryParams: {current_board: true, association__slug: props.association.slug, board_group: true},
resolve: data => data && data.results
});
const morphBoardMemberToCard = (board_member) => {
let data = {
"Name": board_member.given_name + " " + board_member.surname,
"Name": board_member.profile.given_name + " " + board_member.profile.surname,
"Email": board_member.email
};
return {
duty: board_member.duty,
data: data,
given_name: board_member.given_name,
given_name: board_member.profile.given_name,
description: board_member.description || loremIpsum()[0],
photo: null,
order: board_member.order
};
};
const board = !loadingBoard && boards.find(board=>board.current_board===true);
const board = !loadingBoard && boards[0];
console.log(board);
let x = board && board.groupmemberships && orderBy(board.groupmemberships, ["order"], ["asc"]).map(board_member=>morphBoardMemberToCard(board_member));
console.log(x);
......
......@@ -350,7 +350,7 @@ export class AssociationDataFields extends Component {
getAssociationSpecificDataFields = () => {
return Helper.api_call(
process.env.REACT_APP_API_URL + "/data_fields?ordering=name&association__slug=" + this.props.association.slug,
process.env.REACT_APP_API_URL + "/association_data_fields?ordering=name&association__slug=" + this.props.association.slug,
"GET",
null,
"json",
......@@ -364,7 +364,7 @@ export class AssociationDataFields extends Component {
return (
<Container>
<Block>
<Typography variant={"h5"}>ASSOCIATION Membertypes</Typography>
<Typography variant={"h5"}>ASSOCIATION Data fields</Typography>
<hr className={"box-title-separator"}/>
{ specific_data_fields && specific_data_fields.map((specific_data_field, index) => { return (
<CollapsableList
......
......@@ -45,7 +45,9 @@ const useStyles = makeStyles(theme => ({
const Matchings = (props) => {
const classes = useStyles();
const alertHandler = useAlertHandler();
const [matches, setMatches] = useState([]);
const [show, setShowMatches] = useState(true);
const [selectedLeft, setLeft] = useState({});
......@@ -63,17 +65,17 @@ const Matchings = (props) => {
}, [classes]); // function is called whenever second attr changes; we don't want it to call aside from mounting so we use constant attr
let { data: members, loading: loadingMembers } = useGet({
path: process.env.REACT_APP_API_URL + "/memberships",
path: "/memberships",
queryParams: {limit: 10000, current: true, association__slug: props.association.slug},
resolve: data => data && data.results
});
let { data: data_fields, loading: loadingDataFields } = useGet({
path: process.env.REACT_APP_API_URL + "/association_data_fields",
path: "/association_data_fields",
queryParams: {limit: 10000, association__slug: props.association.slug},
resolve: data => data && data.results
});
let { data: membertypes, loading: loadingMembertypes } = useGet({
path: process.env.REACT_APP_API_URL + "/membertypes",
path: "/membertypes",
queryParams: {limit: 100, association__slug: props.association.slug},
resolve: data => data && data.results
});
......
......@@ -9,6 +9,7 @@ import Block from "App/Components/PageLayout/Content/Block";
import PageContent from "App/Components/PageLayout/Content/Content";
import PropTypes from "prop-types";
import React from "react";
import {Spinner} from "react-bootstrap";
import {useGet} from "restful-react";
import Info from "../../Components/Info/Info";
......@@ -30,7 +31,7 @@ const MyMatches = (props) => {
const { profile, association } = props;
const queryParams = association ? {limit: 10000, association__slug: association.slug} : {limit: 10000};
let { data: matchings } = useGet({
let { data: matchings, loading } = useGet({
path: "/matchings",
queryParams: queryParams,
resolve: data => data && data.results
......@@ -46,31 +47,46 @@ const MyMatches = (props) => {
matchings = left_matchings.concat(right_matchings);
}
return (
<PageContent title={"Matchings"}>
<Container>
<Block>
<Typography variant={"h5"}>You are matched with:</Typography>
<List>
{ matchings && matchings.map((matching, m)=>(
<ListItem key={m}>
<Avatar className={classes.avatar} key={m} src={matching.photo}/>
<div className={classes.info}>
<Info
headerless={true}
data={{
name: matching.name,
email: matching.email
}}
/>
</div>
</ListItem>
)) }
</List>
</Block>
</Container>
</PageContent>
);
if (loading) {
return (
<PageContent title={"Matchings"}>
<Container>
<Block>
<Spinner/>
</Block>
</Container>
</PageContent>
);
} else {
return (
<PageContent title={"Matchings"}>
<Container>
<Block>
<Typography variant={"h5"}>
{ matchings.length > 0 ? "You are matched with:" : "You are not matched to someone at the moment." }
</Typography>
<List>
{ matchings.map((matching, m) => (
<ListItem key={m}>
<Avatar className={classes.avatar} key={m} src={matching.photo}/>
<div className={classes.info}>
<Info
headerless={true}
data={{
name: matching.name,
email: matching.email
}}
/>
</div>
</ListItem>
))}
</List>
</Block>
</Container>
</PageContent>
);
}
};
MyMatches.propTypes = {
......
This diff is collapsed.
......@@ -3,16 +3,16 @@ import "./Groups.css";
import Container from "@material-ui/core/Container";
import { Helper } from "App/Helper";
import PropTypes from "prop-types";
import React, { Component } from "react";
import { NavLink, Redirect , withRouter } from "react-router-dom";
import { NavLink, withRouter } from "react-router-dom";
import TreeMenu from "react-simple-tree-menu";
import { Button } from "reactstrap";
import Block from "../../../Components/PageLayout/Content/Block";
import { GroupRouter } from "./GroupRouter";
export class Boards extends Component {
class Boards extends Component {
constructor(props) {
super(props);
this.state = {
......@@ -39,10 +39,12 @@ export class Boards extends Component {
}
componentDidMount() {
Helper.api_call(this.props.association.url+"/boards?limit=1000", "GET", null,"json",
(data)=>{this.setState({boards: data.results, tree: this.boardArrayToTree(data.results)});
}
);
Helper.api_callv3({
url: "/groups?limit=1000&board_group=true&association__slug="+this.props.association.slug,
method: "GET",
on_succes: (data)=>{this.setState({boards: data.results, tree: this.boardArrayToTree(data.results)});},
on_failure: ()=>{},
});
}
currentBoardSlug(data) {
......@@ -54,7 +56,7 @@ export class Boards extends Component {
}
render() {
const {association} = this.props;
const { association } = this.props;
let path = this.props.path+"/boards";
return (
......@@ -96,4 +98,8 @@ export class Boards extends Component {
}
}
Boards.propTypes = {
association: PropTypes.object.isRequired
};
export const BoardsWithRouter = withRouter(Boards);
......@@ -3,39 +3,63 @@ import "../Board/Groups.css";
import { makeStyles, useTheme, withStyles } from "@material-ui/core/styles";
import { Helper } from "App/Helper";
import PropTypes from "prop-types";
import React, { Component } from "react";
import { Route , withRouter } from "react-router-dom";
import { Route , useLocation, withRouter } from "react-router-dom";
import { useGet } from "restful-react";
import CardGrid from "../../../Components/Card/CardGrid";
import GroupCard from "../../../Components/Card/GroupCardV2";
import PageContent from "../../../Components/PageLayout/Content/Content";
import Detail from "./Detail";
import Image from "img/default_photo.jpg"; // Import using relative path
const useStyles = theme => ({
photo_header: {
width: "100%",
height: "300px",
position: "absolute",
backgroundPosition: "center center",
backgroundSize: "cover",
backgroundRepeat: "no-repeat",
backgroundImage: `url(${Image})`,
},
header: {
display: "flex",
alignItems: "center",
justifyContent: "center",
lineHeight: "300px",
color: "#fff",
},
sub_photo_container: {
paddingTop: "300px"
const useStyles = makeStyles(theme => ({
}));
const Committees = ({ association, path }) => {
const theme = useTheme();
const classes = useStyles(theme);
const location = useLocation();
path = path + "/committees";
let { data: committees, loading } = useGet({
path: "/groups",
queryParams: {limit: 10000, association__slug: association.slug, board_group: false},
resolve: data => data && data.results
});
const committeeToGroupCard = (committee) => ({
title: committee.full_name,
photo: committee.photo,
path: "committees/" + committee.slug
});
if (loading) {
return null;
} else {
return (
<>
<MyCommitteesRouter
groups={committees}
path={path}
/>
{ location.pathname === path &&
<PageContent title={"Groups and Committees"}>
<CardGrid
component={GroupCard}
card_grid={committees.map(committee=>committeeToGroupCard(committee))}
chunk_size={4}
/>
</PageContent>
}
</>
);
}
});
};
export class Committees extends Component {
export class Committees2 extends Component {
constructor(props) {
super(props);
this.state = {
......@@ -48,9 +72,11 @@ export class Committees extends Component {
}
getGroups = () => {
return Helper.api_call(this.props.association.url+"/committees","GET", null, "json",
(data)=>{this.setState({committees: data.results.filter(committee=>committee.parent_group === null)});}
);
return Helper.api_callv3({
url: "/groups?board_group=false&association__slug="+this.props.association.slug,
method: "GET",
on_succes: (data)=>{this.setState({committees: data.results.filter(committee=>committee.parent_group === null)});}
});
};
committeeToGroupCard = (committee) => ({
......@@ -60,8 +86,7 @@ export class Committees extends Component {
});
render() {
let path = this.props.path+"/committees";
const { classes } = this.props;
let path = this.props.path + "/committees";
let { committees } = this.state;
let groupcards = committees ? committees.map(committee=>this.committeeToGroupCard(committee)) : [];
console.log(committees, groupcards);
......@@ -86,31 +111,30 @@ export class Committees extends Component {
}
}
export class MyCommitteesRouter extends Component {
render() {
const {groups, path, association} = this.props;
return (
<>
{ groups.map((group, g) =>{
return (
<Route
key={g}
exact
path= {path+"/"+group.slug}
render={() =>
<Detail
{...group}
/>
}
/>
);
}) }
</>
);
}
}
const MyCommitteesRouter = ({groups, path}) => {
return (
<>
{ groups.map((group, g) =>{
return (
<Route
key={g}
exact
path= {path+"/"+group.slug}
render={() =>
<Detail
{...group}
/>
}
/>
);
}) }
</>
);
};
MyCommitteesRouter.propTypes = {
groups: PropTypes.array.isRequired,
path: PropTypes.string.isRequired
};
export const MyCommitteesWithRouter = withRouter(
withStyles(useStyles)(Committees)
);
\ No newline at end of file
export const MyCommitteesWithRouter = withRouter(Committees);
\ No newline at end of file
import {Typography} from "@material-ui/core";
import Avatar from "@material-ui/core/Avatar";
import Container from "@material-ui/core/Container";
import makeStyles from "@material-ui/core/styles/makeStyles";
import useTheme from "@material-ui/core/styles/useTheme";
import Typography from "@material-ui/core/Typography";
import AvatarGroup from "@material-ui/lab/AvatarGroup";
import PropTypes from "prop-types";
import React from "react";
......
......@@ -42,7 +42,7 @@ export class AssociationProfile extends Component {
};
render() {
const {association, association_membership} = this.props;
const { association, association_membership } = this.props;
const association_specific_data = association_membership.association_specific_data;
return (
<Container>
......@@ -79,8 +79,8 @@ export class AssociationProfile extends Component {
/>
:
<Get
base={association.url}
path={"/membertypes"}
queryParams={{association__slug:association.slug}}
>
{ (data, { loading, error }) =>
loading ? (
......@@ -102,8 +102,8 @@ export class AssociationProfile extends Component {
</Get>
}
<Get
base={association.url}
path={"/data_fields"}
path={"/association_data_fields"}
queryParams={{association__slug:association.slug}}
>
{ (data, { loading, error }) =>
loading ? (
......@@ -113,30 +113,30 @@ export class AssociationProfile extends Component {
{ error ? (
console.log(error)
) : (
<x-fragment>
<>
<h4>Specific Data for Association</h4>
{ this.state.form_type === "info"
?
association_specific_data.map((specific_data)=>{
association_specific_data.map((specific_data, id)=>{
let data = {};
data[specific_data.name] = specific_data.value;
return <Info
key={uuidv4()}
key={id}
headerless={true}
data={data}
/>;
})
:
association_specific_data.map((specific_data)=>{
association_specific_data.map((specific_data, id)=>{
return <AssociationSpecificDataForm
key={uuidv4()}
key={id}
association_specific_data={specific_data}
association_specific_data_fields={data.results}
/>;
})
}
</x-fragment>
</>
) }
</div>
)
......
......@@ -10,7 +10,7 @@ export const FAQ = (props) => {
return (
<PublicPageLayout>
<Container>
<Block className={"box mt-20"}>
<Block>
<Typography variant={"h5"}>Frequently Asked Questions</Typography>
<hr className={"box-title-separator"}/>
<Typography variant={"h6"}>What is My SU?</Typography>
......@@ -18,11 +18,10 @@ export const FAQ = (props) => {
money or man power needed to build their own.
</p>
<Typography variant={"h6"}>How do I add my association?</Typography>
<p>If you want to add your association, please sent an email to sun@union.utwente.nl with subject `Association Join Request`.
*TODO: change to join@my.su.utwente.nl once MX is ready*
<p>If you want to add your association, please sent an email to join@my.su.utwente.nl with subject `Association Join Request: [association name]`. Replace the part between square brackets with the name of your association
</p>
<Typography variant={"h6"}>My Student Number has changed. Can I still login?</Typography>
<p>Please email to sun@union.utwente.nl.</p>
<p>Please email to help@my.su.utwente.nl.</p>
<Typography variant={"h6"}>Do you do any tracking?</Typography>
<p>No.</p>
<Typography variant={"h6"}>Who can see my data?</Typography>
......
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