-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Build Stats #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat: Build Stats #105
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,68 @@ | ||||||
import React from 'react'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all components should be inside the outer components folder. I'd say this component is an organism, so place it inside |
||||||
import Build from '../../types/build'; | ||||||
import Panel from '../common/uiLibrary/panel'; | ||||||
import { FaArrowUp, FaWrench } from 'react-icons/fa'; | ||||||
import { FaCirclePlus } from "react-icons/fa6"; | ||||||
import Card from '../../components/mocules/Card'; | ||||||
import SmallNoteText from '../../components/mocules/SmallNoteText'; | ||||||
|
||||||
interface BuildStatsProps { | ||||||
builds: Build[]; | ||||||
} | ||||||
|
||||||
const BuildStatsComponent: React.FC<BuildStatsProps> = ({ builds }) => { | ||||||
const recentBuilds = builds.slice(0, 150); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 150 is a big slice, isn't it? |
||||||
|
||||||
const stats = recentBuilds.reduce((acc, build) => { | ||||||
build.changes.forEach(change => { | ||||||
switch (change.category) { | ||||||
case 'NEW': | ||||||
acc.additions++; | ||||||
break; | ||||||
case 'IMPROVEMENT': | ||||||
acc.improvements++; | ||||||
break; | ||||||
case 'FIX': | ||||||
acc.fixes++; | ||||||
break; | ||||||
default: | ||||||
break; | ||||||
} | ||||||
}); | ||||||
return acc; | ||||||
}, { additions: 0, improvements: 0, fixes: 0 }); | ||||||
|
||||||
return ( | ||||||
<Panel> | ||||||
<h3 className="text-xl font-bold mb-4 text-white">Recent Build Statistics</h3> | ||||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4"> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
there is an awkward transition if you test how responsive is this new component where the 3 cols are not big enough for the text |
||||||
<Card> | ||||||
<FaCirclePlus className="text-green-500 text-2xl mr-3" /> | ||||||
<div> | ||||||
<p className="text-gray-300 text-sm">Additions</p> | ||||||
<p className="text-white text-xl font-bold">{stats.additions}</p> | ||||||
</div> | ||||||
</Card> | ||||||
|
||||||
<Card> | ||||||
<FaArrowUp className="text-blue-600 text-2xl mr-3" /> | ||||||
<div> | ||||||
<p className="text-gray-300 text-sm">Improvements</p> | ||||||
<p className="text-white text-xl font-bold">{stats.improvements}</p> | ||||||
</div> | ||||||
</Card> | ||||||
|
||||||
<Card> | ||||||
<FaWrench className="text-orange-600 text-2xl mr-3" /> | ||||||
<div> | ||||||
<p className="text-gray-300 text-sm">Bug Fixes</p> | ||||||
<p className="text-white text-xl font-bold">{stats.fixes}</p> | ||||||
</div> | ||||||
</Card> | ||||||
</div> | ||||||
<SmallNoteText text={`Stats are based on the past ${recentBuilds.length} builds that were pushed onto our staging server from upstream.`} /> | ||||||
</Panel> | ||||||
); | ||||||
}; | ||||||
|
||||||
export default BuildStatsComponent; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import Panel from '../common/uiLibrary/panel'; | ||
import { FaTag } from 'react-icons/fa'; | ||
import Card from '../../components/mocules/Card'; | ||
import SmallNoteText from '../../components/mocules/SmallNoteText'; | ||
|
||
interface ReleaseInfo { | ||
version: string; | ||
commitSha: string; | ||
} | ||
|
||
interface LatestReleaseComponentProps { | ||
releaseInfo: ReleaseInfo; | ||
} | ||
|
||
const LatestReleaseComponent: React.FC<LatestReleaseComponentProps> = ({ releaseInfo }) => { | ||
return ( | ||
<Panel> | ||
<h3 className="text-xl font-bold mb-4 text-white">Latest Code-Scan Release</h3> | ||
<Card> | ||
<FaTag className="text-purple-500 text-2xl mr-3" /> | ||
<div> | ||
<p className="text-white text-xl font-bold">{releaseInfo.version}</p> | ||
<p className="text-gray-300 text-sm">Commit: {releaseInfo.commitSha.substring(0, 7)}</p> | ||
</div> | ||
</Card> | ||
<SmallNoteText text="To keep our players safe, we only allow whitelisted code to be run on clients that are scanned and opened via stationhub." /> | ||
</Panel> | ||
); | ||
}; | ||
|
||
export default LatestReleaseComponent; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, { ReactNode } from 'react'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mocules? |
||
|
||
interface CardProps { | ||
children: ReactNode; | ||
} | ||
|
||
const Card: React.FC<CardProps> = ({ children }) => { | ||
return ( | ||
<div className="flex items-center p-4 bg-gray-800 rounded-lg"> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Card; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
|
||
interface SmallNoteTextProps { | ||
text: string; | ||
} | ||
|
||
const SmallNoteText: React.FC<SmallNoteTextProps> = ({ text }) => { | ||
return ( | ||
<p className="text-gray-400 text-sm mt-4">{text}</p> | ||
); | ||
}; | ||
|
||
export default SmallNoteText; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you forgot to rebase. This commmit already exists