Skip to content

feat(site): show favorite workspaces in ui #11875

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 9 commits into from
Jan 29, 2024
Merged

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Jan 29, 2024

Screenshot 2024-01-29 at 10 30 09

Screenshot 2024-01-29 at 10 30 52

Screenshot 2024-01-29 at 10 30 55

@johnstcn johnstcn changed the title [wip] feat(site): show favorite workspaces in ui feat(site): show favorite workspaces in ui Jan 29, 2024
@johnstcn johnstcn marked this pull request as ready for review January 29, 2024 11:21
queryClient.setQueryData(
workspaceByOwnerAndNameKey(workspace.owner_name, workspace.name),
{ ...workspace, favorite: !workspace.favorite },
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

You also may want to invalidate the "workspace list" query data.

}

export const FavoriteButton: FC<FavoriteButtonProps> = ({
handleAction,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's an implicit convention, but when dealing with event handlers, we usually name them using the on prefix like onSomething instead of handleSomething. So instead of handleActions, I think a better name would be onToggle.

Also, you can move the query inside this button 😁. We're trying to put things close to where they're used.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, you can move the query inside this button 😁. We're trying to put things close to where they're used.

I'm not quite sure how to accomplish this; React doesn't seem to like me putting useMutation inside a component.

Copy link
Member Author

Choose a reason for hiding this comment

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

Created #11892 to follow-up.

startIcon={isFavorite ? <Star /> : <StarBorder />}
onClick={() => handleAction(workspaceID)}
>
{isFavorite ? "Unfavorite" : "Favorite"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this button can have two states, favorite and unfavorite, I would create a story in a storybook for both scenarios.

Copy link
Collaborator

Choose a reason for hiding this comment

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

One small thing about the design is that I don't think it should be a primary action, located in the same place as workspace actions like start, stop, refresh, etc. I think it should be in the "more options" menu.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think @matifali ?

Copy link
Member

@matifali matifali Jan 29, 2024

Choose a reason for hiding this comment

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

Hmm. I like it on the front page, but what about making a filled vs. an empty star only and removing the text altogether?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd prefer to leave the text on, as a button should show what will happen when you click it.

Copy link
Member Author

Choose a reason for hiding this comment

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

@BrunoQuaresma I think we have enough space to leave the button up top for now; hiding it in the menu makes it less discoverable.

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

I think you did a really good job on this 🙏. I just left some comments but any of them are blockers.

@BrunoQuaresma
Copy link
Collaborator

@johnstcn don't forget to review things in Chromatic 🙏

@johnstcn johnstcn merged commit 9abf6ec into main Jan 29, 2024
@johnstcn johnstcn deleted the cj/ui-favorite-workspace branch January 29, 2024 13:39
@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2024
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.

3 participants