file type is submodule , but submodule_git_url is null

This commit is contained in:
caishi 2023-03-17 10:46:14 +08:00
parent bbfb4ea8bd
commit f0e74326ac
1 changed files with 16 additions and 6 deletions

View File

@ -29,12 +29,22 @@ function CoderDepotCatalogue({item , goToSubRoot , owner , projectsId , platform
<span><i className={`iconfont ${typeIco[`${item.type}`]} mr8`}></i>{item.name}</span>
:
(item.type === "submodule" ?
<React.Fragment>
<a href={`${item.submodule_git_url.slice(0,item.submodule_git_url.length-4)}`} target="_self">
<i className={`iconfont ${typeIco[`${item.type}`]} mr8`}></i>{item.name}
</a>
<span className="ml2">@</span><a href={`${item.submodule_git_url.slice(0,item.submodule_git_url.length-4)}/commits/${truncateCommitId(item.sha)}`} title={item.sha}>{truncateCommitId(item.sha)}</a>
</React.Fragment>
(
item.submodule_git_url ?
<React.Fragment>
<a href={`${item.submodule_git_url.slice(0,item.submodule_git_url.length-4)}`} target="_self">
<i className={`iconfont ${typeIco[`${item.type}`]} mr8`}></i>{item.name}
</a>
<span className="ml2">@</span>
<a href={`${item.submodule_git_url.slice(0,item.submodule_git_url.length-4)}/commits/${truncateCommitId(item.sha)}`} title={item.sha}>{truncateCommitId(item.sha)}</a>
</React.Fragment>
:
<React.Fragment>
<i className={`iconfont ${typeIco[`${item.type}`]} mr8`}></i>{item.name}
<span className="ml2">@</span>
<span title={item.sha}>{truncateCommitId(item.sha)}</span>
</React.Fragment>
)
:
<a onClick={()=>goToSubRoot(item.path,item.type,item.name)}>
<i className={`iconfont ${typeIco[`${item.type}`]} mr8`}></i>{item.name}