Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

See previous years' member stats #476

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 39 additions & 9 deletions src/pages/admin/Memberships/Memberships.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ import {
import {
makeStyles, useTheme
} from "@material-ui/core/styles";
import {
FormControl, InputLabel, Select, MenuItem,
List,
ListItem,
ListItemText,
Typography,
Chip,
} from "@material-ui/core";
import useMediaQuery from "@material-ui/core/useMediaQuery";
// import ListIcon from "@material-ui/icons/List";
import StarBorderIcon from "@material-ui/icons/StarBorder";
Expand All @@ -21,13 +29,6 @@ import Questions from "./Questions/Questions";
import Summary from "./Summary/Summary";
// import Individual from "./Individual/Individual";

import {
List,
ListItem,
ListItemText,
Typography,
Chip,
} from "@material-ui/core";

const PERSONALIZATION_STATES = {
SUMMARY: {
Expand All @@ -49,6 +50,16 @@ const PERSONALIZATION_STATES = {
};

const useStyles = makeStyles((theme) => ({
formControl: {
margin: theme.spacing(1),
minWidth: 120,
"& .MuiOutlinedInput-root, & .MuiOutlinedInput-root fieldset": {
borderColor: `${COLORS.BIZTECH_GREEN}`,
},
"& .MuiInputLabel-outlined, & .MuiSelect-outlined, & .MuiSelect-icon": {
color: `${COLORS.BIZTECH_GREEN}`,
}
},
container: {
display: "flex",
flexDirection: "row",
Expand Down Expand Up @@ -116,24 +127,43 @@ function Memberships() {

const [membershipData, setMembershipData] = useState([]);

const [selectedYear, setSelectedYear] = useState("2024"); // default year is 2024

useEffect(() => {
let isSubscribed = true;
const getMemberships = async () => {
const res = await fetchBackend("/members", "GET");
const res = await fetchBackend(`/members?year=${selectedYear}`, "GET");
// const res = await fetchBackend("/members", "GET");
if (isSubscribed) {
setMembershipData(res);
}
};
getMemberships();

return () => (isSubscribed = false);
}, []);
}, [selectedYear]);

return (
<div>
<Helmet>
<title>BizTech Memberships</title>
</Helmet>

<FormControl variant="outlined" className={classes.formControl}>
<InputLabel id="year-label">Year</InputLabel>
<Select
labelId="year-label"
value={selectedYear}
onChange={e => setSelectedYear(e.target.value)}
label="Year"
>
<MenuItem value="2021">2021</MenuItem>
<MenuItem value="2022">2022</MenuItem>
<MenuItem value="2023">2023</MenuItem>
<MenuItem value="2024">2024</MenuItem>
</Select>
</FormControl>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console log remove

<div className={classes.container}>
{/* Left panel for additional event filters (only on desktop view) */}
{!isMobile && (
Expand Down