Skip to content

Commit f604134

Browse files
Merge pull request #71 from usingbrain/btosz
Toggle history bar
2 parents 3bea0f6 + e5103a6 commit f604134

12 files changed

Lines changed: 25368 additions & 248 deletions

File tree

client/package-lock.json

Lines changed: 25190 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/Assets/PerfectLogo2.svg

Lines changed: 0 additions & 95 deletions
This file was deleted.

client/src/Components/Calendar/Overview.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import { useCourseOverviewQuery } from '../../generated/graphql';
44
//package for date format
55
import moment from 'moment';
66

7-
const overviewStyle = "flex flex-col m-auto bg-white w-11/12 md:w-10/12 lg:w-9/12 xl:w-7/12 shadow-xl mt-8";
8-
const headerStyle = "flex bg-green shadow-md p-4 justify-center text-white text-md sm:text-lg md:text-xl";
9-
const historyStyle = "flex flex-row flex-wrap justify-start w-full";
7+
const overviewStyle =
8+
'flex flex-col m-auto bg-white w-11/12 md:w-10/12 lg:w-9/12 xl:w-7/12 shadow-xl mt-8';
9+
const headerStyle =
10+
'flex bg-green shadow-md p-4 justify-center text-white text-md sm:text-lg md:text-xl';
11+
const historyStyle = 'flex flex-row flex-wrap justify-start w-full';
1012

1113
const Overview: React.FC = () => {
1214
const courseId = Number(useParams().courseId);
@@ -20,30 +22,30 @@ const Overview: React.FC = () => {
2022
} // TODO handle error
2123

2224
const history = data?.getCourseOverview?.data;
23-
const total = history?.studentTotal;
2425
const sessions = history?.sessions;
2526

2627
console.log('history: ', history);
2728
return (
2829
<div>
2930
<div className={overviewStyle}>
30-
<header>
31-
<h3 className={headerStyle}>Students assigned to this course: {total}</h3>
32-
</header>
33-
<article className="flex flex-col justify-center">
34-
<p className="m-auto text-xl">Attendance</p>
31+
<article className='flex flex-col justify-center'>
32+
<p className='m-auto text-xl'>Attendance</p>
3533
<section className={historyStyle}>
3634
{!!sessions &&
3735
sessions.map((session) => {
3836
if (session) {
3937
const date = new Date(Number(session.createdAt));
4038
const UTCdate = date.toUTCString();
4139
return (
42-
<div className="w-26 p-2 md:w-32 text-center border-2 border-black m-1 hover:bg-green-xlight">
40+
<div className='w-26 p-2 md:w-32 text-center border-2 border-black m-1 hover:bg-green-xlight'>
4341
<Link to={`/homepage/classes/${courseId}/${session.id}`}>
4442
<div>
45-
<h5 className="text-lg sm:text-xl">{session.attendance}</h5>
46-
<p className="text-sm sm:text-md">{moment(UTCdate).format('L')}</p>
43+
<h5 className='text-lg sm:text-xl'>
44+
{session.attendance}
45+
</h5>
46+
<p className='text-sm sm:text-md'>
47+
{moment(UTCdate).format('L')}
48+
</p>
4749
</div>
4850
</Link>
4951
</div>

client/src/Components/ClassView/ClassDashboard.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,16 @@ import StudentsList from './StudentsList';
33
import SessionBtn from './SessionBtn';
44
import RegisterBtn from './RegisterBtn';
55

6-
const viewStyle =
7-
'flex flex-row justify-between items-left content-center pt-4 w-full px-8 h-full';
8-
const listStyle = "rounded-sm shadow-xl w-1/2";
9-
const listHeader = "bg-green p-2 text-white text-bold text-lg rounded-t-sm";
6+
const viewStyle = 'flex flex-row justify-around';
7+
const listStyle = 'rounded-sm shadow-xl w-1/2';
108

119
const ClassDashboard: React.FC<{ courseId: number }> = ({ courseId }) => {
1210
return (
1311
<div className={viewStyle}>
1412
<section className={listStyle}>
15-
<div className={listHeader}>Students</div>
1613
<StudentsList courseId={courseId} />
1714
</section>
18-
<article>
15+
<article className='w-2/6'>
1916
<SessionBtn courseId={courseId} />
2017
<RegisterBtn courseId={courseId} />
2118
</article>

client/src/Components/ClassView/ClassView.tsx

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import Overview from '../Calendar/Overview';
99

1010
const headerStyle =
1111
'bg-black text-white flex flex-row justify-between items-center content-center p-8 h-20 mb-4 text-3xl';
12-
const attendanceStyle = 'flex justify-center bg-black hover:bg-green-light py-4 rounded-sm font-bold text-lg mb-4 w-1/3 text-white ';
12+
const attendanceStyle =
13+
'flex justify-center bg-black py-4 rounded-sm font-bold text-lg w-1/3 text-white mb-4';
14+
const listHeader =
15+
'w-1/2 bg-green p-2 text-white text-bold text-lg rounded-t-sm';
1316

1417
const ClassView: React.FC = () => {
1518
const dispatch = useDispatch();
@@ -25,26 +28,31 @@ const ClassView: React.FC = () => {
2528

2629
if (course && courseId) {
2730
return (
28-
<section className="h-screen flex flex-col justify-start w-3/4">
31+
<section className='h-screen flex flex-col justify-start w-3/4'>
2932
<div className={headerStyle}>
30-
<h1 className="font-bold">{course.name?.toUpperCase()}</h1>
31-
<Link to="/homepage">
33+
<h1 className='font-bold'>{course.name?.toUpperCase()}</h1>
34+
<Link to='/homepage'>
3235
<button onClick={() => dispatch(setSelected(null))}>
33-
<CloseBtn className="w-10 h-10" />
36+
<CloseBtn className='w-10 h-10' />
3437
</button>
3538
</Link>
3639
</div>
37-
<article className="flex self-end">
38-
<Link to={link} className={attendanceStyle}>
39-
<h3
40-
className="text-lg"
41-
onClick={() => dispatch(setHistory(history))}
42-
>
43-
{history ? 'Back to dashboard' : 'Attendance history'}
44-
</h3>
45-
</Link>
40+
<article className='flex flex-col px-10'>
41+
<div className='flex flex-row justify-around w-full'>
42+
<div className={listHeader}>
43+
Students {history && `assigned to this course:`}
44+
</div>
45+
<Link to={link} className={attendanceStyle}>
46+
<h3
47+
className='text-lg'
48+
onClick={() => dispatch(setHistory(history))}
49+
>
50+
{history ? 'Back to dashboard' : 'Attendance history'}
51+
</h3>
52+
</Link>
53+
</div>
54+
{history ? <Outlet /> : <ClassDashboard courseId={courseId} />}
4655
</article>
47-
{history ? <Outlet /> : <ClassDashboard courseId={courseId} />}
4856
</section>
4957
);
5058
}

client/src/Components/ClassView/StudentsList.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ const StudentsList: React.FC<{ courseId: number }> = ({ courseId }) => {
3737

3838
useEffect(() => {
3939
const socket = socketIOClient(ENDPOINT);
40-
socket.on('ASSIGNMENT_CHANGE', () => {
41-
console.log('socket is called');
42-
refetchAssigned();
43-
});
44-
}, [refetchAssigned]);
40+
socket.on('ASSIGNMENT_CHANGE', () => refetchAssigned());
41+
}, []);
4542

4643
const loadingAnimationOptions = {
4744
loop: true,
@@ -60,7 +57,7 @@ const StudentsList: React.FC<{ courseId: number }> = ({ courseId }) => {
6057
return (
6158
<div className={listStyle}>
6259
{students?.length ? (
63-
<div className="flex">
60+
<div className='flex'>
6461
<div>
6562
{students.map((student) => {
6663
return (
Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,55 @@
1-
import React from "react";
2-
import { Link, Outlet } from "react-router-dom";
1+
import React from 'react';
2+
import { Link, Outlet } from 'react-router-dom';
33
import Lottie from 'react-lottie';
44
import animationData from '../Assets/checklist.json';
55
import { ReactComponent as QRStamp } from '../../../Assets/thePerfectestLogo2.svg';
66

7-
8-
const linkStyle = "flex text-white w-3/4 h-12 md:h-14 lg:h-20 xl:h-24 border-2 border-white justify-center m-auto my-8 md:my-8 items-center md:text-xl hover:bg-green-light xl:text-2xl";
9-
const promptStyle = "bg-white flex flex-row rounded-sm w-full sm:w-10/12 h-80 lg:h-96 items-center m-auto my-14";
10-
const checklistStyle = "invisible sm:visible w-0 sm:w-1/2 h-full";
11-
const buttonStyle = "bg-green flex rounded-sm h-full w-full sm:w-1/2 lg:w-4/12 justify-center items-center flex-col px-8 lg:px-8 xl:px-16 hover:shadow-2xl";
12-
const welcomeStyle = "flex rounded-sm justify-center flex-col sm:items-start items-center w-0 sm:w-1/2 sm:p-4 m-auto";
7+
const promptStyle =
8+
'flex flex-col justify-around w-full h-full md:h-3/4 md:self-center';
9+
const checklistStyle = 'h-auto w-44 md:w-4/6 sm:w-1/2';
10+
const welcomeStyle =
11+
'flex flex-col justify-around items-center sm:w-full md:flex-row';
12+
const registerStyle =
13+
'w-11/12 bg-green text-white text-center mb-6 p-4 sm:m-0 sm:w-5/12';
14+
const loginStyle =
15+
'w-11/12 text-green border-2 border-green text-center p-4 sm:w-5/12';
1316

1417
const Prompt: React.FC = () => {
18+
const defaultOptions = {
19+
loop: true,
20+
autoplay: true,
21+
animationData: animationData,
22+
rendererSettings: {},
23+
};
1524

16-
const defaultOptions = {
17-
loop: true,
18-
autoplay: true,
19-
animationData: animationData,
20-
rendererSettings: {}
21-
};
22-
23-
return (
24-
<div className="w-full">
25-
<Outlet />
26-
<div className="h-1/3 w-1/3 m-auto my-4 visible sm:invisible sm:my-0 sm:h-2 sm:w-2"><QRStamp /></div>
27-
<section className={promptStyle}>
28-
<article className={welcomeStyle}>
29-
<div className={checklistStyle}>
30-
<Lottie options={defaultOptions}
31-
height={200}
32-
width={'100%'}
33-
/>
34-
</div>
35-
<p className="text-black text-md text-xl md:text-2xl lg:text-3xl xl:text-4xl invisible sm:visible">We help you take attendance quickly, easily, and without hassle.</p>
36-
</article>
37-
<aside className={buttonStyle}>
38-
<h1 className="text-white text-2xl lg:text-4xl">Welcome</h1>
39-
<ul className="w-full">
40-
<li className="w-full">
41-
<p><Link to={'/register'} className={linkStyle}>Register</Link></p>
42-
</li>
43-
<li>
44-
<p><Link to={'/login'} className={linkStyle}>Login</Link></p>
45-
</li>
46-
</ul>
47-
</aside>
48-
</section>
49-
</div>
50-
)
51-
}
25+
return (
26+
<div className='flex w-full h-full 2xl:px-32 2xl:w-3/4'>
27+
<Outlet />
28+
<section className={promptStyle}>
29+
<h1 className='text-green font-bold text-5xl md:text-6xl xl:text-7xl text-center'>
30+
Welcome to QRCheckd!
31+
</h1>
32+
<article className={welcomeStyle}>
33+
<div className='flex flex-col justify-around w-full sm:h-4/6'>
34+
<p className='text-black text-2xl lg:text-3xl xl:text-4xl text-center p-4'>
35+
Take attendance quickly, easily, and without hassle.
36+
</p>
37+
<div className='flex flex-col justify-around items-center sm:flex-row w-full'>
38+
<Link to={'/register'} className={registerStyle}>
39+
Register
40+
</Link>
41+
<Link to={'/login'} className={loginStyle}>
42+
Login
43+
</Link>
44+
</div>
45+
</div>
46+
<div className={checklistStyle}>
47+
<Lottie options={defaultOptions} height={'100%'} width={'100%'} />
48+
</div>
49+
</article>
50+
</section>
51+
</div>
52+
);
53+
};
5254

53-
export default Prompt;
55+
export default Prompt;

0 commit comments

Comments
 (0)