Skip to content

Commit

Permalink
Fixes and Minor Features
Browse files Browse the repository at this point in the history
Push to Prod
  • Loading branch information
Freeassassin authored Aug 15, 2023
2 parents b5b174b + 2408b9c commit 3f12df5
Show file tree
Hide file tree
Showing 22 changed files with 722 additions and 487 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/backend_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Backend Tests

on:
push:
paths:
- server/**
pull_request:
paths:
- server/**

jobs:
test_backend:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3.5.3

- name: Start Docker
run: docker-compose -f docker-compose.test.yml up --build -d

- name: Run Tests
run: cd server && yarn install && yarn test:actions
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: automated_tests

on:
pull_request:
branches:
- dev
- main

jobs:
build_frontend:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3.5.3

- name: Build client
run: cd client && yarn install && yarn build
name: Frontend Tests

on:
push:
paths:
- client/**
pull_request:
paths:
- client/**

jobs:
build_frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3.5.3

- name: Build client
run: cd client && yarn install && yarn build
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"dependencies": {
"@react-pdf/renderer": "^3.1.12",
"@reduxjs/toolkit": "^1.9.5",
"@tanstack/react-table": "^8.9.3",
"axios": "^1.4.0",
"email-validator": "^2.0.4",
"export-from-json": "^1.7.2",
Expand Down
296 changes: 148 additions & 148 deletions client/src/assets/schedule/data.jsx

Large diffs are not rendered by default.

87 changes: 87 additions & 0 deletions client/src/components/MakeSchedulePDF/MakeSchedulePDF.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import React from 'react';
import { getFroshGroupSchedule } from '../../pages/Profile/functions';
import { Document, Page, Text, View, Svg, Line, Font, StyleSheet } from '@react-pdf/renderer';
import MainFroshLogo from '../../assets/logo/frosh-main-logo-with-bg.svg';

const styles = StyleSheet.create({
page: {
backgroundColor: '#E4E4E4',
},
eventBubble: {
backgroundColor: '#58458f',
borderRadius: '10px',
padding: '10px',
margin: '10px'
},
eventName: {
fontSize: 12,
fontWeight: 'bold',
padding: '10px 0',
color: '#fff'
},
eventLoc: {
fontSize: 12,
padding: '10px 0',
color: '#fff'
},
eventDate: {
fontSize: 11,
fontStyle: 'italic',
color: '#fff',
padding: '5px 0'
},
eventDesc: {
fontSize: 12,
color: '#fff',
padding: '10px 0'
}
});

const MakeSchedulePDF = (froshObject) => {
const froshGroup = froshObject?.froshGroup;
const scheduleData = getFroshGroupSchedule(froshGroup);

return (
<Document>
<Page size="A4" style={styles.page}>
<View style={{ padding: '30px' }}>
<Text style={{ fontSize: 16, color: '#2c1370', padding: '20px 0', fontWeight: 'bold' }}>
F!rosh Schedule 2T3
</Text>
<Svg height="10" width="500">
<Line x1="0" y1="0" x2="500" y2="0" strokeWidth={4} stroke="rgb(49,25,87)" />
</Svg>
{Object.keys(scheduleData).map((day) => (
<div key={day}>
<Text style={{ fontSize: 14, padding: '20px 0', color: '#2c1370', fontWeight: 'bold' }}>
{day}
</Text>
{scheduleData[day].map((scheduleDay, index) => (
<div key={scheduleDay} style={styles.eventBubble}>
<Text style={styles.eventName}>
{scheduleDay['Event Name']}
</Text>
<Text style={styles.eventDate}>
{scheduleDay['Start Time']} - {scheduleDay['End Time']}
</Text>
{scheduleDay['Event Location'] ?
<Text style={styles.eventLoc}>
{scheduleDay['Event Location']}
</Text> : <></>
}
{scheduleDay['Event Description'] ?
<Text style={styles.eventDesc}>
{scheduleDay['Event Description']}
</Text> : <></>
}
</div>
))}
</div>
))}
</View>
</Page>
</Document>
);
};

export { MakeSchedulePDF };
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ const AskQuestionButton = () => {
const { user } = useSelector(userSelector);

const leader = user?.userType === 'leadur';
if (leader) {

if (leader || !user) {
// don't show FAQ button if leadur or if not logged in
return <></>;
}
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import './ProfilePageResources.scss';
import PropTypes from 'prop-types';

export const ProfilePageResources = ({ froshObject }) => {

return (
<div className="profile-page-resources profile-page-side-section">
<h2>Resources</h2>
Expand All @@ -24,7 +25,8 @@ export const ProfilePageResources = ({ froshObject }) => {
</a>
);
})}
{froshObject ? (
{froshObject ? (
<>
<a key={'5Download'} className="no-link-style">
<ButtonBubble
label={'Download Information PDF'}
Expand All @@ -40,9 +42,23 @@ export const ProfilePageResources = ({ froshObject }) => {
style={{ margin: 0, marginTop: '10px' }}
/>
</a>
</>
) : (
<></>
)}
<ButtonBubble
label={'Download Schedule PDF'}
onClick={async () => {
const ReactPDF = await import('@react-pdf/renderer');
const { MakeSchedulePDF } = await import('../../MakeSchedulePDF/MakeSchedulePDF');
const blob = await ReactPDF.pdf(MakeSchedulePDF(froshObject)).toBlob();
const fileURL = URL.createObjectURL(blob);
const pdfWindow = window.open(fileURL, '_blank');
pdfWindow && pdfWindow.focus();
}}
isSecondary
style={{ margin: 0, marginTop: '10px' }}
/>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ export const ProfilePageSchedule = () => {
const [froshGroup, setFroshGroup] = useState(user?.froshGroup);
const scheduleData = getFroshGroupSchedule(froshGroup);
const days = getDaysSchedule(scheduleData);

const today = new Date();
const options = { weekday: 'long' };
const options = { weekday: 'long', month: 'long', day: 'numeric' };
const todayString = today.toLocaleDateString('en-US', options).replace(',', '');

let count = 0;
Expand Down Expand Up @@ -60,7 +61,7 @@ export const ProfilePageSchedule = () => {
setCloseAll(!closeAll);
}}
style={{
maxWidth: '250px',
maxWidth: '160px',
marginTop: '0px',
marginBottom: '10px',
padding: '11px 15px',
Expand Down
9 changes: 2 additions & 7 deletions client/src/components/schedule/ScheduleHome/ScheduleHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@ import location from '../../../assets/misc/location.png';
import { DarkModeContext } from '../../../util/DarkModeProvider';

function getDaysSchedule() {
const scheduleData = data;
const days = [];
for (let day of Object.keys(scheduleData)) {
days.push(day.split(' ')[0]);
}
return days;
return Object.keys(data);
}

const ScheduleComponent = () => {
const today = new Date();
const options = { weekday: 'long' };
const options = { weekday: 'long', month: 'long', day: 'numeric' };
const todayString = today.toLocaleDateString('en-US', options).replace(',', '');
let count = 0;
for (let day of getDaysSchedule()) {
Expand Down
Loading

0 comments on commit 3f12df5

Please sign in to comment.