-
Notifications
You must be signed in to change notification settings - Fork 39
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
Refactor header using GravityUI #566
Conversation
Kabir-Ivan
commented
Jul 5, 2024
•
edited
Loading
edited
620327d
to
80bb4e6
Compare
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 would also like to see the screenshots (of that browser list especially)
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 did the menu went in the left?
It should stay at the right
await browser.$('button*=Expand all').click(); | ||
await browser.$('//*[contains(@class, "expand-dropdown")]//button').click(); | ||
await browser.$('//*[contains(@class, "g-popup")]//span[contains(normalize-space(), "Expand all")]').click(); | ||
// await browser.$('//label[contains(normalize-space(), "Expand all")]').click(); |
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.
Commented code should be removed
} | ||
versions.forEach((version) => { | ||
hasSpecialGroup = true; |
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 don't need to assign true
to hasSpecialGroup
in every iteration of this forEach
loop
const getOptions = () => { | ||
const groups = {}; | ||
const DEFAULT_GROUP = "other"; | ||
let hasSpecialGroup = 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.
From its name, it is unobvious, what makes the group "special"
Variable name should be more self-explanatory. For example: "hasNestedOptions", or "hasMultipleVersions", etc...
|
||
if (!isEmpty(versions) && versions.length > 1) { | ||
node.children = versions.map(version => mkNode({browserId, version})); | ||
const rawOptions = useMemo(getOptions, [available]); |
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.
Double "space" between "=" and "useMemo" here and at line#96
Interesting, how didn't eslint notice that.
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.
Let's write new files in typescript: ".tsx"
@@ -46,6 +47,18 @@ const RunButton = ({actions, autoRun, isDisabled, isRunning, failedTests, checke | |||
action(); | |||
}; | |||
|
|||
const handleSelect = (values) => { | |||
if (values.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.
How could there be multiple values?
// const additionalInfo = fetchDbDetails.map(({url, status, success}) => ( | ||
// <Menu.Item key={url}> | ||
// {' '} | ||
// {url} responded with | ||
// <span className={success ? 'db-info__row_success' : 'db-info__row_fail'}>{' ' + status}</span> | ||
// </Menu.Item> | ||
// )); |
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.
Commented code should be removed
<Popover | ||
disablePortal | ||
placement={'bottom'} | ||
content={ | ||
additionalInfo | ||
} | ||
> |
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.
Strange formatting.
Have you launched npm run lint -- --fix
?
@@ -34,19 +35,15 @@ | |||
display: inline; | |||
} | |||
|
|||
.db-info__popup { | |||
.db-info-container { | |||
--g-popover-max-width: 5000px; |
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 5000px?
ffea142
to
4bd408b
Compare
.browserlist__row:hover | ||
.action-button | ||
opacity 1 |
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 should be:
.g-select-list__option:hover
.browserlist__row
.action-button
opacity 1
That way the "Only"/"Except" button will be shown while hovering the entire line, including the check mark.
Currently "Only"/"Except" is not shown while hovering the check mark
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.
/ok
fix: fix copy button feat: use gravity ui in header refactor: refactor header using gravityUI test: fix tests refactor: use gravity ui in menu bar test: debug test: add retries refactor: refactor code
4684fe6
to
abad3fc
Compare
if (!hasNestedOptions) { | ||
return groups[DEFAULT_GROUP]; | ||
} | ||
else { |
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.
A few remarks about code style:
- There are almost no blank lines at all. It makes code harder to read. Look at how the code was structured before — we usually divide code into sections (grouped by meaning) with blank lines between them. For instance, it's almost always a good idea to insert a blank line before return statement (unless it's the only statement in the code block e.g.
if (...) { return ...; }
- We usually write
else
clauses like this} else {
. But here we don't needelse
clause altogether — it just introduces unnecessary level of nesting.
label: name, | ||
options: groups[name] | ||
}) | ||
}) |
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.
Here, there's no semicolon. And this is not the only place. Don't we have a linter rule turned on for that? Can you please check? eslint should issue warnings/errors for missing semicolons.
}); | ||
return mapping; | ||
} | ||
const getSelected = () => { |
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.
This is not a descriptive&clear name either. By reading getSelected
I don't understand at all what this function will return — will it return a single selected string? Or a selected element? Or will it return an array of them?
I suggest something like getSelectedBrowserIds
. Feel free to choose the other name, but it should be clear what function does just by looking at its name.
}); | ||
import { Button, Select, useSelectOptions } from '@gravity-ui/uikit'; | ||
|
||
const BrowserList = ({available, onChange, selected: selectedProp}) => { |
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 see that selectedProp
was here before, but I think it's bad naming too — it doesn't reflect what the variable holds at all. Let's name it something like selectedBrowsersProp
, or you can try to come up with a better name.
and maybe available -> availableBrowsersProp too. This would indicate that these props store values of similar shape.
if (isEmpty(available)) { | ||
return (<div></div>); | ||
return ( | ||
<div className='browserlist__row'> |
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.
Right now when you click on only/except the width of the popup changes, but it shouldn't.