From 5ae1d7d59d19162c0b3dbed6e3b782b4b322cf30 Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Sat, 25 Mar 2023 04:28:55 +0100 Subject: [PATCH 01/11] :coffin: Remove livewire user components --- app/Http/Livewire/User/Activities.php | 19 ------------- app/Http/Livewire/User/Articles.php | 23 --------------- app/Http/Livewire/User/Discussions.php | 22 --------------- app/Http/Livewire/User/Threads.php | 22 --------------- .../user/activities.blade.php | 0 .../views/components/user/articles.blade.php | 0 .../user/discussions.blade.php | 0 .../user/threads.blade.php | 0 .../views/livewire/user/articles.blade.php | 28 ------------------- 9 files changed, 114 deletions(-) delete mode 100644 app/Http/Livewire/User/Activities.php delete mode 100644 app/Http/Livewire/User/Articles.php delete mode 100644 app/Http/Livewire/User/Discussions.php delete mode 100644 app/Http/Livewire/User/Threads.php rename resources/views/{livewire => components}/user/activities.blade.php (100%) create mode 100644 resources/views/components/user/articles.blade.php rename resources/views/{livewire => components}/user/discussions.blade.php (100%) rename resources/views/{livewire => components}/user/threads.blade.php (100%) delete mode 100644 resources/views/livewire/user/articles.blade.php diff --git a/app/Http/Livewire/User/Activities.php b/app/Http/Livewire/User/Activities.php deleted file mode 100644 index 2e73ff86..00000000 --- a/app/Http/Livewire/User/Activities.php +++ /dev/null @@ -1,19 +0,0 @@ - Activity::latestFeed($this->user, 5), - ]); - } -} diff --git a/app/Http/Livewire/User/Articles.php b/app/Http/Livewire/User/Articles.php deleted file mode 100644 index 01603ab4..00000000 --- a/app/Http/Livewire/User/Articles.php +++ /dev/null @@ -1,23 +0,0 @@ - $this->user->articles() - ->with('tags') - ->published() - ->recent() - ->limit(5) - ->get(), - ]); - } -} diff --git a/app/Http/Livewire/User/Discussions.php b/app/Http/Livewire/User/Discussions.php deleted file mode 100644 index adaa10f2..00000000 --- a/app/Http/Livewire/User/Discussions.php +++ /dev/null @@ -1,22 +0,0 @@ - $this->user->discussions() - ->with('tags') - ->withCount('replies') - ->limit(5) - ->get(), - ]); - } -} diff --git a/app/Http/Livewire/User/Threads.php b/app/Http/Livewire/User/Threads.php deleted file mode 100644 index a5425818..00000000 --- a/app/Http/Livewire/User/Threads.php +++ /dev/null @@ -1,22 +0,0 @@ - $this->user->threads() - ->with(['solutionReply', 'channels', 'reactions']) - ->orderByDesc('created_at') - ->limit(5) - ->get(), - ]); - } -} diff --git a/resources/views/livewire/user/activities.blade.php b/resources/views/components/user/activities.blade.php similarity index 100% rename from resources/views/livewire/user/activities.blade.php rename to resources/views/components/user/activities.blade.php diff --git a/resources/views/components/user/articles.blade.php b/resources/views/components/user/articles.blade.php new file mode 100644 index 00000000..e69de29b diff --git a/resources/views/livewire/user/discussions.blade.php b/resources/views/components/user/discussions.blade.php similarity index 100% rename from resources/views/livewire/user/discussions.blade.php rename to resources/views/components/user/discussions.blade.php diff --git a/resources/views/livewire/user/threads.blade.php b/resources/views/components/user/threads.blade.php similarity index 100% rename from resources/views/livewire/user/threads.blade.php rename to resources/views/components/user/threads.blade.php diff --git a/resources/views/livewire/user/articles.blade.php b/resources/views/livewire/user/articles.blade.php deleted file mode 100644 index f6ea33c2..00000000 --- a/resources/views/livewire/user/articles.blade.php +++ /dev/null @@ -1,28 +0,0 @@ -
- @if($articles->isNotEmpty()) -
-
- @foreach ($articles as $article) - - @endforeach -
-
- @else -
-
- - - -

{{ __(':name n\'a pas encore posté d\'articles', ['name' => $user->name]) }}

- @if ($user->isLoggedInUser()) - - - - - {{ __('Nouvel Article') }} - - @endif -
-
- @endif -
From 82934021a587e5e852eb303d959325a25332fc36 Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Sat, 25 Mar 2023 09:28:56 +0100 Subject: [PATCH 02/11] :construction: wip --- app/Http/Controllers/ThreadController.php | 13 +-- .../Controllers/User/ProfileController.php | 34 +++++++- app/Models/Article.php | 1 - app/Models/Discussion.php | 9 -- app/Models/Thread.php | 6 -- app/Traits/HasAuthor.php | 12 +-- app/View/Composers/ModeratorsComposer.php | 2 +- public/js/app.js | 84 +++++++++---------- resources/views/articles/show.blade.php | 64 +++++++------- .../components/articles/overview.blade.php | 15 ++-- .../components/discussions/overview.blade.php | 60 ++++++------- .../forum/thread-overview.blade.php | 8 +- .../components/user/activities.blade.php | 2 + .../views/components/user/articles.blade.php | 30 +++++++ .../components/user/discussions.blade.php | 4 +- .../views/components/user/threads.blade.php | 2 + resources/views/user/dashboard.blade.php | 10 +-- resources/views/user/profile.blade.php | 15 ++-- 18 files changed, 210 insertions(+), 161 deletions(-) diff --git a/app/Http/Controllers/ThreadController.php b/app/Http/Controllers/ThreadController.php index 4182361b..934c8330 100644 --- a/app/Http/Controllers/ThreadController.php +++ b/app/Http/Controllers/ThreadController.php @@ -4,16 +4,17 @@ use App\Models\Channel; use App\Models\Thread; +use Illuminate\Contracts\View\View; use Illuminate\Http\Request; -class ThreadController extends Controller +final class ThreadController extends Controller { public function __construct() { $this->middleware(['auth', 'verified'], ['only' => ['create', 'edit']]); } - public function index(Request $request) + public function index(Request $request): View { $filter = getFilter('sortBy', ['recent', 'resolved', 'unresolved']); $threads = Thread::filter($request) @@ -28,7 +29,7 @@ public function index(Request $request) ]); } - public function channel(Request $request, Channel $channel) + public function channel(Request $request, Channel $channel): View { $filter = getFilter('sortBy', ['recent', 'resolved', 'unresolved']); $threads = Thread::forChannel($channel) @@ -40,19 +41,19 @@ public function channel(Request $request, Channel $channel) return view('forum.index', compact('channel', 'threads', 'filter')); } - public function create() + public function create(): View { return view('forum.create'); } - public function show(Thread $thread) + public function show(Thread $thread): View { views($thread)->record(); return view('forum.thread', compact('thread')); } - public function edit(Thread $thread) + public function edit(Thread $thread): View { return view('forum.edit', compact('thread')); } diff --git a/app/Http/Controllers/User/ProfileController.php b/app/Http/Controllers/User/ProfileController.php index 143deeca..d5a9e3c6 100644 --- a/app/Http/Controllers/User/ProfileController.php +++ b/app/Http/Controllers/User/ProfileController.php @@ -3,15 +3,43 @@ namespace App\Http\Controllers\User; use App\Http\Controllers\Controller; +use App\Models\Article; +use App\Models\Discussion; +use App\Models\Thread; use App\Models\User; +use Illuminate\Contracts\View\View; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -class ProfileController extends Controller +final class ProfileController extends Controller { - public function show(Request $request, User $user = null) + public function show(Request $request, User $user = null): View | RedirectResponse { if ($user) { - return view('user.profile', compact('user')); + $articles = Article::with('tags') + ->whereBelongsTo($user) + ->published() + ->recent() + ->limit(5) + ->get(); + + $threads = Thread::whereBelongsTo($user) + ->orderByDesc('created_at') + ->limit(5) + ->get(); + + $discussions = Discussion::with('tags') + ->whereBelongsTo($user) + ->limit(5) + ->get(); + + return view('user.profile', [ + 'user' => $user, + 'articles' => $articles, + 'threads' => $threads, + 'discussions' => $discussions, + 'activities' => [], + ]); } if ($request->user()) { diff --git a/app/Models/Article.php b/app/Models/Article.php index 21889514..d585c4f2 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -77,7 +77,6 @@ class Article extends Model implements ReactableInterface, HasMedia, Viewable * @var array */ protected $with = [ - 'author', 'media', ]; diff --git a/app/Models/Discussion.php b/app/Models/Discussion.php index a7b32cf3..69499835 100644 --- a/app/Models/Discussion.php +++ b/app/Models/Discussion.php @@ -58,15 +58,6 @@ class Discussion extends Model implements ReactableInterface, ReplyInterface, Su 'is_pinned' => 'boolean', ]; - /** - * The relations to eager load on every query. - * - * @var array - */ - protected $with = [ - 'author', - ]; - /** * The accessors to append to the model's array form. * diff --git a/app/Models/Thread.php b/app/Models/Thread.php index b9db4dfe..d593dcff 100644 --- a/app/Models/Thread.php +++ b/app/Models/Thread.php @@ -76,16 +76,10 @@ class Thread extends Model implements Feedable, ReactableInterface, ReplyInterfa */ protected $with = [ 'channels', - 'author', ]; protected $removeViewsOnDelete = true; - public static function boot() - { - parent::boot(); - } - /** * Get the route key for the model. * diff --git a/app/Traits/HasAuthor.php b/app/Traits/HasAuthor.php index 2dc748ed..82759bc8 100644 --- a/app/Traits/HasAuthor.php +++ b/app/Traits/HasAuthor.php @@ -9,23 +9,23 @@ trait HasAuthor { public function authoredBy(User $author): void { - $this->author()->associate($author); + $this->user()->associate($author); $this->unsetRelation('author'); } - public function author(): BelongsTo + public function user(): BelongsTo { - return $this->belongsTo(User::class, 'user_id'); + return $this->belongsTo(User::class); } - public function getAuthor(): User + public function getUser(): User { - return $this->author; + return $this->user; } public function isAuthoredBy(User $user): bool { - return $this->author->is($user); + return $this->user->is($user); } } diff --git a/app/View/Composers/ModeratorsComposer.php b/app/View/Composers/ModeratorsComposer.php index 0ded0d39..58df020e 100644 --- a/app/View/Composers/ModeratorsComposer.php +++ b/app/View/Composers/ModeratorsComposer.php @@ -10,7 +10,7 @@ final class ModeratorsComposer { public function compose(View $view): void { - $view->with('moderators', Cache::remember('moderators', now()->addMinutes(30), function () { + $view->with('moderators', Cache::remember('moderators', now()->addYear(), function () { return User::moderators()->get(); })); } diff --git a/public/js/app.js b/public/js/app.js index 19c1c19a..e842e52a 100755 --- a/public/js/app.js +++ b/public/js/app.js @@ -4542,9 +4542,9 @@ window.snakeCase = string => string && string.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9 /** * Injecte la fonction dans le contexte global - * - * @param {number} number - * @returns + * + * @param {number} number + * @returns */ window.formatMoney = number => formatMoney(number); @@ -4886,7 +4886,7 @@ var filepond_esm_exports={};__export(filepond_esm_exports,{FileOrigin:()=>FileOr ${markupSVG.replace(/ /g," ")} `;}const aspectRatio=crop.aspectRatio||imageHeight/imageWidth;const canvasWidth=imageWidth;const canvasHeight=canvasWidth*aspectRatio;const shouldLimit=typeof crop.scaleToFit==="undefined"||crop.scaleToFit;const cropCenterX=crop.center?crop.center.x:0.5;const cropCenterY=crop.center?crop.center.y:0.5;const canvasZoomFactor=getImageRectZoomFactor2({width:imageWidth,height:imageHeight},getCenteredCropRect2({width:canvasWidth,height:canvasHeight},aspectRatio),crop.rotation,shouldLimit?{x:cropCenterX,y:cropCenterY}:{x:0.5,y:0.5});const scale=crop.zoom*canvasZoomFactor;const rotation=crop.rotation*(180/Math.PI);const canvasCenter={x:canvasWidth*0.5,y:canvasHeight*0.5};const imageOffset={x:canvasCenter.x-imageWidth*cropCenterX,y:canvasCenter.y-imageHeight*cropCenterY};const cropTransforms=[`rotate(${rotation} ${canvasCenter.x} ${canvasCenter.y})`,`translate(${canvasCenter.x} ${canvasCenter.y})`,`scale(${scale})`,`translate(${-canvasCenter.x} ${-canvasCenter.y})`,`translate(${imageOffset.x} ${imageOffset.y})`];const cropFlipHorizontal=crop.flip&&crop.flip.horizontal;const cropFlipVertical=crop.flip&&crop.flip.vertical;const flipTransforms=[`scale(${cropFlipHorizontal?-1:1} ${cropFlipVertical?-1:1})`,`translate(${cropFlipHorizontal?-imageWidth:0} ${cropFlipVertical?-imageHeight:0})`];const transformed=` -1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var n=this._prepareSearchers(e),r=n.tokenSearchers,o=n.fullSearcher,i=this._search(r,o),a=i.weights,s=i.results;return this._computeScore(a,s),this.options.shouldSort&&this._sort(s),t.limit&&"number"==typeof t.limit&&(s=s.slice(0,t.limit)),this._format(s)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),r=0,o=n.length;r0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=this.list,r={},o=[];if("string"==typeof n[0]){for(var i=0,a=n.length;i1)throw new Error("Key weight has to be > 0 and <= 1");d=d.name}else s[d]={weight:1};this._analyze({key:d,value:this.options.getFn(l,d),record:l,index:c},{resultMap:r,results:o,tokenSearchers:e,fullSearcher:t})}return{weights:s,results:o}}},{key:"_analyze",value:function(e,t){var n=e.key,r=e.arrayIndex,o=void 0===r?-1:r,i=e.value,a=e.record,c=e.index,h=t.tokenSearchers,l=void 0===h?[]:h,u=t.fullSearcher,f=void 0===u?[]:u,d=t.resultMap,v=void 0===d?{}:d,p=t.results,g=void 0===p?[]:p;if(null!=i){var y=!1,m=-1,k=0;if("string"==typeof i){this._log("\nKey: ".concat(""===n?"-":n));var S=f.search(i);if(this._log('Full text: "'.concat(i,'", score: ').concat(S.score)),this.options.tokenize){for(var x=i.split(this.options.tokenSeparator),b=[],M=0;M-1&&(P=(P+m)/2),this._log("Score average:",P);var F=!this.options.tokenize||!this.options.matchAllTokens||k>=l.length;if(this._log("\nCheck Matches: ".concat(F)),(y||S.isMatch)&&F){var T=v[c];T?T.output.push({key:n,arrayIndex:o,value:i,score:P,matchedIndices:S.matchedIndices}):(v[c]={item:a,output:[{key:n,arrayIndex:o,value:i,score:P,matchedIndices:S.matchedIndices}]},g.push(v[c]))}}else if(s(i))for(var z=0,E=i.length;z-1&&(a.arrayIndex=i.arrayIndex),t.matches.push(a)}}}),this.options.includeScore&&o.push(function(e,t){t.score=e.score});for(var i=0,a=e.length;in)return o(e,this.pattern,r);var a=this.options,s=a.location,c=a.distance,h=a.threshold,l=a.findAllMatches,u=a.minMatchCharLength;return i(e,this.pattern,this.patternAlphabet,{location:s,distance:c,threshold:h,findAllMatches:l,minMatchCharLength:u})}}])&&r(t.prototype,n),s&&r(t,s),e}();e.exports=s},function(e,t){var n=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,o=new RegExp(t.replace(n,"\\$&").replace(r,"|")),i=e.match(o),a=!!i,s=[];if(a)for(var c=0,h=i.length;c=P;z-=1){var E=z-1,K=n[e.charAt(E)];if(K&&(x[E]=1),T[z]=(T[z+1]<<1|1)&K,0!==I&&(T[z]|=(L[z+1]|L[z])<<1|1|L[z+1]),T[z]&C&&(w=r(t,{errors:I,currentLocation:E,expectedLocation:g,distance:h}))<=m){if(m=w,(k=E)<=g)break;P=Math.max(1,2*g-k)}}if(r(t,{errors:I+1,currentLocation:g,expectedLocation:g,distance:h})>m)break;L=T}return{isMatch:k>=0,score:0===w?.001:w,matchedIndices:o(x,p)}}},function(e,t){e.exports=function(e,t){var n=t.errors,r=void 0===n?0:n,o=t.currentLocation,i=void 0===o?0:o,a=t.expectedLocation,s=void 0===a?0:a,c=t.distance,h=void 0===c?100:c,l=r/e.length,u=Math.abs(s-i);return h?l+u/h:u?1:l}},function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],r=-1,o=-1,i=0,a=e.length;i=t&&n.push([r,o]),r=-1)}return e[i-1]&&i-r>=t&&n.push([r,i-1]),n}},function(e,t){e.exports=function(e){for(var t={},n=e.length,r=0;r { /******/ __webpack_require__.amdO = {}; /******/ })(); -/******/ +/******/ /******/ /* webpack/runtime/chunk loaded */ /******/ (() => { /******/ var deferred = []; @@ -73559,7 +73559,7 @@ __webpack_require__.r(__webpack_exports__); /******/ return result; /******/ }; /******/ })(); -/******/ +/******/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules @@ -73571,7 +73571,7 @@ __webpack_require__.r(__webpack_exports__); /******/ return getter; /******/ }; /******/ })(); -/******/ +/******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports @@ -73583,7 +73583,7 @@ __webpack_require__.r(__webpack_exports__); /******/ } /******/ }; /******/ })(); -/******/ +/******/ /******/ /* webpack/runtime/global */ /******/ (() => { /******/ __webpack_require__.g = (function() { @@ -73595,12 +73595,12 @@ __webpack_require__.r(__webpack_exports__); /******/ } /******/ })(); /******/ })(); -/******/ +/******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); -/******/ +/******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports @@ -73611,11 +73611,11 @@ __webpack_require__.r(__webpack_exports__); /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); -/******/ +/******/ /******/ /* webpack/runtime/jsonp chunk loading */ /******/ (() => { /******/ // no baseURI -/******/ +/******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded @@ -73624,19 +73624,19 @@ __webpack_require__.r(__webpack_exports__); /******/ "css/app": 0, /******/ "css/filament": 0 /******/ }; -/******/ +/******/ /******/ // no chunk on demand loading -/******/ +/******/ /******/ // no prefetching -/******/ +/******/ /******/ // no preloaded -/******/ +/******/ /******/ // no HMR -/******/ +/******/ /******/ // no HMR manifest -/******/ +/******/ /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); -/******/ +/******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; @@ -73661,14 +73661,14 @@ __webpack_require__.r(__webpack_exports__); /******/ } /******/ return __webpack_require__.O(result); /******/ } -/******/ +/******/ /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); /******/ })(); -/******/ +/******/ /************************************************************************/ -/******/ +/******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module depends on other loaded chunks and execution need to be delayed @@ -73676,6 +73676,6 @@ __webpack_require__.r(__webpack_exports__); /******/ __webpack_require__.O(undefined, ["css/app","css/filament"], () => (__webpack_require__("./resources/css/app.css"))) /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["css/app","css/filament"], () => (__webpack_require__("./resources/css/filament.css"))) /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); -/******/ +/******/ /******/ })() -; \ No newline at end of file +; diff --git a/resources/views/articles/show.blade.php b/resources/views/articles/show.blade.php index 53a610e3..4ee85441 100644 --- a/resources/views/articles/show.blade.php +++ b/resources/views/articles/show.blade.php @@ -7,7 +7,7 @@ @php $next = $article->nextArticle(); $previous = $article->previousArticle(); - $author = $article->author; + $user = $article->user; @endphp
@@ -16,42 +16,42 @@

{{ __('A propos de l’auteur') }}

- +
- {{ $author->username }} + {{ $user->username }}

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

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

- @if($author->bio) -

{{ $author->bio }}

+ @if($user->bio) +

{{ $user->bio }}

@endif
- @if($author->twitter()) - + @if($user->twitter()) + Twitter @endif - @if($author->linkedin()) - + @if($user->linkedin()) + LinkedIn @endif - @if($author->githubUsername()) - + @if($user->githubUsername()) + GitHub @@ -115,17 +115,17 @@

{{ $article->title }}

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

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

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

@@ -145,42 +145,42 @@ class="mt-8 prose prose-lg prose-green text-skin-base mx-auto overflow-x-hidden
- +
- {{ $author->username }} + {{ $user->username }}

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

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

- @if($author->bio) -

{{ $author->bio }}

+ @if($user->bio) +

{{ $user->bio }}

@endif
- @if($author->twitter()) - + @if($user->twitter()) + Twitter @endif - @if($author->linkedin()) - + @if($user->linkedin()) + LinkedIn @endif - @if($author->githubUsername()) - + @if($user->githubUsername()) + GitHub @@ -193,17 +193,17 @@ class="mt-8 prose prose-lg prose-green text-skin-base mx-auto overflow-x-hidden

{{ __('Vous aimez cet article ? Faite le savoir en partageant') }}

- title.'" par '. ($article->author->twitter() ? '@'.$article->author->twitter() : $article->author->name) . ' #caparledev - ') }}&url={{ urlencode(route('articles.show', $article)) }}" + title.'" par '. ($article->user->twitter() ? '@'.$article->user->twitter() : $article->user->name) . ' #caparledev - ') }}&url={{ urlencode(route('articles.show', $article)) }}" class="inline-flex items-center py-2 px-4 border border-skin-base rounded-md shadow-sm bg-skin-button text-sm leading-5 font-normal text-skin-base hover:bg-skin-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500"> Twitter - title.'" par '.$article->author->name.' - ') }}" + title.'" par '.$article->user->name.' - ') }}" class="inline-flex items-center py-2 px-4 border border-skin-base rounded-md shadow-sm bg-skin-button text-sm leading-5 font-normal text-skin-base hover:bg-skin-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500"> Facebook - title.'" par '.$article->author->name.' - ') }}" + title.'" par '.$article->user->name.' - ') }}" class="inline-flex items-center py-2 px-4 border border-skin-base rounded-md shadow-sm bg-skin-button text-sm leading-5 font-normal text-skin-base hover:bg-skin-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500"> LinkedIn diff --git a/resources/views/components/articles/overview.blade.php b/resources/views/components/articles/overview.blade.php index c934a39f..a0c1d297 100644 --- a/resources/views/components/articles/overview.blade.php +++ b/resources/views/components/articles/overview.blade.php @@ -3,7 +3,10 @@
- {{ $article->title }} + {{ $article->title }}
@@ -27,15 +30,15 @@

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

diff --git a/resources/views/components/discussions/overview.blade.php b/resources/views/components/discussions/overview.blade.php index df0ae4c1..b8b3c3cd 100644 --- a/resources/views/components/discussions/overview.blade.php +++ b/resources/views/components/discussions/overview.blade.php @@ -1,4 +1,4 @@ -@props(['discussion']) +@props(['discussion', 'hiddenAuthor' => false])
@@ -20,34 +20,36 @@

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

-
-
- - {{ $discussion->author->name }} - - {{ __('Posté par') }} - -
- diff --git a/resources/views/components/forum/thread-overview.blade.php b/resources/views/components/forum/thread-overview.blade.php index b12663eb..65ad0fcd 100644 --- a/resources/views/components/forum/thread-overview.blade.php +++ b/resources/views/components/forum/thread-overview.blade.php @@ -6,13 +6,13 @@
- {{ $thread->author->name }} + {{ $thread->user->name }}

- - {{ $thread->author->name }} - {{ '@'. $thread->author->username }} + + {{ $thread->user->name }} + {{ '@'. $thread->user->username }}

diff --git a/resources/views/components/user/activities.blade.php b/resources/views/components/user/activities.blade.php index c85a834e..7be62e67 100644 --- a/resources/views/components/user/activities.blade.php +++ b/resources/views/components/user/activities.blade.php @@ -1,3 +1,5 @@ +@props(['user', 'activities']) +

{{ __('Dernières activités de :name', ['name' => $user->name]) }} diff --git a/resources/views/components/user/articles.blade.php b/resources/views/components/user/articles.blade.php index e69de29b..cf13e55e 100644 --- a/resources/views/components/user/articles.blade.php +++ b/resources/views/components/user/articles.blade.php @@ -0,0 +1,30 @@ +@props(['user', 'articles']) + +
+ @if($articles->isNotEmpty()) +
+
+ @foreach ($articles as $article) + + @endforeach +
+
+ @else +
+
+ + + +

{{ __(':name n\'a pas encore posté d\'articles', ['name' => $user->name]) }}

+ @if ($user->isLoggedInUser()) + + + + + {{ __('Nouvel Article') }} + + @endif +
+
+ @endif +
diff --git a/resources/views/components/user/discussions.blade.php b/resources/views/components/user/discussions.blade.php index 51ccc776..bf98f4c9 100644 --- a/resources/views/components/user/discussions.blade.php +++ b/resources/views/components/user/discussions.blade.php @@ -1,8 +1,10 @@ +@props(['user', 'discussions']) +
@if($discussions->isNotEmpty())
@foreach($discussions as $discussion) - + @endforeach
@else diff --git a/resources/views/components/user/threads.blade.php b/resources/views/components/user/threads.blade.php index 21f7d868..086fbab9 100644 --- a/resources/views/components/user/threads.blade.php +++ b/resources/views/components/user/threads.blade.php @@ -1,3 +1,5 @@ +@props(['user', 'threads']) +
@if($threads->isNotEmpty())
diff --git a/resources/views/user/dashboard.blade.php b/resources/views/user/dashboard.blade.php index c430f8ba..d6594fe8 100644 --- a/resources/views/user/dashboard.blade.php +++ b/resources/views/user/dashboard.blade.php @@ -74,16 +74,16 @@
- + {{ $article->author->username }} + src="{{ $article->user->profile_photo_url }}" + alt="{{ $article->user->username }}" />

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

diff --git a/resources/views/user/profile.blade.php b/resources/views/user/profile.blade.php index 62f8aa6f..058d4c34 100644 --- a/resources/views/user/profile.blade.php +++ b/resources/views/user/profile.blade.php @@ -121,12 +121,12 @@ class="lg:col-span-5" x-data="{ activeTab: 'articles', - tabs: ['articles', 'discussions', 'questions', 'badges'] + tabs: ['articles', 'discussions', 'questions'] }" >
- +