Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
rubben-88 committed May 21, 2024
1 parent 98b75d2 commit be04e21
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
21 changes: 20 additions & 1 deletion frontend/src/components/ProjectTeacherComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ import {useTranslation} from 'react-i18next';
import Switch from "react-switch";
import Statistics from "./Statistics.tsx";
import {RegularButton} from "./RegularButton.tsx";
import {FaDownload} from "react-icons/fa6";

export function ProjectTeacherComponent(props: { project: ProjectTeacher, submission_statistics: {[key: number]: number} | undefined}): JSX.Element {
export function ProjectTeacherComponent(props: {
project: ProjectTeacher,
submission_statistics: {[key: number]: number} | undefined,
download_all_submissions: (() => Promise<void>) | undefined
}): JSX.Element {

const {t} = useTranslation();

Expand Down Expand Up @@ -59,6 +64,20 @@ export function ProjectTeacherComponent(props: { project: ProjectTeacher, submis
{props.submission_statistics !== undefined &&
<Statistics statistics={props.submission_statistics}/>
}
<div className={"mr-5"}/>
{props.download_all_submissions !== undefined &&
<button className="js-modal-trigger button is-rounded is-pulled-right"
onClick={() => {
if (props.download_all_submissions !== undefined) {
void props.download_all_submissions()
}
}}>
<span className="icon is-small">
<FaDownload/>
</span>
<span>{t('download.download_all')}</span>
</button>
}
</div>
<div className={"create-project-content"}>
{/* PROJECT NAME FIELD */}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/teacher/CreateProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function CreateProject(): JSX.Element {
<Sidebar home={"teacher"}/>
</div>
<div className={"student-main is-flex is-flex-direction-column"}>
<ProjectTeacherComponent project={emptyProjectTeacher} submission_statistics={undefined}/>
<ProjectTeacherComponent project={emptyProjectTeacher} submission_statistics={undefined} download_all_submissions={undefined}/>
</div>
</div>
</>
Expand Down
13 changes: 4 additions & 9 deletions frontend/src/pages/teacher/ProjectViewTeacher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {PROJECT_TEACHER, ProjectTeacherLoaderObject} from "../../dataloaders/Pro
import {useTranslation} from 'react-i18next';
import DefaultErrorPage from "../../components/DefaultErrorPage.tsx";
import {DEBUG} from "../root.tsx";
import {FaDownload} from "react-icons/fa6";

export default function ProjectViewTeacher() {

Expand Down Expand Up @@ -66,14 +65,10 @@ export default function ProjectViewTeacher() {
<Sidebar home={"teacher"}/>
</div>
<div className={"student-main my-3 is-flex is-flex-direction-column"}>
<button className="js-modal-trigger button is-rounded is-pulled-right"
onClick={() => void downloadAllSubmissions()}>
<span className="icon is-small">
<FaDownload/>
</span>
<span>{t('download.download_all')}</span>
</button>
<ProjectTeacherComponent project={project}/>
<ProjectTeacherComponent
project={project}
submission_statistics={project_data.submission_statistics}
download_all_submissions={downloadAllSubmissions}/>
</div>
</div>
</>
Expand Down

0 comments on commit be04e21

Please sign in to comment.