Redo user comments list
This commit is contained in:
@@ -38,7 +38,7 @@ class UserComments extends Component
|
|||||||
$comments = Comment::where('user_id', $this->model->id)
|
$comments = Comment::where('user_id', $this->model->id)
|
||||||
->when($this->commentSearch != '', fn ($query) => $query->where('body', 'like', '%'.$this->commentSearch.'%'))
|
->when($this->commentSearch != '', fn ($query) => $query->where('body', 'like', '%'.$this->commentSearch.'%'))
|
||||||
->orderBy($orderby, $orderdirection)
|
->orderBy($orderby, $orderdirection)
|
||||||
->paginate(10);
|
->paginate(6);
|
||||||
|
|
||||||
return view('livewire.user-comments', [
|
return view('livewire.user-comments', [
|
||||||
'comments' => $comments,
|
'comments' => $comments,
|
||||||
|
|||||||
@@ -1,130 +1,101 @@
|
|||||||
<div class="py-3 relative">
|
|
||||||
<div class="mx-auto sm:px-6 lg:px-8 space-y-6 max-w-[100%] lg:max-w-[90%] xl:max-w-[80%] 2xl:max-w-[90%] relative z-10">
|
|
||||||
<!-- Search Filter -->
|
|
||||||
<div class="p-4 sm:p-8 bg-white/30 dark:bg-neutral-950/40 shadow sm:rounded-lg backdrop-blur relative z-100">
|
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4 ">
|
|
||||||
|
|
||||||
<!-- Title -->
|
|
||||||
<div>
|
<div>
|
||||||
<label for="live-search"
|
<div class="mx-auto max-w-5xl px-4 space-y-6">
|
||||||
class="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white">Search</label>
|
|
||||||
<div class="relative right-2 left-0 sm:left-2 transition-all">
|
|
||||||
<div class="absolute inset-y-0 left-2 flex items-center pl-3 pointer-events-none">
|
|
||||||
<svg class="w-4 h-4 text-gray-500 dark:text-gray-400" aria-hidden="true"
|
|
||||||
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
|
||||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
|
|
||||||
stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z" />
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input wire:model.live.debounce.600ms="commentSearch" type="search" id="live-search"
|
<!-- Filters -->
|
||||||
class="block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-rose-800 focus:border-rose-900 dark:bg-neutral-900 dark:border-neutral-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-rose-800 dark:focus:border-rose-900"
|
<div class="p-4 bg-white/40 dark:bg-neutral-950/40 backdrop-blur rounded-xl shadow flex flex-col sm:flex-row gap-3">
|
||||||
placeholder="Search comment..." required>
|
|
||||||
|
|
||||||
<div class="absolute right-0 top-[11px]" wire:loading>
|
<!-- Search -->
|
||||||
<svg aria-hidden="true"
|
<div class="relative flex-1">
|
||||||
class="inline w-8 h-8 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-pink-600"
|
<input
|
||||||
viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
|
wire:model.live.debounce.500ms="commentSearch"
|
||||||
<path
|
type="search"
|
||||||
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
placeholder="Search comments..."
|
||||||
fill="currentColor" />
|
class="w-full pl-10 pr-4 py-3 rounded-lg border-neutral-300 dark:text-neutral-300 bg-white/80 dark:bg-neutral-900/50 dark:border-neutral-700 focus:outline-none focus:ring-2 focus:ring-rose-600 focus:border-rose-700 transition"
|
||||||
<path
|
>
|
||||||
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
<div class="pointer-events-none absolute inset-y-0 left-0 pl-3 flex items-center">
|
||||||
fill="currentFill" />
|
<svg class="w-4 h-4 text-gray-400 dark:text-gray-300" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
||||||
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Ordering -->
|
<!-- Order -->
|
||||||
<div>
|
<select
|
||||||
<div class="relative right-2 left-0 sm:left-2 transition-all">
|
wire:model.live="order"
|
||||||
<div class="absolute inset-y-0 left-2 flex items-center pl-3 pointer-events-none">
|
class="px-4 py-3 rounded-lg border-neutral-300 dark:text-gray-300 bg-white/80 dark:bg-neutral-900/50 dark:border-neutral-700 min-w-[128px]"
|
||||||
<i class="fa-solid fa-sort text-gray-500 dark:text-gray-400"></i>
|
>
|
||||||
</div>
|
<option value="created_at_desc">Newest</option>
|
||||||
<select wire:model.live="order"
|
<option value="created_at_asc">Oldest</option>
|
||||||
class="block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-rose-800 focus:border-rose-900 dark:bg-neutral-900 dark:border-neutral-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-rose-800 dark:focus:border-rose-900">
|
|
||||||
<option value="created_at_desc">Created DESC</option>
|
|
||||||
<option value="created_at_asc">Created ASC</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="relative pt-5 mx-auto sm:px-6 lg:px-8 space-y-6 text-gray-900 dark:text-white max-w-[100%] lg:max-w-[90%] xl:max-w-[80%] 2xl:max-w-[90%] 2xl:w-[50vw]">
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<div class="overflow-x-auto sm:-mx-6 lg:-mx-8">
|
|
||||||
<div class="inline-block min-w-full py-2 sm:px-6 lg:px-8">
|
|
||||||
<div class="overflow-hidden">
|
|
||||||
|
|
||||||
<!-- Desktop -->
|
<!-- Comments -->
|
||||||
<div class="w-full text-left text-sm font-light">
|
<div class="space-y-4">
|
||||||
<!-- Header -->
|
@forelse ($comments as $comment)
|
||||||
<div
|
|
||||||
class="flex bg-white/30 dark:bg-neutral-950/40 backdrop-blur font-medium dark:border-neutral-500 border-b rounded-tl-lg rounded-tr-lg">
|
|
||||||
|
|
||||||
<div class="flex-1 px-6 py-4 text-center">Comment</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Rows -->
|
|
||||||
@foreach ($comments as $comment)
|
|
||||||
<div wire:key="comment-{{ $comment->id }}"
|
|
||||||
class="flex flex-col sm:flex-row items-center border-b bg-white dark:bg-neutral-950 dark:border-zinc-700 hover:bg-zinc-100 dark:hover:bg-neutral-800">
|
|
||||||
|
|
||||||
<!-- Image -->
|
|
||||||
<div class="flex w-fit sm:w-56">
|
|
||||||
@if($comment->commentable_type == \App\Models\Episode::class)
|
|
||||||
@php $episode = \App\Models\Episode::find($comment->commentable_id); @endphp
|
|
||||||
<div class="relative p-1 w-full transition duration-300 ease-in-out md:p-2 md:hover:-translate-y-1 md:hover:scale-110">
|
|
||||||
<a href="{{ route('hentai.index', ['title' => $episode->slug]) }}">
|
|
||||||
<img alt="{{ $episode->title }} - {{ $episode->episode }}" loading="lazy" width="1000"
|
|
||||||
class="block object-cover object-center relative z-20 rounded-lg aspect-video"
|
|
||||||
src="{{ $episode->gallery->first()->thumbnail_url }}" />
|
|
||||||
|
|
||||||
<p class="absolute left-1 md:left-2 bottom-1 md:bottom-2 bg-rose-700/70 !text-white rounded-bl-lg rounded-tr-lg p-1 pr-2 pl-2 font-semibold text-sm z-30">
|
|
||||||
<i class="fa-regular fa-eye"></i> {{ $episode->viewCountFormatted() }}
|
|
||||||
<i class="fa-regular fa-heart"></i> {{ $episode->likeCount() }}
|
|
||||||
<i class="fa-regular fa-comment"></i> {{ $episode->commentCount() }}
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
@elseif($comment->commentable_type == \App\Models\Hentai::class)
|
|
||||||
@php
|
@php
|
||||||
$hentai = \App\Models\Hentai::find($comment->commentable_id);
|
$model = $comment->commentable;
|
||||||
$episode = $hentai->episodes->first();
|
$episode = $model instanceof \App\Models\Episode
|
||||||
|
? $model
|
||||||
|
: $model->episodes->first();
|
||||||
|
|
||||||
|
$url = route('hentai.index', ['title' => $model->slug]);
|
||||||
@endphp
|
@endphp
|
||||||
<div class="relative p-1 w-full transition duration-300 ease-in-out md:p-2 md:hover:-translate-y-1 md:hover:scale-110">
|
|
||||||
<a href="{{ route('hentai.index', ['title' => $hentai->slug]) }}">
|
|
||||||
<img alt="{{ $episode->title }}" loading="lazy" width="1000"
|
|
||||||
class="block object-cover object-center relative z-20 rounded-lg aspect-video"
|
|
||||||
src="{{ $episode->gallery->first()->thumbnail_url }}" />
|
|
||||||
|
|
||||||
|
<a href="{{ $url }}#comment-{{ $comment->id }}"
|
||||||
|
wire:key="comment-{{ $comment->id }}"
|
||||||
|
class="block group">
|
||||||
|
|
||||||
</a>
|
<div class="bg-white/40 dark:bg-neutral-950/40 backdrop-blur rounded-xl shadow hover:shadow-lg transition overflow-hidden">
|
||||||
</div>
|
|
||||||
@endif
|
<div class="flex flex-col sm:flex-row">
|
||||||
|
|
||||||
|
<!-- Thumbnail -->
|
||||||
|
<div class="sm:w-48 shrink-0">
|
||||||
|
<img
|
||||||
|
src="{{ $episode->gallery->first()->thumbnail_url }}"
|
||||||
|
alt=""
|
||||||
|
class="w-full h-40 sm:h-full object-cover"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Body -->
|
<!-- Content -->
|
||||||
<div class="flex text-lg flex-1 items-center space-x-2 px-3 py-2 bg-neutral-200 dark:bg-neutral-900 h-[115px] rounded-lg sm:mr-2">
|
<div class="flex-1 p-4 flex flex-col justify-between">
|
||||||
|
|
||||||
|
<!-- Comment -->
|
||||||
|
<div class="text-gray-800 dark:text-gray-200 text-sm line-clamp-3">
|
||||||
{!! $comment->presenter()->markdownBody() !!}
|
{!! $comment->presenter()->markdownBody() !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-x-2 sm:mr-2 w-24">
|
<!-- Meta -->
|
||||||
<span class="text-gray-500 dark:text-gray-300 font-medium">
|
<div class="flex items-center justify-between mt-3 text-xs text-gray-700 dark:text-gray-400">
|
||||||
|
|
||||||
|
<span>
|
||||||
{{ $comment->presenter()->relativeCreatedAt() }}
|
{{ $comment->presenter()->relativeCreatedAt() }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<span class="text-rose-600 font-medium group-hover:underline">
|
||||||
|
View comment
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
|
@empty
|
||||||
|
<div class="flex bg-white/40 dark:bg-neutral-950/40 backdrop-blur rounded-xl shadow hover:shadow-lg transition overflow-hidden">
|
||||||
|
<div class="text-gray-800 dark:text-gray-200 text-center w-full p-4">
|
||||||
|
<p class="text-lg">No results</p>
|
||||||
|
<p class="text-sm opacity-70">(╥﹏╥)</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Pagination -->
|
||||||
|
<div>
|
||||||
{{ $comments->links('pagination::tailwind') }}
|
{{ $comments->links('pagination::tailwind') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="scroll-smooth">
|
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="scroll-smooth">
|
||||||
@include('partials.head')
|
@include('partials.head')
|
||||||
|
|
||||||
<body class="font-sans antialiased">
|
<body class="font-sans antialiased">
|
||||||
<div class="flex flex-col min-h-screen bg-gray-100 dark:bg-neutral-900">
|
<div class="flex flex-col min-h-screen bg-gray-100 dark:bg-neutral-900">
|
||||||
@include('layouts.navigation')
|
@include('layouts.navigation')
|
||||||
@@ -9,13 +8,11 @@
|
|||||||
<main>
|
<main>
|
||||||
@include('user.partials.background')
|
@include('user.partials.background')
|
||||||
<div
|
<div
|
||||||
class="relative max-w-[120rem] mx-auto sm:px-6 lg:px-8 space-y-6 pt-20 mt-[65px] flex flex-row justify-center xl:justify-normal">
|
class="relative max-w-[120rem] mx-auto sm:px-6 lg:px-8 space-y-6 pt-20 mt-[65px] flex flex-row justify-center md:justify-normal">
|
||||||
<div class="flex flex-col xl:flex-row">
|
<div class="grid md:grid-flow-col gap-4 xl:w-5/6 flex-row">
|
||||||
@include('profile.partials.sidebar')
|
@include('profile.partials.sidebar')
|
||||||
<div class="pb-2 space-y-6 max-w-7xl px-0 md:px-6 lg:px-8 pt-8 xl:pt-0 flex flex-row">
|
<div class="flex flex-col gap-2">
|
||||||
|
|
||||||
<livewire:user-comments :model="$user"/>
|
<livewire:user-comments :model="$user"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,5 +20,4 @@
|
|||||||
@include('layouts.footer')
|
@include('layouts.footer')
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user