diff --git a/frontend/frontend/src/components/Home/CheckboxSection.js b/frontend/frontend/src/components/Home/CheckboxSection.js index c5bcc0b8..277a3e51 100644 --- a/frontend/frontend/src/components/Home/CheckboxSection.js +++ b/frontend/frontend/src/components/Home/CheckboxSection.js @@ -16,7 +16,7 @@ const CheckboxSection = ({ }) => { return (
-

+ {text &&

} { + setInternalValue(value); + }, [value]); + useEffect(() => { // Debounce setValue if (debounceTimeout.current) { diff --git a/frontend/frontend/src/pages/Home/Home.js b/frontend/frontend/src/pages/Home/Home.js index c75fd11b..35783673 100644 --- a/frontend/frontend/src/pages/Home/Home.js +++ b/frontend/frontend/src/pages/Home/Home.js @@ -106,8 +106,7 @@ const HomeScreen = ({ stage, setStage }) => { fullSuffix += `username=${userId}`; break; case CardTypes.PIN: - fullSuffix += `username=${userId}`; - fullSuffix += `repo=${repo}`; + fullSuffix += `username=${userId}&repo=${repo}`; break; case CardTypes.GIST: fullSuffix += `id=${gist}`; diff --git a/frontend/frontend/src/pages/Home/stages/Customize.js b/frontend/frontend/src/pages/Home/stages/Customize.js index c6a9b1e1..8780fc1f 100644 --- a/frontend/frontend/src/pages/Home/stages/Customize.js +++ b/frontend/frontend/src/pages/Home/stages/Customize.js @@ -8,7 +8,7 @@ import NumericSection from '../../../components/Home/NumericSection'; import StatsRankSection from '../../../components/Home/StatsRankSection'; import LanguagesLayoutSection from '../../../components/Home/LanguagesLayoutSection'; import WakatimeLayoutSection from '../../../components/Home/WakatimeLayoutSection'; -import { DEMO_REPO, DEMO_WAKATIME_USER } from '../../../constants'; +import { DEMO_GIST, DEMO_REPO, DEMO_WAKATIME_USER } from '../../../constants'; import { useIsAuthenticated } from '../../../redux/selectors/userSelectors'; const CustomizeStage = ({ @@ -73,7 +73,7 @@ const CustomizeStage = ({ @@ -98,7 +98,7 @@ const CustomizeStage = ({ title="Repository" description={ <> - Set your GitHub Repo to fetch your stats. + Enter a repository in owner/repo format.
{!isAuthenticated && ( <> @@ -112,20 +112,56 @@ const CustomizeStage = ({ className="underline text-blue-900" > log in - + {' '} to change the repo. )} } - placeholder={`e.g. "${DEMO_REPO}"`} // TODO: example without owner? + placeholder={`e.g. "${DEMO_REPO}"`} value={repo} - setValue={(myRepo) => { - if (myRepo.endsWith('/')) { - myRepo = myRepo.slice(0, -1); + setValue={ + setRepo + /*(newValue) => { + if (newValue.endsWith('/')) { + newValue = newValue.slice(0, -1); } - setRepo(myRepo.includes('/') ? myRepo.split('/')[1] : myRepo); - }} + setRepo( + newValue.includes('/') ? newValue.split('/')[1] : newValue, + ); + }*/ + } + disabled={!isAuthenticated} + /> + )} + {cardType === CardTypes.GIST && ( + + Enter a Gist id. +
+ {!isAuthenticated && ( + <> + Please{' '} + { + e.preventDefault(); + setStage(0); + }} + className="underline text-blue-900" + > + log in + {' '} + to change the gist id. + + )} + + } + placeholder={`e.g. "${DEMO_GIST}"`} + value={gist} + setValue={setGist} disabled={!isAuthenticated} /> )} @@ -206,8 +242,8 @@ const CustomizeStage = ({ cardType === CardTypes.TOP_LANGS || cardType === CardTypes.WAKATIME) && (