File tree Expand file tree Collapse file tree
packages/ui/src/theme/components/shared Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,18 +33,19 @@ export function Color({ value, name }: ColorProps): React.ReactElement {
3333 } , [ ] )
3434
3535 const handleClick = useCallback ( ( ) => {
36- navigator . clipboard . writeText ( value ) . then (
37- ( ) => {
36+ navigator . clipboard
37+ . writeText ( value )
38+ . then ( ( ) => {
3839 if ( resetTimerRef . current !== null ) {
3940 clearTimeout ( resetTimerRef . current )
4041 }
4142 setCopied ( true )
4243 resetTimerRef . current = setTimeout ( ( ) => setCopied ( false ) , 2000 )
43- } ,
44- ( ) => {
44+ return null
45+ } )
46+ . catch ( ( ) => {
4547 setCopied ( false )
46- }
47- )
48+ } )
4849 } , [ value ] )
4950
5051 const nameEl = match ( name )
Original file line number Diff line number Diff line change @@ -82,38 +82,41 @@ export function Prompt({
8282
8383 match ( action )
8484 . with ( 'copy' , ( ) => {
85- navigator . clipboard . writeText ( text ) . then (
86- ( ) => {
85+ navigator . clipboard
86+ . writeText ( text )
87+ . then ( ( ) => {
8788 showFeedback ( 'Copied!' )
88- } ,
89- ( ) => {
89+ return null
90+ } )
91+ . catch ( ( ) => {
9092 showFeedback ( 'Copy failed' )
91- }
92- )
93+ } )
9394 } )
9495 . with ( 'cursor' , ( ) => {
9596 // Copy prompt to clipboard then open Cursor so the user can paste into composer
96- navigator . clipboard . writeText ( text ) . then (
97- ( ) => {
97+ navigator . clipboard
98+ . writeText ( text )
99+ . then ( ( ) => {
98100 showFeedback ( 'Copied — opening Cursor…' )
99101 globalThis . open ( 'cursor://' , '_self' )
100- } ,
101- ( ) => {
102+ return null
103+ } )
104+ . catch ( ( ) => {
102105 showFeedback ( 'Copy failed' )
103- }
104- )
106+ } )
105107 } )
106108 . with ( 'vscode' , ( ) => {
107109 // Copy prompt to clipboard then open VS Code so the user can paste
108- navigator . clipboard . writeText ( text ) . then (
109- ( ) => {
110+ navigator . clipboard
111+ . writeText ( text )
112+ . then ( ( ) => {
110113 showFeedback ( 'Copied — opening VS Code…' )
111114 globalThis . open ( 'vscode://' , '_self' )
112- } ,
113- ( ) => {
115+ return null
116+ } )
117+ . catch ( ( ) => {
114118 showFeedback ( 'Copy failed' )
115- }
116- )
119+ } )
117120 } )
118121 . with ( 'chatgpt' , ( ) => {
119122 const encoded = encodeURIComponent ( text )
You can’t perform that action at this time.
0 commit comments