-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from laravelcm/user-dashboard
User dashboard
- Loading branch information
Showing
29 changed files
with
600 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\User; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
class DashboardController extends Controller | ||
{ | ||
public function dashboard() | ||
{ | ||
return view('user.dashboard', [ | ||
'user' => $user = Auth::user(), | ||
'articles' => $user->articles() | ||
->orderByDesc('submitted_at') | ||
->orderByDesc('created_at') | ||
->paginate(5), | ||
]); | ||
} | ||
|
||
public function threads() | ||
{ | ||
return view('user.threads', [ | ||
'user' => $user = Auth::user(), | ||
'threads' => $user->threads() | ||
->recent() | ||
->paginate(5), | ||
]); | ||
} | ||
|
||
public function discussions() | ||
{ | ||
return view('user.discussions', [ | ||
'user' => $user = Auth::user(), | ||
'discussions' => $user->discussions() | ||
->orderByDesc('created_at') | ||
->paginate(5), | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
database/migrations/2021_11_29_114833_add_linkedin_profile_column_to_users_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class AddLinkedinProfileColumnToUsersTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->string('linkedin_profile') | ||
->after('twitter_profile') | ||
->nullable(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->dropColumn('linkedin_profile'); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"/js/app.js": "/js/app.js?id=6e9d959a77c0ed56a844", | ||
"/css/app.css": "/css/app.css?id=a4b94cf149d9afd5d3e5" | ||
"/js/app.js": "/js/app.js?id=7d557689434ab2f122d8", | ||
"/css/app.css": "/css/app.css?id=fe258fa62dce97e1cd59" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@props(['discussion']) | ||
|
||
<div class="py-6 border-b border-skin-base"> | ||
<div class="mt-2 lg:flex lg:items-center lg:justify-between"> | ||
<div class="flex-1"> | ||
<h2 class="text-xl font-semibold font-sans text-skin-inverted leading-7"> | ||
<a href="{{ route('discussions.show', $discussion) }}" class="hover:text-skin-primary">{{ $discussion->title }}</a> | ||
</h2> | ||
</div> | ||
<div class="mt-2 lg:mt-0 flex-shrink-0 self-start"> | ||
@if (count($tags = $discussion->tags)) | ||
<div class="flex flex-wrap gap-2 lg:gap-x-3"> | ||
@foreach ($tags as $tag) | ||
<x-tag :tag="$tag" /> | ||
@endforeach | ||
</div> | ||
@endif | ||
</div> | ||
</div> | ||
<p class="mt-1 text-sm font-normal text-skin-base leading-5"> | ||
{!! $discussion->excerpt(175) !!} | ||
</p> | ||
<div class="mt-3 flex justify-between"> | ||
<div class="flex items-center text-sm font-sans text-skin-muted"> | ||
<a class="flex-shrink-0" href="{{ route('profile', $discussion->author->username) }}"> | ||
<img class="h-6 w-6 rounded-full" src="{{ $discussion->author->profile_photo_url }}" alt="{{ $discussion->author->name }}"> | ||
</a> | ||
<span class="ml-2 pr-1">Posté par</span> | ||
<div class="flex items-center space-x-1"> | ||
<a href="{{ route('profile', $discussion->author->username) }}" class="text-skin-inverted hover:underline">{{ $discussion->author->name }}</a> | ||
<span aria-hidden="true">·</span> | ||
<time-ago time="{{ $discussion->created_at->getTimestamp() }}"/> | ||
</div> | ||
</div> | ||
<div class="flex items-center text-sm space-x-4"> | ||
<p class="inline-flex space-x-2 text-skin-base"> | ||
<x-heroicon-o-chat-alt-2 class="h-5 w-5" /> | ||
<span class="font-normal text-skin-inverted-muted">{{ $discussion->count_all_replies_with_child }}</span> | ||
<span class="sr-only">réponses</span> | ||
</p> | ||
<a href="{{ route('discussions.edit', $discussion->slug()) }}" class="inline-flex items-center font-normal text-skin-inverted-muted hover:text-skin-base hover:underline"> | ||
<x-heroicon-o-pencil class="h-4 w-4 mr-1.5" /> | ||
Éditer | ||
</a> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
@props(['thread']) | ||
|
||
<div class="py-6 border-b border-skin-base"> | ||
<article aria-labelledby="question-title-{{ $thread->id }}"> | ||
<div> | ||
<div class="lg:flex lg:space-x-3"> | ||
<div class="flex-1 flex items-center space-x-3"> | ||
<div class="flex-shrink-0"> | ||
<img class="h-8 w-8 rounded-full" src="{{ $thread->author->profile_photo_url }}" alt=""> | ||
</div> | ||
<div class="min-w-0 flex-1 flex items-center space-x-1 font-sans"> | ||
<p class="text-sm font-medium text-skin-inverted"> | ||
<a href="{{ route('profile', $thread->author->username) }}" class="block group"> | ||
<span class="group-hover:underline">{{ $thread->author->name }}</span> | ||
<span class="text-skin-muted">{{ '@'. $thread->author->username }}</span> | ||
</a> | ||
</p> | ||
<span aria-hidden="true">·</span> | ||
<p class="text-sm text-skin-base"> | ||
<time-ago time="{{ $thread->created_at->getTimestamp() }}"/> | ||
</p> | ||
</div> | ||
</div> | ||
<div class="mt-2 lg:mt-0 flex-shrink-0 self-center"> | ||
@if (count($channels = $thread->channels->load('parent'))) | ||
<div class="flex flex-wrap gap-2 mt-2 lg:mt-0 lg:gap-x-3"> | ||
@foreach ($channels as $channel) | ||
<a href="{{ route('forum.channels', $channel) }}" class="flex gap-2"> | ||
<x-forum.channel :channel="$channel" /> | ||
</a> | ||
@endforeach | ||
</div> | ||
@endif | ||
</div> | ||
</div> | ||
<h2 id="question-title-{{ $thread->id }}" class="mt-4 text-base font-medium text-skin-inverted font-sans"> | ||
<a href="{{ route('forum.show', $thread) }}" class="hover:underline">{{ $thread->subject() }}</a> | ||
</h2> | ||
</div> | ||
<div class="mt-2 text-sm text-skin-inverted-muted font-normal"> | ||
<a href="{{ route('forum.show', $thread) }}">{!! $thread->excerpt() !!}</a> | ||
</div> | ||
<div class="mt-6 flex justify-between space-x-8"> | ||
<div class="flex items-center space-x-4"> | ||
<div class="flex items-center text-sm text-skin-inverted-muted font-normal"> | ||
<span class="text-base mr-2">👏</span> | ||
{{ count($thread->reactions) }} | ||
</div> | ||
<p class="inline-flex text-sm space-x-2 text-skin-base"> | ||
<x-heroicon-o-chat-alt class="h-5 w-5" /> | ||
<span class="font-normal text-skin-inverted-muted">{{ count($thread->replies) }}</span> | ||
<span class="sr-only">réponses</span> | ||
</p> | ||
</div> | ||
<div class="flex text-sm"> | ||
<p class="inline-flex items-center space-x-3 text-sm"> | ||
@if ($thread->isSolved()) | ||
<a href="{{ route('forum.show', $thread->slug) }}#{{ $thread->solution_reply_id }}" class="flex items-center gap-x-2 font-medium text-green-500"> | ||
<x-heroicon-s-badge-check class="w-5 h-5" /> | ||
<span class="hover:underline">Résolu</span> | ||
</a> | ||
@endif | ||
</p> | ||
</div> | ||
</div> | ||
</article> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="p-4 w-full mx-auto bg-skin-card border border-skin-base shadow-sm rounded-md"> | ||
<div class="animate-pulse flex space-x-4"> | ||
<div class="flex-1 space-y-4 py-1"> | ||
<div class="h-4 bg-skin-card-muted rounded w-3/4"></div> | ||
<div class="space-y-2"> | ||
<div class="h-4 bg-skin-card-muted rounded"></div> | ||
<div class="h-4 bg-skin-card-muted rounded w-5/6"></div> | ||
<div class="h-4 bg-skin-card-muted rounded w-5/6"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@props(['section']) | ||
|
||
<nav class="flex mb-3" aria-label="Breadcrumb"> | ||
<ol role="list" class="flex items-center space-x-4"> | ||
<li> | ||
<div> | ||
<a href="{{ route('dashboard') }}" class="text-skin-muted hover:text-skin-base"> | ||
<x-heroicon-s-home class="flex-shrink-0 h-5 w-5" /> | ||
<span class="sr-only">Accueil</span> | ||
</a> | ||
</div> | ||
</li> | ||
|
||
<li> | ||
<div class="flex items-center"> | ||
<svg class="flex-shrink-0 h-5 w-5 text-gray-300" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true"> | ||
<path d="M5.555 17.776l8-16 .894.448-8 16-.894-.448z" /> | ||
</svg> | ||
<span href="#" class="ml-4 text-sm font-medium text-skin-base" aria-current="page">{{ $section }}</span> | ||
</div> | ||
</li> | ||
</ol> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@props(['title', 'button', 'url']) | ||
|
||
<div class="md:flex md:items-center md:justify-between"> | ||
<div class="flex-1 min-w-0"> | ||
<h2 class="text-lg font-bold leading-7 text-skin-inverted sm:text-xl sm:truncate font-sans"> | ||
{{ $title }} | ||
</h2> | ||
</div> | ||
<div class="mt-4 flex md:mt-0 md:ml-4"> | ||
<x-button :link="$url" class="ml-3"> | ||
{{ $button }} | ||
</x-button> | ||
</div> | ||
</div> |
Oops, something went wrong.