profanity

This commit is contained in:
Sewmina 2025-06-03 06:22:12 +05:30
parent 6363dd46fc
commit 0a78520be5
3 changed files with 15 additions and 4 deletions

10
package-lock.json generated
View File

@ -8,6 +8,7 @@
"name": "duelfi",
"version": "0.1.0",
"dependencies": {
"@2toad/profanity": "^3.1.1",
"@coral-xyz/anchor": "^0.31.0",
"@fontsource/manrope": "^5.2.5",
"@privy-io/react-auth": "^2.7.2",
@ -37,6 +38,15 @@
"typescript": "^5"
}
},
"node_modules/@2toad/profanity": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/@2toad/profanity/-/profanity-3.1.1.tgz",
"integrity": "sha512-07ny4pCSa4gDrcJ4vZ/WWmiM90+8kv/clXfnDvThf9IJq0GldpjRVdzHCfMwGDs2Y/8eClmTGzKb5tEfUWy/uA==",
"license": "MIT",
"engines": {
"node": ">=12"
}
},
"node_modules/@adraffy/ens-normalize": {
"version": "1.10.1",
"resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz",

View File

@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@2toad/profanity": "^3.1.1",
"@coral-xyz/anchor": "^0.31.0",
"@fontsource/manrope": "^5.2.5",
"@privy-io/react-auth": "^2.7.2",

View File

@ -5,7 +5,7 @@ import { usePrivy } from '@privy-io/react-auth';
import { io, Socket } from 'socket.io-client';
import { fetchUserById } from '@/shared/data_fetcher';
import { ChatBubbleLeftIcon, XMarkIcon } from '@heroicons/react/24/outline';
import { profanity } from '@2toad/profanity';
interface ChatMessage {
id: string;
user: string;
@ -139,7 +139,7 @@ export default function GlobalChat() {
if (isCollapsed) {
return (
<div className="fixed bottom-4 right-4 flex items-center gap-2">
<div className="fixed bottom-4 right-4 flex items-center gap-2 z-50">
{notification && (
<div className="bg-[rgb(40,40,40)] text-white px-4 py-2 rounded-lg shadow-lg animate-fade-in-out">
<div className="text-sm font-semibold">{notification.username}</div>
@ -157,7 +157,7 @@ export default function GlobalChat() {
}
return (
<div className="fixed bottom-4 right-4 w-80 bg-[rgb(30,30,30)] rounded-lg shadow-lg">
<div className="fixed bottom-4 right-4 w-80 bg-[rgb(30,30,30)] rounded-lg shadow-lg z-50">
<div className="p-4 border-b border-gray-700 flex justify-between items-center">
<div>
<h3 className="text-lg font-semibold text-white">Global Chat</h3>
@ -191,7 +191,7 @@ export default function GlobalChat() {
{new Date(msg.timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
</span>
</div>
<div className="text-white">{msg.message}</div>
<div className="text-white">{profanity.censor(msg.message)}</div>
</div>
))}
<div ref={messagesEndRef} />