-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3982da0
commit 9da9485
Showing
15 changed files
with
763 additions
and
223 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,73 @@ | ||
import React, { useState } from "react"; | ||
import { AllSection } from "../Keys"; | ||
import { Head, router } from "@inertiajs/react"; | ||
import Sections from "./Sections/Sections"; | ||
import Completed from "./Sections/Completed"; | ||
import Theme1 from "./Theme1/Theme1"; | ||
import Theme2 from "./Theme2/Theme2"; | ||
|
||
export default function Main(props) { | ||
|
||
const { tasks,completedTasks } = props; | ||
const [ draggedTaskId, setDraggedTaskId ] = useState(); | ||
const { tasks, completedTasks } = props; | ||
const [draggedTaskId, setDraggedTaskId] = useState(); | ||
const [layout, setLayout] = useState(1); | ||
|
||
const onDragOver = (event) => { | ||
event.preventDefault(); | ||
} | ||
}; | ||
|
||
const onDrop = (event, section ) => { | ||
const onDrop = (event, section) => { | ||
event.preventDefault(); | ||
router.put(`/todo/${draggedTaskId}`, { | ||
section : section | ||
section: section, | ||
}); | ||
} | ||
}; | ||
|
||
const changeLayout = () => { | ||
setLayout(layout == 1 ? 2 : 1); | ||
}; | ||
|
||
return ( | ||
<div className="container"> | ||
<div className="mx-5"> | ||
<Head title="IR PMS - Home" /> | ||
<h1 className="text-center text-success">Todo List</h1> | ||
<div className="row"> | ||
<Sections tasks={tasks} setDraggedTaskId={setDraggedTaskId} section={AllSection.backlog} sectionName="Backlog" onDragOver={onDragOver} onDrop={onDrop}/> | ||
<Sections tasks={tasks} setDraggedTaskId={setDraggedTaskId} section={AllSection.inProgress} sectionName="In Progress" onDragOver={onDragOver} onDrop={onDrop}/> | ||
<Sections tasks={tasks} setDraggedTaskId={setDraggedTaskId} section={AllSection.done} sectionName="Done" onDragOver={onDragOver} onDrop={onDrop}/> | ||
<div className="d-flex justify-content-between align-items-center"> | ||
<h1 className="text-center text-success">Todo List</h1> | ||
<div className="align-items-center"> | ||
<div className="form-check form-switch"> | ||
<input | ||
className="form-check-input" | ||
type="checkbox" | ||
id="themeSwitch" | ||
onChange={changeLayout} | ||
checked={layout == 2} | ||
/> | ||
<label | ||
className="form-check-label" | ||
htmlFor="themeSwitch" | ||
> | ||
Change Theme | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{/* Completed Task */} | ||
<Completed completedTasks={completedTasks}/> | ||
</div> | ||
{layout == 1 && ( | ||
<Theme1 | ||
tasks={tasks} | ||
setDraggedTaskId={setDraggedTaskId} | ||
AllSection={AllSection} | ||
onDragOver={onDragOver} | ||
onDrop={onDrop} | ||
completedTasks={completedTasks} | ||
/> | ||
)} | ||
{layout == 2 && ( | ||
<Theme2 | ||
tasks={tasks} | ||
setDraggedTaskId={setDraggedTaskId} | ||
AllSection={AllSection} | ||
onDragOver={onDragOver} | ||
onDrop={onDrop} | ||
completedTasks={completedTasks} | ||
/> | ||
)} | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from "react"; | ||
import Task from "../Task"; | ||
|
||
export default function Completed(props) { | ||
const { completedTasks } = props; | ||
return ( | ||
<> | ||
{completedTasks.length > 0 && ( | ||
<div className="m-2 border-top pt-4 shadow shadow-md"> | ||
<h4 className="text-success" role="button"> | ||
Completed | ||
</h4> | ||
{completedTasks.map((task) => { | ||
return ( | ||
<Task | ||
key={task.id} | ||
task={task} | ||
isCompleted={true} | ||
/> | ||
); | ||
})} | ||
</div> | ||
)} | ||
</> | ||
); | ||
} |
Oops, something went wrong.