diff --git a/README.md b/README.md index 9716858..179bc3a 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ Notice that the styles were taken from [AnySpace](https://anyspace.3to.moe/about - [ ] Check when waiting for approval - [ ] Handle Rejection - [x] Likes - - [ ] Comments + - [x] Comments - [ ] Boosts - - [ ] Tags + - [x] Tags - [ ] Pinned Posts - [-] Social features @@ -37,6 +37,7 @@ Notice that the styles were taken from [AnySpace](https://anyspace.3to.moe/about - [ ] Mark account as private (in federation manual approval is needed) - [ ] Allow custom CSS - [ ] Profile audio + - [ ] Top 8 friends - [x] Friends (they are known as follows in the activitypub protocol) - [x] Add friends - [x] Remove friends @@ -44,9 +45,9 @@ Notice that the styles were taken from [AnySpace](https://anyspace.3to.moe/about - [x] Create posts - [x] Delete posts - [x] Like posts - - [ ] Comment posts + - [x] Comment posts - [ ] Boost posts - - [ ] Post tags + - [x] Post tags - [ ] Blog - [ ] Bulletin - [ ] Groups diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index d3b99dd..8ce4f8c 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -7,6 +7,8 @@ use App\Actions\ActionsFriends; use App\Models\User; use App\Models\Actor; +use App\Models\Note; +use App\Models\Hashtag; use GuzzleHttp\Client; @@ -21,6 +23,22 @@ class HomeController extends Controller return view ("home", compact ("latest_users")); } + public function browse () + { + $latest_users = User::latest ()->take (8)->get (); + $popular_hashtags = Hashtag::withCount ("get_notes")->orderBy ("get_notes_count", "desc")->take (16)->get ()->shuffle (); + $popular_notes = Note::withCount ([ "get_likes" => function ($query) { + $query->where ("created_at", ">=", now ()->subDay ()); + }])->where ("in_reply_to", null)->orderBy ("get_likes_count", "desc")->take (8)->get (); + + return view ("browse", compact ("latest_users", "popular_hashtags", "popular_notes")); + } + + public function tag ($tag) + { + dd ($tag); + } + public function search () { $query = request ()->get ("query"); diff --git a/app/Models/User.php b/app/Models/User.php index 1d42cac..dd457a2 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -134,7 +134,7 @@ class User extends Authenticatable $friends_id[] = Actor::where ("actor_id", $friend)->first ()->id; } - $notes = Note::whereIn ("actor_id", $friends_id)->where ("in_reply_to", null)->orderBy ("created_at", "desc")->get (); + $notes = Note::whereIn ("actor_id", $friends_id)->orderBy ("created_at", "desc")->get (); return $notes; } diff --git a/resources/css/style.css b/resources/css/style.css index 2cf73c6..57d87da 100644 --- a/resources/css/style.css +++ b/resources/css/style.css @@ -3730,3 +3730,20 @@ audio { width: 80px; transition: 0.5s width; } + +ul.cloud { + list-style: none; + padding-left: 0; + + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; +} + +ul.cloud a { + display: block; + padding: 0.125rem 0.25rem; + text-decoration: none; + position: relative; +} diff --git a/resources/views/browse.blade.php b/resources/views/browse.blade.php new file mode 100644 index 0000000..c39eea3 --- /dev/null +++ b/resources/views/browse.blade.php @@ -0,0 +1,76 @@ +@extends ("partials.layout") + +@section ("title", "Explore") + +@section ("content") +
Tags: @foreach ($post->get_hashtags ()->get () as $hashtag) - + {{ $hashtag->name }} @endforeach diff --git a/resources/views/partials/header.blade.php b/resources/views/partials/header.blade.php index 0a33975..d73423f 100644 --- a/resources/views/partials/header.blade.php +++ b/resources/views/partials/header.blade.php @@ -39,7 +39,7 @@
Joined: {{ $user->created_at->diffForHumans () }}
@endif @@ -277,7 +278,16 @@ - +