This repository has been archived by the owner on Aug 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
115 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { Box, Card, Heading, ScrollArea, Table } from "@radix-ui/themes"; | ||
import { | ||
Accordion, | ||
AccordionContent, | ||
AccordionItem, | ||
AccordionTrigger, | ||
} from "@/components/ui/accordion"; | ||
import { BarChart } from "@mui/x-charts/BarChart"; | ||
|
||
export default function BarChartCardWrapper({ | ||
data, | ||
title, | ||
}: { | ||
data: Object; | ||
title: string; | ||
}) { | ||
const statsData = Object.entries(data).map(([year, count]) => ({ | ||
category: year, | ||
value: count, | ||
})); | ||
if (Object.entries(data).length === 0) return null; | ||
return ( | ||
<Card> | ||
<Heading className="ml-3">{title}</Heading> | ||
<Box className="h-[20rem] w-full rounded-2xl bg-gray-400 p-2"> | ||
<BarChart | ||
xAxis={[ | ||
{ | ||
data: statsData.map((d) => d.category), | ||
scaleType: "band", | ||
}, | ||
]} | ||
series={[ | ||
{ | ||
data: statsData.map((d) => d.value), | ||
}, | ||
]} | ||
/> | ||
</Box> | ||
{Object.entries.length > 5 && ( | ||
<Accordion type="single" collapsible className="w-full"> | ||
<AccordionItem value="item-1"> | ||
<AccordionTrigger>See All</AccordionTrigger> | ||
<AccordionContent> | ||
<Table.Root> | ||
<ScrollArea className="h-[15rem] w-full rounded-2xl border p-4"> | ||
<Table.Header> | ||
<Table.Row> | ||
<Table.ColumnHeaderCell>Year</Table.ColumnHeaderCell> | ||
<Table.ColumnHeaderCell>Count</Table.ColumnHeaderCell> | ||
</Table.Row> | ||
</Table.Header> | ||
<Table.Body> | ||
{statsData.map((data) => ( | ||
<Table.Row key={data.value} className="hover:bg-black/30"> | ||
<Table.Cell>{data.category}</Table.Cell> | ||
<Table.Cell>{data.value}</Table.Cell> | ||
</Table.Row> | ||
))} | ||
</Table.Body> | ||
</ScrollArea> | ||
</Table.Root> | ||
</AccordionContent> | ||
</AccordionItem> | ||
</Accordion> | ||
)} | ||
</Card> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,14 @@ | ||
import { Box, Card, Heading, ScrollArea, Table } from "@radix-ui/themes"; | ||
import { | ||
Accordion, | ||
AccordionContent, | ||
AccordionItem, | ||
AccordionTrigger, | ||
} from "@/components/ui/accordion"; | ||
import { BarChart } from "@mui/x-charts/BarChart"; | ||
import { StatsContext } from "@/app/context/StatsContext"; | ||
import { useContext } from "react"; | ||
import BarChartCardWrapper from "../BarChartCardWrapper"; | ||
|
||
export default function CreationDate() { | ||
const statsContext = useContext(StatsContext); | ||
const creationStats = statsContext?.creationStats || {}; | ||
const statsData = Object.entries(creationStats).map(([year, count]) => ({ | ||
category: year, | ||
value: count, | ||
})); | ||
if (Object.entries(creationStats).length === 0) return null; | ||
return ( | ||
<> | ||
<Card> | ||
<Heading className="ml-3">Repository Creation Dates</Heading> | ||
<Box className="h-[20rem] w-full rounded-2xl bg-gray-400 p-2"> | ||
<BarChart | ||
xAxis={[ | ||
{ | ||
data: statsData.map((d) => d.category), | ||
scaleType: "band", | ||
}, | ||
]} | ||
series={[ | ||
{ | ||
data: statsData.map((d) => d.value), | ||
}, | ||
]} | ||
/> | ||
</Box> | ||
<Accordion type="single" collapsible className="w-full"> | ||
<AccordionItem value="item-1"> | ||
<AccordionTrigger>See All Creation Dates</AccordionTrigger> | ||
<AccordionContent> | ||
<Table.Root> | ||
<ScrollArea className="h-[15rem] w-full rounded-2xl border p-4"> | ||
<Table.Header> | ||
<Table.Row> | ||
<Table.ColumnHeaderCell>Year</Table.ColumnHeaderCell> | ||
<Table.ColumnHeaderCell>Count</Table.ColumnHeaderCell> | ||
</Table.Row> | ||
</Table.Header> | ||
<Table.Body> | ||
{statsData | ||
.sort((a, b) => Number(b.value) - Number(a.value)) | ||
.map((data) => ( | ||
<Table.Row | ||
key={data.value} | ||
className="hover:bg-black/30" | ||
> | ||
<Table.Cell>{data.category}</Table.Cell> | ||
<Table.Cell>{data.value}</Table.Cell> | ||
</Table.Row> | ||
))} | ||
</Table.Body> | ||
</ScrollArea> | ||
</Table.Root> | ||
</AccordionContent> | ||
</AccordionItem> | ||
</Accordion> | ||
</Card> | ||
</> | ||
<BarChartCardWrapper | ||
data={creationStats} | ||
title="Repository Creation Dates" | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,12 @@ | ||
import { Box, Card, Heading, ScrollArea, Table } from "@radix-ui/themes"; | ||
import { | ||
Accordion, | ||
AccordionContent, | ||
AccordionItem, | ||
AccordionTrigger, | ||
} from "@/components/ui/accordion"; | ||
import { BarChart } from "@mui/x-charts/BarChart"; | ||
import { StatsContext } from "@/app/context/StatsContext"; | ||
import { useContext } from "react"; | ||
import BarChartCardWrapper from "../BarChartCardWrapper"; | ||
|
||
export default function GistCreationDate() { | ||
const statsContext = useContext(StatsContext); | ||
const gistCreationStats = statsContext?.gistCreationStats || {}; | ||
const statsData = Object.entries(gistCreationStats).map(([year, count]) => ({ | ||
category: year, | ||
value: count, | ||
})); | ||
|
||
if (Object.entries(gistCreationStats).length === 0) return null; | ||
return ( | ||
<> | ||
<Card> | ||
<Heading className="ml-3">Gist Creation Dates</Heading> | ||
<Box className="h-[20rem] w-full rounded-2xl bg-gray-400 p-2"> | ||
<BarChart | ||
xAxis={[ | ||
{ | ||
data: statsData.map((d) => d.category), | ||
scaleType: "band", | ||
}, | ||
]} | ||
series={[ | ||
{ | ||
data: statsData.map((d) => d.value), | ||
}, | ||
]} | ||
/> | ||
</Box> | ||
<Accordion type="single" collapsible className="w-full"> | ||
<AccordionItem value="item-1"> | ||
<AccordionTrigger>See All Creation Dates</AccordionTrigger> | ||
<AccordionContent> | ||
<Table.Root> | ||
<ScrollArea className="h-[15rem] w-full rounded-2xl border p-4"> | ||
<Table.Header> | ||
<Table.Row> | ||
<Table.ColumnHeaderCell>Year</Table.ColumnHeaderCell> | ||
<Table.ColumnHeaderCell>Count</Table.ColumnHeaderCell> | ||
</Table.Row> | ||
</Table.Header> | ||
<Table.Body> | ||
{statsData | ||
.sort((a, b) => Number(b.value) - Number(a.value)) | ||
.map((data) => ( | ||
<Table.Row | ||
key={data.value} | ||
className="hover:bg-black/30" | ||
> | ||
<Table.Cell>{data.category}</Table.Cell> | ||
<Table.Cell>{data.value}</Table.Cell> | ||
</Table.Row> | ||
))} | ||
</Table.Body> | ||
</ScrollArea> | ||
</Table.Root> | ||
</AccordionContent> | ||
</AccordionItem> | ||
</Accordion> | ||
</Card> | ||
</> | ||
<BarChartCardWrapper data={gistCreationStats} title="Gist Creation Dates" /> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36e326e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
github-profile-viewer – ./
github-profile-viewer-git-master-sametcn99.vercel.app
next-github-profile-viewer.vercel.app
www.githubprofileviewer.com
github-profile-viewer-sametcn99.vercel.app
githubprofileviewer.com