Skip to content

Commit

Permalink
feat: implemented Enriched UI responses for StarSearch (#3394)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline committed May 16, 2024
1 parent 3c5310b commit 9886681
Show file tree
Hide file tree
Showing 2 changed files with 258 additions and 60 deletions.
21 changes: 21 additions & 0 deletions components/StarSearch/Widgets/LotteryFactorWidget.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import LotteryFactorChart from "components/Repositories/LotteryFactorChart";
import { useRepositoryLottoFactor } from "lib/hooks/api/useRepositoryLottoFactor";

interface LotteryFactorWidgetProps {
repoName: string;
}

const LotteryFactorWidget = ({ repoName }: LotteryFactorWidgetProps) => {
const range = 30;
const { data, error, isLoading } = useRepositoryLottoFactor({ repository: repoName.toLowerCase(), range });

if (error) {
// whether it's a 404 or any other error, we don't want to render the widget
// StarSearch will handle the error.
throw error;
}

return <LotteryFactorChart lotteryFactor={data} isLoading={isLoading} error={error} range={range} />;
};

export default LotteryFactorWidget;

0 comments on commit 9886681

Please sign in to comment.