Skip to content

Commit 83bc2fc

Browse files
committed
feat: [LAR-102] update user profile page
1 parent 312bb36 commit 83bc2fc

File tree

60 files changed

+687
-561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+687
-561
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Livewire\Components\User;
6+
7+
use App\Models\Activity;
8+
use App\Models\User;
9+
use Illuminate\Contracts\View\View;
10+
use Livewire\Component;
11+
12+
final class Activities extends Component
13+
{
14+
public User $user;
15+
16+
public function render(): View
17+
{
18+
return view('livewire.components.user.activities', [
19+
'activities' => Activity::latestFeed($this->user),
20+
]);
21+
}
22+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Livewire\Pages\Account;
6+
7+
use App\Models\User;
8+
use Illuminate\Contracts\View\View;
9+
use Livewire\Component;
10+
11+
final class Profile extends Component
12+
{
13+
public User $user;
14+
15+
public function mount(): void
16+
{
17+
$this->user = $this->user->load([
18+
'activities',
19+
'articles',
20+
'articles.tags',
21+
'discussions',
22+
'discussions.tags',
23+
'threads',
24+
]);
25+
}
26+
27+
public function render(): View
28+
{
29+
return view('livewire.pages.account.profile', [
30+
'articles' => $this->user->articles()
31+
->published()
32+
->recent()
33+
->limit(5)
34+
->get(),
35+
'threads' => $this->user->threads()
36+
->orderByDesc('created_at')
37+
->limit(5)
38+
->get(),
39+
'discussions' => $this->user->discussions()
40+
->limit(5)
41+
->get(),
42+
])
43+
->title($this->user->username.' ( '.$this->user->name.')');
44+
}
45+
}

app/Livewire/Pages/Articles/SinglePost.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public function mount(Article $article): void
1818
{
1919
/** @var User $user */
2020
$user = Auth::user();
21-
views($article)->cooldown(now()->addHours(2))->record();
2221

2322
$article = $article->load(['media', 'user'])->loadCount('views');
2423

@@ -27,6 +26,10 @@ public function mount(Article $article): void
2726
404
2827
);
2928

29+
if ($article->isPublished()) {
30+
views($article)->cooldown(now()->addHours(2))->record();
31+
}
32+
3033
$image = empty($article->getFirstMediaUrl('media'))
3134
? $article->getFirstMediaUrl('media')
3235
: asset('/images/socialcard.png');

app/Models/User.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@
4949
* @property Carbon | null $email_verified_at
5050
* @property Carbon | null $last_login_at
5151
* @property Carbon | null $banned_at
52+
* @property Carbon $created_at
53+
* @property Carbon $updated_at
5254
* @property Collection | Activity[] $activities
55+
* @property Collection | Article[] $articles
56+
* @property Collection | Thread[] $threads
57+
* @property Collection | Discussion[] $discussions
5358
*/
5459
final class User extends Authenticatable implements FilamentUser, HasAvatar, HasMedia, HasName, MustVerifyEmail
5560
{

app/Providers/AppServiceProvider.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function boot(): void
3838
$this->bootViewsComposer();
3939
$this->bootEloquentMorphs();
4040
$this->bootFilament();
41-
$this->bootBindings();
4241

4342
ReplyResource::withoutWrapping();
4443
}
@@ -101,14 +100,6 @@ public function bootFilament(): void
101100
Tables\Actions\DeleteAction::configureUsing(fn (Tables\Actions\Action $action) => $action->icon('untitledui-trash-03'));
102101
}
103102

104-
public function bootBindings(): void
105-
{
106-
Route::bind(
107-
key: 'username',
108-
binder: fn (string $username): User => User::findByUsername($username)
109-
);
110-
}
111-
112103
public function registerLocaleDate(): void
113104
{
114105
date_default_timezone_set('Africa/Douala');

lang/en/global.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
'navigation' => [
1212
'home' => 'Home',
1313
'forum' => 'Forum',
14+
'questions' => 'Threads',
1415
'articles' => 'Posts',
1516
'discussions' => 'Discussions',
1617
'community' => 'Community',
@@ -93,5 +94,7 @@
9394
'all' => 'All',
9495
'banned' => 'Banned',
9596
'unbanned' => 'Unbanned',
97+
'joined' => 'Joined',
98+
'website' => 'Website',
9699

97100
];

lang/fr/global.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
'navigation' => [
1212
'home' => 'Accueil',
1313
'forum' => 'Forum',
14+
'questions' => 'Questions',
1415
'articles' => 'Articles',
1516
'discussions' => 'Discussions',
1617
'community' => 'Communauté',
@@ -93,5 +94,7 @@
9394
'all' => 'Tout',
9495
'banned' => 'Bannis',
9596
'unbanned' => 'Non bannis',
97+
'joined' => 'Inscrit',
98+
'website' => 'Site internet',
9699

97100
];

lang/fr/pages/account.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,22 @@
1414
],
1515
],
1616

17+
'account' => [
18+
'location' => 'Localisation',
19+
'biography' => 'Biographie',
20+
],
21+
22+
'activities' => [
23+
'title' => 'Activités',
24+
'answer_reply' => 'a répondu au sujet',
25+
'create_article' => 'a rédigé l\'article',
26+
'create_thread' => 'a lancé le sujet',
27+
'create_discussion' => 'a démarré une conversation',
28+
'latest_of' => 'Dernières activités de :name',
29+
'empty' => 'Aucune activité pour le moment.',
30+
'empty_articles' => "n'a pas encore rédigé d'articles",
31+
'empty_discussions' => "n'a pas encore démarrer de discussions",
32+
'empty_threads' => "n'a pas encore posté de sujets",
33+
],
34+
1735
];

public/robots.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
User-agent: *
2-
Disallow:
2+
3+
# User
4+
Disallow: /@*
5+
Disallow: /dashboard/*
6+
7+
# Forum
8+
Disallow: /forum/channels
9+
Disallow: /forum/channels/*
10+
Disallow: /rules
11+
Disallow: /terms
12+
Disallow: /privacy
13+
Disallow: /auth/github
14+
15+
# Sitemap
16+
Sitemap: https://laravel.cm/sitemap.xml

resources/views/about.blade.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class="text-primary-600 hover:text-primary-600-hover"
217217
<li>
218218
<a
219219
href="https://twitter.com/MonneyArthur"
220-
class="text-skin-muted hover:text-gray-500 dark:text-gray-400"
220+
class="text-gray-400 dark:text-gray-500 hover:text-gray-500 dark:text-gray-400"
221221
>
222222
<span class="sr-only">Twitter</span>
223223
<x-icon.twitter class="size-6" />
@@ -226,7 +226,7 @@ class="text-skin-muted hover:text-gray-500 dark:text-gray-400"
226226
<li>
227227
<a
228228
href="https://github.com/mckenziearts"
229-
class="text-skin-muted hover:text-gray-500 dark:text-gray-400"
229+
class="text-gray-400 dark:text-gray-500 hover:text-gray-500 dark:text-gray-400"
230230
>
231231
<span class="sr-only">Github</span>
232232
<x-icon.github class="size-6" />
@@ -235,7 +235,7 @@ class="text-skin-muted hover:text-gray-500 dark:text-gray-400"
235235
<li>
236236
<a
237237
href="https://www.linkedin.com/in/arthurmonney"
238-
class="text-skin-muted hover:text-gray-500 dark:text-gray-400"
238+
class="text-gray-400 dark:text-gray-500 hover:text-gray-500 dark:text-gray-400"
239239
>
240240
<span class="sr-only">LinkedIn</span>
241241
<x-icon.linkedin class="size-6" />
@@ -270,7 +270,7 @@ class="h-16 w-16 rounded-full lg:h-20 lg:w-20"
270270
<li>
271271
<a
272272
href="https://twitter.com/yopafabrice"
273-
class="text-skin-muted hover:text-gray-500 dark:text-gray-400"
273+
class="text-gray-400 dark:text-gray-500 hover:text-gray-500 dark:text-gray-400"
274274
>
275275
<span class="sr-only">Twitter</span>
276276
<x-icon.twitter class="size-6" />
@@ -279,7 +279,7 @@ class="text-skin-muted hover:text-gray-500 dark:text-gray-400"
279279
<li>
280280
<a
281281
href="https://github.com/fabriceyopa"
282-
class="text-skin-muted hover:text-gray-500 dark:text-gray-400"
282+
class="text-gray-400 dark:text-gray-500 hover:text-gray-500 dark:text-gray-400"
283283
>
284284
<span class="sr-only">Github</span>
285285
<x-icon.github class="size-6" />
@@ -288,7 +288,7 @@ class="text-skin-muted hover:text-gray-500 dark:text-gray-400"
288288
<li>
289289
<a
290290
href="https://www.linkedin.com/in/fabriceyopa"
291-
class="text-skin-muted hover:text-gray-500 dark:text-gray-400"
291+
class="text-gray-400 dark:text-gray-500 hover:text-gray-500 dark:text-gray-400"
292292
>
293293
<span class="sr-only">LinkedIn</span>
294294
<x-icon.linkedin class="size-6" />

0 commit comments

Comments
 (0)