Refactor and add doc level comments
This commit is contained in:
parent
0d915eccc4
commit
daa759a066
4 changed files with 35 additions and 17 deletions
|
@ -14,6 +14,12 @@ interface ISidebar {
|
|||
repository: Object
|
||||
}
|
||||
|
||||
/**
|
||||
* The Component for the sidebar of the repo page
|
||||
* @param {string} isPublic - A string that states whether the repository is private or public
|
||||
* @param {tag} tags - The list of tags for the repository
|
||||
* @param {object} repository - The list of properties for the repository
|
||||
*/
|
||||
class repoSidebar extends React.Component<ISidebar, {}> {
|
||||
static propTypes = {
|
||||
isPublic: React.PropTypes.string.isRequired,
|
||||
|
@ -27,16 +33,18 @@ class repoSidebar extends React.Component<ISidebar, {}> {
|
|||
let badgeIcon: string = (this.props.isPublic) ? "rp-badge__icon--public" : "rp-badge__icon--private";
|
||||
let repository: any = this.props.repository;
|
||||
let sharing: string = repository.company || repository.namespace;
|
||||
for (let t in this.props.tags){
|
||||
sortedTags.push(
|
||||
{
|
||||
name: this.props.tags[t].name,
|
||||
lastModified: Date.parse(this.props.tags[t].last_modified)
|
||||
}
|
||||
);
|
||||
|
||||
for (let tagObject in this.props.tags) {
|
||||
sortedTags.push({
|
||||
name: this.props.tags[tagObject].name,
|
||||
lastModified: Date.parse(this.props.tags[tagObject].last_modified)
|
||||
});
|
||||
}
|
||||
|
||||
sortedTags = sortedTags.sort(function(a,b){return a.lastModified - b.lastModified});
|
||||
sortedTags = sortedTags.sort(function(a, b) {
|
||||
return a.lastModified - b.lastModified;
|
||||
});
|
||||
|
||||
sortedTags.forEach(function(el, i){
|
||||
tagRows.push(
|
||||
<tr>
|
||||
|
|
Reference in a new issue