-
Notifications
You must be signed in to change notification settings - Fork 3
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
PR to add JavaScript ToDo app #1
base: main
Are you sure you want to change the base?
Conversation
debarshi/js/components/todoBase.js
Outdated
const onTodoDragStart = (event) => { | ||
const dataId = event.currentTarget.getAttribute("data-id") | ||
event.dataTransfer.dropEffect = "move" | ||
event.dataTransfer.setData("data_id", dataId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two different variable with same name but different convention would be confusing - data-id and data_id
debarshi/js/components/todoBase.js
Outdated
) | ||
|
||
if (currentTodoIdx >= 0 && previousTodoIdx >= 0) { | ||
const temp = todos[currentTodoIdx] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can use destructing assignment here for swapping to avoid temp - Eg: [b,a] = [a,b]
debarshi/js/components/todoBase.js
Outdated
import { todoWrapper } from "../selectors.js" | ||
|
||
const createTodoBase = (todo, props = {}) => { | ||
const { draggable = false } = props |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use semicolons after every statement
debarshi/js/components/index.js
Outdated
@@ -0,0 +1,5 @@ | |||
export { default as createTodoBase } from "./todoBase.js" | |||
export { default as createTodoRoot } from "./todoRoot.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use semicolon after every statement. Applies to all the files.
debarshi/js/todo.js
Outdated
case "clear": | ||
return clearAllTodos() | ||
case "mark-complete": | ||
return handleMarkAllComplete() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linter might give warning for not having default case. Also i suggest using object mapping (eg: {'add-sub-todo' : handleAddTodo}) instead of switch case if possible.
debarshi/js/utils/helperfuncs.js
Outdated
@@ -0,0 +1,65 @@ | |||
const validateInput = (value = "") => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file naming doesn't seem correct. should be helpers.js/utils.js etc but not helpersfuncs.js since helpersfuns is neither snake case or any other standard naming convention
debarshi/js/utils/helperfuncs.js
Outdated
const findTodo = (todos = [], todoId) => { | ||
let searchedTodo | ||
|
||
for (let todo of todos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use map or forEach here
debarshi/js/utils/helperfuncs.js
Outdated
} | ||
|
||
const findNode = (parentNode = {}, tagName = "") => { | ||
let resultNode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems an incomplete statement without semicolon
09488d6
to
0fa4d58
Compare
PR to add JavaScript training ToDo app
Changes:
Functionality:
Demo:
Demo
Screenshots:
![FlixTodos](https://user-images.githubusercontent.com/42608795/185882020-10c8a71b-f3ed-4048-882d-457b6703b1ec.png)
![FlixTodos (1)](https://user-images.githubusercontent.com/42608795/185882014-7e992258-06a1-4881-9052-7cdb3359e6ef.png)
![FlixTodos (3)](https://user-images.githubusercontent.com/42608795/185882003-efa9f960-c076-4508-a612-de39892810a6.png)
![FlixTodos (2)](https://user-images.githubusercontent.com/42608795/185882012-7c01a343-aad5-4e5d-bcb9-72b648f82d3d.png)