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

Revert "issue/2-Logic for Gamification system - Incrementing points" #9

Merged
merged 1 commit into from
Apr 13, 2020
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
33 changes: 0 additions & 33 deletions doto-frontend/src/components/Points.js

This file was deleted.

24 changes: 2 additions & 22 deletions doto-frontend/src/components/pages/Calendar/Calendar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React, { useState, useEffect, useContext } from "react";
import { makeStyles } from "@material-ui/core/styles";
import Avatar from "@material-ui/core/Avatar";
import { blue } from "@material-ui/core/colors";
import Modal from "@material-ui/core/Modal";
import Backdrop from "@material-ui/core/Backdrop";
import Fade from "@material-ui/core/Fade";
Expand All @@ -11,7 +9,6 @@ import FormatListBulletedIcon from "@material-ui/icons/FormatListBulleted";
import CalendarTodayIcon from "@material-ui/icons/CalendarToday";
import AddIcon from "@material-ui/icons/Add";
import ModalContent from "../../ModalContent";
import Points from "../../Points";
import CalendarComponent from "./CalendarComponent";
import CalendarListView from "./CalendarListView";
import Header from "../Header";
Expand All @@ -37,15 +34,10 @@ const useStyles = makeStyles(theme => ({
boxShadow: theme.shadows[5],
padding: theme.spacing(2, 4, 3),
},
blue: {
color: theme.palette.getContrastText(blue[500]),
backgroundColor: blue[500],
boxShadow: theme.shadows[5],
},
}));

const Calendar = () => {
var pointRef = React.createRef();
var points = 20;

const classes = useStyles();
const [listView, setListView] = useState();
Expand All @@ -72,7 +64,7 @@ const Calendar = () => {
};
fetchUserInfo();
fetchTasks();
}, [setTheme]);
}, []);

// Adds new task based on input fields from Modal
const addNewTask = (newTask, currentDate) => {
Expand All @@ -85,12 +77,6 @@ const Calendar = () => {
const handleTaskStatusUpdated = taskId => {
const newTasks = [...tasks];
const taskToUpdate = newTasks.find(task => task.taskId === taskId);
// if duration is passed in, use that, otherwise calculate it from start and end dates
const minutes = taskToUpdate.duration
? taskToUpdate.duration
: Math.abs(taskToUpdate.startDate - taskToUpdate.endDate) / 1000 / 60;
// if task is completed, increase points, otherwise, decrease points
taskToUpdate.isComplete ? pointRef.current.changePoints(-minutes) : pointRef.current.changePoints(minutes);
taskToUpdate.isComplete = !taskToUpdate.isComplete;
DotoService.updateTask(taskToUpdate);
setTasks(newTasks);
Expand Down Expand Up @@ -121,12 +107,6 @@ const Calendar = () => {
</Fab>
</Tooltip>
</div>
<div>
<h2>Points</h2>
<Avatar className={classes.blue}>
<Points ref={pointRef} id="points_id" />
</Avatar>
</div>
</div>
<span className="content-container">
<Header title="Calendar" />
Expand Down