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

create project #360

Merged
merged 7 commits into from
May 23, 2024
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
2 changes: 2 additions & 0 deletions frontend/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
},
"create_project": {
"title": "Create project",
"success": "Your project has been successfully saved.",
"failed": "Something went wrong while saving your project. Please try again.",
"name": {
"tag": "Project name:",
"placeholder": "Enter a name"
Expand Down
2 changes: 2 additions & 0 deletions frontend/public/locales/nl/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
},
"create_project": {
"title": "Maak een project aan",
"success": "Uw project is succesvol opgeslagen.",
"failed": "Er is iets fout gegaan tijdens het opslaan van uw project. Probeer het opnieuw.",
"name": {
"tag": "Projectnaam:",
"placeholder": "Voer een naam in"
Expand Down
210 changes: 152 additions & 58 deletions frontend/src/components/ProjectTeacherComponent.tsx

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion frontend/src/pages/teacher/CreateProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export function CreateProject(): JSX.Element {
hours: 0,
minutes: 0,
otherFilesAllow: false,
visible: false,
archived: false,
projectName: "",
requiredFiles: {
type: "SUBMISSION",
Expand All @@ -51,7 +53,11 @@ 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} download_all_submissions={undefined} is_new={true}/>
<ProjectTeacherComponent
project={emptyProjectTeacher}
submission_statistics={undefined}
download_all_submissions={undefined}
is_new={true}/>
</div>
</div>
</>
Expand Down
16 changes: 12 additions & 4 deletions frontend/src/pages/teacher/ProjectViewTeacher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import {PROJECT_TEACHER, ProjectTeacherLoaderObject} from "../../dataloaders/Pro
import {useTranslation} from 'react-i18next';
import DefaultErrorPage from "../../components/DefaultErrorPage.tsx";
import {DEBUG} from "../root.tsx";
import {useState} from "react";

export default function ProjectViewTeacher() {

const {t} = useTranslation();
const [projectName, setProjectName] = useState("")

const data: ProjectTeacherLoaderObject = useRouteLoaderData(PROJECT_TEACHER) as ProjectTeacherLoaderObject
const project_data = data.project
Expand All @@ -20,8 +22,9 @@ export default function ProjectViewTeacher() {
}

const deadline_date = new Date(project_data.project_deadline)


if (!projectName){
setProjectName(project_data.project_name)
}
const project: ProjectTeacher = {
projectId: project_data.project_id,
projectName: project_data.project_name,
Expand All @@ -30,6 +33,8 @@ export default function ProjectViewTeacher() {
hours: deadline_date.getHours(),
minutes: deadline_date.getMinutes(),
deadline: deadline_date,
visible: project_data.project_visible,
archived: project_data.project_archived,
description: project_data.project_description,
maxGroupMembers: project_data.project_max_students,
requiredFiles: JSON.parse(project_data.project_requirements) as object,
Expand All @@ -38,6 +43,7 @@ export default function ProjectViewTeacher() {
dockerFile: project_data.project_dockerfile
}


async function downloadAllSubmissions() {
let url = ''
if (DEBUG) {
Expand All @@ -59,7 +65,7 @@ export default function ProjectViewTeacher() {
return (
<>
<div className={"main-header"}>
<Header page_title={project.projectName} home={"teacher"}/>
<Header page_title={projectName} home={"teacher"}/>
</div>
<div className={"main-content is-flex is-flex-direction-row"}>
<div className={"side-bar is-flex is-justify-content-center"}>
Expand All @@ -69,7 +75,9 @@ export default function ProjectViewTeacher() {
<ProjectTeacherComponent
project={project}
submission_statistics={project_data.submission_statistics}
download_all_submissions={downloadAllSubmissions}/>
download_all_submissions={downloadAllSubmissions}
updateTitle={setProjectName}
/>
</div>
</div>
</>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/types/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export type ProjectTeacher = {
hours: number,
minutes: number,
deadline: Value,
visible: boolean,
archived: boolean,
description: string,
requiredFiles: object,
otherFilesAllow: boolean,
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/utils/InputInterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {Value} from "../types/project.ts";

export interface ProjectInput{
name: string,
deadline: Value,
deadline: string,
archived: boolean,
description: string,
requirements: string,
Expand Down