Skip to content

Commit

Permalink
fix: contributor profile tab click state flicker (#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
OgDev-01 committed Jul 26, 2023
1 parent 5614886 commit c9cf8ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ const ContributorProfileTab = ({
useEffect(() => {
setInputVisible(highlights && highlights.length !== 0 ? true : false);
if (login && currentPathname) {
router.push(`/user/${login}/${currentPathname}`);
setCurrentPathname(getCurrentPathName);
router.push(`/user/${login}/${currentPathname}`);
}
if (login && !hasHighlights) {
router.push(`/user/${login}/contributions`);
setCurrentPathname("contributions");
if (login && !hasHighlights && currentPathname) {
setCurrentPathname(currentPathname);
router.push(`/user/${login}/${currentPathname}`);
}
}, [currentPathname, hasHighlights, highlights, login]);
}, [login, hasHighlights]);

useEffect(() => {
// sets the highlights state to true if the user has highlights on profile route change
Expand All @@ -100,7 +100,7 @@ const ContributorProfileTab = ({
}, [highlights]);

return (
<Tabs value={uppercaseFirst(currentPathname as string)} onValueChange={handleTabUrl}>
<Tabs defaultValue={uppercaseFirst(currentPathname as string)} onValueChange={handleTabUrl}>
<TabsList className="justify-start w-full overflow-x-auto border-b">
{tabLinks.map((tab) => (
<TabsTrigger
Expand Down Expand Up @@ -262,8 +262,8 @@ const ContributorProfileTab = ({
)}
</div>
</div>
<div className="h-32 mt-10">
<CardLineChart lineChartOption={chart} className="!h-32" />
<div className="mt-2 h-36">
<CardLineChart lineChartOption={chart} className="!h-36" />
</div>
<div>
<CardRepoList limit={7} repoList={repoList} />
Expand Down
3 changes: 2 additions & 1 deletion lib/hooks/useContributorPullRequestsChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const useContributorPullRequestsChart = (contributor: string, topic: string, rep
},
},
grid: {
height: 100,
height: 130,
top: 0,
bottom: 0,
right: 0,
Expand All @@ -41,6 +41,7 @@ const useContributorPullRequestsChart = (contributor: string, topic: string, rep
color: "#FFB74D",
opacity: 0.6,
},
clip: false,
},
],
tooltip: {
Expand Down
2 changes: 0 additions & 2 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ function MyApp({ Component, pageProps }: ComponentWithPageLayout) {

if (typeof window !== "undefined") hostname = window.location.hostname;

console.log(router.asPath);

useEffect(() => {
let chatButton = document.getElementById("sitegpt-chat-icon");

Expand Down

0 comments on commit c9cf8ed

Please sign in to comment.