Skip to content

Commit 8301413

Browse files
committed
quick event touchups
1 parent d86984e commit 8301413

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

apps/web/src/components/events/admin/EditEventForm.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ export default function EditEventForm({
5454
onExecute: () => setLoading(true),
5555
onSettled: () => setLoading(false),
5656
onSuccess: () => {
57-
alert("Event Edited Successfully! Redirecting to event page...");
58-
router.push("/admin/events");
57+
toast.success(
58+
"Event Edited Successfully! Redirecting to event page...",
59+
);
60+
setTimeout(() => {
61+
router.push("/admin/events");
62+
}, 2000);
5963
},
6064
onError: ({ error }) => {
6165
let description: string;

apps/web/src/components/events/admin/NewEventForm.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { ONE_HOUR_IN_MILLISECONDS } from "@/lib/constants";
3434
import { NewEventFormProps } from "@/lib/types/events";
3535
import { newEventFormSchema } from "@/validators/event";
3636
import { ThreeCircles } from "react-loader-spinner";
37+
import { toast } from "sonner";
3738

3839
export default function NewEventForm({ defaultDate }: NewEventFormProps) {
3940
const [loading, setLoading] = useState(false);
@@ -65,10 +66,10 @@ export default function NewEventForm({ defaultDate }: NewEventFormProps) {
6566
});
6667
setLoading(false);
6768
if (res.success) {
68-
alert("Event Created Successfully! Redirecting to event page...");
69+
toast.success("Event Created Successfully! Redirecting to event");
6970
router.push(res.data.redirect);
7071
} else {
71-
alert(
72+
toast.error(
7273
"Failed to create event, please try again. Error:\n\n" +
7374
res.error,
7475
);

apps/web/src/components/events/shared/EventColumns.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,21 @@ export const columns: ColumnDef<EventRow>[] = [
121121
</Button>
122122
</DropdownMenuTrigger>
123123
<DropdownMenuContent align="end">
124-
<DropdownMenuItem>
124+
<DropdownMenuItem
125+
asChild
126+
className="h-full w-full cursor-pointer"
127+
>
125128
<Link
126129
href={`/schedule/${data.id}`}
127130
className="h-full w-full"
128131
>
129132
View
130133
</Link>
131134
</DropdownMenuItem>
132-
<DropdownMenuItem>
135+
<DropdownMenuItem
136+
asChild
137+
className="h-full w-full cursor-pointer"
138+
>
133139
<Link
134140
href={`/admin/scanner/${data.id}`}
135141
className="h-full w-full"
@@ -138,7 +144,10 @@ export const columns: ColumnDef<EventRow>[] = [
138144
</Link>
139145
</DropdownMenuItem>
140146
<DropdownMenuSeparator />
141-
<DropdownMenuItem>
147+
<DropdownMenuItem
148+
className="h-full w-full cursor-pointer"
149+
asChild
150+
>
142151
<Link
143152
href={`/admin/events/edit/${data.id}`}
144153
className="h-full w-full"
@@ -148,7 +157,7 @@ export const columns: ColumnDef<EventRow>[] = [
148157
</DropdownMenuItem>
149158
<DropdownMenuItem
150159
asChild
151-
className="h-full w-full text-red-500"
160+
className="h-full w-full cursor-pointer text-red-500"
152161
>
153162
<AlertDialogTrigger>Delete</AlertDialogTrigger>
154163
</DropdownMenuItem>

0 commit comments

Comments
 (0)