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

PR to add JavaScript ToDo app #1

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

Debarshi95
Copy link

@Debarshi95 Debarshi95 commented Aug 12, 2022

PR to add JavaScript training ToDo app

Changes:

  • Added components folder for code modularization, contains files that create different DOM node required for ToDo
  • Utils folder, contains utility functions

Functionality:

  • User can create a ToDo
  • Each created ToDo can be updated, deleted, marked as complete/incomplete
  • N number of sub-ToDos can be created from parent ToDo, sub-ToDos also be updated, deleted, marked as complete/incomplete
  • Drag n Drop Parent ToDos (and related child-todos) with each-other
  • Clear all ToDo functionality
  • Mark all ToDo functionality

Demo:
Demo

Screenshots:
FlixTodos
FlixTodos (1)
FlixTodos (3)
FlixTodos (2)

@Debarshi95 Debarshi95 changed the title User/debarshi todos user/debarshi-todos Aug 12, 2022
@Debarshi95 Debarshi95 changed the title user/debarshi-todos PR to add JavaScript ToDo app Aug 17, 2022
const onTodoDragStart = (event) => {
const dataId = event.currentTarget.getAttribute("data-id")
event.dataTransfer.dropEffect = "move"
event.dataTransfer.setData("data_id", dataId)

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

)

if (currentTodoIdx >= 0 && previousTodoIdx >= 0) {
const temp = todos[currentTodoIdx]

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]

import { todoWrapper } from "../selectors.js"

const createTodoBase = (todo, props = {}) => {
const { draggable = false } = props

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

@@ -0,0 +1,5 @@
export { default as createTodoBase } from "./todoBase.js"
export { default as createTodoRoot } from "./todoRoot.js"

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.

case "clear":
return clearAllTodos()
case "mark-complete":
return handleMarkAllComplete()

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.

@@ -0,0 +1,65 @@
const validateInput = (value = "") => {
Copy link

@maulikkotak98 maulikkotak98 Sep 5, 2022

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

const findTodo = (todos = [], todoId) => {
let searchedTodo

for (let todo of todos) {

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

}

const findNode = (parentNode = {}, tagName = "") => {
let resultNode

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants