-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into webyourmind/e2eTests
- Loading branch information
Showing
17 changed files
with
1,432 additions
and
98 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) Microsoft Corporation and others. Licensed under the MIT license. | ||
// SPDX-License-Identifier: MIT | ||
|
||
import React, { Component } from 'react' | ||
import { Grid, Row, Col, Jumbotron } from 'react-bootstrap' | ||
import TypeCard from './TypeCard' | ||
import CountUp from 'react-countup' | ||
import { getStats } from '../../../../api/clearlyDefined' | ||
import npm from '../../../../../src/images/n-large.png' | ||
import maven from '../../../../../src/images/maven.png' | ||
import nuget from '../../../../../src/images/nuget.svg' | ||
import pod from '../../../../../src/images/pod.png' | ||
import git from '../../../../../src/images/GitHub-Mark-120px-plus.png' | ||
import crate from '../../../../../src/images/cargo.png' | ||
import gem from '../../../../../src/images/gem.png' | ||
import pypi from '../../../../../src/images/pypi.png' | ||
|
||
export default class PageStats extends Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
totalComponents: 0 | ||
} | ||
} | ||
|
||
async componentDidMount() { | ||
const totalComponents = await getStats('totalcount') | ||
this.setState({ totalComponents: totalComponents.value }) | ||
} | ||
|
||
render() { | ||
return ( | ||
<Grid className="main-container"> | ||
<Row> | ||
<Jumbotron className="text-center" style={{ backgroundColor: '#ecf0f1' }}> | ||
<h2> | ||
<CountUp end={this.state.totalComponents} separator="," /> | ||
</h2> | ||
<p>Number of total definitions</p> | ||
</Jumbotron> | ||
</Row> | ||
<Row> | ||
<div className="card-container"> | ||
<TypeCard type="npm" image={npm} /> | ||
<TypeCard type="maven" image={maven} /> | ||
<TypeCard type="nuget" image={nuget} /> | ||
<TypeCard type="git" image={git} /> | ||
<TypeCard type="pod" image={pod} /> | ||
<TypeCard type="crate" image={crate} /> | ||
<TypeCard type="gem" image={gem} /> | ||
<TypeCard type="pypi" image={pypi} /> | ||
</div> | ||
</Row> | ||
</Grid> | ||
) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { Component } from 'react' | ||
import { UserCard } from 'react-ui-cards' | ||
import { getStats } from '../../../../api/clearlyDefined' | ||
|
||
export default class TypeCard extends Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
totalCount: 0, | ||
averageLicensed: 0, | ||
averageDescribed: 0 | ||
} | ||
} | ||
|
||
async componentDidMount() { | ||
const data = await getStats(this.props.type) | ||
if (!data.value) return | ||
this.setState({ | ||
totalCount: data.value.totalcount, | ||
averageLicensed: Math.round(data.value['avg_licensed.score.total'] * 100) / 100, | ||
averageDescribed: Math.round(data.value['avg_described.score.total'] * 100) / 100 | ||
}) | ||
} | ||
|
||
render() { | ||
return ( | ||
<UserCard | ||
cardClass="float" | ||
header={this.props.image} | ||
name={this.props.type} | ||
positionName={`total count: ${this.state.totalCount}`} | ||
stats={[ | ||
{ | ||
name: 'average licensed score', | ||
value: this.state.averageLicensed | ||
}, | ||
{ | ||
name: 'average described score', | ||
value: this.state.averageDescribed | ||
} | ||
]} | ||
/> | ||
) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './PageStats' |
Oops, something went wrong.