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

Admin web officers #392

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
ee6dfb9
header
cjwagn1 Apr 20, 2020
37e81ab
before
cjwagn1 Apr 30, 2020
8d1a120
A lot of changes
cjwagn1 May 27, 2020
0d7e130
almost deleted all work
cjwagn1 May 27, 2020
4129f27
Added bankend
cjwagn1 May 31, 2020
c0888e1
Fixes
cjwagn1 Aug 24, 2020
67a729f
header
cjwagn1 Apr 20, 2020
a5a4608
before
cjwagn1 Apr 30, 2020
204bcdc
Move files to flatten structure and reduce layers
Apr 15, 2020
eeedcd7
Create MIGRATIONS.md
Apr 14, 2020
668a64f
Styling file and adding clarity
Apr 17, 2020
5e3501c
More info and formatting
Apr 17, 2020
47f76b7
Fix document links
Apr 17, 2020
aab3553
Add migration for missing permissions
Apr 17, 2020
8380fe2
Add omitted step which resulted in errors
Apr 22, 2020
fa08466
Update README.md
Apr 21, 2020
719a791
fix text being seen as html tag
Apr 21, 2020
d941ab5
Fix indentation of code blocks
Apr 21, 2020
73cc73a
Last indentation issue fixed
Apr 21, 2020
094af15
Move files to flatten structure and reduce layers
Apr 15, 2020
1362730
Fix Redemption code to have optional transaction
Apr 15, 2020
fe6f756
update to ant design version 4
Apr 15, 2020
4bde1d2
Events rework to make work with antd 4
Apr 15, 2020
d7cb180
Add starting code for redemption codes
Apr 15, 2020
95fe649
Add resolvers for groups
Apr 15, 2020
ca82d89
Add generation functionality
Apr 15, 2020
fa3e880
add file back
Apr 16, 2020
79e6cc7
Fix product redemption error
Apr 16, 2020
31502d3
Fix permission name, add migration
Apr 17, 2020
d23fe9e
Fixed date bug in membership tool
Apr 17, 2020
fe3fb29
almost deleted all work
cjwagn1 May 27, 2020
22d77b6
Added bankend
cjwagn1 May 31, 2020
5589c85
Fixes
cjwagn1 Aug 24, 2020
55df2f7
Git merge
cjwagn1 Sep 10, 2020
57b7a0b
Get current events query added
cjwagn1 Sep 10, 2020
ffa97f4
Took out comments
cjwagn1 Sep 10, 2020
d826300
Fixes
cjwagn1 Oct 8, 2020
a4cece6
Experimenting
cjwagn1 Nov 16, 2020
40b9724
added query things
cjwagn1 Nov 17, 2020
225c636
event fixes
cjwagn1 Nov 17, 2020
023cfcf
update
cjwagn1 Apr 19, 2021
4c07b15
Added nav tab icons
Dec 19, 2021
3763d0c
Removed tooltip bug
Dec 20, 2021
dcb7435
tees
Feb 9, 2022
8a8e8c4
setup Permission pages
henrievjen Mar 1, 2022
b70e02d
completed filters on officers page
henrievjen Mar 1, 2022
4883f73
officers card grid setup with dummy data
henrievjen Mar 1, 2022
591d1ab
front-end implementation of Officers page complete
henrievjen Apr 12, 2022
fdf6f91
added comments
henrievjen Apr 12, 2022
5a7e96d
merged master into branch
henrievjen Apr 12, 2022
4e775e3
fixed merge issues
henrievjen Apr 12, 2022
a4e1b54
Merge branch 'master' into admin-web-officers
henrievjen Aug 30, 2022
96cfaea
Merge branch 'master' into admin-web-officers
henrievjen Oct 27, 2022
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
8 changes: 8 additions & 0 deletions apps/admin-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@
"@auth0/auth0-spa-js": "^1.2.2",
"@types/react-csv": "^1.1.2",
"antd": "^4.1.3",
"chart.js": "^2.9.3",
"graphql": "^14",
"graphql-tag": "^2.10.1",
"qrcode.react": "^1.0.0",
"react": "^16.7.0",
"react-apollo": "^3.1.3",
"react-burger-menu": "^2.6.13",
"react-chartjs-2": "^2.9.0",
"react-csv": "^2.0.3",
"react-dom": "^16.7.0",
"react-highlight-words": "^0.16.0",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.4.1",
"react-use": "^15.1.0",
"serialize-javascript": "^2.1.2",
"styled-components": "^4.1.3"
},
"scripts": {
Expand All @@ -35,6 +42,7 @@
"@types/jest": "^24.0.18",
"@types/node": "^12.7.12",
"@types/react": "^16.7.20",
"@types/react-burger-menu": "^2.6.1",
"@types/react-dom": "^16.0.11",
"@types/react-highlight-words": "^0.16.0",
"@types/react-router-dom": "^5.1.0",
Expand Down
17 changes: 12 additions & 5 deletions apps/admin-web/public/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<link
href="https://fonts.googleapis.com/css2?family=Nunito+Sans&display=swap"
rel="stylesheet"
/>
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
184 changes: 71 additions & 113 deletions apps/admin-web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,129 +1,87 @@
import React, { useEffect } from "react";
import { BrowserRouter, Link, Route, Switch } from "react-router-dom";
import { Layout, Menu, PageHeader, Spin } from "antd";

import { ToolList } from "./Tools";
import { Events } from "./screens/Events";
import { Membership } from "./screens/Membership";
import { RedemptionCodes } from "./screens/RedemptionCodes";
import { Spin } from "antd";
import { BrowserRouter } from "react-router-dom";
import styled, { AnyStyledComponent } from "styled-components";
import { config } from "./config";
import "./static/css/App.css";

import { useAuth0 } from "./utils/react-auth0-wrapper";
import Sidebar from "./screens/Dashboard/Sidebar";
import Main from "./screens/Dashboard/Main";

const { Header, Content, Footer, Sider } = Layout;

const NotFound: React.FC<{}> = (): JSX.Element => {
return <h1>You are lost!</h1>;
};

const MainContent: React.SFC<{}> = (): JSX.Element => {
return (
<Switch>
<Route exact={true} path="/" component={ToolList} />
<Route path="/events" component={Events} />
<Route path="/membership" component={Membership} />
<Route path="/redemption" component={RedemptionCodes} />
<Route component={NotFound} />
</Switch>
);
};
const Grid: AnyStyledComponent = styled.div`
height: 100vh;
display: grid;
width: 100vw;
margin: auto;
grid-template-columns: repeat(16, 1fr);
grid-template-rows: auto;
grid-template-areas: "m m c c c c c c c c c c c c c c";
@media (max-width: 1530px) {
grid-template-columns: 1fr
grid-template-areas:
"m"
"c";
grid-template-rows: 0px auto;

}
`;
const Content: AnyStyledComponent = styled.div`
grid-area: c;
`;
const Menu: AnyStyledComponent = styled.div`
grid-area: m;
@media (max-width: 1530px) {
grid-area: m;
}
`;

const App: React.SFC<{}> = (): JSX.Element => {
const {
loading,
isAuthenticated,
getTokenSilently,
loginWithRedirect,
logout,
user,
} = useAuth0();
const {
loading,
isAuthenticated,
getTokenSilently,
loginWithRedirect,
} = useAuth0();

useEffect(() => {
if (loading) {
return;
}
useEffect(() => {
if (loading) {
return;
}

if (!isAuthenticated) {
const fn: any = async (): Promise<void> => {
await loginWithRedirect({
appState: { targetUrl: window.location.href },
});
};
if (!isAuthenticated) {
const fn: any = async (): Promise<void> => {
await loginWithRedirect({
appState: { targetUrl: window.location.href },
});
};

fn();
} else {
const setToken: () => void = async (): Promise<void> => {
const token: string = (await getTokenSilently()) || "";
localStorage.setItem(config.ACCESS_TOKEN_KEY, token);
};
fn();
} else {
const setToken: () => void = async (): Promise<void> => {
const token: string = (await getTokenSilently()) || "";
localStorage.setItem(config.ACCESS_TOKEN_KEY, token);
};

setToken();
}
}, [loading, isAuthenticated, getTokenSilently]);
setToken();
}
}, [loading, isAuthenticated, getTokenSilently]);

const onLogoutClick: () => void = (): void => {
logout({ returnTo: config.REDIRECT_PAGE_URI });
};
if (loading || !isAuthenticated) {
return <Spin size="large" className="load-page" tip="Loading..." />;
}

if (loading || !isAuthenticated) {
return <Spin size="large" className="load-page" tip="Loading..." />;
}

return (
<BrowserRouter>
<Layout>
<Sider
breakpoint="md"
collapsedWidth="0"
onBreakpoint={undefined}
onCollapse={undefined}
>
<div className="logo" />
<Menu theme="dark" mode="inline" defaultSelectedKeys={["events"]}>
<Menu.Item key="events">
<Link to="/events">
<span className="nav-text">Events</span>
</Link>
</Menu.Item>
<Menu.Item key="membership">
<Link to="/membership">
<span className="nav-text">Membership Tool</span>
</Link>
</Menu.Item>
<Menu.Item key="redemption">
<Link to="/redemption">
<span className="nav-text">Redemption Codes</span>
</Link>
</Menu.Item>
<Menu.Item onClick={onLogoutClick} key="signOut">
<span className="nav-text">Sign Out</span>
</Menu.Item>
</Menu>
</Sider>
<Layout>
<Header style={{ background: "#fff", padding: 0 }}>
<PageHeader
backIcon={false}
title={`Hello, ${user.name}. Welcome to your Admin Dashboard`}
/>
</Header>
<Content style={{ margin: "24px 16px 0" }}>
<MainContent />
<Footer style={{ textAlign: "center" }}>S&T ACM 2019</Footer>
</Content>
</Layout>
</Layout>
</BrowserRouter>
);
return (
<BrowserRouter>
<Grid>
<Content>
<Main />
</Content>
<Menu>
<Sidebar />
</Menu>
</Grid>
</BrowserRouter>
);
};

/*
* Future Routes
<Route exact={true} path="/membership" component={Membership} />
<Route exact={true} path="/sigs" component={Sigs} />
<Route exact={true} path="/sponsors" component={Sponsors} />
<Route exact={true} path="/products" component={Products} />
*/

export { App };
23 changes: 0 additions & 23 deletions apps/admin-web/src/Tools.tsx

This file was deleted.

58 changes: 58 additions & 0 deletions apps/admin-web/src/generated/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,21 @@ export type UserUpdateInput = {
email?: Maybe<Scalars['String']>;
};

export type GetCurrentEventsQueryVariables = Exact<{ [key: string]: never; }>;


export type GetCurrentEventsQuery = (
{ __typename?: 'Query' }
& { currentEvents: Array<(
{ __typename?: 'Event' }
& Pick<Event, 'id' | 'dateCreated' | 'dateHosted' | 'dateExpire' | 'eventTitle' | 'description' | 'location' | 'flierLink' | 'eventLink'>
& { hostSig: (
{ __typename?: 'Sig' }
& Pick<Sig, 'name'>
) }
)> }
);

export type SigsQueryVariables = Exact<{ [key: string]: never; }>;


Expand Down Expand Up @@ -621,6 +636,49 @@ export type GetProductsQuery = (
);


export const GetCurrentEventsDocument = gql`
query getCurrentEvents {
currentEvents {
id
dateCreated
dateHosted
dateExpire
hostSig {
name
}
eventTitle
description
location
flierLink
eventLink
}
}
`;

/**
* __useGetCurrentEventsQuery__
*
* To run a query within a React component, call `useGetCurrentEventsQuery` and pass it any options that fit your needs.
* When your component renders, `useGetCurrentEventsQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useGetCurrentEventsQuery({
* variables: {
* },
* });
*/
export function useGetCurrentEventsQuery(baseOptions?: ApolloReactHooks.QueryHookOptions<GetCurrentEventsQuery, GetCurrentEventsQueryVariables>) {
return ApolloReactHooks.useQuery<GetCurrentEventsQuery, GetCurrentEventsQueryVariables>(GetCurrentEventsDocument, baseOptions);
}
export function useGetCurrentEventsLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<GetCurrentEventsQuery, GetCurrentEventsQueryVariables>) {
return ApolloReactHooks.useLazyQuery<GetCurrentEventsQuery, GetCurrentEventsQueryVariables>(GetCurrentEventsDocument, baseOptions);
}
export type GetCurrentEventsQueryHookResult = ReturnType<typeof useGetCurrentEventsQuery>;
export type GetCurrentEventsLazyQueryHookResult = ReturnType<typeof useGetCurrentEventsLazyQuery>;
export type GetCurrentEventsQueryResult = ApolloReactCommon.QueryResult<GetCurrentEventsQuery, GetCurrentEventsQueryVariables>;
export const SigsDocument = gql`
query sigs {
sigs {
Expand Down
30 changes: 30 additions & 0 deletions apps/admin-web/src/screens/Dashboard/Main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from "react";
import { Route, Switch } from "react-router-dom";
import { Upcoming } from "../Events/Upcoming";
import { Previous } from "../Events/Previous";
import { Membership } from "../Membership";
import { ToolList } from "../../tools/Tools";
import { Officers } from "../Permissions/Officers";
import { Groups } from "../Permissions/Groups";
import { RedemptionCodes } from "../Permissions/RedemptionCodes";

const NotFound: React.FC<{}> = (): JSX.Element => {
return <h1>You are lost!</h1>;
};

const Main: React.SFC<{}> = (): JSX.Element => {
return (
<Switch>
<Route exact={true} path="/" component={ToolList} />
<Route path="/events/upcoming" component={Upcoming} />
<Route path="/events/previous" component={Previous} />
<Route path="/membership" component={Membership} />
<Route path="/permissions/officers" component={Officers} />
<Route path="/permissions/groups" component={Groups} />
<Route path="/permissions/redemption" component={RedemptionCodes} />
<Route component={NotFound} />
</Switch>
);
};

export default Main;
Loading