File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import { Button } from "../ui/button";
2121import { ScrollArea } from "../ui/scroll-area" ;
2222import { ScrollShadow } from "../ui/scroll-shadow" ;
2323import { TutorialTableOfContents } from "./TutorialTableOfContents" ;
24+ import { toast } from "sonner" ;
2425
2526function CopyArticleLinkButton ( { activeStep } : { activeStep : string | null } ) {
2627 const [ copied , setCopied ] = useState ( false ) ;
@@ -34,10 +35,15 @@ function CopyArticleLinkButton({ activeStep }: { activeStep: string | null }) {
3435 encodeURIComponent ( activeStep . toLowerCase ( ) ) ,
3536 ) ;
3637
37- navigator . clipboard . writeText ( url . toString ( ) ) . then ( ( ) => {
38- setCopied ( true ) ;
39- setTimeout ( ( ) => setCopied ( false ) , 2000 ) ;
40- } ) ;
38+ navigator . clipboard
39+ . writeText ( url . toString ( ) )
40+ . then ( ( ) => {
41+ setCopied ( true ) ;
42+ setTimeout ( ( ) => setCopied ( false ) , 2000 ) ;
43+ } )
44+ . catch ( ( _ ) => {
45+ toast . error ( "Couldn't copy the url" ) ;
46+ } ) ;
4147 } , [ activeStep ] ) ;
4248
4349 return (
You can’t perform that action at this time.
0 commit comments