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

Pr/108 #254

Merged
merged 32 commits into from
Dec 4, 2017
Merged

Pr/108 #254

merged 32 commits into from
Dec 4, 2017

Conversation

tansongyang
Copy link
Contributor

What kind of change does this PR introduce? Enhancement

What is the current behavior? See discussion in #108.

What is the new behavior? Add a modal that lets you search npm packages.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

This is definitely not done yet, but I wanted to get an initial review before moving forward.

New behavior looks like this (unstyled).

pr-0

What do people think of this workflow?

@CompuIves
Copy link
Member

CompuIves commented Oct 22, 2017

Awesome!! This is great! I have an idea on how it could look like. Lemme draw something...

screen shot 2017-10-22 at 18 07 23

This is inspired a lot by how yarnpkg shows the list 😄 .

The idea is that you can navigate the list of dependencies with up/down keys. When you press enter or click one it will add the latest version, but if you click the dropdown it will open a list of versions of which you can select one.

Curious what you think!

@tansongyang
Copy link
Contributor Author

I like that idea as well and I'm happy to do it.

However, I have a question about the sandbox. I tried to change the action of dependency-not-found-error.js to this:

const onConfirm = (name, version) => {
  dispatch(actions.source.dependencies.add(parsedName, version));
};
// In my branch, I am able to import `store`
store.dispatch(
  modalActionCreators.openModal({
    width: 600,
    Body: <SearchDependencies onConfirm={onConfirm} />,
  })
);

The goal was to make the "Add foo as dependency" button have the same workflow as the "Add Package". However, the modal was not opening. Is this expected behavior? Does the sandbox prevent redux actions from being received in the app?

@CompuIves
Copy link
Member

Ah, yes, that won't work because that error is executed in the sandbox environment. You need to do something similar as dispatch(actions.source.dependencies.add(parsedName, version));. But this is a bit of a mess right now, so I can add this functionality as well 🙂 .

@tansongyang
Copy link
Contributor Author

OK, then I will just worry about implementing that mockup.

@CompuIves
Copy link
Member

Hey @tansongyang! How is this going? Can I help in any way? 😄

@tansongyang
Copy link
Contributor Author

tansongyang commented Oct 28, 2017

Hi there! It's just a little slow because I generally only have time to work on these projects on the weekends, and this is turning out to be a busy weekend for other reasons. Did you have a goal time for when you wanted to see this feature be complete?

As for help, I think the only thing I would need is the correct keys to use. I copied the current keys from the yarn repo as a temporary solution, just to get something working that I could dev against.

@CompuIves
Copy link
Member

Absolutely no problem @tansongyang. I'm just very excited for this feature 😜 .

Take your time 😄 .

@tansongyang
Copy link
Contributor Author

I'm excited too! Thanks for the opportunity to contribute 😄

@tansongyang
Copy link
Contributor Author

@CompuIves I thought I should let you know: work has been heavy for me for the past few weeks, and I think it's going to stay this way for a couple more. Realistically speaking, I may not have a chance to work on this PR again until mid-November.

I don't feel that I own this code or anything like that, so if the best thing for the project is for you or someone else to take over the PR, that's totally fine by me.

Of course, if we're all willing to wait a few weeks, I can get back to it.

I'll let you decide. Thanks again!

@CompuIves
Copy link
Member

Thanks for letting us know @tansongyang, I really appreciate that!

Absolutely no problem if you have no time, don't feel pushed to work on it if you don't have time. We're currently not in a rush to get this in, if I want to get this in quickly I'll let you know and then I'll finish the PR 🙂 .

@lbogdan
Copy link
Contributor

lbogdan commented Nov 20, 2017

Hey @tansongyang, you should probably try merging with the master branch, there were a lot of (big) changes since you started this.

@tansongyang
Copy link
Contributor Author

@CompuIves Thanks! I'll take a look at using Downshift later this week.

@CompuIves @lbogdan Scoped packages seem to be an issue in the npm-search package. This happens on yarnpkg.com as well. For example, @angular/core does not appear until page 3, and it says it has 0 downloads. Perhaps the solution is to add paging controls?

@lbogdan
Copy link
Contributor

lbogdan commented Nov 27, 2017

Or maybe switch to https://npms.io/ (i.e. https://api.npms.io/v2/search?q=@angular/core )?

@CompuIves
Copy link
Member

Hmm, yes. The dependency should at least be there to add, otherwise it can be very confusing. I'm not sure if this can be fixed easily, I'll ask someone from Algolia first.

@tansongyang
Copy link
Contributor Author

Updates

  • Use codesandbox keys.
  • Use Downshift to get arrow navigation.
  • Add paging.

pr-108-demo

@CompuIves
Copy link
Member

CompuIves commented Dec 3, 2017

Wow @tansongyang, this is awesome! Thank you very much, it's perfect.

Could you fix the lint errors and fix the jest errors? I think you can fix jest by just merging with master, had the same issue before. Then it's ready to go.

root added 4 commits December 3, 2017 21:16
* Extract formatDownloads into own file.
* Reorder SearchDependencies so that the main content comes first.
@tansongyang
Copy link
Contributor Author

tansongyang commented Dec 4, 2017

@CompuIves Oops, I forgot to do that. Hopefully, it's good now. In the future, do you think it would be valuable to add linting and testing to the precommit?

@tansongyang
Copy link
Contributor Author

@CompuIves Is the timeout in the integration tests something I should be able to handle on my end?

@CompuIves
Copy link
Member

This is really great, cannot wait to get this live 😄 . I'll make some very minor styling changes after merge to master (a border-bottom and text color change).

In the future, do you think it would be valuable to add linting and testing to the precommit?

Still thinking of this, I'm afraid that it will slow down my dev flow so I'd leave it off for now.

Is the timeout in the integration tests something I should be able to handle on my end?

Happens sometimes randomly, we should move the timer for that.

Again, thank you very much! This is a major feature for us 😄 😄

@CompuIves CompuIves merged commit a135fcb into codesandbox:master Dec 4, 2017
@tansongyang
Copy link
Contributor Author

Great! It was fun to work on and I learned a lot. Thanks for the opportunity.

@tansongyang tansongyang deleted the pr/108 branch December 4, 2017 13:02
@CompuIves
Copy link
Member

One quick question, is there a specific reason you put pagination on top?

I'm experimenting with putting it at the bottom, but maybe there are good reasons to keep it top.

@tansongyang
Copy link
Contributor Author

I was thinking about the situation where you keep clicking "next page". If the paging controls are at the top, you are guaranteed that the button is always in the same place. So you can just keep clicking.

At first, I had the controls at the bottom. I noticed that, when I was paging, the controls would move under because each page of results would be slightly different in height. On each page, I had to readjust my mouse to get to the button.

Two solutions I can think of:

  1. If we don't think the controls moving around is a problem, and it looks better at the bottom, we can just move them to the bottom.
  2. If we think it's a problem but we still want controls at the bottom, we could find some way to fix the height of each page of results.

@CompuIves
Copy link
Member

Very smart @tansongyang, we'll keep them at the top!

@CompuIves
Copy link
Member

I helped with pushing a fix for the Algolia scoped packages indexing, let's wait for that before fully deploying. Should be today or tomorrow hopefully 😄

@Haroenv
Copy link
Contributor

Haroenv commented Dec 4, 2017

All scoped packages have downloads now, thanks for contributing all of you

@CompuIves
Copy link
Member

Hey @tansongyang, one small last thing! Do you have a Twitter handle? I want to give credits where its due with the announcement 🙂 .

@tansongyang
Copy link
Contributor Author

Sure thing! It's https://twitter.com/tansongyang. Now, I'll warn you, I haven't actually tweeted anything yet! I just used it to follow others haha.

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.

4 participants