diff --git a/app/Actions/Article/CreateArticleAction.php b/app/Actions/Article/CreateArticleAction.php index 824e1528..5c6104f7 100644 --- a/app/Actions/Article/CreateArticleAction.php +++ b/app/Actions/Article/CreateArticleAction.php @@ -4,7 +4,7 @@ namespace App\Actions\Article; -use App\Data\Article\CreateArticleData; +use App\Data\CreateArticleData; use App\Gamify\Points\ArticleCreated; use App\Models\Article; use App\Notifications\PostArticleToTelegram; diff --git a/app/Actions/Discussion/CreateDiscussionAction.php b/app/Actions/Discussion/CreateDiscussionAction.php index f1ba3d96..e37b1936 100644 --- a/app/Actions/Discussion/CreateDiscussionAction.php +++ b/app/Actions/Discussion/CreateDiscussionAction.php @@ -4,7 +4,7 @@ namespace App\Actions\Discussion; -use App\Data\Discussion\CreateDiscussionData; +use App\Data\CreateDiscussionData; use App\Gamify\Points\DiscussionCreated; use App\Models\Discussion; use App\Notifications\PostDiscussionToTelegram; diff --git a/app/Data/Article/CreateArticleData.php b/app/Data/CreateArticleData.php similarity index 95% rename from app/Data/Article/CreateArticleData.php rename to app/Data/CreateArticleData.php index 63896500..5afceb09 100644 --- a/app/Data/Article/CreateArticleData.php +++ b/app/Data/CreateArticleData.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Data\Article; +namespace App\Data; use Carbon\Carbon; use Illuminate\Http\UploadedFile; diff --git a/app/Data/Discussion/CreateDiscussionData.php b/app/Data/CreateDiscussionData.php similarity index 88% rename from app/Data/Discussion/CreateDiscussionData.php rename to app/Data/CreateDiscussionData.php index 811eacbb..1e168435 100644 --- a/app/Data/Discussion/CreateDiscussionData.php +++ b/app/Data/CreateDiscussionData.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Data\Discussion; +namespace App\Data; use Spatie\LaravelData\Data; diff --git a/app/Http/Controllers/ArticlesController.php b/app/Http/Controllers/ArticlesController.php index 7b2c0dc5..26fc0172 100644 --- a/app/Http/Controllers/ArticlesController.php +++ b/app/Http/Controllers/ArticlesController.php @@ -5,11 +5,8 @@ namespace App\Http\Controllers; use App\Models\Article; -use App\Models\User; use App\Policies\ArticlePolicy; use Illuminate\Contracts\View\View; -use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Cache; final class ArticlesController extends Controller { @@ -18,43 +15,6 @@ public function __construct() $this->middleware(['auth', 'verified'], ['except' => ['index', 'show']]); } - public function index(): View - { - return view('articles.index'); - } - - public function show(Article $article): View - { - /** @var User $user */ - $user = Auth::user(); - - views($article)->record(); - - /** @var Article $article */ - $article = Cache::remember('post-'.$article->id, now()->addHour(), fn () => $article); - - abort_unless( - $article->isPublished() || ($user && $article->isAuthoredBy($user)) || ($user && $user->hasAnyRole(['admin', 'moderator'])), // @phpstan-ignore-line - 404 - ); - - $image = $article->getFirstMediaUrl('media'); - // @phpstan-ignore-next-line - seo() - ->title($article->title) - ->description($article->excerpt(100)) - ->image($image) - ->twitterTitle($article->title) - ->twitterDescription($article->excerpt(100)) - ->twitterImage($image) - ->twitterSite('laravelcm') - ->withUrl(); - - return view('articles.show', [ - 'article' => $article->loadCount('views'), - ]); - } - public function create(): View { return view('articles.new'); diff --git a/app/Livewire/Articles/Browse.php b/app/Livewire/Articles/Browse.php deleted file mode 100644 index 6f7cba0d..00000000 --- a/app/Livewire/Articles/Browse.php +++ /dev/null @@ -1,78 +0,0 @@ - ['except' => ''], - 'sortBy' => ['except' => 'recent'], - ]; - - public function mount(): void - { - $this->viewMode = session('viewMode', $this->viewMode); - } - - public function changeViewMode(string $mode): void - { - session()->put('viewMode', $mode); - - $this->viewMode = $mode; - } - - public function validSort(string $sort): bool - { - return in_array($sort, [ - 'recent', - 'popular', - 'trending', - ]); - } - - public function render(): View - { - $articles = Article::with(['tags', 'user', 'user.transactions']) - ->withCount(['views', 'reactions']) - ->published() - ->notPinned() - ->orderByDesc('sponsored_at') - ->orderByDesc('published_at'); - - $tags = Tag::whereHas('articles', function ($query): void { - $query->published(); - })->orderBy('name')->get(); - - $selectedTag = Tag::where('slug', $this->tag)->first(); - - if ($this->tag) { - $articles->forTag($this->tag); - } - - $articles->{$this->sortBy}(); - - return view('livewire.articles.browse', [ - 'articles' => $articles->paginate($this->perPage), - 'tags' => $tags, - 'selectedTag' => $selectedTag, - 'selectedSortBy' => $this->sortBy, - ]); - } -} diff --git a/app/Livewire/Articles/Create.php b/app/Livewire/Articles/Create.php index 29b66235..0d566bdf 100644 --- a/app/Livewire/Articles/Create.php +++ b/app/Livewire/Articles/Create.php @@ -5,7 +5,7 @@ namespace App\Livewire\Articles; use App\Actions\Article\CreateArticleAction; -use App\Data\Article\CreateArticleData; +use App\Data\CreateArticleData; use App\Models\Tag; use App\Models\User; use App\Traits\WithArticleAttributes; diff --git a/app/Livewire/Discussions/Create.php b/app/Livewire/Discussions/Create.php index f611c0e9..2104dd3b 100644 --- a/app/Livewire/Discussions/Create.php +++ b/app/Livewire/Discussions/Create.php @@ -5,7 +5,7 @@ namespace App\Livewire\Discussions; use App\Actions\Discussion\CreateDiscussionAction; -use App\Data\Discussion\CreateDiscussionData; +use App\Data\CreateDiscussionData; use App\Models\Tag; use App\Traits\WithTagsAssociation; use Illuminate\Contracts\View\View; diff --git a/app/Livewire/Pages/Articles/Index.php b/app/Livewire/Pages/Articles/Index.php new file mode 100644 index 00000000..41b956a4 --- /dev/null +++ b/app/Livewire/Pages/Articles/Index.php @@ -0,0 +1,32 @@ + Article::with(['tags', 'user', 'user.transactions']) + ->withCount(['views', 'reactions']) + ->scopes(['published', 'notPinned']) + ->orderByDesc('sponsored_at') + ->orderByDesc('published_at') + ->paginate($this->perPage), + 'tags' => Tag::query()->whereHas('articles', function ($query): void { + $query->published(); + })->orderBy('name')->get(), + ]) + ->title(__('pages/article.title')); + } +} diff --git a/app/Livewire/Pages/Articles/SinglePost.php b/app/Livewire/Pages/Articles/SinglePost.php new file mode 100644 index 00000000..1e89295a --- /dev/null +++ b/app/Livewire/Pages/Articles/SinglePost.php @@ -0,0 +1,52 @@ +cooldown(now()->addHours(2))->record(); + + $article = $article->load(['media', 'user'])->loadCount('views'); + + abort_unless( + $article->isPublished() || ($user && $article->isAuthoredBy($user)) || ($user && $user->hasAnyRole(['admin', 'moderator'])), // @phpstan-ignore-line + 404 + ); + + $image = empty($article->getFirstMediaUrl('media')) + ? $article->getFirstMediaUrl('media') + : asset('/images/socialcard.png'); + + // @phpstan-ignore-next-line + seo() + ->title($article->title) + ->description($article->excerpt(150)) + ->image($image) + ->twitterTitle($article->title) + ->twitterDescription($article->excerpt(150)) + ->twitterImage($image) + ->twitterSite('laravelcm') + ->withUrl(); + + $this->article = $article; + } + + public function render(): View + { + return view('livewire.pages.articles.single-post')->title($this->article->title); + } +} diff --git a/app/Livewire/Pages/Articles/SingleTag.php b/app/Livewire/Pages/Articles/SingleTag.php new file mode 100644 index 00000000..7a92a202 --- /dev/null +++ b/app/Livewire/Pages/Articles/SingleTag.php @@ -0,0 +1,33 @@ + Article::with(['tags', 'user', 'user.transactions']) + ->whereHas('tags', function ($query): void { + $query->where('id', $this->tag->id); + }) + ->withCount(['views', 'reactions']) + ->scopes(['published', 'notPinned']) + ->orderByDesc('sponsored_at') + ->orderByDesc('published_at') + ->paginate($this->perPage), + ])->title($this->tag->name); + } +} diff --git a/app/Models/Article.php b/app/Models/Article.php index 118d270e..5dc9579a 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -67,10 +67,6 @@ final class Article extends Model implements HasMedia, ReactableInterface, Viewa 'is_pinned' => 'boolean', ]; - protected $with = [ - 'media', - ]; - protected bool $removeViewsOnDelete = true; public function getRouteKeyName(): string @@ -115,11 +111,6 @@ public function registerMediaCollections(): void ->acceptsMimeTypes(['image/jpg', 'image/jpeg', 'image/png']); } - public function showToc(): bool - { - return $this->show_toc; - } - public function submittedAt(): ?Carbon { return $this->submitted_at; diff --git a/app/Models/Tag.php b/app/Models/Tag.php index 8dfdcbd0..44ea1db3 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -5,16 +5,21 @@ namespace App\Models; use App\Traits\HasSlug; -use App\Traits\ModelHelpers; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\MorphToMany; +/** + * @property-read int $id + * @property string $name + * @property string $slug + * @property string | null $description + * @property array $concerns + */ final class Tag extends Model { use HasFactory; use HasSlug; - use ModelHelpers; public $timestamps = false; @@ -29,16 +34,6 @@ final class Tag extends Model 'concerns' => 'array', ]; - public function id(): int - { - return $this->id; - } - - public function name(): string - { - return $this->name; - } - public function articles(): MorphToMany { return $this->morphedByMany(Article::class, 'taggable'); diff --git a/app/Traits/ModelHelpers.php b/app/Traits/ModelHelpers.php deleted file mode 100644 index 6fc8a4b1..00000000 --- a/app/Traits/ModelHelpers.php +++ /dev/null @@ -1,20 +0,0 @@ -paginate($perPage); - } - - public function matches(self $model): bool - { - return $this->id() === $model->id(); - } -} diff --git a/app/Traits/WithInfiniteScroll.php b/app/Traits/WithInfiniteScroll.php index 1805f197..def8e3dc 100644 --- a/app/Traits/WithInfiniteScroll.php +++ b/app/Traits/WithInfiniteScroll.php @@ -10,10 +10,10 @@ trait WithInfiniteScroll { use WithPagination; - public int $perPage = 10; + public int $perPage = 12; public function loadMore(): void { - $this->perPage += 10; + $this->perPage += 12; } } diff --git a/app/Traits/WithTags.php b/app/Traits/WithTags.php index 2a6a9ae2..97bd2b5d 100644 --- a/app/Traits/WithTags.php +++ b/app/Traits/WithTags.php @@ -24,6 +24,6 @@ public function sortBy(string $sort): void public function tagExists(string $tag): bool { - return Tag::where('slug', $tag)->exists(); + return Tag::query()->where('slug', $tag)->exists(); } } diff --git a/config/lcm.php b/config/lcm.php index 5ea7d289..eda80e6c 100644 --- a/config/lcm.php +++ b/config/lcm.php @@ -6,13 +6,13 @@ 'ads' => [ [ - 'url' => 'https://github.com/mckenziearts/laravel-notify/?utm_source=laravelcm&utm_medium=sidebar-widget', + 'url' => 'https://github.com/mckenziearts/laravel-notify/?utm_source=laravel.cm&utm_medium=sidebar-widget', 'image' => 'notify', 'alt' => 'Laravel Notify', 'description' => 'Découvrez la nouvelle version de Laravel Notify pour vos projets Laravel.', ], [ - 'url' => 'https://laravelshopper.dev?utm_source=laravelcm&utm_medium=sidebar-widget', + 'url' => 'https://laravelshopper.dev?utm_source=laravel.cm&utm_medium=sidebar-widget', 'image' => 'shopper', 'alt' => 'Laravel Shopper', 'description' => 'Créez votre boutique en ligne aujourd\'hui avec Laravel Shopper.', diff --git a/lang/en/global.php b/lang/en/global.php index a49876a0..80611895 100644 --- a/lang/en/global.php +++ b/lang/en/global.php @@ -9,6 +9,7 @@ 'by' => 'by', 'soon' => 'Soon', 'navigation' => [ + 'home' => 'Home', 'forum' => 'Forum', 'articles' => 'Posts', 'discussions' => 'Discussions', @@ -72,9 +73,13 @@ 'view_more' => 'View more →', 'or' => 'or', 'need' => 'You need', + 'loading' => 'Loading...', 'discord' => [ 'title' => 'Join discord', 'description' => 'Join the community Discord server and connect with other developers.', ], + 'ads' => [ + 'ln_ui' => 'A fun collection of small, well-coded components to streamline your development process.', + ], ]; diff --git a/lang/en/pages/article.php b/lang/en/pages/article.php index 21d6764a..bf5b5691 100644 --- a/lang/en/pages/article.php +++ b/lang/en/pages/article.php @@ -4,9 +4,12 @@ return [ + 'title' => 'Laravel Cameroon Blog', + 'blog' => 'Le Blog de Laravel Cameroun', + 'blog_summary' => 'All the latest articles, tips and tutorials published just for you.', 'about_author' => 'About author', 'next_article' => 'Next article', 'prev_article' => 'Previous article', - 'share_article' => 'Do you like this article? Share it with others', + 'share_article' => 'Share', ]; diff --git a/lang/fr/global.php b/lang/fr/global.php index 41f897e2..ff22f176 100644 --- a/lang/fr/global.php +++ b/lang/fr/global.php @@ -9,6 +9,7 @@ 'by' => 'par', 'soon' => 'Bientôt', 'navigation' => [ + 'home' => 'Accueil', 'forum' => 'Forum', 'articles' => 'Articles', 'discussions' => 'Discussions', @@ -72,9 +73,13 @@ 'view_more' => 'En savoir plus →', 'or' => 'ou', 'need' => 'Il faut', + 'loading' => 'Chargement...', 'discord' => [ 'title' => 'Rejoindre Discord', 'description' => 'Rejoignez le serveur Discord de la communauté et connectez-vous avec d\'autres développeurs.', ], + 'ads' => [ + 'ln_ui' => 'Une collection interactives de petits composants bien codés pour optimiser votre temps de développement.', + ], ]; diff --git a/lang/fr/pages/article.php b/lang/fr/pages/article.php index 068e25de..df82bfd9 100644 --- a/lang/fr/pages/article.php +++ b/lang/fr/pages/article.php @@ -4,9 +4,12 @@ return [ + 'title' => 'Blog Laravel Cameroun', + 'blog' => 'The Laravel Cameroon Blog', + 'blog_summary' => 'Tous les articles, tips et tutoriels récemment publiés juste pour vous.', 'about_author' => 'À propos de l’auteur', 'next_article' => 'Article suivant', 'prev_article' => 'Article précédent', - 'share_article' => 'Vous aimez cet article ? Faite le savoir en partageant', + 'share_article' => 'Partager', ]; diff --git a/resources/js/utils/helpers.js b/resources/js/utils/helpers.js index 95ee84f8..8a5d9811 100644 --- a/resources/js/utils/helpers.js +++ b/resources/js/utils/helpers.js @@ -71,42 +71,3 @@ const share = function () { } share() - -const addAffiliateLink = function () { - let articleContent = document.getElementById('content') - - if (!articleContent) { - return - } - - let pTags = document.getElementById('content').querySelectorAll('p') - let i = 0 - pTags.forEach((p) => { - if (i === 7) { - let a = document.createElement('a') - a.setAttribute( - 'href', - 'https://www.digitalocean.com/?refcode=d6dca1691fb4&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge', - ) - a.setAttribute('target', '_blank') - a.classList.add( - 'relative', - 'affiliate', - 'block', - 'w-full', - 'mb-6', - 'overflow-hidden', - 'rounded-lg', - 'cursor-pointer', - ) - a.innerHTML = ` - Affiliate link - Obtenez le code gratuit en créant votre serveur 🚀 - ` - p.parentNode.insertBefore(a, p.nextSibling) - } - i++ - }) -} - -addAffiliateLink() diff --git a/resources/views/ads/ln.blade.php b/resources/views/ads/ln.blade.php new file mode 100644 index 00000000..71d0bfef --- /dev/null +++ b/resources/views/ads/ln.blade.php @@ -0,0 +1,51 @@ +
+
+
+ +
+ +
+ + + + +

+ {{ __('global.ads.ln_ui') }} +

+
diff --git a/resources/views/articles/index.blade.php b/resources/views/articles/index.blade.php deleted file mode 100644 index 93684edc..00000000 --- a/resources/views/articles/index.blade.php +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/resources/views/articles/show.blade.php b/resources/views/articles/show.blade.php deleted file mode 100644 index 0a7a8ab4..00000000 --- a/resources/views/articles/show.blade.php +++ /dev/null @@ -1,477 +0,0 @@ - - @php - $next = $article->nextArticle(); - $previous = $article->previousArticle(); - $user = $article->user; - @endphp - - -
- -
-
-
-
- @if ($article->tags->isNotEmpty()) -
- @foreach ($article->tags as $tag) - - @endforeach -
- @endif - - -
- -
- - - {{ __('global.read_time', ['time' => $article->readTime()]) }} - - {{ __('global.page_views', ['number' => $article->views_count]) }} -
-
-

- {{ $article->title }} -

- -
-
- {{ $article->user->username }} -
-
-

- {{ $article->user->name }} -

-

- {{ '@' . $article->user->username }} -

-
-
-
-
- - @if ($media = $article->getFirstMediaUrl('media')) -
- {{ $article->title }} -
- @endif - - - -
-
- -
-
- {{ $user->username }} -
-
-

- {{ $user->name }} -

-

- {{ '@' . $user->username }} -

-
-
-
- @if ($user->bio) -

- {{ $user->bio }} -

- @endif - -
- @if ($user->twitter()) - - Twitter - - - @endif - - @if ($user->linkedin()) - - LinkedIn - - - @endif - - @if ($user->githubUsername()) - - GitHub - - - @endif -
-
-
- - - - @canany([App\Policies\ArticlePolicy::UPDATE, App\Policies\ArticlePolicy::DELETE], $article) -
- -
- - - {{ __('actions.edit') }} - - - @if ($article->isNotApproved()) - @hasanyrole('admin|moderator') - - {{ __('actions.approve') }} - - @endhasanyrole - @endif - - - {{ __('actions.delete') }} - - -
-
- @endcanany - - @if ($next || $previous) -
-
- @if ($next) -
-

- Article suivant -

-
- {{ $next->slug }} -
- - {{ $next->title }} - - - {{ $next->readTime() }} min de lecture - -
-
-
- @endif - - @if ($previous) -
-

- Article précédent -

-
- {{ $previous->slug }} -
- - {{ $previous->title }} - - - {{ $previous->readTime() }} min de lecture - -
-
-
- @endif -
-
- @endif -
- -
-
- - @if ($article->showToc()) -
- - -
-
- -
-
-
- @endif -
diff --git a/resources/views/components/articles/card-author.blade.php b/resources/views/components/articles/card-author.blade.php new file mode 100644 index 00000000..bfdeb9dc --- /dev/null +++ b/resources/views/components/articles/card-author.blade.php @@ -0,0 +1,61 @@ +@props([ + 'article', +]) + +@php + $media = ! empty($article->getFirstMediaUrl('media')) + ? $article->getFirstMediaUrl('media') + : asset('images/socialcard.png') +@endphp + +
+
+ {{ $article->title }} +
+
+
+
+ @if ($article->tags->isNotEmpty()) +
+ @foreach ($article->tags as $tag) + + @endforeach +
+ @endif + + +
+
+

+ + + {{ $article->title }} + +

+

+ {!! $article->excerpt(175) !!} +

+
+
+
+ + + + {{ $article->user->name }} + +
+ +
+
+
+
diff --git a/resources/views/components/articles/card-with-author.blade.php b/resources/views/components/articles/card-with-author.blade.php deleted file mode 100644 index 4bbc02e4..00000000 --- a/resources/views/components/articles/card-with-author.blade.php +++ /dev/null @@ -1,96 +0,0 @@ -@props([ - 'article', -]) - -
-
-
-
- -
-
-

- - {{ $article->user->name }} - -

-

- -

-
-
-

- {{ $article->title }} -

-
- -

- {!! $article->excerpt(175) !!} -

-
- {{ $article->title }} -
-
-
- - - - -
- - - - - {{ $article->views_count }} - {{ __('vues') }} -
-
-
-
- @if ($article->tags->isNotEmpty()) -
- @foreach ($article->tags as $tag) - - @endforeach -
- @endif - - -
-
-
-
diff --git a/resources/views/components/articles/card.blade.php b/resources/views/components/articles/card.blade.php index c9ccdfad..41d90401 100644 --- a/resources/views/components/articles/card.blade.php +++ b/resources/views/components/articles/card.blade.php @@ -7,23 +7,45 @@
$isSummary]) > -
- {{ $article->title }} -
-
$isSummary])> + @php + $media = ! empty($article->getFirstMediaUrl('media')) + ? $article->getFirstMediaUrl('media') + : asset('images/socialcard.png') + @endphp + + @if(! $isSummary) +
+ {{ $article->title }} +
+ @endif + +
$isSummary])>
- - -

+
! $isSummary, + 'flex-col justify-between gap-2' => $isSummary, + ])> + + @if ($article->tags->isNotEmpty()) +
+ @foreach ($article->tags as $tag) + + @endforeach +
+ @endif +
+ +

{{ $article->title }}

@if ($iconLink) @@ -35,16 +57,5 @@ class="text-sm capitalize leading-5 text-gray-500 dark:text-gray-400" {!! $article->excerpt(150) !!}

-
- @if ($article->tags->isNotEmpty()) -
- @foreach ($article->tags as $tag) - - @endforeach -
- @endif - - -
diff --git a/resources/views/components/articles/filter.blade.php b/resources/views/components/articles/filter.blade.php deleted file mode 100644 index 4457225d..00000000 --- a/resources/views/components/articles/filter.blade.php +++ /dev/null @@ -1,131 +0,0 @@ -@props([ - 'selectedSortBy', - 'forMobile' => false, -]) - -@if (! $forMobile) -
- - - - - -
-@else -
- -
-@endif diff --git a/resources/views/components/articles/overview.blade.php b/resources/views/components/articles/overview.blade.php index a08bd392..8191d9e3 100644 --- a/resources/views/components/articles/overview.blade.php +++ b/resources/views/components/articles/overview.blade.php @@ -2,19 +2,25 @@ 'article', ]) +@php + $media = ! empty($article->getFirstMediaUrl('media')) + ? $article->getFirstMediaUrl('media') + : asset('images/socialcard.png'); +@endphp +
- +
{{ $article->title }}
-
+
@if ($article->tags->isNotEmpty()) @@ -28,33 +34,33 @@ class="rounded-lg object-cover shadow-lg group-hover:opacity-75"
- +

{{ $article->title }}

-
+

{!! $article->excerpt(130) !!}

- + {{ $article->user->name }} - +

- {{ __(':time min de lecture', ['time' => $article->readTime()]) }} + {{ __('global.read_time', ['time' => $article->readTime()]) }}
diff --git a/resources/views/components/danger-button.blade.php b/resources/views/components/danger-button.blade.php deleted file mode 100644 index eb349456..00000000 --- a/resources/views/components/danger-button.blade.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/resources/views/components/section-header.blade.php b/resources/views/components/section-header.blade.php index 33226faf..1a0a5e21 100644 --- a/resources/views/components/section-header.blade.php +++ b/resources/views/components/section-header.blade.php @@ -4,6 +4,10 @@ ])
-

{{ $title }}

-

{{ $content }}

+

+ {{ $title }} +

+

+ {{ $content }} +

diff --git a/resources/views/components/sponsors.blade.php b/resources/views/components/sponsors.blade.php index 37c40c52..22b309de 100644 --- a/resources/views/components/sponsors.blade.php +++ b/resources/views/components/sponsors.blade.php @@ -1,7 +1,9 @@
twMerge(['class' => 'text-right']) }}> -

Sponsors

+

+ Sponsors +

- + + - {{ $tag->name() }} - + {{ $tag->name }} + diff --git a/resources/views/components/view-mode.blade.php b/resources/views/components/view-mode.blade.php deleted file mode 100644 index 9f28f7aa..00000000 --- a/resources/views/components/view-mode.blade.php +++ /dev/null @@ -1,22 +0,0 @@ -@props([ - 'mode', - 'isViewMode' => false, -]) - - $isViewMode, - 'bg-transparent' => ! $isViewMode, - ]) -> - @if ($isViewMode) - - - - @endif - - {{ $slot }} - diff --git a/resources/views/components/winter-is-coming.blade.php b/resources/views/components/winter-is-coming.blade.php deleted file mode 100644 index 15040ee6..00000000 --- a/resources/views/components/winter-is-coming.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -
    - @for ($i = 0; $i < 100; $i++) -
  • - @endfor -
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 13368147..d3362cf8 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -53,7 +53,7 @@ class="inline-flex items-center rounded-full bg-green-700 p-1 pr-2 text-white sm :content="__('pages/home.popular_posts.description')" />
@foreach ($latestArticles as $article) @if ($loop->first) diff --git a/resources/views/livewire/articles/browse.blade.php b/resources/views/livewire/articles/browse.blade.php deleted file mode 100644 index 06a4229a..00000000 --- a/resources/views/livewire/articles/browse.blade.php +++ /dev/null @@ -1,84 +0,0 @@ -
- -
-
-
-

Récentes publications

-

Tous les articles récemment publiés.

-
- -
- @foreach ($articles as $article) - @if ($viewMode === 'card') - - @else - - @endif - @endforeach -
- - @if ($articles->hasMorePages()) -
-

- - Chargement... -

-
- @endif -
- - -
-
diff --git a/resources/views/livewire/pages/articles/index.blade.php b/resources/views/livewire/pages/articles/index.blade.php new file mode 100644 index 00000000..043fb52e --- /dev/null +++ b/resources/views/livewire/pages/articles/index.blade.php @@ -0,0 +1,122 @@ +
+
+ +
+

+ {{ __('pages/article.blog') }} +

+

+ {{ __('pages/article.blog_summary') }} +

+
+ +
+
+ +
+ +
+ + + +
+ +
+
+
+
+ + +
+ @foreach ($articles as $article) + + @endforeach +
+ + @if ($articles->hasMorePages()) +

+

+ @endif +
+
diff --git a/resources/views/livewire/pages/articles/single-post.blade.php b/resources/views/livewire/pages/articles/single-post.blade.php new file mode 100644 index 00000000..e31fa940 --- /dev/null +++ b/resources/views/livewire/pages/articles/single-post.blade.php @@ -0,0 +1,168 @@ +
+ @php + $next = $article->nextArticle(); + $previous = $article->previousArticle(); + $user = $article->user; + $media = $article->getFirstMediaUrl('media'); + @endphp + + + + +
+
+
+
+
+ + {{ __('global.read_time', ['time' => $article->readTime()]) }} + +
+ + + {{ __('global.page_views', ['number' => $article->views_count]) }} + +
+

+ {{ $article->title }} +

+
+ @if ($article->tags->isNotEmpty()) +
+ @foreach ($article->tags as $tag) + + @endforeach +
+ @endif + +
+ + + + {{ $article->user->name }} + +
+ +
+
+
+ + @if ($media) +
+ {{ $article->title }} +
+ @endif +
+ +
+
+ +
+
+
+
+ +
diff --git a/resources/views/livewire/pages/articles/tag.blade.php b/resources/views/livewire/pages/articles/tag.blade.php new file mode 100644 index 00000000..9f76390d --- /dev/null +++ b/resources/views/livewire/pages/articles/tag.blade.php @@ -0,0 +1,45 @@ + +
+ +
+
+ @if($tag->description) +

+ {{ $tag->description }} +

+ @endif +
+ +
+
+ @foreach ($articles as $article) + + @endforeach +
+ + @if ($articles->hasMorePages()) +

+

+ @endif +
+
diff --git a/resources/views/livewire/pages/forum/detail-thread.blade.php b/resources/views/livewire/pages/forum/detail-thread.blade.php index ac5707f4..233ce600 100644 --- a/resources/views/livewire/pages/forum/detail-thread.blade.php +++ b/resources/views/livewire/pages/forum/detail-thread.blade.php @@ -3,7 +3,7 @@
{{ __('pages/forum.reply_thread') }} diff --git a/routes/web.php b/routes/web.php index 20b2eb76..aa1adaa2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -13,6 +13,7 @@ use App\Http\Controllers\SponsoringController; use App\Http\Controllers\SubscriptionController; use App\Http\Controllers\User; +use App\Livewire\Pages\Articles; use Illuminate\Support\Facades\Route; Route::get('/', HomeController::class)->name('home'); @@ -35,9 +36,11 @@ // Articles Route::prefix('articles')->group(function (): void { - Route::get('/', [ArticlesController::class, 'index'])->name('articles'); + Route::get('/', Articles\Index::class)->name('articles'); + Route::get('/tags/{tag:slug}', Articles\SingleTag::class)->name('articles.tag'); + Route::get('/{article}', Articles\SinglePost::class)->name('articles.show'); + Route::get('/new', [ArticlesController::class, 'create'])->name('articles.new'); - Route::get('/{article}', [ArticlesController::class, 'show'])->name('articles.show'); Route::get('/{article}/edit', [ArticlesController::class, 'edit'])->name('articles.edit'); }); diff --git a/tests/Feature/Actions/Article/CreateArticleActionTest.php b/tests/Feature/Actions/Article/CreateArticleActionTest.php index 13ac6b35..456b77ff 100644 --- a/tests/Feature/Actions/Article/CreateArticleActionTest.php +++ b/tests/Feature/Actions/Article/CreateArticleActionTest.php @@ -3,7 +3,7 @@ declare(strict_types=1); use App\Actions\Article\CreateArticleAction; -use App\Data\Article\CreateArticleData; +use App\Data\CreateArticleData; use App\Models\Article; use App\Models\Tag; diff --git a/tests/Feature/Actions/Discussion/CreateDiscussionActionTest.php b/tests/Feature/Actions/Discussion/CreateDiscussionActionTest.php index 0b8a95a4..eab9e5bb 100644 --- a/tests/Feature/Actions/Discussion/CreateDiscussionActionTest.php +++ b/tests/Feature/Actions/Discussion/CreateDiscussionActionTest.php @@ -3,7 +3,7 @@ declare(strict_types=1); use App\Actions\Discussion\CreateDiscussionAction; -use App\Data\Discussion\CreateDiscussionData; +use App\Data\CreateDiscussionData; use App\Models\Discussion; use App\Models\Tag; use Illuminate\Support\Facades\Notification;