diff --git a/app/Http/Livewire/Library/LibraryTable.php b/app/Http/Livewire/Library/LibraryTable.php index f7578b1d..89a552bf 100644 --- a/app/Http/Livewire/Library/LibraryTable.php +++ b/app/Http/Livewire/Library/LibraryTable.php @@ -6,7 +6,6 @@ use App\Models\Country; use App\Models\Library; use App\Models\LibraryItem; use App\Models\Tag; -use Illuminate\Pagination\LengthAwarePaginator; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; @@ -83,7 +82,7 @@ class LibraryTable extends Component } return view('livewire.library.library-table', [ - 'libraries' => $tabs, + 'libraries' => $tabs, 'libraryItems' => LibraryItem::query() ->with([ 'lecturer', @@ -103,8 +102,10 @@ class LibraryTable extends Component ->where('libraries.name', $this->currentTab) ) ) - ->when(count($this->filters) > 0, fn($query) => $query->whereHas('tags', - fn($query) => $query->whereIn('tags.id', $this->filters))) + ->when(isset($this->filters['tag']), fn($query) => $query->whereHas('tags', + fn($query) => $query->whereIn('tags.id', $this->filters['tag']))) + ->when(isset($this->filters['language']), + fn($query) => $query->whereIn('language_code', $this->filters['language'])) ->whereHas('libraries', fn($query) => $query->where('libraries.is_public', $shouldBePublic)) ->orderByDesc('library_items.created_at') diff --git a/app/Http/Livewire/Library/SearchByTagComponent.php b/app/Http/Livewire/Library/SearchByTagComponent.php index b9deee91..50286e11 100644 --- a/app/Http/Livewire/Library/SearchByTagComponent.php +++ b/app/Http/Livewire/Library/SearchByTagComponent.php @@ -2,6 +2,7 @@ namespace App\Http\Livewire\Library; +use App\Models\LibraryItem; use App\Models\Tag; use Livewire\Component; @@ -11,7 +12,7 @@ class SearchByTagComponent extends Component public array $filters = []; protected $queryString = [ - 'filters' => ['except' => ''], + 'filters' => ['except' => ''], ]; public function render() @@ -21,19 +22,29 @@ class SearchByTagComponent extends Component ->getName() !== 'library.table.lecturer'; return view('livewire.library.search-by-tag-component', [ - 'tags' => Tag::query() - ->with([ - 'libraryItems.libraries', - 'libraryItems.lecturer', - ]) - ->withCount([ - 'libraryItems', - ]) - ->where('type', 'library_item') - ->whereHas('libraryItems.libraries', fn($query) => $query->where('is_public', $shouldBePublic)) - ->orderByDesc('library_items_count') - ->orderBy('tags.id') - ->get(), + 'languages' => LibraryItem::query() + ->pluck('language_code') + ->unique() + ->sort() + ->map(fn($item) => str($item) + ->before('_') + ->toString()) + ->values() + ->toArray(), + 'tags' => Tag::query() + ->with([ + 'libraryItems.libraries', + 'libraryItems.lecturer', + ]) + ->withCount([ + 'libraryItems', + ]) + ->where('type', 'library_item') + ->whereHas('libraryItems.libraries', + fn($query) => $query->where('is_public', $shouldBePublic)) + ->orderByDesc('library_items_count') + ->orderBy('tags.id') + ->get(), ]); } } diff --git a/app/Nova/Episode.php b/app/Nova/Episode.php index b46e0296..b6ff79fa 100644 --- a/app/Nova/Episode.php +++ b/app/Nova/Episode.php @@ -53,7 +53,9 @@ class Episode extends Resource 'episode_id' => $model->id, 'name' => $model->data['title'], 'type' => 'podcast_episode', - 'language_code' => $model->podcast->language_code, + 'language_code' => str($model->podcast->language_code) + ->before('-') + ->toString(), 'value' => null, 'excerpt' => $model->data['description'], 'subtitle' => $model->data['description'], diff --git a/resources/views/livewire/frontend/header.blade.php b/resources/views/livewire/frontend/header.blade.php index b94d06c6..c68f9742 100644 --- a/resources/views/livewire/frontend/header.blade.php +++ b/resources/views/livewire/frontend/header.blade.php @@ -110,6 +110,7 @@ option-value="language" /> + @auth
@else @@ -128,16 +129,16 @@
-
+
@if(str(request()->route()->getName())->contains('school.'))
-

+

Bitcoin {{ __('Courses') }}

-

+

{{ __('Choose your city, search for courses in the surrounding area and select a topic that suits you.') }}

@@ -145,11 +146,11 @@ @if(str(request()->route()->getName())->contains('library.'))
-

+

Bitcoin {{ __('Content') }}

-

+

{{ __('Choose a topic that is right for you.') }}

diff --git a/resources/views/livewire/library/search-by-tag-component.blade.php b/resources/views/livewire/library/search-by-tag-component.blade.php index 90c2e217..1d19dda3 100644 --- a/resources/views/livewire/library/search-by-tag-component.blade.php +++ b/resources/views/livewire/library/search-by-tag-component.blade.php @@ -1,26 +1,52 @@ - diff --git a/yarn.lock b/yarn.lock index cfd0be46..9cfd03b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -292,9 +292,9 @@ camelcase-css@^2.0.1: integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA== caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001426: - version "1.0.30001446" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001446.tgz#6d4ba828ab19f49f9bcd14a8430d30feebf1e0c5" - integrity sha512-fEoga4PrImGcwUUGEol/PoFCSBnSkA9drgdkxXkJLsUBOnJ8rs3zDv6ApqYXGQFOyMPsjh79naWhF4DAxbF8rw== + version "1.0.30001449" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001449.tgz#a8d11f6a814c75c9ce9d851dc53eb1d1dfbcd657" + integrity sha512-CPB+UL9XMT/Av+pJxCKGhdx+yg1hzplvFJQlJ2n68PyQGMz9L/E2zCyLdOL8uasbouTUgnPl+y0tccI/se+BEw== chokidar@^3.5.3: version "3.5.3"