-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
still a lot to do #849
base: master
Are you sure you want to change the base?
still a lot to do #849
Conversation
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.
404 when trying to access your DEMO
src/App.tsx
Outdated
import { TodoList } from './components/TodoList/TodoList'; | ||
import { Todo } from './types/Todo'; | ||
|
||
// const USER_ID = 11569; |
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.
cleanup
src/App.tsx
Outdated
const [todos, setTodos] = useState<Todo[] >([]); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const [isLoading, setIsLoading] = useState<number[] | []>([]); | ||
|
||
const [statusFilter, setStatusFilter] = useState('all'); | ||
|
||
const [tempTodo, setTempTodo] = useState<Todo | null>(null); | ||
|
||
const [error, setError] = useState(''); | ||
|
||
const [addTodoForm, setAddTodoForm] = useState(''); |
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.
const [todos, setTodos] = useState<Todo[] >([]); | |
// eslint-disable-next-line @typescript-eslint/no-unused-vars | |
const [isLoading, setIsLoading] = useState<number[] | []>([]); | |
const [statusFilter, setStatusFilter] = useState('all'); | |
const [tempTodo, setTempTodo] = useState<Todo | null>(null); | |
const [error, setError] = useState(''); | |
const [addTodoForm, setAddTodoForm] = useState(''); | |
const [todos, setTodos] = useState<Todo[] >([]); | |
// eslint-disable-next-line @typescript-eslint/no-unused-vars | |
const [isLoading, setIsLoading] = useState<number[] | []>([]); | |
const [statusFilter, setStatusFilter] = useState('all'); | |
const [tempTodo, setTempTodo] = useState<Todo | null>(null); | |
const [error, setError] = useState(''); | |
const [addTodoForm, setAddTodoForm] = useState(''); |
src/App.tsx
Outdated
// const focusInput = () => { | ||
// inputRef.current.focus(); | ||
// }; |
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.
cleanup
src/App.tsx
Outdated
setError('Unable to delete a todo'); | ||
} finally { | ||
setTimeout(() => { | ||
setIsLoading(todos.filter(todo => todo.id !== todoId) as number[] | []); |
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.
try to type it better, you shouldn't have to use as
src/App.tsx
Outdated
} | ||
}; | ||
|
||
const updateStatusHandler = (todo: Todo, data: {}) => { |
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.
you're forcing data to be empty object in your typing, which is not ideal
src/components/ToDoContext.tsx
Outdated
@@ -0,0 +1,49 @@ | |||
import React, { useContext, useState } from 'react'; | |||
// import { useTodos } from './useTodos'; |
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.
cleanup
src/components/ToDoContext.tsx
Outdated
}; | ||
|
||
export const TodosProvider = ({ children, userId }: TodosProviderProps) => { | ||
// const { isLoading, ...rest } = useTodos(userId); |
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.
cleanup
src/components/TodoList/TodoList.tsx
Outdated
|
||
}, | ||
) => { | ||
// const [todosUpdated, setTodosUpdated] = useState(0); |
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.
cleanup
src/components/TodoRow/TodoRow.tsx
Outdated
import classNames from 'classnames'; | ||
import { useRef, useState } from 'react'; | ||
import { patchTodo } from '../../api/todos'; | ||
// import { deleteTodoHandler } from '../../App' |
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.
cleanup
src/components/TodoRow/TodoRow.tsx
Outdated
}) => { | ||
const [isEdited, setIsEdited] = useState(false); | ||
const [editTitle, setEditTitle] = useState(''); | ||
const [isCompletedLocale] = useState(todo.completed); |
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.
cleanup
I'm still working on it, I haven't passed 3 tests and I haven't managed to do everything you marked yet, but I've sorted it out a bit and it's all over now. and the link already works ;D |
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.
It looks good enough to approve it, despite that, please apply suggested changes 😄
https://MateuszSlezak.github.io/react_todo-app-with-api/