created a new component for showing users

This commit is contained in:
Ghostie 2025-01-04 10:52:15 -05:00
parent 4cd0dc96df
commit a2ddb90ae9
7 changed files with 32 additions and 14 deletions

View File

@ -41,6 +41,8 @@ Notice that the styles were taken from [AnySpace](https://anyspace.3to.moe/about
- [ ] Delete posts - [ ] Delete posts
- [ ] Like posts - [ ] Like posts
- [ ] Comment posts - [ ] Comment posts
- [ ] Boost posts
- [ ] Post tags
- [ ] Blog - [ ] Blog
- [ ] Bulletin - [ ] Bulletin
- [ ] Groups - [ ] Groups

View File

@ -22,6 +22,7 @@ class APActorController extends Controller
public function followers (User $user) public function followers (User $user)
{ {
// TODO: Rewrite this using the follow model
$followers = Activity::where ("type", "Follow")->where ("object", $user->actor->actor_id); $followers = Activity::where ("type", "Follow")->where ("object", $user->actor->actor_id);
$ordered_collection = new TypeOrderedCollection (); $ordered_collection = new TypeOrderedCollection ();
$ordered_collection->collection = $followers->get ()->pluck ("actor")->toArray (); $ordered_collection->collection = $followers->get ()->pluck ("actor")->toArray ();
@ -38,6 +39,7 @@ class APActorController extends Controller
public function following (User $user) public function following (User $user)
{ {
// TODO: Rewrite this using the follow model
$following = Activity::where ("type", "Follow")->where ("actor", $user->actor->actor_id); $following = Activity::where ("type", "Follow")->where ("actor", $user->actor->actor_id);
$ordered_collection = new TypeOrderedCollection (); $ordered_collection = new TypeOrderedCollection ();
$ordered_collection->collection = $following->get ()->pluck ("object")->toArray (); $ordered_collection->collection = $following->get ()->pluck ("object")->toArray ();

View File

@ -22,7 +22,7 @@ class APInstanceInboxController extends Controller
$activity_type = $activity['type']; $activity_type = $activity['type'];
Log::info ("APInstanceInboxController:inbox"); Log::info ("APInstanceInboxController:inbox");
Log::info ($activity); Log::info (json_encode ($activity));
switch ($activity_type) switch ($activity_type)
{ {

View File

@ -71,8 +71,8 @@ class Actor extends Model
public function friends_with (Actor $actor) public function friends_with (Actor $actor)
{ {
$following = Activity::where ("actor", $this->actor_id)->where ("type", "Follow")->where ("object", '"' . $actor->actor_id . '"')->first (); $following = Follow::where ("actor", $this->id)->where ("object", $actor->id)->first ();
$followers = Activity::where ("actor", $actor->actor_id)->where ("type", "Follow")->where ("object", '"' . $this->actor_id . '"')->first (); $followers = Follow::where ("actor", $actor->id)->where ("object", $this->id)->first ();
return $following && $followers; return $following && $followers;
} }

View File

@ -0,0 +1,9 @@
<div class="person">
<a href="{{ route ('users.show', [ 'user_name' => $user->name ]) }}">
<p>{{ $user->name }}</p>
</a>
<a href="{{ route ('users.show', [ 'user_name' => $user->name ]) }}">
<img loading="lazy" src="{{ $user->avatar }}" alt="{{ $user->name }}'s profile picture"
class="pfp-fallback" style="width: 100%; max-height: 95px; aspect-ratio: 1/1">
</a>
</div>

View File

@ -14,15 +14,7 @@
</div> </div>
<div class="inner"> <div class="inner">
@foreach ($latest_users as $user) @foreach ($latest_users as $user)
<div class="person"> <x-user_block :user="$user" />
<a href="{{ route ('users.show', [ 'user_name' => $user->name ]) }}">
<p>{{ $user->name }}</p>
</a>
<a href="{{ route ('users.show', [ 'user_name' => $user->name ]) }}">
<img loading="lazy" src="{{ $user->avatar }}" alt="{{ $user->name }}'s profile picture"
class="pfp-fallback" style="width: 100%; max-height: 95px; aspect-ratio: 1/1">
</a>
</div>
@endforeach @endforeach
</div> </div>
</div> </div>

View File

@ -100,6 +100,19 @@
</div> </div>
</div> </div>
<div class="new-people cool">
<div class="top">
<h4>Cool New People</h4>
<a href="#" class="more">[view more]</a>
</div>
<div class="inner">
@foreach ($latest_users as $user)
<x-user_block :user="$user" />
@endforeach
</div>
</div>
<div class="friends"> <div class="friends">
<div class="heading"> <div class="heading">
<h4>Friend Requests</h4> <h4>Friend Requests</h4>
@ -119,8 +132,8 @@
</div> </div>
</div> </div>
<div class="new-people cool"> <div class="bulletin-preview">
<div class="top"> <div class="heading">
<h4>Feed</h4> <h4>Feed</h4>
</div> </div>