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

UI components #11

Merged
merged 1 commit into from
Mar 10, 2021
Merged

UI components #11

merged 1 commit into from
Mar 10, 2021

Conversation

tpardeshi
Copy link
Member

Developed UI components for all the APIs as per backend

Copy link
Contributor

@akkias akkias left a comment

Choose a reason for hiding this comment

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

@tpardeshi awesome work on getting the front end together, there are small changes need to be done before we can merge this PR.

@pravins I and @tpardeshi have discussed the future changes in which we will make the code more restructured and readable, also we would be adding unit test cases as we start improving the tool further.

src/App.js Outdated
</div>
<BrowserRouter>
<Switch>
<>
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove React Fragments from here as we have the wrapper.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure.

const [selectProductsVersion, setSelectProductsVersion] = useState("");
const [selectLocales, setSelectLocales] = useState("");
return (
<>
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove React Fragments from here as well.
Also, add a new line at the end of every file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure.

</FormSelect>
</FormGroup>
<ActionGroup>
<Button type="submit" value="Submit">Submit</Button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the value from here, it is not required as we are using Patternfly components.
If it had been an HTML input button then we could use the value attribute.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok.

</TextContent>
</Link>
</CardBody>
<CardFooter></CardFooter>
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove empty footer.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. I will remove it.

@tpardeshi tpardeshi changed the title Remove warnings ui-components Dec 16, 2020
@tpardeshi tpardeshi changed the title ui-components ui components Dec 16, 2020
@tpardeshi tpardeshi changed the title ui components UI components Dec 16, 2020
@pravins
Copy link
Member

pravins commented Dec 21, 2020

@akkias Thanks for the discussions with Twinkle. I agree with both of you.

Copy link
Contributor

@akkias akkias left a comment

Choose a reason for hiding this comment

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

Looks good.

@@ -1,17 +1,40 @@
{
"name": "imagematch",
"name": "frontend-demo",
Copy link
Member

Choose a reason for hiding this comment

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

This must name of the project and not the purpose of a demonstration.

"@storybook/addons": "^5.3.8",
"@storybook/preset-create-react-app": "^1.5.2",
"@storybook/react": "^5.3.8",
"eslint-plugin-react-hooks": "^4.0.8"
Copy link
Member

Choose a reason for hiding this comment

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

Are we making of the eslint, because I see many syntax error that lint would not allow before merging.

"react": "^16.10.1",
"react-dom": "^16.10.1",
"react-scripts": "3.1.2"
"@patternfly/react-core": "^3.129.3",
Copy link
Member

@rabajaj0509 rabajaj0509 Feb 4, 2021

Choose a reason for hiding this comment

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

Are we not using pattern fly 4? pf3 has flaws and all projects that are being developed at current time have moved to pf4. Its better you do all your development in pf4.

Comment on lines +9 to 13
const logoProps = {
href: "https://github.com/lingostack",
target: "_blank",
};
return (
Copy link
Member

Choose a reason for hiding this comment

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

There is no prop validation for this?

Comment on lines +7 to +21
<nav className="pf-c-breadcrumb" aria-label="breadcrumb">
<ol className="pf-c-breadcrumb__list">
<li className="pf-c-breadcrumb__item">
<Link to="/" className="pf-c-breadcrumb__link">Products</Link>
<span className="pf-c-breadcrumb__item-divider">
<AngleRightIcon />
</span>
</li>
<li className="pf-c-breadcrumb__item">
<span className="pf-c-breadcrumb__link pf-m-current" aria-current="page">
Versions
</span>
</li>
</ol>
</nav>
Copy link
Member

@rabajaj0509 rabajaj0509 Feb 4, 2021

Choose a reason for hiding this comment

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

This is ugly, in pf4 you can do something like:

import React from 'react';
import { Breadcrumb, BreadcrumbItem, BreadcrumbHeading } from '@patternfly/react-core';

SimpleBreadcrumbs = () => (
  <Breadcrumb>
    <BreadcrumbItem to="#">Section home</BreadcrumbItem>
    <BreadcrumbItem to="#">Section title</BreadcrumbItem>
    <BreadcrumbItem to="#">Section title</BreadcrumbItem>
    <BreadcrumbItem to="#" isActive>
      Section Landing
    </BreadcrumbItem>
  </Breadcrumb>
);

Copy link
Contributor

Choose a reason for hiding this comment

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

@rabajaj0509 Yes, we can do this now.
When we started working on this app at that time the patternfly didn't implement the react-router with the breadcrumb and used product anchor tag with it and that was the reason we had to hardcode the breadcrumb component.

Comment on lines +22 to +24
<CardBody>
<SimpleEmptyState />
<Form onSubmit={props.handleSubmit}>
Copy link
Member

Choose a reason for hiding this comment

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

What might the reason to use a emptystate component inside a card?

Copy link
Contributor

Choose a reason for hiding this comment

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

If someone uses the direct URL to land on a certain page then we show the message that you need to select options from the form to check the diff.

Using query params is a part of the next PR and we have already discussed that and conveyed it to @pravins

const [currentPage, setCurrentPage] = useState(0);
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(10);
const [productsVersion, setProductsVersion] = useState([]);
Copy link
Member

Choose a reason for hiding this comment

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

You have set this multiple times? is that required?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's how Patternfly implemented the pagination, but if you have any better way then, please suggest.

Copy link
Member

@rabajaj0509 rabajaj0509 left a comment

Choose a reason for hiding this comment

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

I am so confused looking at this PR for the following reasons:

  1. It has so many components in just 1 PR.
  2. Have you tried to run lint on this codebase? There will be so many errors that have gone unnoticed here.
  3. There is no prop validation at all.
  4. The package.json has many dependencies which I believe are not required.

Few suggestions:

  1. Take packaging seriously, only use modules that are required
  2. Setup a github action, for running lint on your PRs.
  3. Create small PRs
  4. Attach screen shots to your PR else how will the reviewer understand what you are tryign to do.
  5. Use PF4! please dont use pf3 now.

These are few things that come to my mind when I see this PR. I am not a react expert and have not tested the PR.

@tpardeshi
Copy link
Member Author

@rabajaj0509 Thanks for the review. We will surely consider all this suggestions in upcoming improvement pull requests. As of now I think lets have a base ready for the project, we will continue with the improvements further.
Thanks !!

@rabajaj0509
Copy link
Member

Sure, go ahead!

@akkias akkias merged commit ae396b3 into lingostack:master Mar 10, 2021
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.

4 participants