Skip to content

Commit

Permalink
fix: Charts hover states are not standalone open-sauced#4189
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhav-xp committed Nov 20, 2024
1 parent ca77bc3 commit 1424c72
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
9 changes: 5 additions & 4 deletions components/Graphs/ForksChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import humanizeNumber from "lib/utils/humanizeNumber";
type ForksChartProps = {
stats: StatsType[] | undefined;
total: number;
syncId: number;
// syncId: number;
range: DayRange;
isLoading: boolean;
onCategoryClick?: (category: string) => void;
Expand All @@ -35,7 +35,7 @@ type ForksChartProps = {
export default function ForksChart({
stats,
total,
syncId,
// syncId,
range = 30,
isLoading,
onCategoryClick,
Expand All @@ -52,7 +52,8 @@ export default function ForksChart({
switch (category) {
case "daily":
return (
<BarChart data={dailyData} syncId={syncId} className="!-left-6">
// <BarChart data={dailyData} syncId={syncId} className="!-left-6">
<BarChart data={dailyData} className="!-left-6">
<XAxis dataKey="bucket" ticks={bucketTicks} tick={CustomTick} />
<YAxis
interval={1}
Expand All @@ -69,7 +70,7 @@ export default function ForksChart({
);
case "history":
return (
<LineChart data={historyData} syncId={syncId} className="!-left-6">
<LineChart data={historyData} className="!-left-6">
<XAxis dataKey="bucket" tick={false} />
<YAxis
domain={["auto", "auto"]}
Expand Down
8 changes: 5 additions & 3 deletions components/Graphs/IssuesChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import { humanizeNumber } from "netlify/og-image-utils";
type IssuesChartProps = {
stats: StatsType[] | undefined;
velocity: number;
syncId: number;
// syncId: number;
range: DayRange;
isLoading: boolean;
className?: string;
};

export default function IssuesChart({ stats, velocity, syncId, range = 30, isLoading, className }: IssuesChartProps) {
// export default function IssuesChart({ stats, velocity, syncId, range = 30, isLoading, className }: IssuesChartProps) {
export default function IssuesChart({ stats, velocity, range = 30, isLoading, className }: IssuesChartProps) {
const dailyData = useMemo(() => getDailyIssuesHistogramToDays({ stats, range }), [stats, range]);
const bucketTicks = useMemo(() => getTicks({ histogram: dailyData, range }), [dailyData, range]);
const { openedRangedTotal, closedRangedTotal } = useMemo(
Expand Down Expand Up @@ -87,7 +88,8 @@ export default function IssuesChart({ stats, velocity, syncId, range = 30, isLoa
{isLoading ? (
<SkeletonWrapper width={100} height={100} />
) : (
<LineChart data={dailyData} syncId={syncId} className="-left-6">
// <LineChart data={dailyData} syncId={syncId} className="-left-6">
<LineChart data={dailyData} className="-left-6">
<XAxis dataKey="bucket" ticks={bucketTicks} tick={CustomTick} />
<YAxis
domain={["auto", "auto"]}
Expand Down
8 changes: 5 additions & 3 deletions components/Graphs/PRChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import { humanizeNumber } from "netlify/og-image-utils";
type PRChartProps = {
stats: StatsType[] | undefined;
velocity: number;
syncId: number;
// syncId: number;
range: DayRange;
isLoading: boolean;
className?: string;
};

export default function PRChart({ stats, velocity, syncId, range = 30, isLoading, className }: PRChartProps) {
// export default function PRChart({ stats, velocity, syncId, range = 30, isLoading, className }: PRChartProps) {
export default function PRChart({ stats, velocity, range = 30, isLoading, className }: PRChartProps) {
const dailyData = useMemo(() => getDailyPullRequestsHistogramToDays({ stats, range }), [stats, range]);
const bucketTicks = useMemo(() => getTicks({ histogram: dailyData, range }), [dailyData, range]);
const { openedRangedTotal, closedRangedTotal } = useMemo(
Expand Down Expand Up @@ -87,7 +88,8 @@ export default function PRChart({ stats, velocity, syncId, range = 30, isLoading
{isLoading ? (
<SkeletonWrapper width={100} height={100} />
) : (
<LineChart data={dailyData} syncId={syncId} className="-left-6">
// <LineChart data={dailyData} syncId={syncId} className="-left-6">
<LineChart data={dailyData} className="-left-6">
<XAxis dataKey="bucket" ticks={bucketTicks} tick={CustomTick} />
<YAxis
domain={["auto", "auto"]}
Expand Down
10 changes: 6 additions & 4 deletions components/Graphs/StarsChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import humanizeNumber from "lib/utils/humanizeNumber";
type StarsChartProps = {
stats: StatsType[] | undefined;
total: number;
syncId: number;
// syncId: number;
range: DayRange;
isLoading: boolean;
onCategoryClick?: (category: string) => void;
Expand All @@ -35,7 +35,7 @@ type StarsChartProps = {
export default function StarsChart({
stats,
total,
syncId,
// syncId,
range = 30,
isLoading,
onCategoryClick,
Expand All @@ -52,7 +52,8 @@ export default function StarsChart({
switch (category) {
case "daily":
return (
<BarChart data={dailyData} syncId={syncId} className="-left-5">
// <BarChart data={dailyData} syncId={syncId} className="-left-5">
<BarChart data={dailyData} className="-left-5">
<XAxis dataKey="bucket" ticks={bucketTicks} tick={CustomTick} />
<YAxis
interval={1}
Expand All @@ -69,7 +70,8 @@ export default function StarsChart({
);
case "history":
return (
<LineChart data={historyData} syncId={syncId} className="-left-5">
// <LineChart data={historyData} syncId={syncId} className="-left-5">
<LineChart data={historyData} className="-left-5">
<XAxis dataKey="bucket" ticks={bucketTicks} tick={CustomTick} />
<YAxis
domain={["auto", "auto"]}
Expand Down
10 changes: 5 additions & 5 deletions pages/s/[org]/[repo]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ interface RepoPageProps {
}

export default function RepoPage({ repoData, ogImageUrl }: RepoPageProps) {
const syncId = repoData.id;
// const syncId = repoData.id;
const router = useRouter();
const { toast } = useToast();
const posthog = usePostHog();
Expand Down Expand Up @@ -572,7 +572,7 @@ export default function RepoPage({ repoData, ogImageUrl }: RepoPageProps) {
stats={issueStats}
range={range}
velocity={repoStats?.issues_velocity_count ?? 0}
syncId={syncId}
// syncId={syncId}
isLoading={isIssueDataLoading}
/>
</CopyContainer>
Expand All @@ -599,7 +599,7 @@ export default function RepoPage({ repoData, ogImageUrl }: RepoPageProps) {
stats={prStats}
range={range}
velocity={repoStats?.pr_velocity_count ?? 0}
syncId={syncId}
// syncId={syncId}
isLoading={isPrDataLoading}
/>
</CopyContainer>
Expand Down Expand Up @@ -631,7 +631,7 @@ export default function RepoPage({ repoData, ogImageUrl }: RepoPageProps) {
stats={starsData}
total={repoData.stars}
range={range}
syncId={syncId}
// syncId={syncId}
isLoading={isStarsDataLoading}
onCategoryClick={(category) =>
posthog.capture("Repo Pages: clicked Stars Chart category", {
Expand Down Expand Up @@ -665,7 +665,7 @@ export default function RepoPage({ repoData, ogImageUrl }: RepoPageProps) {
stats={forkStats}
total={repoData.forks}
range={range}
syncId={syncId}
// syncId={syncId}
isLoading={isForksDataLoading}
onCategoryClick={(category) =>
posthog.capture("Repo Pages: clicked Forks Chart category", {
Expand Down

0 comments on commit 1424c72

Please sign in to comment.