-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
Hide number of changes in UI, add it in debug logging utility #861
Conversation
Your Render PR Server URL is https://toolpad-pr-861.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cc4f9m1a6gdmo9nc4i2g. |
I would suggest the "All changes saved" to be transient (disappear after a few second delay), benchmarking based on how Google Docs does it: Screen.Recording.2022-08-27.at.5.37.09.PM.mov |
Yes, taking it a bit further even, to reduce the amount of space it takes in the UI and avoid layout shifting, perhaps it makes sense to just use an icon + tooltip for this? |
Good idea! I'll add something like that.
On one hand this makes the information we're conveying less clear, but this information is also a bit secondary, so I think this would make sense. I'll try something like this too. |
Your Render PR Server URL is https://toolpad-pr-861.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cc6irdhgp3jian8oe6m0. |
With icon and tooltip (disappears after 4.5 seconds without changing, forgot to record that): Screen.Recording.2022-08-30.at.17.29.39.mov |
<Tooltip title={getSaveStateMessage(isSaving, hasUnsavedChanges)}> | ||
<Box display="flex" flexDirection="row" alignItems="center"> | ||
{isSaving ? ( | ||
<CircularProgress size={16} color="inherit" sx={{ mr: 1 }} /> |
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.
I feel that we don't need the CircularProgress
icon for the isSaving
state: it is not discernable to me in the video as a separate icon; perhaps we can add a "pulsating" animation to the icon in the isSaving
state
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, that could be a follow-up improvement! This looks great to me overall as a first step
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.
it is not discernable to me in the video as a separate icon
keep in mind this video is made on a locally running app, irl it will often take longer to complete the request
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 it's showing as long as saving
is true, looks like in dev it's a pretty short time.
lmk if you think we should show the loader when there are unsaved changes even though the saving flag is false
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.
Looking good 👍
we could also use the CloudDone
icon for this
ok i'll make a quick switch before merging, it's more techy i guess :D |
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.
Had a few more comments
@@ -0,0 +1,6 @@ | |||
export function debugLog(message: string, color: string): void { |
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.
@apedroferreira This looks like a function that is only there to circumvent // eslint-disable-next-line no-console
. Can't we just use console.log
, so that we don't get tempted to start logging everything?
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.
i made this a separate function to abstract away the environment variable check and the color in the logs. but sure, we can write it every time too. i'll change 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.
Perhaps we can leave out the color and the env check?
- Not sure we need the env check if we use logging sparingly
- Not sure what the color brings, but if we use it, we should probably think about the semantic meaning of 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.
i was thinking maybe we didn't want to show certain logs to end users so i added this environment variable, we could just show them to everyone though.
about the color, i could have made the function only take certain values such as success
, warning
, error
, info
, but i'm fine with not having colors for now especially if we don't have cases for all these types of logs yet.
<Box display="flex" flexDirection="row" alignItems="center"> | ||
<CircularProgress size={16} color="inherit" sx={{ mr: 1 }} /> | ||
</Box> | ||
{isSaveStateVisible ? ( |
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.
I don't think we should hide the icon. It will cause layout shift and prevent us from adding more things in the header
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.
ok, i can use something like visibility: hidden
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.
What's the reason to hide it exactly?
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.
oh i see, i was thinking the save state wasn't that helpful after a while so it could stay hidden - that's also what Bharat proposed and i implemented with the timeout (it disappears after a few seconds). but we can keep the green cloud there as long as it's saved too.
'orange', | ||
); | ||
} else if (previousUnsavedChanges > 0) { | ||
debugLog('All changes saved!', 'green'); |
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.
To reduce the amount of logs, perhaps we can just do one message "Saved X changes"?
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.
i can change it, just has a bit less visibility into changes that don't all happen together and the save state. maybe we don't need all that though.
Closes #781 (fix just for UX, not the number of updates yet)
Saving changes...
(saving),You have unsaved changes.
(unsaved changes, not saving) orAll changes saved!
in UITOOLPAD_DEBUG
environment variable andutils/logs
with a method for debug logs. Feel free to suggest changes or alternatives about this.Screen.Recording.2022-08-26.at.17.24.44.mov