Skip to content

Commit

Permalink
feat: show less data on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
dartpain committed Aug 20, 2024
1 parent 03401f7 commit 8b34c13
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frontend/src/components/BarGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export function BarGraph({ title, chartData, chartConfig, info }: {

const filteredData = chartData.filter(data => data.ingestPrice !== null || data.outputPrice !== null);

const isMobile = window.innerWidth <= 768; // Adjust the breakpoint as needed

const displayedData = isMobile ? filteredData.slice(0, 4) : filteredData;

return (
<div className="flex justify-center text=#1E1E1E] my-8">
<div className="border border-gray-700 rounded-xl w-11/12 flex flex-col gap-6">
Expand All @@ -34,7 +38,7 @@ export function BarGraph({ title, chartData, chartConfig, info }: {
</span>
</h1>
<ChartContainer config={chartConfig} className="max-h-[200px] w-full mx-1">
<BarChart accessibilityLayer data={filteredData}>
<BarChart accessibilityLayer data={displayedData}>
<CartesianGrid vertical={false} horizontal={false}/>
<XAxis
dataKey="inference"
Expand All @@ -52,4 +56,4 @@ export function BarGraph({ title, chartData, chartConfig, info }: {
</div>
</div>
)
}
}

0 comments on commit 8b34c13

Please sign in to comment.