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

Adding Toasts #17030

Merged
merged 14 commits into from
Apr 6, 2023
Merged

Adding Toasts #17030

merged 14 commits into from
Apr 6, 2023

Conversation

selfcontained
Copy link
Contributor

@selfcontained selfcontained commented Mar 25, 2023

Description

WIP
Adding Toasts and updating User Preferences to use them for dotfiles and timeout fields. Also tweaked those forms on user prefs page to have a bit more feedback for the UX.

Some considerations:

  • Opted for animate in from right for toasts as it's a slightly simpler thing to implement that centered toasts that animate in from bottom. We can always revisit though.
  • Deferred adding specific types of toasts to reduce initial scope, i.e. success/error/info etc. We should add those as a followup though.
1 2
image image
image image

Related Issue(s)

Fixes WEB-38
Fixes #3530

How to test

  • Testing updating your dotfiles repo and default workspace timeout

Release Notes

NONE

Documentation

Build Options:

  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish Options
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer Options
  • with-ee-license
  • with-dedicated-emulation
  • with-ws-manager-mk2
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated

Preview Environment Options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-bmh-toasty.2 because the annotations in the pull request description changed
(with .werft/ from main)

@selfcontained selfcontained marked this pull request as ready for review March 28, 2023 17:53
@selfcontained selfcontained requested a review from a team March 28, 2023 17:54
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Mar 28, 2023
@geropl
Copy link
Member

geropl commented Mar 29, 2023

Happened to bump into this: Seems we're still using the an alert for the error case:
image

Not sure if this is in-scope for this PR, but: Would it make sense to make that symmetric? Or is there a better way for error messages, e.g. closer to the input field? 🤔

@gtsiolis
Copy link
Contributor

gtsiolis commented Mar 29, 2023

Looking at this now! 👀

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Excited to see the toast notifications coming alive, @selfcontained! 🌮 🌮

Left some UX comments below, but feel free to open follow-up issues or combine topics in a follow-up issue or PR. 🏓

Approving to unblock merging, but holding in case you'd like to address any of the comments in this PR.

/hold

components/dashboard/src/user-settings/Preferences.tsx Outdated Show resolved Hide resolved
components/dashboard/src/user-settings/Preferences.tsx Outdated Show resolved Hide resolved
onRemove: (id: string) => void;
};

export const Toast: FC<Props> = ({ id, message, duration = 5000, autoHide = true, onRemove }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: Excellent choice, 5 seconds. ✨

},
},
animation: {
"toast-in-right": "toast-in-right 0.5s",
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Can we make sure the animation is ease-in?

onRemove: (id: string) => void;
};

export const Toast: FC<Props> = ({ id, message, duration = 5000, autoHide = true, onRemove }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Can we keep the toast shown if the user hovers the mouse over it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice idea, definitely!

clone and install your dotfiles for every new workspace.
</p>
</div>
<InputField
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: Thanks for reusing the form components here! 🙇

</div>
<InputField
label="Repository URL"
hint="Add a repository URL that includes dotfiles. Gitpod will clone and install your dotfiles for every new workspace."
Copy link
Contributor

@gtsiolis gtsiolis Mar 29, 2023

Choose a reason for hiding this comment

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

suggestion: Probably out of the scope here, but could we limit the hint width to not grow beyond the input width?

BEFORE AFTER
Frame 1370 Frame 1371

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good eye 🦅 👁️ - it was a side effect of re-using the form components here, and finding a way to add the button into the row the input was on, but keep the hint rendering as it did by default. I'll play around with this a little more to see if there's a better way to have that behavior, but still re-use the form input components.

Copy link
Contributor

@gtsiolis gtsiolis Mar 30, 2023

Choose a reason for hiding this comment

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

Ah, I see. Yeah, let's make this change if it's trivial—otherwise we could keep it like this, as I wouldn't be surprized if the UX or interaction to update the dotfiles or timeouts moves away from these inline forms. Your call. 🏓

See relevant comments:

</div>
<InputField
label="Repository URL"
hint="Add a repository URL that includes dotfiles. Gitpod will clone and install your dotfiles for every new workspace."
Copy link
Contributor

@gtsiolis gtsiolis Mar 29, 2023

Choose a reason for hiding this comment

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

suggestion: Also, out of the scope here, but the input should look, feel, and work better if it had a smaller height and width.

BEFORE AFTER
input-before input-after

},
},
animation: {
"toast-in-right": "toast-in-right 0.5s",
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Can we make the toast ease-in from the bottom?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yah we can. fwiw I tried coming in from the bottom and centered, and it looked a little janky w/ stacked toasts and how they would shift up to make room instantly while the new one slides up. We could make it pretty slick, but will be a bit more effort to animate it nicely I think. In from right looks a little better with this lower level of effort imo, so I ended up doing that. It's not too tough to swap it to in from bottom to show you what I mean sometime too if you wanted to see each.

className={classNames(
"relative flex justify-between items-center",
"w-full md:w-96 max-w-full",
"p-6 border-1 md:rounded",
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Could we make the design of the toast closer to the original design spec in #3530? For example, larger corner radius, smaller padding, better color text for accessibility, bolder x icon. Later on we can explore how toasts with two lines of text or actions could look like.

BEFORE AFTER
Frame 1370 Frame 1371

@selfcontained
Copy link
Contributor Author

selfcontained commented Mar 29, 2023

Happened to bump into this: Seems we're still using the an alert for the error case: image

Not sure if this is in-scope for this PR, but: Would it make sense to make that symmetric? Or is there a better way for error messages, e.g. closer to the input field? 🤔

My plan was to make that an error styled toast, but in a follow up where I can work with @gtsiolis around what those styled toasts might look like. It would be easy to make that a toast instead in this PR too though.

@gtsiolis
Copy link
Contributor

gtsiolis commented Mar 29, 2023

Regarding the browser alert[1][2], 🅰️ this was mentioned also in the original PR in #16503 (comment) and 🅱️ this is currently the UX on production.

I'd think it should be perfectly fine to not fix this in the scope of this PR but I'll leave this to the engineering team to decide. @selfcontained Your call, but let me know if you need any UX input on this now or later. 💭

Thanks again for making this happen! 🍞

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

Thanks for the explanations. 🙏

Code LGTM, tested and works. 🧘

@selfcontained
Copy link
Contributor Author

/unhold

@roboquat roboquat merged commit ee4a5a0 into main Apr 6, 2023
@roboquat roboquat deleted the bmh/toasty branch April 6, 2023 11:55
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/XL team: webapp Issue belongs to the WebApp team
Projects
Status: In Validation
Development

Successfully merging this pull request may close these issues.

Add toast component in notifications
4 participants