diff --git a/frontend/frontend/src/components/Home/StatsLayoutSection.js b/frontend/frontend/src/components/Home/StatsRankSection.js similarity index 85% rename from frontend/frontend/src/components/Home/StatsLayoutSection.js rename to frontend/frontend/src/components/Home/StatsRankSection.js index bee5c8eb..e7eee41c 100644 --- a/frontend/frontend/src/components/Home/StatsLayoutSection.js +++ b/frontend/frontend/src/components/Home/StatsRankSection.js @@ -11,7 +11,7 @@ export const DEFAULT_OPTION = { value: 'default', }; -const StatsLayoutSection = ({ selectedOption, setSelectedOption }) => { +const StatsRankSection = ({ selectedOption, setSelectedOption }) => { const options = [ DEFAULT_OPTION, { id: 2, label: 'Percentile', disabled: false, value: 'percentile' }, @@ -31,9 +31,9 @@ const StatsLayoutSection = ({ selectedOption, setSelectedOption }) => { ); }; -StatsLayoutSection.propTypes = { +StatsRankSection.propTypes = { selectedOption: PropTypes.object.isRequired, setSelectedOption: PropTypes.func.isRequired, }; -export default StatsLayoutSection; +export default StatsRankSection; diff --git a/frontend/frontend/src/pages/Home/Home.js b/frontend/frontend/src/pages/Home/Home.js index 4144ad5f..6ba2fbc8 100644 --- a/frontend/frontend/src/pages/Home/Home.js +++ b/frontend/frontend/src/pages/Home/Home.js @@ -15,7 +15,7 @@ import { authenticate } from '../../api'; import { login as _login } from '../../redux/actions/userActions'; import { HOST } from '../../constants'; import { CardTypes } from '../../utils'; -import { DEFAULT_OPTION as STATS_DEFAULT_LAYOUT } from '../../components/Home/StatsLayoutSection'; +import { DEFAULT_OPTION as STATS_DEFAULT_RANK } from '../../components/Home/StatsRankSection'; import { DEFAULT_OPTION as LANGUAGES_DEFAULT_LAYOUT } from '../../components/Home/LanguagesLayoutSection'; import { DEFAULT_OPTION as WAKATIME_DEFAULT_LAYOUT } from '../../components/Home/WakatimeLayoutSection'; @@ -39,8 +39,8 @@ const HomeScreen = () => { const [imageSrc, setImageSrc] = useState(`?&username=${userId}`); // for stage two - const [selectedStatsLayout, setSelectedStatsLayout] = - useState(STATS_DEFAULT_LAYOUT); + const [selectedStatsRank, setSelectedStatsRank] = + useState(STATS_DEFAULT_RANK); const [selectedLanguagesLayout, setSelectedLanguagesLayout] = useState( LANGUAGES_DEFAULT_LAYOUT, ); @@ -53,7 +53,9 @@ const HomeScreen = () => { const [descriptionLines, setDescriptionLines] = useState(); const [customTitle, setCustomTitle] = useState(''); const [langsCount, setLangsCount] = useState(); + const [showAllStats, setShowAllStats] = useState(false); const [showIcons, setShowIcons] = useState(false); + const [includeAllCommits, setIncludeAllCommits] = useState(false); const [enableAnimations, setEnableAnimations] = useState(true); const [usePercent, setUsePercent] = useState(false); @@ -84,8 +86,8 @@ const HomeScreen = () => { let fullSuffix = `${imageSrc}`; - if (selectedStatsLayout !== STATS_DEFAULT_LAYOUT) { - fullSuffix += `&rank_icon=${selectedStatsLayout.value}`; + if (selectedStatsRank !== STATS_DEFAULT_RANK) { + fullSuffix += `&rank_icon=${selectedStatsRank.value}`; } if (selectedLanguagesLayout !== LANGUAGES_DEFAULT_LAYOUT) { @@ -117,10 +119,18 @@ const HomeScreen = () => { fullSuffix += `&langs_count=${langsCount}`; } + if (showAllStats) { + fullSuffix += `&show=reviews,discussions_started,discussions_answered,prs_merged,prs_merged_percentage,prs_commented,prs_reviewed,issues_commented`; + } + if (showIcons) { fullSuffix += `&show_icons=true`; } + if (includeAllCommits) { + fullSuffix += `&include_all_commits=true`; + } + if (!enableAnimations) { fullSuffix += `&disable_animations=${!enableAnimations}`; } @@ -226,8 +236,8 @@ const HomeScreen = () => { { setCustomTitle={setCustomTitle} langsCount={langsCount} setLangsCount={setLangsCount} + showAllStats={showAllStats} + setShowAllStats={setShowAllStats} showIcons={showIcons} setShowIcons={setShowIcons} + includeAllCommits={includeAllCommits} + setIncludeAllCommits={setIncludeAllCommits} enableAnimations={enableAnimations} setEnableAnimations={setEnableAnimations} usePercent={usePercent} diff --git a/frontend/frontend/src/pages/Home/stages/Customize.js b/frontend/frontend/src/pages/Home/stages/Customize.js index a167b19e..ed132c13 100644 --- a/frontend/frontend/src/pages/Home/stages/Customize.js +++ b/frontend/frontend/src/pages/Home/stages/Customize.js @@ -5,14 +5,14 @@ import { CheckboxSection, Image } from '../../../components'; import { CardTypes } from '../../../utils'; import TextSection from '../../../components/Home/TextSection'; import NumericSection from '../../../components/Home/NumericSection'; -import StatsLayoutSection from '../../../components/Home/StatsLayoutSection'; +import StatsRankSection from '../../../components/Home/StatsRankSection'; import LanguagesLayoutSection from '../../../components/Home/LanguagesLayoutSection'; import WakatimeLayoutSection from '../../../components/Home/WakatimeLayoutSection'; const CustomizeStage = ({ selectedCard, - selectedStatsLayout, - setSelectedStatsLayout, + selectedStatsRank, + setSelectedStatsRank, selectedLanguagesLayout, setSelectedLanguagesLayout, selectedWakatimeLayout, @@ -29,6 +29,10 @@ const CustomizeStage = ({ setLangsCount, showIcons, setShowIcons, + showAllStats, + setShowAllStats, + includeAllCommits, + setIncludeAllCommits, enableAnimations, setEnableAnimations, usePercent, @@ -71,9 +75,9 @@ const CustomizeStage = ({ /> )} {cardType === CardTypes.STATS && ( - )} {cardType === CardTypes.TOP_LANGS && ( @@ -136,6 +140,24 @@ const CustomizeStage = ({ setVariable={setShowIcons} /> )} + {cardType === CardTypes.STATS && ( + + )} + {cardType === CardTypes.STATS && ( + + )}
@@ -148,8 +170,8 @@ const CustomizeStage = ({ CustomizeStage.propTypes = { selectedCard: PropTypes.string.isRequired, - selectedStatsLayout: PropTypes.object.isRequired, - setSelectedStatsLayout: PropTypes.func.isRequired, + selectedStatsRank: PropTypes.object.isRequired, + setSelectedStatsRank: PropTypes.func.isRequired, selectedLanguagesLayout: PropTypes.object.isRequired, setSelectedLanguagesLayout: PropTypes.func.isRequired, selectedWakatimeLayout: PropTypes.object.isRequired, @@ -166,6 +188,10 @@ CustomizeStage.propTypes = { setLangsCount: PropTypes.func.isRequired, showIcons: PropTypes.bool.isRequired, setShowIcons: PropTypes.func.isRequired, + showAllStats: PropTypes.bool.isRequired, + setShowAllStats: PropTypes.func.isRequired, + includeAllCommits: PropTypes.bool.isRequired, + setIncludeAllCommits: PropTypes.func.isRequired, enableAnimations: PropTypes.bool.isRequired, setEnableAnimations: PropTypes.func.isRequired, usePercent: PropTypes.bool.isRequired,