-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
5c44499
commit 88ce051
Showing
7 changed files
with
149 additions
and
121 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
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,77 @@ | ||
import { getAllExperiences } from "@/models/experience.server"; | ||
|
||
export default async function Experiences() { | ||
const experiences = await getAllExperiences("endDate"); | ||
return ( | ||
<div className="space-y-2"> | ||
<div className="text-xl font-semibold">Experience</div> | ||
<div className="space-y-4"> | ||
{experiences.map(experience => { | ||
const startDate = new Date(experience.startDate); | ||
const endDate = experience.endDate | ||
? new Date(experience.endDate) | ||
: null; | ||
|
||
return ( | ||
<div key={experience.id}> | ||
<div className="flex pb-2 justify-between"> | ||
<div className="flex gap-2 items-end"> | ||
<div className="font-medium"> | ||
{experience.company} | ||
</div> | ||
{"-"} | ||
<div>{experience.title}</div> | ||
</div> | ||
<div | ||
title={calculateTimeSpent( | ||
startDate, | ||
endDate | ||
)} | ||
className="flex gap-2 text-secondary-foreground" | ||
> | ||
<p> | ||
{startDate.getMonth() + 1}/ | ||
{startDate.getFullYear()} | ||
</p> | ||
- | ||
<p> | ||
{endDate | ||
? endDate.getMonth() + | ||
1 + | ||
"/" + | ||
endDate.getFullYear() | ||
: "Present"} | ||
</p> | ||
</div> | ||
</div> | ||
<div className="text-sm px-2"> | ||
{experience.description.map(d => ( | ||
<div key={d}>{d}</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
function calculateTimeSpent(startDate: Date, endDate?: Date | null): string { | ||
if (!endDate) { | ||
endDate = new Date(); | ||
} | ||
|
||
let years = endDate.getFullYear() - startDate.getFullYear(); | ||
let months = endDate.getMonth() - startDate.getMonth() + 1; | ||
|
||
if (months <= 0) { | ||
years--; | ||
months += 12; | ||
} else if (months > 12) { | ||
years++; | ||
months = 0; | ||
} | ||
|
||
return `${years} years, ${months} months`; | ||
} |
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,37 @@ | ||
import TagList from "@/components/TagList"; | ||
import { getAllProjects } from "@/models/project.server"; | ||
|
||
export default async function Projects() { | ||
const projects = await getAllProjects(); | ||
|
||
return ( | ||
<div className="space-y-2"> | ||
<div className="text-xl font-semibold">Projects</div> | ||
<div className="space-y-4"> | ||
{projects.map(project => ( | ||
<div className="space-y-1" key={project.id}> | ||
<div className="flex items-center justify-between"> | ||
<div className="flex gap-2 items-center"> | ||
<div className="font-medium"> | ||
{project.title} | ||
</div> | ||
{"-"} | ||
<div className="text-sm">{project.company}</div> | ||
</div> | ||
<p className="text-sm text-secondary-foreground"> | ||
{project.date.getMonth() + 1}/ | ||
{project.date.getFullYear()} | ||
</p> | ||
</div> | ||
<div className="text-sm px-2"> | ||
{project.description} | ||
</div> | ||
<div> | ||
<TagList tags={project.tags} /> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} |
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