feat(tool): Add ability to view all open PRs for repos other than freeCodeCamp in the Dashboard app (#40453)
* feat: show open boilerplate prs on dashboard fix: rest of boilerplate server changes fix: more fix: other * fix: update lib functions * fix: retrofitted one-off scripts * feat: added rateLimit for requests * fix: reduce time * fix: put limiter inside each route * fix: make client show when rated limited * fix: removed unused probot from app * fix: renamed folders * fix: consolidate config.js and constants.js * chore: update octokit to latest version * fix: remove invalid file * fix: refactored update-db.js * feat: add fcc logo * fix: logo url * fix: remove Home link * fix: change link colors * fix: added rate limiter to landing page * fix: ran npm install in client to create package-lock.json * fix: correct typo in doc Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> * fix: Replace favicon, Gitter => Discord Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> * fix: add extra linting guidance to package.json * Ignore contributor app Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> * fix: revert linting rules for client * fix: add skip_preflight_check=true for tests Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Kris Koishigawa <scissorsneedfoodtoo@gmail.com> Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import ListItem from './ListItem';
|
||||
import FullWidthDiv from './FullWidthDiv';
|
||||
import Result from './Result';
|
||||
|
||||
const List = styled.div`
|
||||
margin: 5px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
`;
|
||||
|
||||
const filenameTitle = { fontWeight: '600' };
|
||||
|
||||
const FilenameResults = ({ searchValue, results, rateLimitMessage }) => {
|
||||
const elements = results.map(result => {
|
||||
const { filename, prs: prObjects } = result;
|
||||
const prs = prObjects.map(({ number, username, title }, index) => {
|
||||
return <ListItem number={number} username={username} prTitle={title} />;
|
||||
});
|
||||
|
||||
const fileOnMaster = `https://github.com/freeCodeCamp/freeCodeCamp/blob/master/${filename}`;
|
||||
return (
|
||||
<Result key={filename}>
|
||||
<span style={filenameTitle}>{filename}</span>{' '}
|
||||
<a href={fileOnMaster} rel="noopener noreferrer" target="_blank">
|
||||
(File on Master)
|
||||
</a>
|
||||
<List>{prs}</List>
|
||||
</Result>
|
||||
);
|
||||
});
|
||||
const showResults = () => {
|
||||
if (!rateLimitMessage) {
|
||||
return (results.length ? <h3>Results for: {searchValue}</h3> : null) && elements;
|
||||
} else {
|
||||
return rateLimitMessage;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<FullWidthDiv>
|
||||
{showResults()}
|
||||
</FullWidthDiv>
|
||||
);
|
||||
};
|
||||
|
||||
export default FilenameResults;
|
Reference in New Issue
Block a user