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

Filter students based on graduation year #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/components/Tables/TablesTableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function TablesTableRow(props) {
setAllData={setAllData}
userStatus={userStatus}
setUserStatus={setUserStatus}
/>
/>
) : (
<PopUp
email={email}
Expand Down
1 change: 1 addition & 0 deletions src/constants/GraduationYear.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const graduationYear = ["All Members", "2022", "2023", "2024", "2025", "2026", "2027"];
263 changes: 136 additions & 127 deletions src/layouts/Admin.js
Original file line number Diff line number Diff line change
@@ -1,108 +1,117 @@
// Chakra imports
import { ChakraProvider, Portal, useDisclosure } from '@chakra-ui/react';
import Configurator from 'components/Configurator/Configurator';
import Footer from 'components/Footer/Footer.js';
import { ChakraProvider, Portal, useDisclosure } from "@chakra-ui/react";
import Configurator from "components/Configurator/Configurator";
import Footer from "components/Footer/Footer.js";
// Layout components
import AdminNavbar from 'components/Navbars/AdminNavbar.js';
import Sidebar from 'components/Sidebar';
import React, { useState } from 'react';
import { Redirect, Route, Switch } from 'react-router-dom';
import routes from 'routes.js';
import '@fontsource/roboto/400.css';
import '@fontsource/roboto/500.css';
import '@fontsource/roboto/700.css';
import AdminNavbar from "components/Navbars/AdminNavbar.js";
import Sidebar from "components/Sidebar";
import React, { useState } from "react";
import { Redirect, Route, Switch } from "react-router-dom";
import routes from "routes.js";
import "@fontsource/roboto/400.css";
import "@fontsource/roboto/500.css";
import "@fontsource/roboto/700.css";
// Custom Chakra theme
import theme from 'theme/theme.js';
import FixedPlugin from '../components/FixedPlugin/FixedPlugin';
import theme from "theme/theme.js";
import FixedPlugin from "../components/FixedPlugin/FixedPlugin";
// Custom components
import MainPanel from '../components/Layout/MainPanel';
import PanelContainer from '../components/Layout/PanelContainer';
import PanelContent from '../components/Layout/PanelContent';
import MainPanel from "../components/Layout/MainPanel";
import PanelContainer from "../components/Layout/PanelContainer";
import PanelContent from "../components/Layout/PanelContent";
export default function Dashboard(props) {
const { ...rest } = props;
// states and functions
const [ sidebarVariant, setSidebarVariant ] = useState('transparent');
const [ fixed, setFixed ] = useState(false);
// functions for changing the states from components
const getRoute = () => {
return window.location.pathname !== '/admin/full-screen-maps';
};
const getActiveRoute = (routes) => {
let activeRoute = 'Default Brand Text';
for (let i = 0; i < routes.length; i++) {
if (routes[i].collapse) {
let collapseActiveRoute = getActiveRoute(routes[i].views);
if (collapseActiveRoute !== activeRoute) {
return collapseActiveRoute;
}
} else if (routes[i].category) {
let categoryActiveRoute = getActiveRoute(routes[i].views);
if (categoryActiveRoute !== activeRoute) {
return categoryActiveRoute;
}
} else {
if (window.location.href.indexOf(routes[i].layout + routes[i].path) !== -1) {
return routes[i].name;
}
}
}
return activeRoute;
};
// This changes navbar state(fixed or not)
const getActiveNavbar = (routes) => {
let activeNavbar = false;
for (let i = 0; i < routes.length; i++) {
if (routes[i].category) {
let categoryActiveNavbar = getActiveNavbar(routes[i].views);
if (categoryActiveNavbar !== activeNavbar) {
return categoryActiveNavbar;
}
} else {
if (window.location.href.indexOf(routes[i].layout + routes[i].path) !== -1) {
if (routes[i].secondaryNavbar) {
return routes[i].secondaryNavbar;
}
}
}
}
return activeNavbar;
};
const getRoutes = (routes) => {
return routes.map((prop, key) => {
if (prop.collapse) {
return getRoutes(prop.views);
}
if (prop.category === 'account') {
return getRoutes(prop.views);
}
if (prop.layout === '/admin') {
return <Route path={prop.layout + prop.path} component={prop.component} key={key} />;
} else {
return null;
}
});
};
const { isOpen, onOpen, onClose } = useDisclosure();
document.documentElement.dir = 'ltr';
// Chakra Color Mode
return (
<ChakraProvider theme={theme} resetCss={false}>
<Sidebar
routes={routes}
logoText={'PURITY UI DASHBOARD'}
display='none'
sidebarVariant={sidebarVariant}
{...rest}
/>
<MainPanel
w={{
base: '100%',
xl: 'calc(100% - 275px)'
}}

>
<Portal>
{/* <AdminNavbar
const { ...rest } = props;
// states and functions
const [sidebarVariant, setSidebarVariant] = useState("transparent");
const [fixed, setFixed] = useState(false);
// functions for changing the states from components
const getRoute = () => {
return window.location.pathname !== "/admin/full-screen-maps";
};
const getActiveRoute = (routes) => {
let activeRoute = "Default Brand Text";
for (let i = 0; i < routes.length; i++) {
if (routes[i].collapse) {
let collapseActiveRoute = getActiveRoute(routes[i].views);
if (collapseActiveRoute !== activeRoute) {
return collapseActiveRoute;
}
} else if (routes[i].category) {
let categoryActiveRoute = getActiveRoute(routes[i].views);
if (categoryActiveRoute !== activeRoute) {
return categoryActiveRoute;
}
} else {
if (
window.location.href.indexOf(routes[i].layout + routes[i].path) !== -1
) {
return routes[i].name;
}
}
}
return activeRoute;
};
// This changes navbar state(fixed or not)
const getActiveNavbar = (routes) => {
let activeNavbar = false;
for (let i = 0; i < routes.length; i++) {
if (routes[i].category) {
let categoryActiveNavbar = getActiveNavbar(routes[i].views);
if (categoryActiveNavbar !== activeNavbar) {
return categoryActiveNavbar;
}
} else {
if (
window.location.href.indexOf(routes[i].layout + routes[i].path) !== -1
) {
if (routes[i].secondaryNavbar) {
return routes[i].secondaryNavbar;
}
}
}
}
return activeNavbar;
};
const getRoutes = (routes) => {
return routes.map((prop, key) => {
if (prop.collapse) {
return getRoutes(prop.views);
}
if (prop.category === "account") {
return getRoutes(prop.views);
}
if (prop.layout === "/admin") {
return (
<Route
path={prop.layout + prop.path}
component={prop.component}
key={key}
/>
);
} else {
return null;
}
});
};
const { isOpen, onOpen, onClose } = useDisclosure();
document.documentElement.dir = "ltr";
// Chakra Color Mode
return (
<ChakraProvider theme={theme} resetCss={false}>
<Sidebar
routes={routes}
logoText={"PURITY UI DASHBOARD"}
display="none"
sidebarVariant={sidebarVariant}
{...rest}
/>
<MainPanel
w={{
base: "100%",
xl: "calc(100% - 275px)",
}}
>
<Portal>
{/* <AdminNavbar

onOpen={onOpen}
logoText={'PURITY UI DASHBOARD'}
Expand All @@ -111,33 +120,33 @@ export default function Dashboard(props) {
fixed={fixed}
{...rest}
/> */}
</Portal>
{getRoute() ? (
<PanelContent>
<PanelContainer>
<Switch>
{getRoutes(routes)}
<Redirect from='/admin' to='/admin/dashboard' />
</Switch>
</PanelContainer>
</PanelContent>
) : null}
{/* <Footer /> */}
{/* <Portal>
</Portal>
{getRoute() ? (
<PanelContent>
<PanelContainer>
<Switch>
{getRoutes(routes)}
<Redirect from="/admin" to="/admin/dashboard" />
</Switch>
</PanelContainer>
</PanelContent>
) : null}
{/* <Footer /> */}
{/* <Portal>
<FixedPlugin secondary={getActiveNavbar(routes)} fixed={fixed} onOpen={onOpen} />
</Portal> */}
<Configurator
secondary={getActiveNavbar(routes)}
isOpen={isOpen}
onClose={onClose}
isChecked={fixed}
onSwitch={(value) => {
setFixed(value);
}}
onOpaque={() => setSidebarVariant('opaque')}
onTransparent={() => setSidebarVariant('transparent')}
/>
</MainPanel>
</ChakraProvider>
);
<Configurator
secondary={getActiveNavbar(routes)}
isOpen={isOpen}
onClose={onClose}
isChecked={fixed}
onSwitch={(value) => {
setFixed(value);
}}
onOpaque={() => setSidebarVariant("opaque")}
onTransparent={() => setSidebarVariant("transparent")}
/>
</MainPanel>
</ChakraProvider>
);
}
1 change: 1 addition & 0 deletions src/utils/firebaseFxns/verification.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
query,
where,
getDocs,
updateDoc
} from "firebase/firestore";
import { ulid } from "ulid";
import { db } from "firebaseConfig";
Expand Down
Loading