forked from Gitlink/forgeplus-react
38 lines
971 B
JavaScript
38 lines
971 B
JavaScript
import React from 'react';
|
|
import { useState } from 'react';
|
|
import EducoderAccount from '../EducoderAccount';
|
|
|
|
function Profile({
|
|
children,
|
|
sureFunc,
|
|
showCompeleteDialog ,
|
|
completeProfile,
|
|
className ,
|
|
current_user,checkIfLogin,showLoginDialog,showNotification
|
|
}) {
|
|
const [ giteaVisible , setGiteaVisible ] = useState(false);
|
|
|
|
function checkProfile() {
|
|
if(checkIfLogin()){
|
|
if(!current_user.has_gitea_user){
|
|
setGiteaVisible(true);
|
|
}else{
|
|
if(!completeProfile){
|
|
showCompeleteDialog && showCompeleteDialog();
|
|
}else{
|
|
sureFunc();
|
|
}
|
|
}
|
|
}else{
|
|
showLoginDialog();
|
|
}
|
|
}
|
|
|
|
return(
|
|
<React.Fragment>
|
|
<EducoderAccount showNotification={showNotification} visible={giteaVisible} onCancel={()=>setGiteaVisible(false)} current_user={current_user}/>
|
|
<a className={className} onClick={checkProfile}>{children}</a>
|
|
</React.Fragment>
|
|
)
|
|
}
|
|
export default Profile; |