-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
杨国璇
authored and
杨国璇
committed
Aug 6, 2024
1 parent
060f34a
commit 0832df8
Showing
13 changed files
with
114 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,49 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import LibDetail from './lib-details'; | ||
import DirentDetail from './dirent-details'; | ||
|
||
import './index.css'; | ||
import ObjectUtils from '../../metadata/metadata-view/utils/object-utils'; | ||
|
||
export { | ||
LibDetail, | ||
DirentDetail, | ||
const Index = React.memo(({ repoID, path, dirent, currentRepoInfo, repoTags, fileTags, onClose, onFileTagChanged }) => { | ||
|
||
if (path === '/' && !dirent) { | ||
return ( | ||
<LibDetail currentRepoInfo={currentRepoInfo} onClose={onClose} /> | ||
); | ||
} | ||
return ( | ||
<DirentDetail | ||
repoID={repoID} | ||
path={path} | ||
dirent={dirent} | ||
currentRepoInfo={currentRepoInfo} | ||
repoTags={repoTags} | ||
fileTags={fileTags} | ||
onFileTagChanged={onFileTagChanged} | ||
onClose={onClose} | ||
/> | ||
); | ||
}, (props, nextProps) => { | ||
const isChanged = props.repoID !== nextProps.repoID || | ||
props.path !== nextProps.path || | ||
!ObjectUtils.isSameObject(props.dirent, nextProps.dirent) || | ||
!ObjectUtils.isSameObject(props.currentRepoInfo, nextProps.currentRepoInfo) || | ||
JSON.stringify(props.repoTags || []) !== JSON.stringify(nextProps.repoTags || []) || | ||
JSON.stringify(props.fileTags || []) !== JSON.stringify(nextProps.fileTags || []); | ||
return !isChanged; | ||
}); | ||
|
||
Index.propTypes = { | ||
repoID: PropTypes.string, | ||
path: PropTypes.string, | ||
dirent: PropTypes.object, | ||
currentRepoInfo: PropTypes.object, | ||
repoTags: PropTypes.array, | ||
fileTags: PropTypes.array, | ||
onClose: PropTypes.func, | ||
onFileTagChanged: PropTypes.func, | ||
}; | ||
|
||
export default Index; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.