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

pushing #946

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

pushing #946

wants to merge 11 commits into from

Conversation

victorgri
Copy link

No description provided.

Copy link

@lerastarynets lerastarynets left a 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);

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';

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();

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 ? (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{posts.length === 0 ? (
{!posts.length ? (

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}`}

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

</tr>
</thead>
{posts.map((post) => (
<tbody>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is key prop

</tr>
</thead>
{posts.map((post) => (
<tbody>

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

export const Users: React.FC<Props> = ({ users }) => {
return (
<div className="dropdown-content">
{users.map((user) => (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls destructure user

Copy link

@lerastarynets lerastarynets left a 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
&& userPosts.length === 0
&& !userPosts.length

src/App.tsx Outdated

<PostsList />
{selectedUser && userPosts.length > 0 && (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{selectedUser && userPosts.length > 0 && (
{selectedUser && !!userPosts.length && (

{!loader
&& !errorMessage
&& postComments
&& postComments.length === 0 && (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
&& 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 && (

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@lerastarynets lerastarynets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When user add comment, it's name and email should remain in the form, while comment text should be cleared, ur logic works vice versa right now, pls fix
Screenshot at Nov 02 12-14-14

>
Misha Hrynko
</a>
{!errorMessage && postComments && postComments.length > 0 && (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{!errorMessage && postComments && postComments.length > 0 && (
{!errorMessage && postComments && !!postComments.length && (

Copy link

@loralevitska loralevitska left a 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);

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

Suggested change
const [loader, setLoader] = useState<boolean>(false);
const [isLoading, setIsLoading] = useState<boolean>(false);

src/App.tsx Outdated
Comment on lines 73 to 76
{selectedUser
&& !userPosts.length
&& !errorMessage
&& !loader && (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix it
image

const closeDropDown = () => {
setTimeout(() => {
setIsActiveDropDown(false);
}, 150); // Maybe more

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 😄

const closeDropDown = () => {
setTimeout(() => {
setIsActiveDropDown(false);
}, 150); // Maybe more

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 😃

Copy link

@nazarmatsevych nazarmatsevych left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I can't choose a user, try to fix it
image

Next time please check your demo link before making re-request.

If you have any questions - feel free to ask them in fe_chat.

Copy link

@maxim2310 maxim2310 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 if you are trying to delete comment and have an error, you must to return comment
2. need to add validation on email
image

@victorgri victorgri requested a review from maxim2310 November 4, 2023 18:45
Copy link

@SanyaBratashchuk SanyaBratashchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should not be able to submit form if there is validation errors
image

setNameError(FormErrors.Name);
}

// eslint-disable-next-line no-useless-escape

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

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.

7 participants