|
1 | 1 | "use client";
|
2 | 2 |
|
3 |
| -import { useDeliverMessage } from "@/lib/bftbench-client/generated"; |
4 |
| -import { ActionIcon } from "@mantine/core"; |
5 |
| -import { showNotification } from "@mantine/notifications"; |
6 |
| -import { IconSend } from "@tabler/icons-react"; |
7 |
| -import { useQueryClient } from "@tanstack/react-query"; |
| 3 | +import {useDeliverMessage} from "@/lib/byzzbench-client/generated"; |
| 4 | +import {ActionIcon} from "@mantine/core"; |
| 5 | +import {showNotification} from "@mantine/notifications"; |
| 6 | +import {IconSend} from "@tabler/icons-react"; |
| 7 | +import {useQueryClient} from "@tanstack/react-query"; |
8 | 8 |
|
9 | 9 | type DeliverMessageActionIconProps = {
|
10 |
| - messageId: number; |
| 10 | + messageId: number; |
11 | 11 | };
|
12 | 12 |
|
13 | 13 | export const DeliverMessageActionIcon = ({
|
14 |
| - messageId, |
15 |
| -}: DeliverMessageActionIconProps) => { |
16 |
| - const queryClient = useQueryClient(); |
17 |
| - const { mutate } = useDeliverMessage(messageId); |
| 14 | + messageId, |
| 15 | + }: DeliverMessageActionIconProps) => { |
| 16 | + const queryClient = useQueryClient(); |
| 17 | + const {mutate} = useDeliverMessage(messageId); |
18 | 18 |
|
19 |
| - return ( |
20 |
| - <ActionIcon |
21 |
| - onClick={(e) => { |
22 |
| - e.preventDefault(); |
23 |
| - mutate(null as never, { |
24 |
| - onSuccess: () => { |
25 |
| - showNotification({ |
26 |
| - message: `Message ${messageId} delivered`, |
27 |
| - }); |
28 |
| - }, |
29 |
| - onError: () => { |
30 |
| - showNotification({ |
31 |
| - message: "Failed to deliver message", |
32 |
| - color: "red", |
33 |
| - }); |
34 |
| - }, |
35 |
| - onSettled: async () => { |
36 |
| - await queryClient.invalidateQueries(); |
37 |
| - }, |
38 |
| - }); |
39 |
| - }} |
40 |
| - > |
41 |
| - <IconSend /> |
42 |
| - </ActionIcon> |
43 |
| - ); |
| 19 | + return ( |
| 20 | + <ActionIcon |
| 21 | + onClick={(e) => { |
| 22 | + e.preventDefault(); |
| 23 | + mutate(null as never, { |
| 24 | + onSuccess: () => { |
| 25 | + showNotification({ |
| 26 | + message: `Message ${messageId} delivered`, |
| 27 | + }); |
| 28 | + }, |
| 29 | + onError: () => { |
| 30 | + showNotification({ |
| 31 | + message: "Failed to deliver message", |
| 32 | + color: "red", |
| 33 | + }); |
| 34 | + }, |
| 35 | + onSettled: async () => { |
| 36 | + await queryClient.invalidateQueries(); |
| 37 | + }, |
| 38 | + }); |
| 39 | + }} |
| 40 | + > |
| 41 | + <IconSend/> |
| 42 | + </ActionIcon> |
| 43 | + ); |
44 | 44 | };
|
0 commit comments