Skip to content

Commit

Permalink
feat: show time data on coding
Browse files Browse the repository at this point in the history
  • Loading branch information
zaida04 committed Jan 23, 2024
1 parent 00664e5 commit e41e971
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
17 changes: 17 additions & 0 deletions src/components/coding_time/CodingTime.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
interface Props {
year: string;
hours: number;
minutes: number;
}
const { year, hours, minutes } = Astro.props;
---

<p class="leading-loose">
{year}:{" "}
<span class="text-pink-600 font-bold">
{hours} hrs & {minutes} mins
</span>{" "}
spent coding.
</p>
22 changes: 15 additions & 7 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { Image } from "astro:assets";
import MyFace from "../static/imgs/my_face.png";
import { projects_data } from "../static/data/projects";
import { competitions_data } from "../static/data/competitions";
import { wakatime_data } from "../static/data/wakatime";
import PageLayout from "../components/layouts/PageLayout.astro";
import ProjectCard from "../components/project/ProjectCard";
import CodingTime from "../components/coding_time/CodingTime.astro";
import BlogCard from "../components/blog/BlogCard";
import { Github, Mail } from "lucide-react";
import CompetitionCard from "../components/competition/CompetitionCard";
Expand Down Expand Up @@ -100,13 +102,19 @@ const allPosts = await getCollection("posts");
/>.
</p>

<h3>Coding Stats</h3>

<p class="leading-loose">
I've spent <span class="text-pink-600 font-bold">
394 hrs & 2 mins
</span> coding last year.
</p>
<div>
<h3>Coding Stats</h3>
{
Object.keys(wakatime_data).map((year) => (
<CodingTime
year={year}
{...wakatime_data[
year as keyof typeof wakatime_data
]}
/>
))
}
</div>

<div class="flex flex-row gap-2">
<Github />
Expand Down
5 changes: 5 additions & 0 deletions src/static/data/wakatime.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const wakatime_data = {
"2022": { hours: 438, minutes: 29 },
"2023": { hours: 482, minutes: 49 },
"2024": { hours: 3, minutes: 1 },
};

0 comments on commit e41e971

Please sign in to comment.