-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
pushing #946
base: master
Are you sure you want to change the base?
pushing #946
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.
Pls attach a link to deployed project and fix comments
src/App.tsx
Outdated
|
||
export const App: React.FC = () => { | ||
const [users, setUsers] = useState<User[]>([]); | ||
const [posts, setPosts] = useState<Post[]>([]); | ||
const [userId, setUserId] = useState<User['id']>(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.
setUserId
is assigned a value but never used
src/App.tsx
Outdated
import { Post } from './types/Post'; | ||
import { PostsList } from './components/PostsList'; | ||
|
||
// import { Loader } from './components/Loader'; |
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.
remove all redundant comments pls
src/App.tsx
Outdated
getUsers().then((usersFromserver) => setUsers(usersFromserver)); | ||
}; | ||
|
||
loadPosts(); |
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.
why do u call this function here instead of doing it inside useEffect?
src/App.tsx
Outdated
</div> | ||
|
||
<PostsList /> | ||
{posts.length === 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.
{posts.length === 0 ? ( | |
{!posts.length ? ( |
src/components/PostDetails.tsx
Outdated
return ( | ||
<div className="content" data-cy="PostDetails"> | ||
<div className="content" data-cy="PostDetails"> | ||
<div className="block"> | ||
<h2 data-cy="PostTitle"> | ||
#18: voluptate et itaque vero tempora molestiae | ||
{`#${post.id}: ${post.title}`} |
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.
pls destructure post
and comment
src/components/PostsList.tsx
Outdated
</tr> | ||
</thead> | ||
{posts.map((post) => ( | ||
<tbody> |
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.
where is key
prop
src/components/PostsList.tsx
Outdated
</tr> | ||
</thead> | ||
{posts.map((post) => ( | ||
<tbody> |
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.
map should be inside <tbody>
, you should only map table rows, not bodies
src/components/Users.tsx
Outdated
export const Users: React.FC<Props> = ({ users }) => { | ||
return ( | ||
<div className="dropdown-content"> | ||
{users.map((user) => ( |
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.
pls destructure user
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.
I still can't see a link to your deployed project, pls fix)
src/App.tsx
Outdated
No posts yet | ||
</div> | ||
{selectedUser | ||
&& userPosts.length === 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.
&& userPosts.length === 0 | |
&& !userPosts.length |
src/App.tsx
Outdated
|
||
<PostsList /> | ||
{selectedUser && userPosts.length > 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.
{selectedUser && userPosts.length > 0 && ( | |
{selectedUser && !!userPosts.length && ( |
src/components/PostDetails.tsx
Outdated
{!loader | ||
&& !errorMessage | ||
&& postComments | ||
&& postComments.length === 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.
&& postComments.length === 0 && ( | |
&& !postComments.length && ( |
If a mentor points out a mistake, it means that you need to fix ALL occurrences of the mistake, not only in the place where the comment was left.
src/App.tsx
Outdated
{selectedUser | ||
&& userPosts.length === 0 | ||
&& !errorMessage | ||
&& !loader && ( |
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.
also pls consider moving long ternaries to separate consts with consistent names
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.
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.
src/components/PostDetails.tsx
Outdated
> | ||
Misha Hrynko | ||
</a> | ||
{!errorMessage && postComments && postComments.length > 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.
{!errorMessage && postComments && postComments.length > 0 && ( | |
{!errorMessage && postComments && !!postComments.length && ( |
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.
Hi, I see you haven't fixed previous comments, maybe you did not push your changes? If you have any questions, please ask them in fe_chat and tag mentors. It will be faster, because your answers in GitHub will be visible to mentor only after you re-request review
src/App.tsx
Outdated
const [userPosts, setUserPosts] = useState<Post[]>([]); | ||
const [selectedUser, setSelectedUser] = useState<User>(); | ||
const [selectedPost, setSelectedPost] = useState<Post>(); | ||
const [loader, setLoader] = useState<boolean>(false); |
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.
Rename all boolean variables using tips
const [loader, setLoader] = useState<boolean>(false); | |
const [isLoading, setIsLoading] = useState<boolean>(false); |
src/App.tsx
Outdated
{selectedUser | ||
&& !userPosts.length | ||
&& !errorMessage | ||
&& !loader && ( |
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.
src/components/UserSelector.tsx
Outdated
const closeDropDown = () => { | ||
setTimeout(() => { | ||
setIsActiveDropDown(false); | ||
}, 150); // Maybe more |
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.
Google best practises
And remove comment
Take responsibility to your code 😄
src/components/UserSelector.tsx
Outdated
const closeDropDown = () => { | ||
setTimeout(() => { | ||
setIsActiveDropDown(false); | ||
}, 150); // Maybe more |
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.
Google best practice
And remove comment
Take responsibility to your code 😃
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.
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.
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.
setNameError(FormErrors.Name); | ||
} | ||
|
||
// eslint-disable-next-line no-useless-escape |
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 is better to fix eslint error
No description provided.