okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
1f727f4b5
main
1import { tr , localeTag } from '../lib/i18n' ; 2import { useEffect , useMemo , useState } from 'react' ; 3import { Bar , Btn , Dialog , Icon } from './ui' ; 4import { api , ApiError } from '../lib/client' ; 5import { nativeAction , refreshNative , useNative , type NativeJob , type NativeState } from '../lib/native' ; 6import { nativeShortName } from '../lib/native-names' ; 7import { sizeGb } from '../lib/format' ; 8 9type Choice = 'move' | 'keep' | 'empty' ; 10interface Plan { 11ok :boolean ; 12issue :{ code :string ; message :string ; details :string } | null ; 13old :string ; new :string ; same_drive :boolean ; 14free_bytes :number ; models_bytes :number ; needed_bytes :number ; 15models :{ group :string ; name :string ; bytes :number }[]; 16choices :Record < Choice , { possible :boolean ; reason :string }>; 17folder :string ; picked :string ; wholeDrive :boolean ; shown :string ; current :string ; running :number ; busy :boolean ; 18} 19interface Outcome { done ?:boolean ; stopped ?:boolean ; failed ?:boolean ; code ?:string ; moved ?:string []; remaining ?:string []; bytes ?:number ; total ?:number ; from ?:string ; to ?:string ; sameDrive ?:boolean } 20 21const gb = ( bytes :number ) => sizeGb ( bytes / 1e9 ); 22const driveOf = ( path :string ) => / ^[A-Za-z]: / . test ( path ) ?path . slice ( 0 , 2 ) :path ; 23const list = ( items :string []) => { try { return new Intl . ListFormat ( localeTag (), { type :'conjunction' }). format ( items ); } catch { return items . join ( ', ' ); } }; 24 25/** The model a folder name belongs to, in the words the Storage list uses ("Gyro-S"); the draft layer and loose files have no name of their own. */ 26function modelName ( group :string , native :NativeState | null ) { 27const hit = native ?. installed ?. models . find ( m => m . model . toLowerCase () === group . toLowerCase ()); 28return hit ?nativeShortName ( hit . model ) :null ; 29} 30 31function timeLeft ( seconds :number ) { 32if ( seconds <= 0 ) return null ; 33if ( seconds < 60 ) return tr ( 'Less than a minute left' ); 34const minutes = Math . ceil ( seconds / 60 ); 35if ( minutes <= 1 ) return tr ( 'About a minute left' ); 36if ( minutes < 120 ) return tr ( 'About {0} minutes left' , [ minutes ]); 37return tr ( 'About {0} hours left' , [ Math . ceil ( minutes / 60 )]); 38} 39 40function Failure ({ message, next, details} :{ message :string ; next ?:string ; details ?:string }) { 41return < div className = "error-notice" role = "alert" >< Icon name = "error" size = { 18 }/>< div >< strong >{ tr ( message )}</ strong >{ next ?< p >{ tr ( next )}</ p > :null }{ details ?< details className = "error-detail" >< summary className = "small" >{ tr ( 'Details' )}</ summary >< pre className = "small muted" >{ details }</ pre ></ details > :null }</ div ></ div >; 42} 43 44/** Settings > Storage > Models folder: the card, the folder dialog with its three choices, the progress of a move and what came of it. */ 45export function ModelsFolderCard ({ blocked} :{ blocked :boolean }) { 46const native = useNative (); 47const [ plan , setPlan ] = useState < Plan | null >( null ); 48const [ stage , setStage ] = useState < 'issue' | 'drive' | 'choose' | null >( null ); 49const [ choice , setChoice ] = useState < Choice >( 'move' ); 50const [ pending , setPending ] = useState ( false ); 51const [ error , setError ] = useState <{ message :string ; details ?:string } | null >( null ); 52const [ typing , setTyping ] = useState ( false ), [ typed , setTyped ] = useState ( '' ); 53const [ jobId , setJobId ] = useState < string | null >( null ); 54const [ outcome , setOutcome ] = useState <{ job :NativeJob } | null >( null ); 55const [ notice , setNotice ] = useState ( '' ); 56const [ stopping , setStopping ] = useState ( false ); 57const [ unfinished , setUnfinished ] = useState <{ from :string ; to :string } | null >( null ); 58const [ resumed , setResumed ] = useState <{ from :string ; to :string } | null >( null ); 59const folder = native ?. downloadDirectory ?? '' ; 60const free = native ?. downloadFreeBytes ?? null ; 61const usage = native ?. installed ?. usage ?. total_bytes ?? 0 ; 62const moving = native ?. jobs . find ( j => j . kind === 'models-move' && j . state === 'running' ) ?? null ; 63const finished = jobId ?native ?. jobs . find ( j => j . id === jobId && j . kind === 'models-move' && j . state !== 'running' ) :undefined ; 64useEffect (() => { if ( finished && ! outcome ) { setOutcome ({ job :finished }); setStopping ( false ); void refreshNative ( true ); } }, [ finished , outcome ]); 65const total = native ?. downloadTotalBytes ?? null ; 66const used = free !== null && total ?Math . min ( 100 , Math . max ( 1 , (( total - free ) / total ) * 100 )) :0 ; 67useEffect (() => { if ( moving && ! jobId ) setJobId ( moving . id ); }, [ moving , jobId ]); 68 69/* A move that a crash or a stop left half done: found again at the next start, with its two choices. */ 70useEffect (() => { 71if ( moving || outcome ) return ; 72let live = true ; 73api . get <{ interrupted :{ from :string ; to :string } | null }>( '/api/native/models-folder/interrupted' ) 74. then ( r => { if ( live ) setUnfinished ( r . interrupted ); }). catch (() => { if ( live ) setUnfinished ( null ); }); 75return () => { live = false ; }; 76}, [ moving , outcome , folder ]); 77async function finishMove () { 78if ( ! unfinished ) return ; 79setPending ( true ); 80setError ( null ); 81try { 82const result = await api . post < NativeJob >( '/api/native/models-folder/resume' , { stopRunning :true }); 83setResumed ( unfinished ); 84setUnfinished ( null ); 85if ( result . id ) { setJobId ( result . id ); setOutcome ( null ); await refreshNative ( true ); } 86} 87catch ( e ) { setError ({ message :( e as Error ). message , details :(( e as ApiError ). body as { details ?:string } | undefined )?. details }); } 88finally { setPending ( false ); } 89} 90async function leaveMove () { 91if ( ! unfinished ) return ; 92setPending ( true ); 93setError ( null ); 94try { 95await api . post ( '/api/native/models-folder/leave' , {}); 96setNotice ( tr ( 'The partial copies were removed. Your models are in {0}.' , [ unfinished . from ])); 97setUnfinished ( null ); 98await refreshNative ( true ); 99} 100catch ( e ) { setError ({ message :( e as Error ). message , details :(( e as ApiError ). body as { details ?:string } | undefined )?. details }); } 101finally { setPending ( false ); } 102} 103 104function leave () { setPlan ( null ); setStage ( null ); setError ( null ); setTyping ( false ); } 105async function pick ( path = '' ) { 106setPending ( true ); 107setError ( null ); 108setNotice ( '' ); 109try { 110const result = await api . post <{ cancelled ?:boolean ; plan ?:Plan }>( '/api/native/models-folder/plan' , { path}); 111if ( result . cancelled || ! result . plan ) return ; 112const next = result . plan ; 113setTyping ( false ); 114setPlan ( next ); 115if ( next . issue ?. code === 'same' ) { setPlan ( null ); return ; } 116setChoice ( next . choices . move . possible ?'move' :'keep' ); 117setStage ( next . issue ?'issue' :next . wholeDrive ?'drive' :'choose' ); 118} 119catch ( e ) { 120if ( e instanceof ApiError && e . status === 501 ) { setTyping ( true ); setError ({ message :e . message }); } 121else setError ({ message :( e as Error ). message , details :(( e as ApiError ). body as { details ?:string } | undefined )?. details }); 122} 123finally { setPending ( false ); } 124} 125async function start () { 126if ( ! plan ) return ; 127setPending ( true ); 128setError ( null ); 129try { 130const result = await api . post < NativeJob & { done ?:boolean ; setAside ?:string [] }>( '/api/native/models-folder/start' , { path :plan . picked , choice, stopRunning :true }); 131if ( result . id ) { setJobId ( result . id ); setOutcome ( null ); setStage ( null ); await refreshNative ( true ); setPlan ( prev => prev ); return ; } 132setNotice ( choice === 'keep' ?tr ( 'Strata now also uses {0}. New downloads go there, and your current models stay where they are.' , [ plan . shown ]) 133 :tr ( 'Strata now uses {0}. Your old model files are still in {1}; Strata does not delete them.' , [ plan . shown , plan . current ])); 134await refreshNative ( true ); 135leave (); 136} 137catch ( e ) { setError ({ message :( e as Error ). message , details :(( e as ApiError ). body as { details ?:string } | undefined )?. details }); } 138finally { setPending ( false ); } 139} 140async function stop () { 141if ( ! moving ) return ; 142setStopping ( true ); 143try { await nativeAction ( `operations/ ${ moving . id } /cancel` ); } 144catch ( e ) { setError ({ message :( e as Error ). message }); } 145} 146function closeResult () { setOutcome ( null ); setJobId ( null ); setResumed ( null ); leave (); setNotice ( '' ); } 147 148const progress = moving ?. progress as { done :number ; total :number ; file :string ; group :string ; index :number ; count :number ; secondsLeft :number ; sameDrive :boolean } | null | undefined ; 149const percent = progress && progress . total > 0 ?Math . round (( progress . done / progress . total ) * 100 ) :0 ; 150const planNames = useMemo (() => ( plan ?. models ?? []). map ( m => ({ ...m , label :modelName ( m . group , native ) })). filter ( m => m . label ), [ plan , native ]); 151const savedPlan = useMemo (() => plan , [ plan ]); 152 153return <> 154< section className = "storage-directory" aria-labelledby = "models-folder-title" > 155< div className = "storage-directory__heading" >< span >< Icon name = "folder" size = { 18 }/>< strong id = "models-folder-title" >{ tr ( 'Models folder' )}</ strong ></ span >< Btn size = "sm" disabled = { ! folder || blocked || pending || !! moving } onClick = {() => void pick ()}>{ tr ( pending && ! plan ?'Waiting for the folder…' :'Change folder' )}</ Btn ></ div > 156< p className = "small muted" >{ tr ( 'Strata saves the big model files here.' )}</ p > 157< code className = "storage-directory__path" >{ folder || tr ( 'Reading model directory…' )}</ code > 158{ free !== null ?< div className = "models-free" >< Bar value = { used } label = { tr ( 'Disk use' )}/>< div className = "models-free__row small" >< span >< strong >{ tr ( '{0} free' , [ gb ( free )])}</ strong > { tr ( 'on this drive' )}</ span >< span className = "muted" >{ tr ( 'Your models use {0}' , [ gb ( usage )])}</ span ></ div ></ div > :null } 159{ blocked && ! moving ?< p className = "small muted" >{ tr ( 'Finish or stop the download to change the folder.' )}</ p > :null } 160{ typing ?< form className = "storage-directory__edit" onSubmit = { e => { e . preventDefault (); if ( typed . trim ()) void pick ( typed . trim ()); }}> 161< label htmlFor = "models-folder-path" className = "small" >{ tr ( 'Directory path' )}</ label > 162< input id = "models-folder-path" className = "st-input" value = { typed } onChange = { e => setTyped ( e . target . value )} placeholder = { tr ( 'Full path to an existing folder' )} spellCheck = { false } autoFocus /> 163< div className = "row" >< Btn variant = "primary" type = "submit" disabled = { pending || ! typed . trim ()}>{ tr ( 'Use this directory' )}</ Btn ></ div > 164</ form > :null } 165{ unfinished && ! moving ?< div className = "models-notice models-notice--info" role = "alert" >< Icon name = "info" size = { 18 }/>< div > 166< strong >{ tr ( 'A move was interrupted. Finish it or leave it.' )}</ strong >< br /> 167{ tr ( 'Strata was moving your models from {0} to {1} when it stopped. Nothing is lost.' , [ unfinished . from , unfinished . to ])} 168< p className = "small muted" >{ tr ( 'Finishing puts all your models in {1}. Leaving it keeps them in {0} and removes the partial copies from {1}.' , [ unfinished . from , unfinished . to ])}</ p > 169< div className = "row" >< Btn variant = "primary" size = "sm" disabled = { pending || blocked } onClick = {() => void finishMove ()}>{ tr ( 'Finish the move' )}</ Btn >< Btn size = "sm" disabled = { pending || blocked } onClick = {() => void leaveMove ()}>{ tr ( 'Leave it' )}</ Btn ></ div > 170</ div ></ div > :null } 171{ notice ?< p className = "small storage-directory__notice" role = "status" >< Icon name = "check" size = { 15 }/>{ notice }</ p > :null } 172{ error && ! stage ?< Failure message = { error . message } details = { error . details }/> :null } 173</ section > 174 175< Dialog className = "models-dialog" open = { stage === 'issue' && !! plan ?. issue } compact title = { tr ( plan ?. issue ?. code === 'not_found' ?"That folder isn't there" :"That folder can't be used" )} onClose = { leave } 176actions = {<>{ plan ?. issue ?. code === 'not_found' ?null :< Btn onClick = { leave }>{ tr ( 'Cancel' )}</ Btn >}< Btn variant = "primary" onClick = {() => { leave (); void pick (); }}>{ tr ( 'Choose another folder' )}</ Btn ></>}> 177{ plan ?. issue ?< Failure message = { plan . issue . message } details = { plan . issue . details } 178next = { plan . issue . code === 'not_writable' ?'Choose a folder you own, for example one in Documents or on another drive.' :plan . issue . code === 'not_found' ?'Check that the drive is plugged in, then pick the folder again. Your models were not touched.' :undefined }/> :null } 179</ Dialog > 180 181< Dialog className = "models-dialog" open = { stage === 'drive' && !! plan } compact title = { tr ( 'Use this folder for your models?' )} onClose = { leave } 182actions = {<>< Btn onClick = { leave }>{ tr ( 'Cancel' )}</ Btn >< Btn variant = "primary" onClick = {() => setStage ( 'choose' )}>{ tr ( 'Continue' )}</ Btn ></>}> 183{ plan ?<> 184< div className = "models-picked" >< span className = "small muted" >{ tr ( 'New folder' )}</ span >< code className = "storage-directory__path" >{ plan . shown }</ code >< span className = "small muted" >{ tr ( '{0} free on this drive' , [ gb ( plan . free_bytes )])}</ span ></ div > 185< div className = "models-notice models-notice--info" >< Icon name = "info" size = { 18 }/>< div >{ tr ( 'You picked the whole drive {0}. Strata keeps its files in a folder of their own, so your models go in {1}.' , [ plan . picked , plan . shown ])}</ div ></ div > 186< p className = "small muted" >{ tr ( 'The three choices come next.' )}</ p > 187</> :null } 188</ Dialog > 189 190< Dialog className = "models-dialog" open = { stage === 'choose' && !! plan } title = { tr ( 'Use this folder for your models?' )} onClose = {() => { if ( ! pending ) leave (); }} 191actions = { plan ?<>{ plan . choices . move . possible ?< Btn disabled = { pending } onClick = { leave }>{ tr ( 'Cancel' )}</ Btn > :< Btn disabled = { pending } onClick = {() => { leave (); void pick (); }}>{ tr ( 'Choose another folder' )}</ Btn >}< Btn variant = "primary" disabled = { pending } onClick = {() => void start ()}>{ tr ( pending ?'Working…' :choice === 'move' ?'Move my models' :choice === 'keep' ?'Use both folders' :'Start empty' )}</ Btn ></> :null }> 192{ plan ?< ChooseBody plan = { plan } choice = { choice } setChoice = { setChoice } names = { planNames } error = { error }/> :null } 193</ Dialog > 194 195< Dialog className = "models-dialog" open = { !! moving && ! outcome } compact noClose title = { tr ( 'Moving your models' )} onClose = {() => undefined } 196actions = {< Btn disabled = { stopping } onClick = {() => void stop ()}>{ tr ( stopping ?'Stopping…' :'Stop moving' )}</ Btn >}> 197< div className = "models-free" >< Bar value = { percent } label = { tr ( 'Progress' )}/>< div className = "models-free__row small" >< span >< strong >{ tr ( '{0} of {1} GB' , [ progress ?( progress . done / 1e9 >= 10 ?Math . round ( progress . done / 1e9 ) :( progress . done / 1e9 ). toFixed ( 1 )) :0 , Math . round (( progress ?. total ?? 0 ) / 1e9 )])}</ strong ></ span >< span className = "muted" >{ progress && ! progress . sameDrive ?timeLeft ( progress . secondsLeft ) :null }</ span ></ div ></ div > 198< p className = "small" >{ tr ( 'Keep Strata open. You can keep using other apps. Your models cannot be loaded until the move is done.' )}</ p > 199{ progress ?< details className = "models-details" >< summary >{ tr ( 'Details' )}</ summary >< ul > 200< li >{ tr ( 'Now copying: {0}, file {1} of {2}' , [ modelName ( progress . group , native ) ?? progress . group , progress . index , progress . count ])}</ li > 201< li >{ tr ( 'From {0} to {1}' , [ savedPlan ?. current ?? resumed ?. from ?? '' , savedPlan ?. folder ?? resumed ?. to ?? '' ])}</ li ></ ul ></ details > :null } 202</ Dialog > 203 204< ResultDialog outcome = { outcome ?. job ?? null } plan = { savedPlan } native = { native } onClose = { closeResult } onAgain = {() => { closeResult (); void pick (); }}/> 205</>; 206} 207 208function ChooseBody ({ plan, choice, setChoice, names, error} :{ plan :Plan ; choice :Choice ; setChoice :( c :Choice ) => void ; names :( Plan [ 'models' ][ number ] & { label :string | null })[]; error :{ message :string ; details ?:string } | null }) { 209const none = plan . models_bytes === 0 ; 210const short = ! none && ! plan . choices . move . possible ; 211const lacking = Math . max ( 0 , plan . needed_bytes - plan . free_bytes ); 212const options :{ id :Choice ; title :string ; text :string ; need :string }[] = [ 213{ id :'move' , title :'Move my models there' , text :none ?'You have no models to move.' :plan . same_drive ?'Strata moves your {0} of models to the new folder. This is the same drive, so it takes a moment.' :'Strata copies your {0} of models to the new folder, checks them, then removes the old copies.' , 214need :none ?'' :plan . same_drive ?'Needs no extra space.' :'Needs {0} free in the new folder. You have {1}.' }, 215{ id :'keep' , title :'Keep them where they are and also use the new folder' , text :'Nothing is copied. Your current models keep working, and new downloads go to the new folder.' , need :short ?'Needs no space now. New downloads must fit in {1}.' :'Needs no space now.' }, 216{ id :'empty' , title :'Start empty' , text :'Strata uses the new folder from now on and does not list your current models. Your old files are not deleted.' , need :'Needs no space now. Each model you download later needs its own space.' }, 217]; 218const values = [ gb ( plan . models_bytes ), gb ( plan . free_bytes )]; 219const running = plan . running > 0 ; 220return <> 221< div className = "models-picked" >< span className = "small muted" >{ tr ( 'New folder' )}</ span >< code className = "storage-directory__path" >{ plan . shown }</ code >< span className = "small muted" >{ tr ( '{0} free on this drive' , [ gb ( plan . free_bytes )])}</ span ></ div > 222{ short ?< div className = "models-notice models-notice--warn" role = "alert" >< Icon name = "warning" size = { 18 }/>< div >< strong >{ tr ( 'Your models need {0}, this drive has {1} free.' , [ gb ( plan . needed_bytes ), gb ( plan . free_bytes )])}</ strong >< br />{ tr ( 'Free up about {0} there, pick another folder, or choose one of the other two options.' , [ gb ( lacking )])}</ div ></ div > :null } 223< fieldset className = "models-choices" aria-label = { tr ( 'What should happen to your models' )}> 224{ options . map ( o => { const possible = plan . choices [ o . id ]. possible ; return < label className = "models-choice" key = { o . id } data-disabled = { ! possible || undefined }> 225< input type = "radio" name = "models-folder-choice" checked = { choice === o . id } disabled = { ! possible } onChange = {() => setChoice ( o . id )}/> 226< span >< strong >{ tr ( o . title )}</ strong >{ o . id === 'move' && possible && ! none ?< span className = "models-choice__tag" >{ tr ( 'Recommended' )}</ span > :null }< br />< span className = "small" >{ tr ( o . text , o . id === 'move' ?[ gb ( plan . models_bytes )] :undefined )}</ span ></ span > 227{ o . need ?< span className = "models-choice__need" >{ tr ( o . need , o . id === 'move' ?[ gb ( plan . needed_bytes ), gb ( plan . free_bytes )] :[ values [ 0 ], values [ 1 ]])}</ span > :null } 228</ label >; })} 229</ fieldset > 230{ running ?< p className = "small muted" >{ tr ( 'A running model is stopped first; load it again when the move is done.' )}</ p > :null } 231{ error ?< Failure message = { error . message } details = { error . details }/> :null } 232< details className = "models-details" >< summary >{ tr ( 'Details' )}</ summary >< ul > 233{ names . length ?< li >{ tr ( '{0} would move.' , [ list ( names . map ( m => ` ${ m . label } , ${ gb ( m . bytes )} ` ))])}</ li > :null } 234{ short ?< li >{ tr ( 'Free space is measured on the drive that holds {0}.' , [ plan . shown ])}</ li > :<> 235< li >{ tr ( 'Old folder: {0}' , [ plan . current ])}</ li > 236< li >{ tr ( 'Strata copies one file at a time and checks its size before it removes the old one.' )}</ li > 237< li >{ tr ( 'You can stop at any time; files already moved stay usable.' )}</ li ></>} 238</ ul ></ details > 239</>; 240} 241 242function ResultDialog ({ outcome, plan, native, onClose, onAgain} :{ outcome :NativeJob | null ; plan :Plan | null ; native :NativeState | null ; onClose :() => void ; onAgain :() => void }) { 243if ( ! outcome ) return null ; 244const result = ( outcome . result ?? {}) as Outcome ; 245const sized = ( groups :string []) => list ( groups . map ( g => { const m = plan ?. models . find ( x => x . group === g ); const name = modelName ( g , native ); return name ?( m ?` ${ name } ( ${ gb ( m . bytes )} )` :name ) :null ; }). filter (( x ) :x isstring => !! x )); 246if ( outcome . state === 'error' ) { 247const full = result . code === 'disk_full' ; 248const where = driveOf ( result . to ?? '' ); 249const some = ( result . moved ?. length ?? 0 ) > 0 ; 250return < Dialog open compact title = { tr ( full ?'The drive ran out of space' :'The move stopped' )} onClose = { onClose } 251actions = {<>< Btn onClick = { onClose }>{ tr ( 'Close' )}</ Btn >< Btn variant = "primary" onClick = { onAgain }>{ tr ( 'Choose another folder' )}</ Btn ></>}> 252< div className = "error-notice" role = "alert" >< Icon name = "error" size = { 18 }/>< div > 253< strong >{ full ?tr ( '{0} filled up after {1}, so the move stopped.' , [ where , gb ( result . bytes ?? 0 )]) :tr ( outcome . error ?? 'The models could not be moved.' )}</ strong > 254< p >{ full ?( some ?tr ( 'Nothing was lost. Models already moved are in the new folder, the rest are still in {0}, and the half-copied file was removed. Free up space on {1} or choose another folder, then try again.' , [ result . from ?? '' , where ]) 255 :tr ( 'Nothing was lost. All your models are still in {0}, and the half-copied file was removed. Free up space on {1} or choose another folder, then try again.' , [ result . from ?? '' , where ])) 256 :tr ( 'Nothing was lost. Your models that were not moved are still in {0}. Choose another folder to try again.' , [ result . from ?? '' ])}</ p > 257{ outcome . details ?< details className = "error-detail" >< summary className = "small" >{ tr ( 'Details' )}</ summary >< pre className = "small muted" >{ outcome . details }</ pre ></ details > :null } 258</ div ></ div > 259</ Dialog >; 260} 261if ( result . stopped ) { 262const moved = sized ( result . moved ?? []), left = sized ( result . remaining ?? []); 263return < Dialog open compact title = { tr ( 'Moving stopped' )} onClose = { onClose } actions = {< Btn variant = "primary" onClick = { onClose }>{ tr ( 'Close' )}</ Btn >}> 264< div className = "models-notice models-notice--info" >< Icon name = "info" size = { 18 }/>< div >< strong >{ tr ( 'Nothing was lost.' )}</ strong >< br /> 265{ moved ?tr ( '{0} is in the new folder.' , [ moved ]) + ' ' :'' }{ left ?tr ( '{0} is still in the old folder.' , [ left ]) + ' ' :'' }{ moved && left ?tr ( 'Both work.' ) :'' }</ div ></ div > 266< p className = "small muted" >{ tr ( 'Models in both folders are listed as normal. You can finish moving later with Change folder.' )}</ p > 267</ Dialog >; 268} 269return < Dialog open compact title = { tr ( 'Your models are moved' )} onClose = { onClose } actions = {< Btn variant = "primary" onClick = { onClose }>{ tr ( 'Done' )}</ Btn >}> 270< div className = "models-ok" >< span className = "models-ok__mark" >< Icon name = "check" size = { 20 }/></ span >< div >< strong >{(() => { const [ before , after ] = tr ( '{0} now live in {1}' , [ gb ( result . total ?? 0 ), '@@' ]). split ( '@@' ); return <>{ before }< code className = "models-path" >{ plan ?. shown ?? result . to ?? '' }</ code >{ after }</>; })()}</ strong > 271{ result . sameDrive ?null :<>< br />< span className = "small muted" >{ tr ( 'The old copies were removed and {0} is free again on {1}.' , [ gb ( result . total ?? 0 ), driveOf ( result . from ?? '' )])}</ span ></>}</ div ></ div > 272</ Dialog >; 273}