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,43 +1,43 @@
|
||||
"use client";
|
||||
'use client'
|
||||
|
||||
import { Plus } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { addEventWinner } from "@/actions/events";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { useServerAction } from "@/hooks/use-server-action";
|
||||
import { Plus } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { addEventWinner } from '@/actions/events'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { useServerAction } from '@/hooks/use-server-action'
|
||||
|
||||
interface Winner {
|
||||
id: number;
|
||||
userId: number;
|
||||
position: number;
|
||||
username: string;
|
||||
createdAt: Date;
|
||||
id: number
|
||||
userId: number
|
||||
position: number
|
||||
username: string
|
||||
createdAt: Date
|
||||
}
|
||||
|
||||
interface Props {
|
||||
eventId: number;
|
||||
winners: Winner[];
|
||||
eventId: number
|
||||
winners: Winner[]
|
||||
}
|
||||
|
||||
export function EventWinnersManager({ eventId, winners }: Props) {
|
||||
const { run, isPending } = useServerAction();
|
||||
const [showForm, setShowForm] = useState(false);
|
||||
const [userId, setUserId] = useState("");
|
||||
const [position, setPosition] = useState(winners.length + 1);
|
||||
const { run, isPending } = useServerAction()
|
||||
const [showForm, setShowForm] = useState(false)
|
||||
const [userId, setUserId] = useState('')
|
||||
const [position, setPosition] = useState(winners.length + 1)
|
||||
|
||||
function handleAdd(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
e.preventDefault()
|
||||
run(() => addEventWinner({ eventId, userId: Number(userId), position }), {
|
||||
successMessage: "Winner added!",
|
||||
successMessage: 'Winner added!',
|
||||
onSuccess: () => {
|
||||
setShowForm(false);
|
||||
setUserId("");
|
||||
setPosition(position + 1);
|
||||
setShowForm(false)
|
||||
setUserId('')
|
||||
setPosition(position + 1)
|
||||
},
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -95,5 +95,5 @@ export function EventWinnersManager({ eventId, winners }: Props) {
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user