Skip to content

refactor: redesign workspace status on workspaces table #17425

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

Merged
merged 7 commits into from
Apr 17, 2025

Conversation

BrunoQuaresma
Copy link
Collaborator

Closes #17310

Before:
Screenshot 2025-04-16 at 11 49 52

After:
Screenshot 2025-04-16 at 11 49 19

Notice!

  • I've create a new size variation for the badge, xs. Since we reduced the line-height for the text-xs to be 16px instead of 18px, having a smaller badge, reducing the vertical size and horizontal paddings, just worked better.
    • I have to update Figma to reflect these changes. I tried, but I was not able to get it working and updated correctly. I'm going to take a pause during this week to learn that.
  • Updated the destructive, and warning badges to use borders as defined in the designs here.

@BrunoQuaresma BrunoQuaresma changed the title refactor: redesign workspace status on workspces table refactor: redesign workspace status on workspaces table Apr 16, 2025
@BrunoQuaresma BrunoQuaresma requested review from a team and bcpeinhardt and removed request for a team April 16, 2025 15:04
Copy link
Member

@Parkreiner Parkreiner 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 overall to me! Just had some questions/remarks

Also, I know that this is out of scope for the PR, but I can't help but feel like the border color should be slightly dimmer. Just bright enough to provide a boundary between the badge and the surrounding area's color, but still dim enough that it doesn't compete with the color of the badge text (which is the main part the user cares about)

@@ -28,10 +28,12 @@
--surface-grey: 240 5% 96%;
--surface-orange: 34 100% 92%;
--surface-sky: 201 94% 86%;
--surface-red: 0 93% 94%;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a good way to get up to speed on how we have colors set up right now, especially for themes? This red is pretty bright and desaturated, and I'm wondering how it looks against the light theme

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, you can check them in Figma - You may need to learn how to see the tokens. I'm not sure if we are following this, but in the past I think we decided to use TailwindCSS colors as reference.

Comment on lines +20 to +22
"border border-solid border-border-warning bg-surface-orange text-content-warning shadow",
destructive:
"border border-solid border-border-destructive bg-surface-red text-content-highlight-red shadow",
Copy link
Member

Choose a reason for hiding this comment

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

I want to say that border-solid is set automatically via border, but I guess it's good to be explicit here

Copy link
Collaborator Author

@BrunoQuaresma BrunoQuaresma Apr 17, 2025

Choose a reason for hiding this comment

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

It is not 😢 . The reason is because we don't use the TailwindCSS pre-flight right now because of MUI - to avoid overlaping resets and styles.


const variantByStatusType: Record<
GetWorkspaceDisplayStatusType,
StatusIndicatorProps["variant"]
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if it's worth splitting off the variant property into a separate type, and exporting that instead. Chaining props like this feels like fragile, over-coupled dependencies

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Chaining props like this feels like fragile, over-coupled dependencies

I think this makes sense when the defined type is dependent on the another one. So, if I change the props onStatusIndicator it will be reflect on variantByStatusTypewithout any extra effort. Besides that, I think having something like:

type StatusIndicatorVariant = StatusIndicatorProps["variant"]

It just works as an alias IMO.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Putting more thoughts on it, I just think types dependency may warn us about components being too coupled, which is not always bad, but definitely something to evaluate.


return (
<TableCell>
<div className="flex flex-col">
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why this is a flex column? I would expect that when there isn't any gap set, you would get the same result if you were to remove the classes entirely

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is true, let me check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it has to be because of the inline elements that are inside like the span.

@@ -176,6 +176,7 @@ export const getDisplayWorkspaceStatus = (
case undefined:
return {
text: "Loading",
type: "active",
Copy link
Member

Choose a reason for hiding this comment

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

I can't flag line 174, but could we get rid of the as const declarations, and add an explicit return type to the function? The current setup won't provide many safety nets if we accidentally add an extra field or make a typo

Copy link
Member

Choose a reason for hiding this comment

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

It would also remove the need for the ReturnType-derived type on line 245

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will take a look on those 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done ✅

@@ -307,3 +312,23 @@ const FALLBACK_ICON = "/icon/widgets.svg";
export const getResourceIconPath = (resourceType: string): string => {
return BUILT_IN_ICON_PATHS[resourceType] ?? FALLBACK_ICON;
};

export const lastUsedMessage = (lastUsedAt: string | Date) => {
Copy link
Member

Choose a reason for hiding this comment

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

Can a return type be added here?


if (t.isAfter(now.subtract(1, "hour"))) {
message = "Now";
} else if (t.isAfter(now.subtract(3, "day"))) {
Copy link
Contributor

@bcpeinhardt bcpeinhardt Apr 16, 2025

Choose a reason for hiding this comment

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

Am I crazy or do these middle branches not do anything since message already defaults to t.fromNow() on line 319?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They do because the conditions are not using the message value to compare things... maybe I'm missing something 🤔 but in my tests and storybook things are working as expected - I guess haha

@BrunoQuaresma BrunoQuaresma force-pushed the bq/refactor-status-column branch from 722e22f to bbe9d8f Compare April 17, 2025 13:39
@BrunoQuaresma BrunoQuaresma merged commit c8edada into main Apr 17, 2025
34 checks passed
@BrunoQuaresma BrunoQuaresma deleted the bq/refactor-status-column branch April 17, 2025 13:57
@github-actions github-actions bot locked and limited conversation to collaborators Apr 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Combine last used and status columns on workspaces table
3 participants