|
1 | 1 | import { useState } from 'react'; |
2 | 2 |
|
3 | | -import { Button, Dialog, Form } from '@douglasneuroinformatics/libui/components'; |
| 3 | +import { Dialog, Form, Tooltip } from '@douglasneuroinformatics/libui/components'; |
4 | 4 | import { useNotificationsStore } from '@douglasneuroinformatics/libui/hooks'; |
5 | 5 | import { CopyPlusIcon } from 'lucide-react'; |
6 | 6 | import { z } from 'zod'; |
@@ -33,41 +33,46 @@ export const CloneButton = () => { |
33 | 33 | }; |
34 | 34 |
|
35 | 35 | return ( |
36 | | - <Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}> |
37 | | - <Dialog.Trigger asChild> |
38 | | - <Button className="h-9 w-9" size="icon" variant="outline"> |
39 | | - <CopyPlusIcon /> |
40 | | - </Button> |
41 | | - </Dialog.Trigger> |
42 | | - <Dialog.Content className="sm:max-w-[475px]"> |
43 | | - <Dialog.Header> |
44 | | - <Dialog.Title>Create New Instrument</Dialog.Title> |
45 | | - <Dialog.Description> |
46 | | - This will save the current playground state in local storage as a new instrument. |
47 | | - </Dialog.Description> |
48 | | - </Dialog.Header> |
49 | | - <Form |
50 | | - className="[&_button]:max-w-32" |
51 | | - content={{ |
52 | | - label: { |
53 | | - kind: 'string', |
54 | | - label: 'Label', |
55 | | - variant: 'input' |
56 | | - } |
57 | | - }} |
58 | | - submitBtnLabel="Save" |
59 | | - validationSchema={z.object({ |
60 | | - label: z |
61 | | - .string() |
62 | | - .min(1) |
63 | | - .refine( |
64 | | - (arg) => !instruments.find((instrument) => instrument.label === arg), |
65 | | - 'An instrument with this label already exists' |
66 | | - ) |
67 | | - })} |
68 | | - onSubmit={(data) => void handleSubmit(data)} |
69 | | - /> |
70 | | - </Dialog.Content> |
71 | | - </Dialog> |
| 36 | + <Tooltip> |
| 37 | + <Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}> |
| 38 | + <Dialog.Trigger asChild> |
| 39 | + <Tooltip.Trigger className="h-9 w-9" size="icon" variant="outline"> |
| 40 | + <CopyPlusIcon /> |
| 41 | + </Tooltip.Trigger> |
| 42 | + </Dialog.Trigger> |
| 43 | + <Dialog.Content className="sm:max-w-[475px]"> |
| 44 | + <Dialog.Header> |
| 45 | + <Dialog.Title>Create New Instrument</Dialog.Title> |
| 46 | + <Dialog.Description> |
| 47 | + This will save the current playground state in local storage as a new instrument. |
| 48 | + </Dialog.Description> |
| 49 | + </Dialog.Header> |
| 50 | + <Form |
| 51 | + className="[&_button]:max-w-32" |
| 52 | + content={{ |
| 53 | + label: { |
| 54 | + kind: 'string', |
| 55 | + label: 'Label', |
| 56 | + variant: 'input' |
| 57 | + } |
| 58 | + }} |
| 59 | + submitBtnLabel="Save" |
| 60 | + validationSchema={z.object({ |
| 61 | + label: z |
| 62 | + .string() |
| 63 | + .min(1) |
| 64 | + .refine( |
| 65 | + (arg) => !instruments.find((instrument) => instrument.label === arg), |
| 66 | + 'An instrument with this label already exists' |
| 67 | + ) |
| 68 | + })} |
| 69 | + onSubmit={(data) => void handleSubmit(data)} |
| 70 | + /> |
| 71 | + </Dialog.Content> |
| 72 | + </Dialog> |
| 73 | + <Tooltip.Content side="bottom"> |
| 74 | + <p>Create New Instrument</p> |
| 75 | + </Tooltip.Content> |
| 76 | + </Tooltip> |
72 | 77 | ); |
73 | 78 | }; |
0 commit comments