Skip to content

[server][dashboard] Improve 'New Workspace' modal #7715

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
Feb 8, 2022
Merged

Conversation

jankeromnes
Copy link
Contributor

@jankeromnes jankeromnes commented Jan 20, 2022

Description

Improve the 'New Workspace' modal with a search input, keyboard navigation, and a new context URL suggestion API.

Related Issue(s)

Fixes #7564

How to test

  1. Click on New Workspace (or hit Ctrl/Cmd + O from anywhere in the dashboard)
  2. Type to find a suggested repository* or paste any context URL and hit Enter

*currently sources suggestions from:

Release Notes

[server][dashboard] Improve 'New Workspace' modal with a search input, keyboard navigation, and a new context URL suggestion API

Documentation

/uncc

@codecov

This comment has been minimized.

@roboquat roboquat added size/XL and removed size/L labels Jan 20, 2022
@jankeromnes jankeromnes force-pushed the jx/open-in-gitpod branch 3 times, most recently from 6c07882 to 0651cb2 Compare January 21, 2022 14:07
@jankeromnes jankeromnes marked this pull request as ready for review January 21, 2022 14:12
@@ -51,7 +51,7 @@ export default function Modal(props: {
return (
<div className="fixed top-0 left-0 bg-black bg-opacity-70 z-50 w-screen h-screen">
<div className="w-screen h-screen align-middle" style={{display: 'table-cell'}}>
<div className={"relative bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-6 max-w-lg mx-auto text-left text-gray-600 " + (props.className || '')} onClick={e => e.stopPropagation()}>
<div className={"relative bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-6 max-w-lg mx-auto text-left " + (props.className || '')} onClick={e => e.stopPropagation()}>
Copy link
Contributor Author

@jankeromnes jankeromnes Jan 21, 2022

Choose a reason for hiding this comment

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

This was making all text in all modals text-gray-600 by default, which was impractical.

I've removed it and checked several Modals, but I hope I haven't missed any side effects of this fix.

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Jan 21, 2022

Alright, I think the current state is pretty cool. ✨

Initial state Type anything Paste
Screenshot 2022-01-21 at 16 18 40 Screenshot 2022-01-21 at 16 18 52 Screenshot 2022-01-21 at 16 19 05
Screenshot 2022-01-21 at 16 19 23 Screenshot 2022-01-21 at 16 19 34 Screenshot 2022-01-21 at 16 20 06

@gtsiolis @jldec Could you please take a look? 🙏

Cool things to try:

  • Up/Down arrow, Enter
  • Cmd+K shortcut (or P, O, or with Ctrl)
  • type rust, next, petclinic
  • paste any context URL
  • connect GitLab and Bitbucket in /integrations then try to find your repos in the Modal

@gtsiolis
Copy link
Contributor

gtsiolis commented Jan 21, 2022

Looking at this now! 👀

gtsiolis
gtsiolis previously approved these changes Jan 21, 2022
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.

Looks great, @jankeromnes! 🔮

Added some first round review comments below with some non-blocking questions. 🥊

Approving to unblock merging but holding in case we could tackle any of the comments below and since someone else could take a closer look at the code changes.

/hold

</div>
<div className="mt-3 flex flex-col space-y-2 h-64 overflow-y-auto" id="search-results">
{searchResults.slice(0, MAX_DISPLAYED_ITEMS).map((result, index) =>
<a className={`px-4 py-3 rounded-xl` + (result === selectedSearchResult ? ' bg-gray-600 text-gray-50 dark:bg-gray-700' : '')} href={`/#${result}`} key={`search-result-${index}`} onMouseEnter={() => setSelectedSearchResult(result)}>
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: It would be probably good to add some right margin here to avoid squashing the highlighted reasult entry with the visible scrollbar. What do you think?

Suggested change
<a className={`px-4 py-3 rounded-xl` + (result === selectedSearchResult ? ' bg-gray-600 text-gray-50 dark:bg-gray-700' : '')} href={`/#${result}`} key={`search-result-${index}`} onMouseEnter={() => setSelectedSearchResult(result)}>
<a className={`px-4 py-3 rounded-xl mr-2` + (result === selectedSearchResult ? ' bg-gray-600 text-gray-50 dark:bg-gray-700' : '')} href={`/#${result}`} key={`search-result-${index}`} onMouseEnter={() => setSelectedSearchResult(result)}>
BEFORE AFTER
Screenshot 2022-01-21 at 6 17 21 PM (2) Screenshot 2022-01-21 at 6 17 35 PM (2)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uh oh 😬 I'm not a big fan of either, and I think I'd prefer having the results be the same width as the input. I'll see if I can improve this somehow.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, no biggie. Regarding width, same width would be nice but that could require us to move the scrollbar outside the scrolling area. Posting below a slightly related design with scrollbars from #4948 to better visualize the problem. In any case, feel free to leave this as is, too. 🏓

127672486-fae3178f-e301-433d-9275-0e198e2a35ff

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gtsiolis Okay, I believe I've found an elegant fix for this 😁 I've simply made the scroll zone wider (negative X-margin) and compensated with some padding (positive X-padding). This doesn't require changing the size of other elements, and has the effect of "simply moving the scrollbar a bit to the right":

Screenshot 2022-02-01 at 15 40 55

Screenshot 2022-02-01 at 15 43 17

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for giving this a go, @jankeromnes!

suggestion: I think going with the simple inner right padding for now sounds better.

issue: Moving the scrollbar outside could make the user feel like they can scroll the through the whole modal inner elements, including title, text input, etc, not just the repository list. This also becomes more visible or an issue when always showing scrollbars, see screenshots below. This is also what I see! 👀

Light Dark
scrollbar-light scrollbar-dark

thought: Keeping the scrollbar near the scrollbar area could help us 🅰️ use better layouts like the one with the gray background mentioned in #7715 (comment), 🅱️ potentially introduce more fixed elements like a bottom toolbar for surfacing results found, etc.

Regarding the scrollbar blindness issue we discussed a few days ago, here's a relevant thread[1] but unfortunately the original article has been removed. I could only find this partial screenshot[2]. 🌟

@roboquat
Copy link
Contributor

LGTM label has been added.

Git tree hash: c63d3e13f3b4e80b6d013910e2fbd1b5d4ff4265

@svenefftinge
Copy link
Member

svenefftinge commented Jan 24, 2022

Would be great if it would propose the repositories I care about.
This graphql query would return the first 100 repos I have contributed to. It's actually pretty fast query.

query { 
  user(login: "svenefftinge") {
      repositoriesContributedTo(includeUserRepositories: true, first: 100) {
        edges {
          node {
            nameWithOwner
            shortDescriptionHTML(limit: 120)
            url
          }
        }
      }
    }
}

Try here.

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Jan 24, 2022

Exciting find, many thanks @svenefftinge!

Actually this PR should already fetch all your GitHub repositories (either just svenefftinge/* or also from orgs, I'm not sure). It uses the same code that feeds the "New Project" wizard options (just with a faster UX), which unfortunately doesn't work in this preview because I haven't connected a GitHub App yet.

You can test it by connecting GitLab and Bitbucket in /integrations though.

Will add a GitHub App in the next deployment.

However, I'll likely keep your query too, because it can probably find even more relevant results than what we already have. Thanks again!

Copy link
Member

@svenefftinge svenefftinge left a comment

Choose a reason for hiding this comment

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

Cool! I belive it would be better if suggestions are displayed already when you first open the dialog with an empty input. WDYT?

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Jan 24, 2022

Cool! I belive it would be better if suggestions are displayed already when you first open the dialog with an empty input. WDYT?

I also like this idea, and you can sort of simulate it by typing then removing a letter. (The order of the suggestions is currently alphabetical, which we could probably make more relevant.)

We discussed this earlier today in our team meeting. Another option could be to have a helpful empty state, which explains what exactly is happening here / what you should do / where the results come from. But if we can immediately show a list of the most relevant suggestions, maybe we don't even need to "explain" the feature with an empty state (i.e. you just click on New Workspace, then you immediately see the repo you're interested in, and voilà, job done, no "learning" was required because the feature was intuitive).

if (!provider) {
return;
}
promises.push(this.getProviderRepositoriesForUser(ctx, { provider }).then(userRepos => {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think reusing this method is a good idea as it limits the list of repos to the repos that have the app installed. Also fetches projects etc. IMHO this should be entirely about proposing great matches for a user, no matter an app is installed. We will grow out of what this method does pretty soon anyway.

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 point, thanks. Added a TODO comment as a first start.

@roboquat
Copy link
Contributor

roboquat commented Feb 4, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gtsiolis, jldec

Associated issue: #7564

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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.

Thanks again @jankeromnes for pushing this through the finish line! 🏁

Cross-linking below one last round of comments related to UX that we could improve before merging this. Up for discussing more about these or leaving any of these for the next iteration and out of the scope of this PR if needed. Cc @jldec

  1. Empty state placeholder, text input design, modal background, and removal of the background page load.
  2. Results found text design.
  3. Restoring empty state.
  4. Text input placeholder.

@jankeromnes jankeromnes force-pushed the jx/open-in-gitpod branch 2 times, most recently from d727b94 to 01ef76b Compare February 7, 2022 18:06
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.

Left two more minor comments regarding the keyboard shortcut inside the button label.

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Feb 8, 2022

Cross-linking below one last round of comments related to UX that we could improve before merging this.

Many thanks @gtsiolis for summarizing remaining concerns! Will address them or open follow-up issues.

  1. Empty state placeholder, text input design, modal background, and removal of the background page load.

Removed the background page load (🅰️ -- good catch!) and opened #8088 for the remaining design items.

  1. Results found text design.

  1. Restoring empty state.

  1. Text input placeholder.

Left two more minor comments regarding the keyboard shortcut inside the button label.

⏳ TODO(janx) EDIT: ✅ (see comment above about OS consistency)

@jankeromnes
Copy link
Contributor Author

/unhold

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Feb 8, 2022

Okay, I think we've iterated enough here. 😅 Happy to iterate further with follow-up issues. 🚀

Could a kind team mate from @gitpod-io/engineering-webapp please approve this Pull Request again? 🙏 (lgtm label is still there, but new process...)

@jankeromnes jankeromnes requested a review from a team February 8, 2022 13:46
Copy link
Contributor

@JanKoehnlein JanKoehnlein left a comment

Choose a reason for hiding this comment

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

Let's ship this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text input + autosuggest for New Workspace modal UI
8 participants