-
Notifications
You must be signed in to change notification settings - Fork 886
refactor(site): generalize UserCell component #484
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #484 +/- ##
==========================================
+ Coverage 60.35% 60.42% +0.06%
==========================================
Files 191 193 +2
Lines 10864 10878 +14
Branches 85 87 +2
==========================================
+ Hits 6557 6573 +16
+ Misses 3587 3585 -2
Partials 720 720
Continue to review full report at Codecov.
|
Summary: This is a first step in porting over v1 AuditLog in a refactored/cleaned up fashion. This isn't a direct port, since we do not yet have a UserAvatar component. Details: - Port over UserCell from v1, sans UserAvatar impl - Add tests and stories for UserCell Notes: We do not have a holistic solution for handling localization, but starting from some kind of easy way that collects/resources strings will make the migration significantly easier. It will also help out our product copy owner, @khorne3 with maintenance. An RFC regarding this might be necessitated. Impact: This change does not have any user-facing impact yet, because the UserCell is not yet rendered in the product. This enables an incremental approach to migrating in the FE of the Audit Log, which is still waiting on the BE port. Relations: - This commit relates to #472, but does not finish it. - This commit should not merge until after #465 and #483 because it's based on them.
8b7a482
to
7a6df41
Compare
Summary: This is a direct follow-up to #484 and a next step in porting over the AuditLog with appropriate refactoring. This isn't a direct port; we used to have a map of icons on the FE, but we want to no loner split the logic between FE and BE. If we want icons at a later time point, we can return an icon identifier in the response, or we can simplify the view and gain real estate by omitting the icons. At the time of this commit, I prefer omitting the icons. Details: - Port over ActionCell from v1, sans icons - Add tests and stories for ActionCell Impact: This change does not have any user-facing impact yet, because the ActionCell is not yet rendered in the product. This enables an incremental approach to migrating in the FE of the Audit Log, which is still waiting on the BE port. Relations: - This commit relates to #472, but does not finish it. - This commit should not merged until after #484 because it's based from it
Summary: This is a direct follow-up to #484 and #500. It is a part of many steps in porting/refactoring the AuditLog from v1. Details: - Port over TargetCell from v1, with refactorings - Add tests and stories Impact: This change does not have any user-facing impact yet because AuditLog is not yet available in the product. This is part of an incremental approach; the FE is still waiting on the BE port. Relations: - This commit relates to #472, but does not finish it - This commit should not be merged until after #484 and #500, because it builds off of them.
Summary: This is direct follow-up to #484, #500, and #501. It is a part of many steps in porting/refactoring the AuditLog from v1. Details: - Port over TimeCell from v1, with refactorings - A jest test was not added because we use locale dates and times, which can be tricky to test. This can be addressed in the future. Impact: This change does not have any user-facing impact yet because AuditLog is not yet available in the product. This is part of an incremental approach; the FE is still waiting on the BE port. Relations: - This commit relates to #472, but does not finish it - This commit should not be merged until after #484, #500 and #501, because it builds off of them
We have a |
Great feedback! |
import { UserCell, UserCellProps } from "./UserCell" | ||
|
||
export default { | ||
title: "Table/Cells/UserCell", |
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.
@presleyp - do you like this organization (Table > Cells) ? Another possibility is a new directory "TableCells". I could go either way, just wanna find the one we all think is best.
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.
Yeah this seems good! Having a manageable number of top level categories will be nice.
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.
Thanks for doing the mocks and tests, looks great!
import { UserCell, UserCellProps } from "./UserCell" | ||
|
||
export default { | ||
title: "Table/Cells/UserCell", |
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.
Yeah this seems good! Having a manageable number of top level categories will be nice.
@@ -1,25 +1,12 @@ | |||
import Avatar from "@material-ui/core/Avatar" | |||
import React from "react" | |||
import { UserResponse } from "../../api/types" | |||
import { firstLetter } from "../../util/first-letter" |
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.
Awesome!
@@ -15,7 +15,7 @@ export const UserProfileCard: React.FC<UserProfileCardProps> = ({ user }) => { | |||
return ( | |||
<div className={styles.root}> | |||
<div className={styles.avatarContainer}> | |||
<UserAvatar className={styles.avatar} user={user} /> | |||
<UserAvatar className={styles.avatar} username={user.username} /> |
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.
Great choice
Summary:
This is a first step in porting over v1 AuditLog in a refactored/cleaned
up fashion. The existing
UserCell
component was generalized for re-use.Details:
components/Table/Cells
Impact:
The UserCell is used in the User dropdown menu and in the Navbar. We should verify that
those are unaffected by this change. Furthermore, this unblocks future work in list views
like the audit log, user management panel and organizations management panel.
Relations:
based on them.
TODO: