File size: 1,079 Bytes
ecb2a3f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import React from 'react';
export default function RefreshNotice({errors=[],block,refreshing,onRetry,onAccount,onPersonal,showAccess=true}){
if(errors.length)return <div className="error" role="alert">
Some information could not be updated: {errors.join(', ')}. Check the connection and try again. Shown results may be out of date.{' '}
<button className="text-button" disabled={refreshing} aria-busy={refreshing} onClick={onRetry}>{refreshing?'Refreshing…':'Retry refresh'}</button>
</div>;
if(!block||!showAccess)return null;
return <div className={block.failed?'error':'note'} role={block.failed?'alert':'status'}>
<div>{block.reason}{' '}
{block.action==='account'&&<button className="text-button" onClick={onAccount}>Open Staff workspace</button>}
{block.action==='personal'&&<button className="text-button" onClick={onPersonal}>Switch to Personal Workspace</button>}
{block.retry&&<button className="text-button" disabled={refreshing} aria-busy={refreshing} onClick={onRetry}>{refreshing?'Refreshing…':'Retry refresh'}</button>}
</div>
</div>;
}
|