1
-
2
1
// UI
3
2
import { Button } from "@/components/ui/button"
4
3
import {
@@ -9,27 +8,99 @@ import {
9
8
DialogTitle ,
10
9
DialogTrigger ,
11
10
} from "@/components/ui/dialog"
11
+ import { Input } from "@/components/ui/input"
12
+ import { Label } from "@/components/ui/label"
13
+ import { Separator } from "@/components/ui/separator"
12
14
13
15
// ICONS
14
16
import { FcSettings } from "react-icons/fc"
17
+ import { FiCopy } from "react-icons/fi"
18
+
19
+ // STORES
20
+ import { useFileName } from "@/stores"
21
+
22
+
23
+
24
+
15
25
16
26
export default function Settings ( ) {
27
+
28
+ // Get the file name from the store
29
+ const { currentFileName, newFileName, setNewFileName, setCurrentFileName } = useFileName ( ) ;
30
+
31
+ // Temp fileID
32
+ const fileId = "FILE_12345"
33
+
34
+ const handleCopyFileId = async ( ) => {
35
+ await navigator . clipboard . writeText ( fileId )
36
+ }
37
+
38
+ const handleUpdateFileName = ( ) => {
39
+ setCurrentFileName ( newFileName )
40
+ }
41
+
42
+
17
43
return (
18
44
< Dialog >
19
- < DialogTrigger >
20
- < Button variant = "outline" className = "flex justify-center items-center capitalize " >
21
- < FcSettings className = "!size -5" />
45
+ < DialogTrigger asChild >
46
+ < Button variant = "outline" className = "flex items-center" >
47
+ < FcSettings className = "h-5 w -5" />
22
48
< span > Settings</ span >
23
49
</ Button >
24
50
</ DialogTrigger >
25
- < DialogContent >
51
+ < DialogContent className = "sm:max-w-[425px]" >
26
52
< DialogHeader >
27
- < DialogTitle > Are you absolutely sure? </ DialogTitle >
53
+ < DialogTitle > File Settings </ DialogTitle >
28
54
< DialogDescription >
29
- This action cannot be undone. This will permanently delete your account
30
- and remove your data from our servers.
55
+ Manage your file settings and properties.
31
56
</ DialogDescription >
32
57
</ DialogHeader >
58
+ < div className = "grid gap-4 mt-2" >
59
+
60
+ < div className = "grid gap-3 mb-2" >
61
+ < Label htmlFor = "fileId" > File ID</ Label >
62
+ < div className = "flex items-center gap-2" >
63
+ < Input
64
+ id = "fileId"
65
+ value = { fileId }
66
+ readOnly
67
+ className = "bg-gray-100 flex-grow"
68
+ />
69
+ < Button
70
+ variant = "outline"
71
+ size = "icon"
72
+ onClick = { handleCopyFileId }
73
+ aria-label = "Copy file ID"
74
+ >
75
+ < FiCopy className = "h-4 w-4" />
76
+ </ Button >
77
+ </ div >
78
+ </ div >
79
+
80
+ < div className = "grid gap-3 mb-2" >
81
+ < div className = "flex items-center justify-between" >
82
+ < Label htmlFor = "fileName" > File name</ Label >
83
+ < span className = "text-sm font-medium text-gray-500" > Current: { currentFileName } </ span >
84
+ </ div >
85
+ < Input
86
+ id = "fileName"
87
+ maxLength = { 25 }
88
+ onChange = { ( e ) => setNewFileName ( e . target . value ) }
89
+ placeholder = "Enter new file name"
90
+ />
91
+ </ div >
92
+
93
+ < Separator />
94
+
95
+ < div className = "flex justify-between items-center" >
96
+ < Button variant = "destructive" >
97
+ Delete file
98
+ </ Button >
99
+ < Button disabled = { newFileName . length <= 0 } onClick = { handleUpdateFileName } >
100
+ Update file name
101
+ </ Button >
102
+ </ div >
103
+ </ div >
33
104
</ DialogContent >
34
105
</ Dialog >
35
106
)
0 commit comments