Fix google transfer ownership popup priority

Only show alertOwnershipToTransfer if:

1) current user is logged in
2) brew actually has authors
3) current user is not author[0]

In all other cases, it should prompt to log in with a google account instead.
This commit is contained in:
Trevor Buckner
2026-09-09 20:55:30 -04:00
parent 4a884233c1
commit da882d6f00
+4 -5
View File
@@ -160,7 +160,7 @@ const EditPage = (props)=>{
}; };
const handleGoogleClick = ()=>{ const handleGoogleClick = ()=>{
if(global.account !== currentBrew.authors[0]) { if(currentBrew.authors.length > 0 && global.account?.username !== currentBrew.authors[0]) {
setAlertOwnershipToTransfer(true); setAlertOwnershipToTransfer(true);
return; return;
} }
@@ -264,12 +264,11 @@ const EditPage = (props)=>{
<Nav.item className='googleDriveStorage' onClick={handleGoogleClick}> <Nav.item className='googleDriveStorage' onClick={handleGoogleClick}>
<img src={googleDriveIcon} className={saveGoogle ? '' : 'inactive'} alt='Google Drive icon' /> <img src={googleDriveIcon} className={saveGoogle ? '' : 'inactive'} alt='Google Drive icon' />
{alertOwnershipToTransfer && ( {alertOwnershipToTransfer && (
<div className='errorContainer'> <div className='errorContainer'>
You must be the Owner to transfer between the Homebrewery and Google Drive! You must be the Owner to transfer between the Homebrewery and Google Drive!
The owner of this file is {currentBrew.authors[0]} The owner of this file is {currentBrew.authors[0]}.
<br></br>
<div className='confirm' onClick={closeAlerts}> Okay </div> <div className='confirm' onClick={closeAlerts}> Okay </div>
</div> </div>
)} )}