Skip to content
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

[UI] Move Runtime status to BottomAppBar #492

Closed
wants to merge 11 commits into from

Conversation

senwang86
Copy link
Collaborator

Summary

A UI refactor which moves the Sync Status and Runtime Status from Sidebar to a newly created BottomAppBar.

Screenshot 2023-08-29 at 4 23 40 PM

Test

bottom_status_bar

@senwang86 senwang86 requested a review from lihebi August 29, 2023 23:28
@@ -215,14 +216,19 @@ function RepoWrapper({ children, id }) {
sx={{
boxSizing: "border-box",
width: "100%",
height: "100%",
height: "96%",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks fragile.

@lihebi
Copy link
Collaborator

lihebi commented Aug 30, 2023

This UI looks fancy! Instead of "moving", I'd like to keep both (essentially two types of "widgets"). We need a "widget" system to allow users to configure what widgets to show in the sidebar and the bottom-status-bar.

@lihebi
Copy link
Collaborator

lihebi commented Aug 30, 2023

I changed the sidebar just a little bit in #493, resulting in a slight conflict. I've merged that PR since it's pretty big and may cause more conflicts.

@lihebi
Copy link
Collaborator

lihebi commented Aug 30, 2023

A second thought: I probably want to hold on this, because the status items/buttons aren’t fixed, and I’m working on adding locally spawned runtimes to these sections. Working with sidebar seems easier to make changes.

@senwang86
Copy link
Collaborator Author

This UI looks fancy! Instead of "moving", I'd like to keep both (essentially two types of "widgets"). We need a "widget" system to allow users to configure what widgets to show in the sidebar and the bottom-status-bar.

Yeah, I recall this. The only concern is that if we need to maintain 2 sets of code for the same UI system, given that Sidebar and BottomBar have different space constraint.

@senwang86
Copy link
Collaborator Author

A second thought: I probably want to hold on this, because the status items/buttons aren’t fixed, and I’m working on adding locally spawned runtimes to these sections. Working with sidebar seems easier to make changes.

SG. Just let me know once you finish the local runtime work.

@forrestbao
Copy link
Collaborator

Thanks @senwang86. My two cents: Can we move the status info to the top bar? The bottom of the screen is usually where the programmer's gaze is at: because code goes top to down. The status bar there sounds a distraction.

@lihebi
Copy link
Collaborator

lihebi commented Aug 30, 2023

We'll have a widget system that allows users to configure "what" widgets to be displayed at "which" location, be it top or bottom.

@senwang86
Copy link
Collaborator Author

Screenshot 2023-08-31 at 6 56 17 PM

return (
<ListItem key={runtimeId} disablePadding sx={{ margin: 0 }}>
{activeRuntime === runtimeId && (
<Tooltip title={wsStatus.title}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Crash when deleting a runtime.

Screenshot 2023-09-01 at 12 54 55 AM

Copy link
Collaborator Author

@senwang86 senwang86 Sep 1, 2023

Choose a reason for hiding this comment

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

Has it been tested after merging PR #501 ? it works fine on my end though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

[3/3] And finally, you access wsStatus.title which crashes with "reading properties of undefined" error.

Copy link
Collaborator

@lihebi lihebi left a comment

Choose a reason for hiding this comment

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

I don't understand how c0b1fd0 creates Sidebar "widget". This commit looks like a few refactorings and a few style changes. It's better if you can create separate small PRs with focused changes.

@lihebi
Copy link
Collaborator

lihebi commented Sep 1, 2023

I used the bottom bar a little, and I feel that this design is a little over-engineered. The first principle of UI design IMO is to be simple and explicit.

  1. Simple: I'm not a fan of replacing text with icons. Texts are simple and easy to understand.
  2. Explicit: The bottom bar also hides multiple runtimes into 2nd-level menus, which is not explicit. We may very well need to see all runtime statuses, especially when we introduce dev/prod, training/inference, multiple languages.

Let's use plain text and refine the UI later.

@lihebi
Copy link
Collaborator

lihebi commented Sep 1, 2023

we need to maintain 2 sets of code for the same UI system

Agree. This is also one of the main concerns that I hesitate to merge. I can feel that this will create headaches for future changes. Let's defer the UI polishing to the very end.

useEffect(() => {}, [runtimeChanged]);
const activeRuntime = useStore(store, (state) => state.activeRuntime);
const setActiveRuntime = useStore(store, (state) => state.setActiveRuntime);
const runtime = runtimeMap.get(runtimeId) || { wsStatus: "unknown" };
Copy link
Collaborator

Choose a reason for hiding this comment

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

[1/3] you set runtime = {wsStatus: "uknonwn"} as the fallback

Comment on lines +88 to +93
const wsStatusConfig = {
connected: { title: "connected", color: "green" },
connecting: { title: "connecting", color: "yellow" },
default: { title: "disconnected", color: "red" },
};
const wsStatus = wsStatusConfig[runtime.wsStatus || "default"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

[2/3] And if that's unknown, this wsStatusConfig doesn't have the key, which leads to wsStatus===undefined

Copy link
Collaborator

Choose a reason for hiding this comment

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

Adding some type annotations can help you catch such bugs early and more comprehensively.

return (
<ListItem key={runtimeId} disablePadding sx={{ margin: 0 }}>
{activeRuntime === runtimeId && (
<Tooltip title={wsStatus.title}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

[3/3] And finally, you access wsStatus.title which crashes with "reading properties of undefined" error.

@senwang86
Copy link
Collaborator Author

Thanks @senwang86. My two cents: Can we move the status info to the top bar? The bottom of the screen is usually where the programmer's gaze is at: because code goes top to down. The status bar there sounds a distraction.

Hi @forrestbao , appreciate for the feedback! After some discussion, we agree that the status bar might not offer enough benefit, just as you suggested that it might cause users to be distracted. Thus it will not be merged.

@senwang86 senwang86 closed this Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants