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

Release Master merge #121

Merged
merged 15 commits into from
Oct 25, 2021
Merged
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
4 changes: 0 additions & 4 deletions src/assets/notif_approved.svg

This file was deleted.

6 changes: 2 additions & 4 deletions src/components/common/notificationCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { CLOSE_MODAL } from 'constants/action-types';
import parseDate from 'utils/parseDate';

import defaultIcon from 'assets/notif_default.svg';
import approved from 'assets/notif_approved.svg';
import file from 'assets/notif_file.svg';
import course from 'assets/notif_course.svg';
import request from 'assets/notif_request.svg';
Expand Down Expand Up @@ -44,11 +43,10 @@ const getTemplateData = (notification_data) => {
break;

case 'request':
templateData.icon = request;
if (verb.includes('you requested')) {
templateData.icon = approved;
templateData.title = 'Request Approved';
templateData.title = 'Request Updated';
} else {
templateData.icon = request;
templateData.title = 'New Request Added';
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/components/coursecard/materialCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const MaterialCard = (props) => {
<img src={material_map[props.ext] ? material_map[props.ext] : img} alt="icon" />
</div>
<div className="material--name" onClick={() => viewFile(props.url)} title={props.name}>
{props.name.length < 30 ? props.name : ShortName(props.name)}
{props.name.length < 10 ? props.name : ShortName(props.name)}
</div>
<div className="material--download">Downloads: {props.downloads}</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/searchResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const SearchResult = (props) => {
<img src={material_map[props.ext] ? material_map[props.ext] : img} alt="icon" />
</div>
<div className="file--card-heading" title={props.name}>
{props.name.length < 30 ? props.name : shortName(props.name)}
{props.name.length < 20 ? props.name : shortName(props.name)}
</div>
<div className="file--card-info">
<span className="file--card-info_name" title={props.course_name}>
Expand Down
36 changes: 34 additions & 2 deletions src/components/request/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class Request extends Component {
* @param {object} e
*/
file_active_material = (e) => {
$('input:radio').prop('checked', false);
$('input:text').val('');
this.setState({ disable: 2 });
};

Expand All @@ -89,6 +91,13 @@ class Request extends Component {
this.setState({ disable: 3 });
};

/**
* Activates request button in file.
*/
active_request_file = () => {
this.setState({ disable: 4 });
};

/**
* Activates course name input.
*/
Expand All @@ -103,6 +112,13 @@ class Request extends Component {
this.setState({ disableCourse: 2 });
};

/**
* Activates request button in course.
*/
active_request_course = () => {
this.setState({ disableCourse: 4 });
};

/**
* Requests file through API.
*
Expand Down Expand Up @@ -340,6 +356,7 @@ class Request extends Component {
type="text"
disabled={!(this.state.disable >= 3)}
name="name"
onChange={this.active_request_file}
/>
{this.state.requested ? (
<div className="request--confirmation">
Expand Down Expand Up @@ -377,7 +394,14 @@ class Request extends Component {
<img className="request--loader" alt="loader" src={small_loader} />
</div>
) : (
<button type="submit" className="request--button-file">
<button
type="submit"
className="request--button-file"
disabled={!(this.state.disable >= 4)}
style={{
background: this.state.disable >= 4 ? '#38a7de' : '#88CAEB',
}}
>
Request
</button>
)}
Expand Down Expand Up @@ -436,6 +460,7 @@ class Request extends Component {
type="text"
name="code"
disabled={!(this.state.disableCourse >= 2)}
onChange={this.active_request_course}
/>
{this.state.requested ? (
<div className="request--confirmation">
Expand Down Expand Up @@ -469,7 +494,14 @@ class Request extends Component {
<img className="request--loader" alt="loader" src={small_loader} />
</div>
) : (
<button type="submit" className="request--button-course">
<button
type="submit"
className="request--button-course"
disabled={!(this.state.disableCourse >= 4)}
style={{
background: this.state.disableCourse >= 4 ? '#38a7de' : '#88CAEB',
}}
>
Request
</button>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebar/adminSubMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const SubMenu = () => {
onClick={() => dispatch(SwitchSubMenu(key))}
>
<span className="coursehandle--heading" title={item.title}>
{item.title.length < 40 ? item.title : ShortName(item.title)}
{item.title.length < 30 ? item.title : ShortName(item.title)}
{item.code && ` | ${item.code}`}
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/styles/partials/_coursePage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
height: 0.0625rem;
align-self: center;
margin-top: 0.625rem;
border: 0.02125rem solid $primary;
border-bottom: 0.125rem solid $primary;
}

&addcourse {
Expand Down
10 changes: 5 additions & 5 deletions src/styles/partials/_landingHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
background-size: contain;
height: 24.4375rem;
width: 100%;
overflow: hidden;

cursor: default;

Expand Down Expand Up @@ -69,6 +68,7 @@
&search {
display: flex;
flex-direction: row;
justify-content: center;
margin-top: 1.25rem;
width: 70%;
border-radius: 0.25rem;
Expand Down Expand Up @@ -104,7 +104,7 @@

&login {
@include font;
width: 6.25rem;
width: 5.25rem;
height: 2.5625rem;
color: $secondary;
background: transparent;
Expand All @@ -113,11 +113,11 @@

&signup {
@include font;
width: 7.5625rem;
width: 4.99625rem;
height: 2.5625rem;
color: $font-color;
border-radius: 0.25rem;
border: 1px solid $font-color;
border-radius: 0.125rem;
border: 0.0625rem solid $font-color;
background: transparent;
}

Expand Down
2 changes: 1 addition & 1 deletion src/styles/partials/_materialCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

&size {
@include font;
width: 3.8rem;
width: 4.5rem;
height: 1.1875rem;
margin-right: 7.75rem;
margin-top: 1.5rem;
Expand Down
3 changes: 2 additions & 1 deletion src/styles/partials/_search.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.search {
@include center;
display: flex;
flex-direction: column;
width: 100%;
Expand Down Expand Up @@ -118,7 +119,7 @@
}
&-seeall {
@include font;
width: 2.625rem;
width: 3rem;
height: 1.0625rem;
margin-left: 87.69%;
margin-bottom: 1rem;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/short-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ let ShortName = function (name) {
}
let names = name.split(' ');
if (names.length === 1) {
return name.length < 30 ? name : name.substr(0, 25) + '...';
return name.length < 10 ? name : name.substr(0, 8) + '...';
}
let firstName = names[0];
let firstName = names[0].length < 10 ? names[0] : names[0].substr(0, 8) + '.';
let lastName = names[names.length - 1];
let lastInitial = `${lastName.substr(0, 1)}.`;
return `${firstName} ${lastInitial}`;
Expand Down