Skip to content

Commit

Permalink
Pop up now shows for new comments and fixed pop up for posts
Browse files Browse the repository at this point in the history
Signed-off-by: WillTheDeveloper <willthedeveloper13@gmail.com>
  • Loading branch information
WillTheDeveloper committed Dec 25, 2022
1 parent 10f7f9f commit 29ab724
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/Community.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ public function createNewComment($id, CreateNewComment $request)

Mail::to(User::find($comment->user_id)->email)->send(new NewCommentOnPost($comment));

session()->flash('commented');

return redirect()->back();
}

Expand Down
2 changes: 1 addition & 1 deletion resources/views/community.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@if(session()->has('liked'))
<!-- Global notification live region, render this permanently at the end of the document -->
<div aria-live="assertive" class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6">
<div aria-live="assertive" class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6" x-show="like">
<div class="flex w-full flex-col items-center space-y-4 sm:items-end">
<!--
Notification panel, dynamically insert this into the live region when it needs to be displayed
Expand Down
45 changes: 44 additions & 1 deletion resources/views/communitypost.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,50 @@
</x-slot>

<!-- Main column -->
<div class="lg:pl-64 flex flex-col" x-data="{likes:false}">
<div class="lg:pl-64 flex flex-col" x-data="{likes:false, commented:true}">

@if(session()->has('commented'))
<!-- Global notification live region, render this permanently at the end of the document -->
<div aria-live="assertive" class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6" x-show="commented">
<div class="flex w-full flex-col items-center space-y-4 sm:items-end">
<!--
Notification panel, dynamically insert this into the live region when it needs to be displayed
Entering: "transform ease-out duration-300 transition"
From: "translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
To: "translate-y-0 opacity-100 sm:translate-x-0"
Leaving: "transition ease-in duration-100"
From: "opacity-100"
To: "opacity-0"
-->
<div class="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5">
<div class="p-4">
<div class="flex items-start">
<div class="flex-shrink-0">
<!-- Heroicon name: outline/check-circle -->
<svg class="h-6 w-6 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="ml-3 w-0 flex-1 pt-0.5">
<p class="text-sm font-medium text-gray-900">Created comment</p>
<p class="mt-1 text-sm text-gray-500">Anyone who looks at this post can see your comment now.</p>
</div>
<div class="ml-4 flex flex-shrink-0">
<button @click="commented = false" type="button" class="inline-flex rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
<span class="sr-only">Close</span>
<!-- Heroicon name: mini/x-mark -->
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" />
</svg>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
@endif


<div x-show="likes" x-cloak class="relative z-10" aria-labelledby="slide-over-title" role="dialog" aria-modal="true">
Expand Down

0 comments on commit 29ab724

Please sign in to comment.