Skip to content

Commit 29ab724

Browse files
Pop up now shows for new comments and fixed pop up for posts
Signed-off-by: WillTheDeveloper <willthedeveloper13@gmail.com>
1 parent 10f7f9f commit 29ab724

3 files changed

Lines changed: 47 additions & 2 deletions

File tree

app/Http/Controllers/Community.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ public function createNewComment($id, CreateNewComment $request)
183183

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

186+
session()->flash('commented');
187+
186188
return redirect()->back();
187189
}
188190

resources/views/community.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@if(session()->has('liked'))
1212
<!-- Global notification live region, render this permanently at the end of the document -->
13-
<div aria-live="assertive" class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6">
13+
<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">
1414
<div class="flex w-full flex-col items-center space-y-4 sm:items-end">
1515
<!--
1616
Notification panel, dynamically insert this into the live region when it needs to be displayed

resources/views/communitypost.blade.php

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,50 @@
66
</x-slot>
77

88
<!-- Main column -->
9-
<div class="lg:pl-64 flex flex-col" x-data="{likes:false}">
9+
<div class="lg:pl-64 flex flex-col" x-data="{likes:false, commented:true}">
10+
11+
@if(session()->has('commented'))
12+
<!-- Global notification live region, render this permanently at the end of the document -->
13+
<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">
14+
<div class="flex w-full flex-col items-center space-y-4 sm:items-end">
15+
<!--
16+
Notification panel, dynamically insert this into the live region when it needs to be displayed
17+
18+
Entering: "transform ease-out duration-300 transition"
19+
From: "translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
20+
To: "translate-y-0 opacity-100 sm:translate-x-0"
21+
Leaving: "transition ease-in duration-100"
22+
From: "opacity-100"
23+
To: "opacity-0"
24+
-->
25+
<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">
26+
<div class="p-4">
27+
<div class="flex items-start">
28+
<div class="flex-shrink-0">
29+
<!-- Heroicon name: outline/check-circle -->
30+
<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">
31+
<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" />
32+
</svg>
33+
</div>
34+
<div class="ml-3 w-0 flex-1 pt-0.5">
35+
<p class="text-sm font-medium text-gray-900">Created comment</p>
36+
<p class="mt-1 text-sm text-gray-500">Anyone who looks at this post can see your comment now.</p>
37+
</div>
38+
<div class="ml-4 flex flex-shrink-0">
39+
<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">
40+
<span class="sr-only">Close</span>
41+
<!-- Heroicon name: mini/x-mark -->
42+
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
43+
<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" />
44+
</svg>
45+
</button>
46+
</div>
47+
</div>
48+
</div>
49+
</div>
50+
</div>
51+
</div>
52+
@endif
1053

1154

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

0 commit comments

Comments
 (0)