Skip to content

Add tags-dropdown feature - #1896

Merged
fregante merged 36 commits into
refined-github:masterfrom
hardikmodha:f_add_search_on_releases
Apr 20, 2019
Merged

fregante merged 36 commits into
refined-github:masterfrom
hardikmodha:f_add_search_on_releases

Conversation

@hardikmodha

@hardikmodha hardikmodha commented Mar 30, 2019 •

Copy link
Copy Markdown
Contributor
  1. Here is the list of URLs that can be used to test the functionality.
  1. It Fixes [Feature request] - Add ability to search releases on /releases page. #1895 and closes [Feature request] - Add ability to search releases on /releases page. #1895.

Note: The feature uses the GitHub API to fetch the releases for the project. If the personal token is available then it uses api v4 (GraphQL) otherwise it uses the api v3 (REST).

Demo:

ezgif com-video-to-gif

@hardikmodha

Copy link
Copy Markdown
Contributor Author

cc @bfred-it @sindresorhus Please have a look. :)

@fregante

Copy link
Copy Markdown
Member

Isn’t this already available in the Code tab? There’s a branch/tag selector

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@bfred-it Yes, It's available on the Code tab but I believe when we want to search for the release notes of any particular release or want to download the release assets (e.g. binaries/tar) it will come handy.

@fregante

fregante commented Mar 30, 2019 •

Copy link
Copy Markdown
Member

Ah right, that one opens the code while this one would open the release directly.

I'm just concerned about the size. I'd like to see the native selector added instead, the code is just:

<details class="details-reset details-overlay select-menu branch-select-menu">
  <summary class="btn btn-sm select-menu-button css-truncate"
           data-hotkey="w"
           
           title="Switch branches or tags">
    <i>Branch:</i>
    <span class="css-truncate-target">master</span>
  </summary>

  <details-menu class="select-menu-modal position-absolute" style="z-index: 99;" src="/sindresorhus/refined-github/ref-list/master?source_action=disambiguate&amp;source_controller=files" preload>
    <include-fragment class="select-menu-loading-overlay anim-pulse">
    </include-fragment>
  </details-menu>
</details>

And once include-fragment loads it can be trimmed of the "Branches" part and redirect the links to the release page instead of /tree

This frees us from any API, adds full search and we're not limited to the last 100 items

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd like to see the suggestion above implemented, but here are some general comments for future code submissions.

Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
@hardikmodha

hardikmodha commented Mar 30, 2019 •

Copy link
Copy Markdown
Contributor Author

Yeah, You got it right. I didn't know about this include-fragment. I'm giving it a try and I'll also address the changes. Thanks for your quick response :)

@fregante

Copy link
Copy Markdown
Member

include-fragment has a load event, if I remember correctly. Check out on-new-comments.ts for the example.

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@bfred-it A quick question. Adding include-fragment thing will require us to add two npm packages.

  1. include-fragment it self and
  2. Webcomponents pollyfill for custom elements.

Are there any concerns?

@notlmn

notlmn commented Mar 31, 2019

Copy link
Copy Markdown
Contributor

<include-fragment> is a custom element and GitHub has all of its code loaded already in the browser, you don't have to load it again, you just use it.

On usage of <include-fragment>, refer to https://github.com/sindresorhus/refined-github/blob/0b6c7330c21f8570519143ad3d0decc328d4db47/source/features/show-recently-pushed-branches-on-more-pages.tsx#L28

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@notlmn Thanks for your response. I initially thought the same but when I tried, It failed with Cannot read property 'get' of null at window.customElements.get. So I tried with those packages installed and it worked. Maybe I need to look into it again.

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@notlmn Don't know what was the issue. This time it worked without those packages installed. 🤔

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@bfred-it I have made the suggested changes. Please take a look. :)

@hardikmodha
hardikmodha force-pushed the f_add_search_on_releases branch from cc895ac to 9edee8f Compare March 31, 2019 16:18
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
@hardikmodha

Copy link
Copy Markdown
Contributor Author

@bfred-it I've made the suggested changed. Please take a look. :)

Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
@hardikmodha

Copy link
Copy Markdown
Contributor Author

@bfred-it Thank you so much for the in-depth reviews. It helped me a lot to understand some concepts and improve my knowledge. I've pushed the latest changes and I think this should suffice. Please let me know if any more changes are needed on my side. :)

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few more changes 😅

I haven't tried the feature at all though, so just reading the code

Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/features/search-releases.tsx Resolved
Comment thread source/libs/icons.tsx Resolved
@hardikmodha

Copy link
Copy Markdown
Contributor Author

@bfred-it Hopefully this should be it. I've implemented all the suggested changes. Please let me know if any more changes are needed.

PS: If anything happens to me, my last wish is to see this PR getting merged. 😂

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@sindresorhus First of all, Thank you for your time to carry out a detailed review. I have made the suggested changes. Please have a look.

@sindresorhus

Copy link
Copy Markdown
Member

You seem to have overwritten my changes in f5572b0.

@sindresorhus

Copy link
Copy Markdown
Member

The feature seems to work well.

@sindresorhus

Copy link
Copy Markdown
Member

@hardikmodha Can you mention it in the readme and link to a screenshot of the feature (should be retina, if you don't have retina screen, then 200% zoom).

@hardikmodha

hardikmodha commented Apr 18, 2019 •

Copy link
Copy Markdown
Contributor Author

You seem to have overwritten my changes in f5572b0.

@sindresorhus Sorry, It was not intentional. I've added your changes back. It should be good now. I've also updated the readme. Can you please take a look?

@sindresorhus

Copy link
Copy Markdown
Member

@hardikmodha Same questions as #1904 (comment)

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@sindresorhus It's a yes from me! :)

@fregante fregante changed the title Add search functionality to the releases page Add tags-dropdown feature Apr 20, 2019
@fregante
fregante merged commit b6d277b into refined-github:master Apr 20, 2019
@hardikmodha
hardikmodha deleted the f_add_search_on_releases branch April 20, 2019 08:20
@jerone

jerone commented Apr 21, 2019

Copy link
Copy Markdown
Contributor

The tags dropdown seems to align weirdly...

image

@fregante

Copy link
Copy Markdown
Member

I opened a new issue

@fregante

fregante commented Apr 25, 2019 •

Copy link
Copy Markdown
Member

@hardikmodha if not too difficult, could you make the content load on demand?

For example in the sidebar here, when you click on Projects, the content will start loading. I think this can be achieved with some HTML. Here's the source of the Projects dropdown:

<details class="details-reset details-overlay select-menu js-select-menu js-dropdown-details hx_rsm js-load-contents "
	data-contents-url="/sindresorhus/refined-github/issues/1896/show_partial?partial=issues%2Fsidebar%2Fprojects_menu_content"
	id="projects-select-menu" data-multiple>

	<summary class="text-bold discussion-sidebar-heading discussion-sidebar-toggle hx_rsm-trigger" aria-haspopup="menu"
		data-hotkey="p">
		<svg class="octicon octicon-gear" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true">
			<path fill-rule="evenodd"
				d="M14 8.77v-1.6l-1.94-.64-.45-1.09.88-1.84-1.13-1.13-1.81.91-1.09-.45-.69-1.92h-1.6l-.63 1.94-1.11.45-1.84-.88-1.13 1.13.91 1.81-.45 1.09L0 7.23v1.59l1.94.64.45 1.09-.88 1.84 1.13 1.13 1.81-.91 1.09.45.69 1.92h1.59l.63-1.94 1.11-.45 1.84.88 1.13-1.13-.92-1.81.47-1.09L14 8.75v.02zM7 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z" />
		</svg>
		Projects
	</summary>

	<div class="select-menu-modal js-navigation-container position-absolute right-0 hx_rsm-modal"
		style="z-index: 99; overflow: visible;">
		<div class="select-menu-header">
			<span class="select-menu-title">Projects</span>
			<button class="hx_rsm-close-button d-none btn-link close-button" type="button"
				data-toggle-for="projects-select-menu"><svg aria-label="Close menu" class="octicon octicon-x"
					viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img">
					<path fill-rule="evenodd"
						d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z" />
				</svg></button>
		</div>

		<div class="js-select-menu-deferred-content hx_rsm-content "
			data-url="/sindresorhus/refined-github/issues/1896/show_partial?partial=issues%2Fsidebar%2Fprojects_menu_content">

		</div>
		<div class="select-menu-loading-overlay anim-pulse hx_rsm-loading">
			<svg height="32" class="octicon octicon-octoface" viewBox="0 0 16 16" version="1.1" width="32" aria-hidden="true">
				<path fill-rule="evenodd"
					d="M14.7 5.34c.13-.32.55-1.59-.13-3.31 0 0-1.05-.33-3.44 1.3-1-.28-2.07-.32-3.13-.32s-2.13.04-3.13.32c-2.39-1.64-3.44-1.3-3.44-1.3-.68 1.72-.26 2.99-.13 3.31C.49 6.21 0 7.33 0 8.69 0 13.84 3.33 15 7.98 15S16 13.84 16 8.69c0-1.36-.49-2.48-1.3-3.35zM8 14.02c-3.3 0-5.98-.15-5.98-3.35 0-.76.38-1.48 1.02-2.07 1.07-.98 2.9-.46 4.96-.46 2.07 0 3.88-.52 4.96.46.65.59 1.02 1.3 1.02 2.07 0 3.19-2.68 3.35-5.98 3.35zM5.49 9.01c-.66 0-1.2.8-1.2 1.78s.54 1.79 1.2 1.79c.66 0 1.2-.8 1.2-1.79s-.54-1.78-1.2-1.78zm5.02 0c-.66 0-1.2.79-1.2 1.78s.54 1.79 1.2 1.79c.66 0 1.2-.8 1.2-1.79s-.53-1.78-1.2-1.78z" />
			</svg>
		</div>
	</div>
</details>

I think the keys here are those hx_rsm classes and this instead of include-fragment

<div class="js-select-menu-deferred-content hx_rsm-content" data-url="/sindresorhus/refined-github/issues/1896/show_partial?partial=issues%2Fsidebar%2Fprojects_menu_content">

@fregante fregante mentioned this pull request May 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

[Feature request] - Add ability to search releases on /releases page.

5 participants