-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
[WIP] feat: search content and users #375
base: main
Are you sure you want to change the base?
Conversation
It's looking great; share some screenshots when you can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great so far!
I added a couple of suggestions you may like to look at.
I have a few questions listed above, I would like to get feedback on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks really good. Just a name change of that blade file.
In terms of the styling, I'm not sure on the outline being present above the shared updates too... What do you guys think @MrPunyapal & @nunomaduro
![Screenshot 2024-07-15 at 8 27 54 AM](https://private-user-images.githubusercontent.com/112100521/348573728-ae3cb884-227d-4dd5-a883-7d70a6288942.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MzEwMzcsIm5iZiI6MTczOTUzMDczNywicGF0aCI6Ii8xMTIxMDA1MjEvMzQ4NTczNzI4LWFlM2NiODg0LTIyN2QtNGRkNS1hODgzLTdkNzBhNjI4ODk0Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQxMDU4NTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04YzBlOGY2NmEyYTUyYzBjNTY4NWZiMGU1Mzg3ZjVhZDVjNzViYTAxNmNjOTZjMzY0YzdlNTllNTJiYWM2YmEyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.r2DWiTW_0spV6So4ffXf7EwlKBh6WgcigmARpQRbK4Y)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would name this component "user-card" - a more general name.
On the welcome page there is a users search field, teasing "Lots of interesting profiles". Since the same component is used twice, there would be a little work left for me there. |
As per Nuno I think default behaviour should be same and if someone searches it should bring Posts with users 🤔 |
4339061
to
9005fae
Compare
…e component initialization
@CamKem can you pull the latest and give some ideas on UI? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should called user-card.blade.php so it more clear what its purpose is.
The card in the file below should be move here.
<a | ||
href="{{ route('profile.show', ['username' => $user->username]) }}" | ||
class="group flex items-center gap-3 rounded-2xl border border-slate-900 bg-slate-950 bg-opacity-80 p-4 transition-colors hover:bg-slate-900" | ||
wire:navigate | ||
> | ||
<figure class="{{ $user->is_company_verified ? 'rounded-md' : 'rounded-full' }} h-12 w-12 flex-shrink-0 overflow-hidden bg-slate-800 transition-opacity group-hover:opacity-90"> | ||
<img | ||
class="{{ $user->is_company_verified ? 'rounded-md' : 'rounded-full' }} h-12 w-12" | ||
src="{{ $user->avatar_url }}" | ||
alt="{{ $user->username }}" | ||
/> | ||
</figure> | ||
|
||
<div class="flex flex-col overflow-hidden text-sm"> | ||
<div class="flex items-center space-x-2"> | ||
<p class="truncate font-medium"> | ||
{{ $user->name }} | ||
</p> | ||
|
||
@if ($user->is_verified && $user->is_company_verified) | ||
<x-icons.verified-company | ||
:color="$user->right_color" | ||
class="size-4" | ||
/> | ||
@elseif ($user->is_verified) | ||
<x-icons.verified | ||
:color="$user->right_color" | ||
class="size-4" | ||
/> | ||
@endif | ||
</div> | ||
|
||
<p class="truncate text-slate-500 transition-colors group-hover:text-slate-400"> | ||
{{ '@'.$user->username }} | ||
</p> | ||
</div> | ||
</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<a | |
href="{{ route('profile.show', ['username' => $user->username]) }}" | |
class="group flex items-center gap-3 rounded-2xl border border-slate-900 bg-slate-950 bg-opacity-80 p-4 transition-colors hover:bg-slate-900" | |
wire:navigate | |
> | |
<figure class="{{ $user->is_company_verified ? 'rounded-md' : 'rounded-full' }} h-12 w-12 flex-shrink-0 overflow-hidden bg-slate-800 transition-opacity group-hover:opacity-90"> | |
<img | |
class="{{ $user->is_company_verified ? 'rounded-md' : 'rounded-full' }} h-12 w-12" | |
src="{{ $user->avatar_url }}" | |
alt="{{ $user->username }}" | |
/> | |
</figure> | |
<div class="flex flex-col overflow-hidden text-sm"> | |
<div class="flex items-center space-x-2"> | |
<p class="truncate font-medium"> | |
{{ $user->name }} | |
</p> | |
@if ($user->is_verified && $user->is_company_verified) | |
<x-icons.verified-company | |
:color="$user->right_color" | |
class="size-4" | |
/> | |
@elseif ($user->is_verified) | |
<x-icons.verified | |
:color="$user->right_color" | |
class="size-4" | |
/> | |
@endif | |
</div> | |
<p class="truncate text-slate-500 transition-colors group-hover:text-slate-400"> | |
{{ '@'.$user->username }} | |
</p> | |
</div> | |
</a> | |
<div class="group flex items-center gap-3 rounded-2xl border dark:border-slate-900 border-slate-200 dark:bg-slate-950 bg-slate-50 dark:bg-opacity-80 p-4 transition-colors dark:hover:bg-slate-900 hover:bg-slate-100"> | |
<figure class="{{ $user->is_company_verified ? 'rounded-md' : 'rounded-full' }} h-12 w-12 flex-shrink-0 overflow-hidden bg-slate-800 transition-opacity group-hover:opacity-90"> | |
<img | |
class="{{ $user->is_company_verified ? 'rounded-md' : 'rounded-full' }} h-12 w-12" | |
src="{{ $user->avatar_url }}" | |
alt="{{ $user->username }}" | |
/> | |
</figure> | |
<div class="flex flex-col overflow-hidden text-sm text-left"> | |
<a | |
class="flex items-center space-x-2" | |
href="{{ route('profile.show', ['username' => $user->username]) }}" | |
wire:navigate | |
x-ref="parentLink" | |
> | |
<p class="text-wrap truncate font-medium dark:text-white text-black"> | |
{{ $user->name }} | |
</p> | |
@if ($user->is_verified && $user->is_company_verified) | |
<x-icons.verified-company | |
:color="$user->right_color" | |
class="size-4" | |
/> | |
@elseif ($user->is_verified) | |
<x-icons.verified | |
:color="$user->right_color" | |
class="size-4" | |
/> | |
@endif | |
</a> | |
<p class="truncate text-slate-500 transition-colors group-hover:text-slate-400"> | |
{{ '@'.$user->username }} | |
</p> | |
</div> | |
<x-follow-button | |
:id="$user->id" | |
:isFollower="auth()->check() && $user->is_follower" | |
:isFollowing="auth()->check() && $user->is_following" | |
class="ml-auto" | |
wire:key="follow-button-{{ $user->id }}" | |
/> | |
</div> |
@php($user = $result) | ||
<li | ||
data-parent=true | ||
x-data="clickHandler" | ||
x-on:click="handleNavigation($event)" | ||
wire:key="user-{{ $user->id }}" | ||
> | ||
<div class="group flex items-center gap-3 rounded-2xl border dark:border-slate-900 border-slate-200 dark:bg-slate-950 bg-slate-50 dark:bg-opacity-80 p-4 transition-colors dark:hover:bg-slate-900 hover:bg-slate-100"> | ||
<figure class="{{ $user->is_company_verified ? 'rounded-md' : 'rounded-full' }} h-12 w-12 flex-shrink-0 overflow-hidden bg-slate-800 transition-opacity group-hover:opacity-90"> | ||
<img | ||
class="{{ $user->is_company_verified ? 'rounded-md' : 'rounded-full' }} h-12 w-12" | ||
src="{{ $user->avatar_url }}" | ||
alt="{{ $user->username }}" | ||
/> | ||
</figure> | ||
<div class="flex flex-col overflow-hidden text-sm text-left"> | ||
<a | ||
class="flex items-center space-x-2" | ||
href="{{ route('profile.show', ['username' => $user->username]) }}" | ||
wire:navigate | ||
x-ref="parentLink" | ||
> | ||
<p class="text-wrap truncate font-medium dark:text-white text-black"> | ||
{{ $user->name }} | ||
</p> | ||
|
||
@if ($user->is_verified && $user->is_company_verified) | ||
<x-icons.verified-company | ||
:color="$user->right_color" | ||
class="size-4" | ||
/> | ||
@elseif ($user->is_verified) | ||
<x-icons.verified | ||
:color="$user->right_color" | ||
class="size-4" | ||
/> | ||
@endif | ||
</a> | ||
<p class="truncate text-slate-500 transition-colors group-hover:text-slate-400"> | ||
{{ '@'.$user->username }} | ||
</p> | ||
</div> | ||
<x-follow-button | ||
:id="$user->id" | ||
:isFollower="auth()->check() && $user->is_follower" | ||
:isFollowing="auth()->check() && $user->is_following" | ||
class="ml-auto" | ||
wire:key="follow-button-{{ $user->id }}" | ||
/> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After changing the name & adding the markup for the user card component, utilise it here.
@php($user = $result) | |
<li | |
data-parent=true | |
x-data="clickHandler" | |
x-on:click="handleNavigation($event)" | |
wire:key="user-{{ $user->id }}" | |
> | |
<div class="group flex items-center gap-3 rounded-2xl border dark:border-slate-900 border-slate-200 dark:bg-slate-950 bg-slate-50 dark:bg-opacity-80 p-4 transition-colors dark:hover:bg-slate-900 hover:bg-slate-100"> | |
<figure class="{{ $user->is_company_verified ? 'rounded-md' : 'rounded-full' }} h-12 w-12 flex-shrink-0 overflow-hidden bg-slate-800 transition-opacity group-hover:opacity-90"> | |
<img | |
class="{{ $user->is_company_verified ? 'rounded-md' : 'rounded-full' }} h-12 w-12" | |
src="{{ $user->avatar_url }}" | |
alt="{{ $user->username }}" | |
/> | |
</figure> | |
<div class="flex flex-col overflow-hidden text-sm text-left"> | |
<a | |
class="flex items-center space-x-2" | |
href="{{ route('profile.show', ['username' => $user->username]) }}" | |
wire:navigate | |
x-ref="parentLink" | |
> | |
<p class="text-wrap truncate font-medium dark:text-white text-black"> | |
{{ $user->name }} | |
</p> | |
@if ($user->is_verified && $user->is_company_verified) | |
<x-icons.verified-company | |
:color="$user->right_color" | |
class="size-4" | |
/> | |
@elseif ($user->is_verified) | |
<x-icons.verified | |
:color="$user->right_color" | |
class="size-4" | |
/> | |
@endif | |
</a> | |
<p class="truncate text-slate-500 transition-colors group-hover:text-slate-400"> | |
{{ '@'.$user->username }} | |
</p> | |
</div> | |
<x-follow-button | |
:id="$user->id" | |
:isFollower="auth()->check() && $user->is_follower" | |
:isFollowing="auth()->check() && $user->is_following" | |
class="ml-auto" | |
wire:key="follow-button-{{ $user->id }}" | |
/> | |
</div> | |
<li> | |
<x-user-card | |
data-parent=true | |
x-data="clickHandler" | |
x-on:click="handleNavigation($event)" | |
wire:key="user-{{ $result->id }}" | |
:user="$result" | |
/> | |
</li> |
@MrPunyapal - Pulled the latest (sorry for the delay) and had a look, it might be a good idea to include @nunowar regarding UI considerations, as this will work in with the new design, where the search bar will be the one at the top in #733 implementation. I would say once my review has been addressed we could merge this for now as an interim solution, then we can update the cards to fit with the new design. |
This pull request add the option to search for questions and answers, in addition to users.
The home "Users" tab has been renamed to "Search".
The search result now contains users, questions and answers, matching the entered search query, using a LIKE statement.
Questions and answers are only searched, when the search query is at least 3 characters long. Otherwise, only users are searched.
Only the first 10 users are returned in the search result (like before).
Only the first 10 questions and answers are returned in the search result.
When nothing is entered in the search field, a set of famous users are displayed instead (just like before).
QUESTIONS
TODO
When query starts with @, only search for users(maybe later in another PR)