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

UI for Multiple Classrooms #526

Merged
merged 29 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
dc4511f
Allowed support for a student to join multiple classes
tfnribeiro Sep 2, 2024
18b87f5
Merge branch 'master' into frontend-support-multiple-classes
tfnribeiro Sep 5, 2024
6b00c04
Added support to show multiple classes
tfnribeiro Sep 5, 2024
890bff0
rename My Current Class to My Classrooms
igawaclawska Sep 9, 2024
db597bb
first attempt on creating removable list items for classrooms
igawaclawska Sep 9, 2024
1c2f2ae
cleanup the CurrentClass.js file
igawaclawska Sep 9, 2024
fc2b40e
implement the confirmation modal
igawaclawska Sep 9, 2024
8e883a5
improve styling of the ClassroommItem component
igawaclawska Sep 10, 2024
3613046
animate the modal's GoToButton on click
igawaclawska Sep 10, 2024
9fcd796
rename InfoPage.sc.js to PreferencesPage.sc.js
igawaclawska Sep 10, 2024
b853506
rename CurrentClass.js with Classrooms.js
igawaclawska Sep 10, 2024
5128827
rename MyClassroomsModal to ExttClassroomModal
igawaclawska Sep 10, 2024
4e1cf76
Clear error message after successful next attempt on adding classroom…
igawaclawska Sep 10, 2024
3cac2ae
Clear error message after successful exit from classroom
igawaclawska Sep 10, 2024
7f36d72
apply more generic naming to the list items and containers
igawaclawska Sep 10, 2024
f9d0d4a
fix the unique key prop warning
igawaclawska Sep 10, 2024
6222538
move FullWidthErrorMsg to the components folder
igawaclawska Sep 10, 2024
aa04618
move FullWidthListItem and FullWidthListContainer to the components f…
igawaclawska Sep 10, 2024
b410d30
cleanup
igawaclawska Sep 10, 2024
625fee3
fix the prop
igawaclawska Sep 10, 2024
7ae9887
move the Classrooms page and its modal to the Classroom folder
igawaclawska Sep 10, 2024
fa75482
update comment
igawaclawska Sep 10, 2024
64289b1
change Add Class and Join Class to Add Classroom and Join Classroom
igawaclawska Sep 10, 2024
97b6bba
Remove console.log()
tfnribeiro Sep 11, 2024
1724932
update the accent color from blue to dark orange
igawaclawska Sep 11, 2024
b0624ed
move function
mircealungu Sep 12, 2024
578bcaf
cleanup
mircealungu Sep 12, 2024
821e2a5
small prop rename
mircealungu Sep 12, 2024
03fc33e
small type hint in the initial state var
mircealungu Sep 12, 2024
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: 4 additions & 0 deletions src/api/student.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Zeeguu_API.prototype.joinCohort = function (inv_code, onSuccess, onError) {
this._post("join_cohort", qs.stringify(payload), onSuccess, onError);
};

Zeeguu_API.prototype.leaveCohort = function (cohortID, callback) {
this._getPlainText(`leave_cohort/${cohortID}`, callback);
};

/*
Gets info about this student, including the cohort he is in.
Endpoint implementation: https://github.com/zeeguu/api/blob/master/zeeguu/api/api/student.py
Expand Down
23 changes: 15 additions & 8 deletions src/api/teacher.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Zeeguu_API.prototype.addColleagueToCohort = function (
cohortID,
colleagueEmail,
onSuccess,
onError
onError,
) {
let payload = {
cohort_id: cohortID,
Expand All @@ -58,7 +58,7 @@ Zeeguu_API.prototype.addColleagueToCohort = function (
`/add_colleague_to_cohort`,
queryString.stringify(payload),
onSuccess,
onError
onError,
);
};

Expand Down Expand Up @@ -101,7 +101,7 @@ Zeeguu_API.prototype.addArticleToCohort = function (
articleID,
cohortID,
onSuccess,
onError
onError,
) {
let payload = {
article_id: articleID,
Expand All @@ -111,7 +111,7 @@ Zeeguu_API.prototype.addArticleToCohort = function (
`add_article_to_cohort`,
queryString.stringify(payload),
onSuccess,
onError
onError,
);
};
/*
Expand All @@ -129,7 +129,7 @@ Zeeguu_API.prototype.deleteArticleFromCohort = function (
articleID,
cohortID,
onSuccess,
onError
onError,
) {
let payload = {
article_id: articleID,
Expand All @@ -139,7 +139,7 @@ Zeeguu_API.prototype.deleteArticleFromCohort = function (
`delete_article_from_cohort`,
queryString.stringify(payload),
onSuccess,
onError
onError,
);
};

Expand All @@ -164,6 +164,13 @@ Zeeguu_API.prototype.parseArticleFromUrl = function (url, callback, onError) {
this._post(`parse_url`, `url=${url}`, callback, onError, true);
};

Zeeguu_API.prototype.removeStudentFromCohort = function (studentID, callback) {
this._getPlainText(`remove_user_from_cohort/${studentID}`, callback);
Zeeguu_API.prototype.removeStudentFromCohort = function (
studentID,
cohortID,
callback,
) {
this._getPlainText(
`remove_user_from_cohort/${studentID}/${cohortID}`,
callback,
);
};
6 changes: 3 additions & 3 deletions src/articles/ClassroomArticles.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export default function ClassroomArticles({ api }) {
let originalList = articleList;

useEffect(() => {
api.getStudent((student) =>
setStudentJoinedCohort(student.cohort_id !== null),
); // eslint-disable-next-line
api.getStudent((student) => {
setStudentJoinedCohort(student.cohorts.length > 0);
}); // eslint-disable-next-line
}, []);

if (articleList == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from "styled-components";
import { zeeguuRedTransparent, zeeguuDarkRed } from "../../components/colors";
import { zeeguuRedTransparent, zeeguuDarkRed } from "./colors";

const FullWidthErrorMsg = styled.div`
box-sizing: border-box;
Expand Down
13 changes: 13 additions & 0 deletions src/components/FullWidthListContainer.sc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import styled from "styled-components";

const FullWidthListContainer = styled.ul`
width: 100%;
display: flex;
flex-direction: column;
gap: 0.5rem;
align-items: center;
padding: 0;
margin: 0;
`;

export { FullWidthListContainer };
19 changes: 19 additions & 0 deletions src/components/FullWidthListItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import CloseRoundedIcon from "@mui/icons-material/CloseRounded";
import * as s from "./FullWidthListItem.sc";

export default function FullWidthListItem({
children,
hasDeleteButton,
onButtonClick,
}) {
return (
<s.FullWidthListItem>
<s.TextContent>{children}</s.TextContent>
{hasDeleteButton && (
<s.ListButton type="button" onClick={onButtonClick}>
<CloseRoundedIcon fontSize="small" sx={{ color: "#808080" }} />
</s.ListButton>
)}
</s.FullWidthListItem>
);
}
57 changes: 57 additions & 0 deletions src/components/FullWidthListItem.sc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import styled from "styled-components";
import { veryDarkGrey } from "./colors";

const FullWidthListItem = styled.li`
width: 100%;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
flex-direction: row;
padding: 0.75rem 1rem;
border-radius: 0.3rem;
color: ${veryDarkGrey};
background-color: #f6f6f6;
font-weight: 600;
margin: 0;
flex: 1;
overflow-x: break-word;

opacity: 0;
animation: fadeIn 0.15s ease-in forwards 0.15s;

@keyframes fadeIn {
to {
opacity: 1;
}
}
`;

const TextContent = styled.div`
display: flex;
flex-direction: row;
flex: 1;
overflow-x: hidden;
font-size: 1rem;

@media (max-width: 576px) {
font-size: 0.87rem;
}
`;

const ListButton = styled.button`
display: flex;
border: inherit;
margin: 0;
padding: 0;
cursor: pointer;
border-radius: 0.15rem;
background-color: inherit;

&:hover {
background-color: #f6f6f6;
}
`;

export { FullWidthListItem, ListButton, TextContent };
17 changes: 12 additions & 5 deletions src/components/modal_shared/GoToButton.sc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { zeeguuDarkOrange } from "../colors";
import { OrangeRoundButton } from "../allButtons.sc";
import styled from "styled-components";

//redesigned button for a better focal point and improved
//readability of the text inside it.
//TODO: After implementing all the onboarding steps,
//create style quide for all buttons and refactor / factor them out
// TODO: Merge with Save button from Preferences
const GoToButton = styled(OrangeRoundButton)`
display: flex;
flex-direction: row;
Expand All @@ -15,7 +12,17 @@ const GoToButton = styled(OrangeRoundButton)`
padding: 0.7em 2em;
border-radius: 4em;
font-weight: 600;
border-bottom: solid 0.2em ${zeeguuDarkOrange};
box-shadow: 0 0.2em ${zeeguuDarkOrange};
transition: all ease-in 0.08s;
overflow: hidden;
white-space: nowrap;
margin-bottom: 0.2em;

&:active {
box-shadow: none;
transform: translateY(0.2em);
transition: all ease-in 0.08s;
}
`;

export { GoToButton };
9 changes: 5 additions & 4 deletions src/i18n/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let strings = new LocalizedStrings(
addTexts: "Add Texts",
delete: "Delete",
cancel: "Cancel",
joinClass: "Join Class",
joinClass: "Join Classroom",
youHaveNotJoinedAClass: "You haven't joined a class yet.",
titleLearnedWords: "Learned Words",
tooEasy: "too easy",
Expand Down Expand Up @@ -502,21 +502,22 @@ let strings = new LocalizedStrings(

//Settings
//Settings categories
myAccount: "My account",
myAccount: "My Account",
exercises: "Exercises",
accountManagement: "Account Management",

//Settings main page nav options
profileDetails: "Profile Details",
languageSettings: "Language Settings",
myCurrentClass: "My Current Class",
myClassrooms: "My Classrooms",
exerciseTypePreferences: "Exercise Type Preferences",
interests: "Interests",
deleteAccount: "Delete Account",

nativeLanguage: "Native Language",
yourCurrentClassIs: "Your current class is: ",
changeClass: "Change Class",
addClass: "Add Class",
insertNewInviteCode: "Insert new invite code",
insertInviteCode: "Insert invite code",
checkIfInviteCodeIsValid:
Expand Down Expand Up @@ -617,7 +618,7 @@ let strings = new LocalizedStrings(
addColleague: "Add Colleague",

//CohortList
addClass: "Add Class",
addClass: "Add Classroom",

//DeleteCohortWarning
dangerzone: "Danger Zone!",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ResetPasswordStep1.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import strings from "../i18n/definitions";

import Form from "./_pages_shared/Form";
import FormSection from "./_pages_shared/FormSection";
import FullWidthErrorMsg from "./_pages_shared/FullWidthErrorMsg";
import FullWidthErrorMsg from "../components/FullWidthErrorMsg";
import InputField from "../components/InputField";
import ButtonContainer from "./_pages_shared/ButtonContainer";
import Button from "./_pages_shared/Button";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ResetPasswordStep2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useFormField from "../hooks/useFormField";

import Form from "./_pages_shared/Form";
import FormSection from "./_pages_shared/FormSection";
import FullWidthErrorMsg from "./_pages_shared/FullWidthErrorMsg";
import FullWidthErrorMsg from "../components/FullWidthErrorMsg";
import InputField from "../components/InputField";
import ButtonContainer from "./_pages_shared/ButtonContainer";
import Button from "./_pages_shared/Button";
Expand Down
Loading