function ProgressSyncStatus({userId}) { const [state,setState]=React.useState(()=>window.ProgressSync.getStatus(userId)); React.useEffect(()=>{ setState(window.ProgressSync.getStatus(userId)); const update=event=>{if(event.detail.userId===String(userId))setState(event.detail);}; window.addEventListener('tb:progress-sync',update); return ()=>window.removeEventListener('tb:progress-sync',update); },[userId]); return
{state.message} {['pending','error'].includes(state.state) && }
; }