revert fb8e77bb68
Local Build and Deploy / deploy (push) Successful in 1m11s
Local Build and Deploy / deploy (push) Successful in 1m11s
revert style: clean up code with prettier and eslint
This commit is contained in:
1 parent
27de078f54
commit
e85e4d74ea
378 files changed
+20710
-22428
No files matched your search
@@ -1,7 +1,16 @@
|
||||
"use client";
|
||||
'use client'
|
||||
|
||||
import { DoorOpen, Loader2, Megaphone, MessageSquare, Shield, Volume2, VolumeX, Zap } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
DoorOpen,
|
||||
Loader2,
|
||||
Megaphone,
|
||||
MessageSquare,
|
||||
Shield,
|
||||
Volume2,
|
||||
VolumeX,
|
||||
Zap,
|
||||
} from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
broadcastAlert,
|
||||
quickAlert,
|
||||
@@ -9,29 +18,29 @@ import {
|
||||
quickMute,
|
||||
quickRoomKick,
|
||||
quickUnmute,
|
||||
} from "@/actions/moderation";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { useServerAction } from "@/hooks/use-server-action";
|
||||
} from '@/actions/moderation'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import { useServerAction } from '@/hooks/use-server-action'
|
||||
|
||||
export function ModActionsClient() {
|
||||
const { run, isPending } = useServerAction();
|
||||
const { run, isPending } = useServerAction()
|
||||
|
||||
// User actions
|
||||
const [userId, setUserId] = useState("");
|
||||
const [muteDuration, setMuteDuration] = useState("10");
|
||||
const [alertMessage, setAlertMessage] = useState("");
|
||||
const [userId, setUserId] = useState('')
|
||||
const [muteDuration, setMuteDuration] = useState('10')
|
||||
const [alertMessage, setAlertMessage] = useState('')
|
||||
|
||||
// Room actions
|
||||
const [roomId, setRoomId] = useState("");
|
||||
const [roomId, setRoomId] = useState('')
|
||||
|
||||
// Broadcast
|
||||
const [broadcastMsg, setBroadcastMsg] = useState("");
|
||||
const [broadcastMsg, setBroadcastMsg] = useState('')
|
||||
|
||||
const uid = parseInt(userId, 10);
|
||||
const rid = parseInt(roomId, 10);
|
||||
const uid = parseInt(userId, 10)
|
||||
const rid = parseInt(roomId, 10)
|
||||
|
||||
return (
|
||||
<div className="grid gap-6 lg:grid-cols-2">
|
||||
@@ -59,7 +68,9 @@ export function ModActionsClient() {
|
||||
variant="destructive"
|
||||
size="sm"
|
||||
disabled={isPending || !uid}
|
||||
onClick={() => run(() => quickKick({ userId: uid }), { successMessage: "User disconnected" })}
|
||||
onClick={() =>
|
||||
run(() => quickKick({ userId: uid }), { successMessage: 'User disconnected' })
|
||||
}
|
||||
>
|
||||
{isPending ? (
|
||||
<Loader2 className="mr-1 h-3 w-3 animate-spin" />
|
||||
@@ -72,7 +83,9 @@ export function ModActionsClient() {
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={isPending || !uid}
|
||||
onClick={() => run(() => quickUnmute({ userId: uid }), { successMessage: "User unmuted" })}
|
||||
onClick={() =>
|
||||
run(() => quickUnmute({ userId: uid }), { successMessage: 'User unmuted' })
|
||||
}
|
||||
>
|
||||
<Volume2 className="mr-1 h-3 w-3" /> Unmute
|
||||
</Button>
|
||||
@@ -118,9 +131,9 @@ export function ModActionsClient() {
|
||||
disabled={isPending || !uid || !alertMessage.trim()}
|
||||
onClick={() => {
|
||||
run(() => quickAlert({ userId: uid, message: alertMessage.trim() }), {
|
||||
successMessage: "Alert sent",
|
||||
onSuccess: () => setAlertMessage(""),
|
||||
});
|
||||
successMessage: 'Alert sent',
|
||||
onSuccess: () => setAlertMessage(''),
|
||||
})
|
||||
}}
|
||||
>
|
||||
<MessageSquare className="h-4 w-4" />
|
||||
@@ -155,7 +168,7 @@ export function ModActionsClient() {
|
||||
disabled={isPending || !rid}
|
||||
onClick={() =>
|
||||
run(() => quickRoomKick({ roomId: rid }), {
|
||||
successMessage: "All users kicked from room",
|
||||
successMessage: 'All users kicked from room',
|
||||
})
|
||||
}
|
||||
>
|
||||
@@ -185,10 +198,10 @@ export function ModActionsClient() {
|
||||
size="sm"
|
||||
disabled={isPending || !broadcastMsg.trim()}
|
||||
onClick={() => {
|
||||
run(() => broadcastAlert({ message: broadcastMsg.trim(), type: "hotel" }), {
|
||||
successMessage: "Hotel alert sent!",
|
||||
onSuccess: () => setBroadcastMsg(""),
|
||||
});
|
||||
run(() => broadcastAlert({ message: broadcastMsg.trim(), type: 'hotel' }), {
|
||||
successMessage: 'Hotel alert sent!',
|
||||
onSuccess: () => setBroadcastMsg(''),
|
||||
})
|
||||
}}
|
||||
>
|
||||
<Megaphone className="mr-1 h-3 w-3" /> Hotel Alert
|
||||
@@ -198,10 +211,10 @@ export function ModActionsClient() {
|
||||
size="sm"
|
||||
disabled={isPending || !broadcastMsg.trim()}
|
||||
onClick={() => {
|
||||
run(() => broadcastAlert({ message: broadcastMsg.trim(), type: "staff" }), {
|
||||
successMessage: "Staff alert sent!",
|
||||
onSuccess: () => setBroadcastMsg(""),
|
||||
});
|
||||
run(() => broadcastAlert({ message: broadcastMsg.trim(), type: 'staff' }), {
|
||||
successMessage: 'Staff alert sent!',
|
||||
onSuccess: () => setBroadcastMsg(''),
|
||||
})
|
||||
}}
|
||||
>
|
||||
<Shield className="mr-1 h-3 w-3" /> Staff Alert
|
||||
@@ -211,5 +224,5 @@ export function ModActionsClient() {
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user