-
Notifications
You must be signed in to change notification settings - Fork 15
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
Api Key settings frontend #2403
Conversation
3f7d17b
to
51e2c27
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.
Hey @CDimonaco ,
Great job.
I have noted many comments, excluding by now the Input/Switch
components.
Let me know what do you think
open={open} | ||
onClose={onClose} | ||
> | ||
<div className="flex flex-col my-5"> |
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.
Checking the modal in storybook
, I would say that some margins don't follow the mock up.
Can you confirm this with @jagabomb ?
I'm fine, but I want Jurgen's approval there hehe
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 @CDimonaco, here is my feedback regarding the spacing, and number input for the default state:
- Reduce and standardise the spacing between the heading and between line of content (highlighted in red block with pixel height dimensions). Ideally they were 16px in the design.
- Remove the margin below the close button. There is already a spacing which is provided by the padding of the modal.
- Resolve this UI addition and subtraction indicator for the numeric field since there is a native component (Chrome) which creates a duplication of the same function.
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.
For the point 1 and 2, I will standardize the space, for the last point, this is a custom component from the same component library we use for other inputs, if we fallback to the native component, we should design all the style and create a custom component to match all the others input design.
Why this component is bad? We could of course fallback to the native component but we need to create a custom component which I think it's a big effort and out the scope of this pr.
I tested on multiple browser and I cannot reproduce the "dual" indicators on the number component, but again, if we need to write custom logic on top of the custom or native component it's not an easy task and out of the scope of this pr.
cc @dottorblaster maybe my difficulty estimation is wrong, wdyt?
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.
@CDimonaco I agree, if the effort is too large for the numeric input to be improved then we can re-look at this in another PR. I just wanted to note the input behaviour since Alberto also raised it too.
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.
Point 1 and 2 are perfectly addressable in this PR, when it comes to point 3 I didn't quite get your feedback @jagabomb, my advice is to merge and proceed incrementally to do this kind of work on the design system, which we couldn't foresee.
The alternative is to adopt a text input for the moment, but I would suggest otherwise since with a number input we can ensure nothing strange is submitted.
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.
@dottorblaster It is easier to see the issue with the duplicated numeric addition and subtraction (arrow up and arrow down) buttons below. But as I said before, I am happy to defer this to another PR and revisit it when we have time. 😊
</span> | ||
)} | ||
{generatedApiKey && ( | ||
<div className="flex flex-col my-1 mb-4"> |
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.
Maybe this div
could be subcomponent itself, as we use it (or should) the same content here in the modal and in the settings page.
What do you think?
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.
Anyway, if Jurgen agrees that they should be different, so be it
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.
If it helps us have consistency in the layout and implementation then I am happy for it to be a subcomponent.
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.
If it's a subcomponent, we will have the same copy button?
8297237
to
718fc0b
Compare
d1d558e
to
1f0e400
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.
Beautiful, Carmine!
Just two questions/remarks:
- In the number field in the API Key Settings modal, when you write a number you have two sets of icons to increase/decrease the number. Shouldn't there be only one set, the one of the field itself?
- Every time you enter the API Key Settings modal, the previous settings are cleared out. This is more a question for @jagabomb . Wouldn't it be better that the last set of settings is displayed instead? For instance, if the user turned on the the non expiration toggle, then, when you open the API Key Settings modal, it is still turned on. Or if the user set 1 year as expiration date then, when you open the modal, it is set to 1 year. Just wondering. The way it works now is also fine.
OK. But, for the record, I'm not using anything out of ordinary (Chrome Version 122.0.6261.112).
OK. I thought the data in the data entered in the modal was persistent. If it adds complexity to the implementation, then forget about it. |
The modal data is "persistent" across page reloads, but in the end the modal will generate an expiration timestamp. We could remove the modal "reset" so the user can see the previous settings if they open and close the modal in the same page, but I think it's not really useful and can lead to some confusion about the usage |
I agree with you here @abravosuse, although I think this Storybook version doesn't really need to showcase the logic like that. I would say that behaviour should be in the AC so that we implement the logic in the product. Unless the team feels there is value to implement logic like that in the Storybook too? |
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.
Excellent work @CDimonaco
Codewise, ready to merge from my side (with some small nitpicks XD)
assets/js/common/ApiKeySettingsModal/ApiKeySettingsModal.stories.jsx
Outdated
Show resolved
Hide resolved
|
001d36f
to
1e3f251
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.
Hey man great work, what a big beautiful pr.
I wrote some comments and questions, but the code looks great.
For me LGTM!
Merging as is Creating 2 tech debts, one for the copy button, the other one for the numeric input. |
Description
This PR adds the Api Key settings frontend.
It includes the generation of new api key with custom expiration
New settings page
API Key settings modal
How was this tested?
Automated tests