Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class ProfileController extends Controller
{
public function show(User $user)
{
return view('users.profile', compact('user'));
$articles = $user->latestArticles(3);

return view('users.profile', compact('user', 'articles'));
}
}
4 changes: 0 additions & 4 deletions resources/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ svg .secondary {
display: none;
}

nav.dashboard-nav a.active {
@apply border-lio-500 text-lio-500;
}

.nav a {
@apply border-transparent text-gray-500;
}
Expand Down
3 changes: 3 additions & 0 deletions resources/svg/hammer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 25 additions & 19 deletions resources/views/_partials/_delete_modal.blade.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
<div class="modal" x-show="activeModal === '{{ $identifier }}'" x-cloak>
<div class="modal-content">
<form action="{{ route(...$route) }}" method="POST">
@csrf
@method('DELETE')
@push('modals')
<div class="modal" x-show="activeModal === '{{ $identifier }}'" x-cloak>
<div class="modal-content">
<form action="{{ route(...$route) }}" method="POST">
@csrf
@method('DELETE')

<div class="flex flex-col justify-between h-full">
<div class="overflow-auto">
<div class="modal-header">
<button type="button" class="close" aria-hidden="true" @click.prevent="activeModal = false">&times;</button>
<h4 class="modal-title">{{ $title }}</h4>
<div class="flex flex-col justify-between h-full">
<div class="overflow-auto">
<div class="modal-header">
<button type="button" class="close" aria-hidden="true" @click.prevent="activeModal = false">&times;</button>

<h4 class="modal-title">{{ $title }}</h4>
</div>

<div class="modal-body">
{!! $body !!}
</div>
</div>
<div class="modal-body">
{!! $body !!}

<div class="modal-footer">
<button type="button" class="text-gray-600 mr-4" @click.prevent="activeModal = false">Cancel</button>

<button type="submit" class="button button-danger">{{ $submit ?? $title }}</button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="text-gray-600 mr-4" @click.prevent="activeModal = false">Cancel</button>
<button type="submit" class="button button-danger">{{ $submit ?? $title }}</button>
</div>
</div>
</form>
</form>
</div>
</div>
</div>
@endpush
44 changes: 25 additions & 19 deletions resources/views/_partials/_update_modal.blade.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
<div class="modal" x-show="activeModal == '{{ $identifier }}'" x-cloak>
<div class="modal-content">
<form action="{{ route(...$route) }}" method="POST">
@csrf
@method('PUT')
@push('modals')
<div class="modal" x-show="activeModal == '{{ $identifier }}'" x-cloak>
<div class="modal-content">
<form action="{{ route(...$route) }}" method="POST">
@csrf
@method('PUT')

<div class="flex flex-col justify-between h-full">
<div class="overflow-auto">
<div class="modal-header">
<button type="button" class="close" aria-hidden="true" @click.prevent="activeModal = false">&times;</button>
<h4 class="modal-title">{{ $title }}</h4>
<div class="flex flex-col justify-between h-full">
<div class="overflow-auto">
<div class="modal-header">
<button type="button" class="close" aria-hidden="true" @click.prevent="activeModal = false">&times;</button>

<h4 class="modal-title">{{ $title }}</h4>
</div>

<div class="modal-body">
{!! $body !!}
</div>
</div>
<div class="modal-body">
{!! $body !!}

<div class="modal-footer">
<button type="button" class="text-gray-600 mr-4" @click.prevent="activeModal = false">Cancel</button>

<button type="submit" class="button button-primary">{{ $submit ?? $title }}</button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="text-gray-600 mr-4" @click.prevent="activeModal = false">Cancel</button>
<button type="submit" class="button button-primary">{{ $submit ?? $title }}</button>
</div>
</div>
</form>
</form>
</div>
</div>
</div>
@endpush
69 changes: 69 additions & 0 deletions resources/views/components/articles/user-summary.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@props([
'article',
])

<div class="h-full rounded-lg shadow-lg bg-white">
<div class="flex flex-col h-full gap-x-8">
<a href="{{ route('articles.show', $article->slug()) }}" class="block">
<div
class="w-full h-32 rounded-t-lg bg-center bg-cover bg-gray-900 lg:h-40"
style="background-image: url({{ $article->heroImage() }});"
>
</div>
</a>

<div class="flex flex-col h-full gap-y-3 p-4">
<div>
<div class="flex flex-col gap-y-2">
<div class="flex">
<x-avatar :user="$article->author()" class="w-6 h-6 rounded-full mr-3" />

<span class="text-gray-900 mr-5">{{ $article->author()->username() }}</span>
</div>

<span class="font-mono text-gray-700 mt-1">
{{ $article->createdAt()->format('j M, Y') }}
</span>
</div>
</div>

<div class="break-words">
<a href="{{ route('articles.show', $article->slug()) }}" class="hover:underline">
<h3 class="text-xl text-gray-900 font-semibold">
{{ $article->title() }}
</h3>
</a>

<p class="text-gray-800 leading-7 mt-1">
{!! $article->excerpt() !!}
</p>
</div>

<div class="flex flex-col h-full justify-end gap-y-3">
<div>
@if (count($tags = $article->tags()))
<div class="flex flex-wrap gap-2">
@foreach ($tags as $tag)
<x-tag>
{{ $tag->name() }}
</x-tag>
@endforeach
</div>
@endif
</div>

<div class="flex items-center gap-x-5">
<span class="text-gray-500 text-sm">
{{ $article->readTime() }} min read
</span>

<span class="flex items-center gap-x-2">
<x-heroicon-o-thumb-up class="w-6 h-6" />
<span>{{ count($article->likes()) }}</span>
<span class="sr-only">Likes</span>
</span>
</div>
</div>
</div>
</div>
</div>
10 changes: 10 additions & 0 deletions resources/views/components/empty-state.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

@props(['icon', 'title'])

<div class="text-center">
@svg($icon, 'mx-auto h-12 w-12 text-gray-400')

<h3 class="mt-2 text-sm font-medium text-gray-900">
{{ $title }}
</h3>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@if (count($tags = $thread->tags()))
<div class="flex flex-wrap gap-2 mt-2 lg:mt-0 lg:gap-x-4">
@foreach ($tags as $tag)
<a href="{{ route('forum.tag', $tag->slug()) }}">
<a href="{{ route('forum.tag', $tag->slug()) }}" class="flex gap-2">
<x-tag>
{{ $tag->name() }}
</x-tag>
Expand Down
52 changes: 52 additions & 0 deletions resources/views/components/users/reply.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@props(['thread', 'reply'])

<div class="h-full rounded shadow-lg p-5 bg-white">
<div class="flex flex-col lg:flex-row lg:justify-between lg:items-center">
<div>
<div class="flex flex-col lg:flex-row lg:items-center">
<div class="flex">
<a href="{{ route('profile', $reply->author()->username()) }}">
<x-avatar :user="$reply->author()" class="w-6 h-6 rounded-full mr-3" />
</a>

<a href="{{ route('profile', $reply->author()->username()) }}" class="hover:underline">
<span class="text-gray-900 mr-5">{{ $reply->author()->username() }}</span>
</a>
</div>

<span class="font-mono text-gray-700 mt-1 lg:mt-0">
{{ $reply->createdAt()->format('j M, Y \a\t h:i') }}
</span>
</div>
</div>
</div>

<div class="mt-3 break-words">
<a href="{{ route('thread', $thread->slug()) }}" class="hover:underline">
<h3 class="text-xl text-gray-900 font-semibold">
{{ $thread->subject() }}
</h3>
</a>

<p class="text-gray-800 leading-7 mt-1">
{!! $reply->excerpt() !!}
</p>
</div>

<div class="flex justify-between items-center mt-4">
<div class="flex gap-x-5">
<span class="flex items-center gap-x-2">
<x-heroicon-o-thumb-up class="w-6 h-6" />
<span>{{ count($reply->likes()) }}</span>
<span class="sr-only">Likes</span>
</span>
</div>

@if ($thread->isSolutionReply($reply))
<span class="flex items-center gap-x-2 font-medium text-lio-500">
<x-heroicon-o-badge-check class="w-6 h-6" />
<span class="hover:underline">Solved</span>
</a>
@endif
</div>
</div>
2 changes: 2 additions & 0 deletions resources/views/layouts/base.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

@include('layouts._footer')

@stack('modals')

@livewireScripts

</body>
Expand Down
52 changes: 6 additions & 46 deletions resources/views/users/_latest_replies.blade.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,7 @@
<div class="container mx-auto flex flex-wrap mb-2">
<div class="w-full">
@forelse ($user->latestReplies(5) as $reply)
<div class="thread-card">
<div class="flex justify-between">
<a href="{{ route('thread', $reply->replyAble()->slug()) }}">
<h4 class="text-xl font-bold text-gray-900">
{{ $reply->replyAble()->subject() }}
</h4>

<p class="text-gray-600">
{!! $reply->excerpt() !!}
</p>
</a>

<div>
<span class="text-base font-normal">
<x-heroicon-s-thumb-up class="inline h-5 w-5 text-gray-500 mr-1"/>
{{ count($reply->likes()) }}
</span>
</div>
</div>

<div class="flex flex-col justify-between md:flex-row md:items-center text-sm pt-5">
<div class="flex flex-col md:flex-row md:items-center">
<div class="flex mb-4 md:mb-0">
<div class="mr-6 text-gray-700">
Posted {{ $reply->createdAt()->diffForHumans() }}
</div>
</div>
</div>

@if ($reply->replyAble()->isSolutionReply($reply))
<span class="label label-primary text-center mt-4 md:mt-0">
<x-heroicon-s-check class="inline w-4 h-4" />
Solution
</span>
@endif
</div>
</div>
@empty
<p class="text-gray-600 text-base">
{{ $user->username() }} has not posted any replies yet
</p>
@endforelse
</div>
<div class="flex flex-col gap-y-6">
@forelse ($user->latestReplies(5) as $reply)
<x-users.reply :thread="$reply->replyAble()" :reply="$reply" />
@empty
<x-empty-state title="{{ $user->username() }} has not posted any replies yet" icon="heroicon-o-annotation" />
@endforelse
</div>
Loading