File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import ExportIcon from "../icons/share.svg";
77import CopyIcon from "../icons/copy.svg" ;
88import DownloadIcon from "../icons/download.svg" ;
99import GithubIcon from "../icons/github.svg" ;
10+ import LoadingButtonIcon from "../icons/loading.svg" ;
1011import Locale from "../locales" ;
1112import { Modal , showToast } from "./ui-lib" ;
1213import { copyToClipboard , downloadAs } from "../utils" ;
@@ -83,6 +84,7 @@ export function ArtifactShareButton({
8384 style ?: any ;
8485 fileName ?: string ;
8586} ) {
87+ const [ loading , setLoading ] = useState ( false ) ;
8688 const [ name , setName ] = useState ( id ) ;
8789 const [ show , setShow ] = useState ( false ) ;
8890 const shareUrl = useMemo (
@@ -110,16 +112,19 @@ export function ArtifactShareButton({
110112 < >
111113 < div className = "window-action-button" style = { style } >
112114 < IconButton
113- icon = { < ExportIcon /> }
115+ icon = { loading ? < LoadingButtonIcon /> : < ExportIcon /> }
114116 bordered
115117 title = { Locale . Export . Artifact . Title }
116118 onClick = { ( ) => {
117- upload ( getCode ( ) ) . then ( ( res ) => {
118- if ( res ?. id ) {
119- setShow ( true ) ;
120- setName ( res ?. id ) ;
121- }
122- } ) ;
119+ setLoading ( true ) ;
120+ upload ( getCode ( ) )
121+ . then ( ( res ) => {
122+ if ( res ?. id ) {
123+ setShow ( true ) ;
124+ setName ( res ?. id ) ;
125+ }
126+ } )
127+ . finally ( ( ) => setLoading ( false ) ) ;
123128 } }
124129 />
125130 </ div >
You can’t perform that action at this time.
0 commit comments