Git Product home page Git Product logo

andreweinkoetz / high5-learning-frontend Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 2.71 MB

The frontend repository for the elearning platform high-five-learning. This is a project of four TUM students of the course: Software Engineering für betriebliche Anwendungen – Masterkurs: Web Application Engineering (IN2087

License: MIT License

HTML 0.83% CSS 2.72% JavaScript 96.45%
javascript material-ui react react-components

high5-learning-frontend's People

Contributors

andrelandgraf avatar hmg248 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

high5-learning-frontend's Issues

Provide basic error handling and user notifications

Taken from description of exercise 3:

The web application is considered to be finished if it supports at least four distinct use cases which are specific to your business model. Furthermore, in addition to those use cases, your web application has to:

  • provide basic error handling and user notifications

Currently we do not notify the user in an appropriate way. Sometimes we just log the error or call alert() - this is not user-friendly and not informative. I suggest that we build upon the error component that was introduced by @HmG248 a new more generic component that is called when one of the service calls fails. Here is an example:

Component: ClassListView
Method: componentWillMount
Service call: UserService

ClassService.getClassesOfUser().then((data) => {
            this.setState({
                classes: [...data],
                loading: false
            });
        }).catch((e) => {
            console.error(e);
        });

Suggestion:

  1. Add error to state:
error : {
                fired: false,
                errorCode: 0,
                errorMsg: ''
            },
  1. If error occured, setState in catch-block
ClassService.getClassesOfUser().then((data) => {
            this.setState({
                classes: [...data],
                loading: false
            });
        }).catch((e) => {
            this.setState({error: {fired: true, errorCode: e.Code, errorMsg: e.Msg}});
        });
  1. Check the error state make the generic ErrorComponent visible:
<ErrorComponent
                    visible={this.state.error.fired}
                    error={this.state.error}
                    closeDialog={()=>{this.setState(
                        {error:
                                {
                                    fired:false,
                                    errorCode:0,
                                    errorMsg:''
                                }
                        })
                    }}
                />
  1. The error component can use the error object to display an informative message to the user:
    image

Create routes for our components

Routes have to be created for each separate component to be rendered. In order to achieve separation between authenticated users and visitors, we have to check if the jwt is set. Additionally, we have to check if the current user is a teacher or a student.

Homework Component

The homework component is responsible for displaying a single homework in a class, as a class contains many homework, also a wrapping list component is needed.

ClassService

Create a service class to communicate with REST backend. Using HttpService is mandatory

Render modal dialogs only when visible

We should not render all modals instantly but only when the modal is called.

Like:

const modal = this.state.visible ? <Modal /> : null;

render() {
   return (
      {modal}
   );
}

HomeworkService

Create a service class to communicate with REST backend. Using HttpService is mandatory

Fix warnings

@ALL please fix the warnings in your components - additionally please remove your console.log statements before committing as it makes it very hard to differentiate between your logging statements and your own.

image

Especially for warnings like Line136: Please make sure to use '===' and if it's not working check out why instead of simply using the non-strict variant '=='.

Homework Detail View

A view is needed to display the list of exercises representing the homework itself.

ClassListView

Another lessons learned here. The view components are required to display the content e.g. a list of classes. Generally, this will not require any additional wrapper, but in the case of using async REST calls, the reply of the server will not arrive before rendering the content. Therefore, a second component is needed to wrap the content in order to show some sort of "loading screen" message until the data arrives from the server.

Homework Detail View: Remove isTeacher from state

We use the type of the currently logged in user to decide wether or not we show the cancel and submit button. This is achieved by saving the type of the user in state - although the type of the current user can be easily identified by calling UserService.isTeacher(), which simply checks the token instead of calling the backend.

Discussion of structure of HomeworkDetailView

At the moment the component HomeworkDetailView has a lot of functionality:
(doing homework/ display of one homework/ display of statistics)

  • student/doing homework: student sees the exercise list and can do the exercises

  • student/homework submitted: after submission the student should not be able to fill out again and should see the submitted solution

  • teacher/homework: teacher can see all statistics and individual ones

Do you think it is a good idea to split the HomeworkDetailView in a StatisticsView (teacher and student) and a HomeworkDetailView (only student doing homework)?

Check if current user (token) is teacher or student

This code snipplet will be used literally everywhere. I think a small js function providing this functionality would be good to support seperation by concern. At least, I will provide the code to copy paste it everywhere to do this check.

Something is already running on port 3000

Do we have any global solution to switch the port of the frontend yet?

I have switched the backend now to port 3010 (see backend config.js). This means the problem is now solved, but still, just wondering if we have found any global solution for the frontend?

Classes detail

After selecting a specific class, the user will be redirected to the detail page of the class. Here a list of homework is displayed using different stylings depending on the user type

Login/Register: change username to email.

The username should be an email address instead of a nickname. An email is always by nature unique and makes it easier for the teacher to find its students on our platform.

Validate input for registration!

REST API frontend concerns

As mentioned in the backend project issue 11, we will have to specify several design/usage aspects regarding our REST API. Concerning the frontend please use this issue to discuss all problems, wishes, changes etc.

Landing Page

A Landing Page with Login / Register Buttons / Components.

Implement the CRUD methods

Taken from exercise 3:

The web application is considered to be finished if it supports at least four distinct use cases which are specific to your business model. Furthermore, in addition to those use cases, your web application has to:

  • provide read and write access to your model, i.e., you have to implement the CRUD methods (Create, Read, Update, Delete) for at least one of your model classes

Currently we do not implement any Update or Delete method in our project.
This issue is for discussing the model we use as well as who is responsible for it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.