-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b38ece
commit fb73f74
Showing
2 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,15 +165,25 @@ | |
<article class="border-b border-solid border-black p-2 bg-gray-50"> | ||
<div class="flex justify-between"> | ||
<p class="text-xs">@username - @message.CreatedAt</p> | ||
<div class="flex gap-4"> | ||
<button class="block" onclick="return toggleChatEdit('@message.Id')"><i class="bi bi-pencil"></i></button> | ||
<button class="block"><i class="bi bi-trash"></i></button> | ||
</div> | ||
@if (!message.IsDeleted) | ||
{ | ||
<div class="flex gap-4"> | ||
<button class="block" onclick="return toggleChatEdit('@message.Id')"><i class="bi bi-pencil"></i></button> | ||
<button class="block" onclick="return deleteChat('@message.Id')"><i class="bi bi-trash"></i></button> | ||
</div> | ||
} | ||
</div> | ||
<p id="[email protected]" class="bg-pink-50">@message.Message</p> | ||
<form id="[email protected]" class="hidden" onsubmit="return editChatMessage(event, '@message.Id')"> | ||
<input class="bg-purple-50" name="editMessage" value="@message.Message" /> | ||
</form> | ||
@if (!message.IsDeleted) | ||
{ | ||
<p id="[email protected]" class="bg-pink-50">@message.Message</p> | ||
<form id="[email protected]" class="hidden" onsubmit="return editChatMessage(event, '@message.Id')"> | ||
<input class="bg-purple-50" name="editMessage" value="@message.Message" /> | ||
</form> | ||
} | ||
else | ||
{ | ||
<p class="bg-pink-50 italic">The message has been deleted.</p> | ||
} | ||
</article> | ||
} | ||
</div> | ||
|
@@ -239,7 +249,7 @@ | |
<p class="text-xs">${usr} - ${msg.createdAt}</p> | ||
<div class="flex gap-4"> | ||
<button class="block" onclick="return toggleChatEdit('${msg.id}')"><i class="bi bi-pencil"></i></button> | ||
<button class="block"><i class="bi bi-trash"></i></button> | ||
<button class="block" onclick="return deleteChat('${msg.id}')"><i class="bi bi-trash"></i></button> | ||
</div> | ||
</div> | ||
<p id="p-${msg.id}" class="bg-pink-50">${msg.message}</p> | ||
|
@@ -256,6 +266,10 @@ | |
console.log(msg); | ||
}); | ||
connection.on("DeleteMessage", (chatId) => { | ||
$(`#p-${chatId}`).text("The message has been deleted.").addClass("italic"); | ||
}) | ||
connection.start().then(() => { | ||
connection.invoke("JoinSpecificChatRoom", { | ||
username: "@User.FindFirstValue(ClaimTypes.Name)", | ||
|
@@ -330,5 +344,11 @@ | |
function openAllLinksInNewTab(links) { | ||
links.forEach((link) => window.open(link, "_blank")); | ||
} | ||
function deleteChat(chatId) { | ||
connection | ||
.invoke("DeleteMessage", "@Model.WorkspaceId", chatId) | ||
.catch(console.error); | ||
} | ||
</script> | ||
} |