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

add ability to search developers by their bio or hero #341

Conversation

themudassarhassan
Copy link
Contributor

@themudassarhassan themudassarhassan commented Mar 20, 2022

This PR is aiming to add a search field on /developers page to allow users to filter developers by their bio or hero. I have used the pg_search gem which implements the full text search feature of PostgresSQL using to_tsvector data type. Although this approach will work fine now but it will eventually get slow when we have hundreds of developer profiles so we also need to add index for that. I'll be creating a separate issue to add more details regarding its implementation.

Pull request checklist

  • Your code contains tests relevant for code you modified
  • You have linted and tested the project with bin/check

@themudassarhassan themudassarhassan marked this pull request as draft March 20, 2022 08:05
Copy link
Owner

@joemasilotti joemasilotti left a comment

Choose a reason for hiding this comment

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

I know this isn't ready for review yet, but I wanted to get some comments in early to hopefully skip a round of review.

<%= inline_svg_tag "icons/solid/chevron_down.svg", class: "flex-shrink-0 -mr-1 ml-1 h-5 w-5 text-gray-400 group-hover:text-gray-500" %>
</button>

<% if Feature.enabled?(:filter_by_search_query) %>
Copy link
Owner

Choose a reason for hiding this comment

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

Is it possible to not have an else statement on the feature flag? Even if that means moving Sort all the way to the right even before this feature is enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah the Sort button will be moved to the right side if we don't add the else here. So do you suggest to remove the else statement?

Copy link
Owner

Choose a reason for hiding this comment

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

Fine by me! The search will eventually be ready for everyone, eventually.

app/models/feature.rb Outdated Show resolved Hide resolved
@themudassarhassan themudassarhassan marked this pull request as ready for review March 21, 2022 09:49
@joemasilotti
Copy link
Owner

Hey @themudassarhassan, is this ready for review?

@themudassarhassan
Copy link
Contributor Author

@joemasilotti I left a question for you on the PR I think you have missed it.

@joemasilotti
Copy link
Owner

Weird, I'm not seeing it! Can you link me or point to the code here?

@themudassarhassan
Copy link
Contributor Author

Here is the link. Pardon me if I didn't get it right.

@joemasilotti
Copy link
Owner

Weird, I'm not seeing anything. Did you do a review and not submit it? Either way, want to copy-paste the question here?

image

@themudassarhassan
Copy link
Contributor Author

Oh so sorry! You are right. I didn't submit the review.

@themudassarhassan
Copy link
Contributor Author

I have pushed the changes. Ready for review and merge 🚀

Copy link
Owner

@joemasilotti joemasilotti left a comment

Choose a reason for hiding this comment

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

Looking good! I'm really excited for this one :)

I left a few questions/suggestions in the code. Along with those, 4 things:

  1. Apologies, but I'm going back on an earlier decision :) Let's keep the Sort button on the left like you had before, even if that means an else statement. It looks a little weird when both role_level_filters and search_feature are disabled.

  2. It looks like the Sort dropdown on mobile is now rendering off the screen.

image

  1. On tablet (of certain sizes) the search bar butts up against the other filters. Let's add some right margin or space between to make sure there is a little room to breath.

image

  1. I know that I need to hit Enter to search, but I think we need a button. Let's add a Search button to the right of the search field that submits the form (along with Enter).

<div class="mx-4 pb-4">
<%= form.label :search_query, t(".search_query_label"), class: "block text-sm font-medium text-gray-700" %>
<div class="mt-1">
<%= form.text_field :search_query, value: search_query, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
<%= form.text_field :search_query, value: search_query, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
<%= form.text_field :search_query, value: search_query, class: "shadow-sm focus:ring-gray-500 focus:border-gray-500 block w-full sm:text-sm border-gray-300 rounded-md" %>

app/models/developer.rb Show resolved Hide resolved
@@ -126,7 +132,8 @@ class DeveloperQueryTest < ActiveSupport::TestCase
utc_offsets:,
role_types: [:part_time_contract],
role_levels: [:junior],
include_not_interested: true
include_not_interested: true,
search_query: ""
Copy link
Owner

Choose a reason for hiding this comment

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

Let's add some query here so it tests the value is getting passed along correctly.

@themudassarhassan
Copy link
Contributor Author

Hey, @joemasilotti I have pushed all feedback changes except one which is adding a search button next to the search field, regarding which I need some input. This is the UI on tablet layout, search input, button, and filters are quite close on this layout as shown in the image below:
Screenshot 2022-03-24 at 9 02 09 PM

We cannot add space because there isn't any available, what do you suggest?

@joemasilotti
Copy link
Owner

Ha, wow that's getting crowded. Let's leave off the submit button for now. I'm hoping to redesign these soon anyways.

Is everything ready for review then?

@themudassarhassan
Copy link
Contributor Author

Yes all other changes are done.

@joemasilotti
Copy link
Owner

This looks great – thanks again for knocking this out! 💪

@joemasilotti joemasilotti merged commit c1f8457 into joemasilotti:main Mar 24, 2022
5 checks passed
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.

None yet

2 participants