103 lines
3.4 KiB
TypeScript
103 lines
3.4 KiB
TypeScript
import profileData from '#content/profile.json';
|
|
import experienceData from '#content/experience.json';
|
|
import leadershipData from '#content/leadership.json';
|
|
import aboutData from '#content/about.json';
|
|
import desktopData from '#content/desktop.json';
|
|
import blogData from '#content/blog.json';
|
|
import musicData from '#content/music.json';
|
|
import openSourceData from '#content/projects/opensource.json';
|
|
import packagesData from '#content/projects/packages.json';
|
|
import hackathonsData from '#content/projects/hackathons.json';
|
|
import researchData from '#content/projects/research.json';
|
|
import organizationsData from '#content/projects/organizations.json';
|
|
import tcgDecksData from '#content/tcgDecks.json';
|
|
import booksData from '#content/books.json';
|
|
import bookDetailsData from '#data/bookDetails.json';
|
|
import wallpapersData from '#content/wallpapers.json';
|
|
import type {
|
|
AboutContent,
|
|
BlogSettings,
|
|
Book,
|
|
DesktopContent,
|
|
Experience,
|
|
Leadership,
|
|
Playlist,
|
|
Profile,
|
|
Project,
|
|
ProjectCategory,
|
|
ProjectCategoryId,
|
|
ResearchGroup,
|
|
TcgDeck,
|
|
Wallpaper
|
|
} from './types';
|
|
|
|
export type * from './types';
|
|
|
|
export const profile: Profile = profileData;
|
|
export const experience: Experience[] = experienceData;
|
|
export const leadership: Leadership[] = leadershipData;
|
|
export const about: AboutContent = aboutData as AboutContent;
|
|
export const desktop: DesktopContent = desktopData;
|
|
export const blogSettings: BlogSettings = blogData;
|
|
export const playlist: Playlist = musicData;
|
|
export const researchGroups: ResearchGroup[] = researchData;
|
|
export const tcgDecks: TcgDeck[] = tcgDecksData as TcgDeck[];
|
|
const bookDetails = bookDetailsData as Record<string, Partial<Book>>;
|
|
|
|
export const books: Book[] = booksData.map((book) => ({ ...bookDetails[book.goodreadsId], ...book }) as Book);
|
|
export const wallpapers: Wallpaper[] = wallpapersData as Wallpaper[];
|
|
|
|
function featuredFirst(projects: Project[]): Project[] {
|
|
return [...projects].sort((first, second) => Number(!!second.featured) - Number(!!first.featured));
|
|
}
|
|
|
|
export const projectCategories: ProjectCategory[] = [
|
|
{
|
|
id: 'opensource',
|
|
title: 'Open Source',
|
|
icon: 'ph:git-branch-duotone',
|
|
summary: 'Libraries and tools I build and maintain in the open.',
|
|
projects: featuredFirst(openSourceData)
|
|
},
|
|
{
|
|
id: 'packages',
|
|
title: 'Packages',
|
|
icon: 'ph:package-duotone',
|
|
summary: 'Published packages and CLI tools you can install directly.',
|
|
projects: featuredFirst(packagesData)
|
|
},
|
|
{
|
|
id: 'hackathons',
|
|
title: 'Hackathons',
|
|
icon: 'ph:trophy-duotone',
|
|
summary: 'Weekend builds, demos, and the awards they picked up.',
|
|
projects: featuredFirst(hackathonsData)
|
|
},
|
|
{
|
|
id: 'research',
|
|
title: 'Research',
|
|
icon: 'ph:microscope-duotone',
|
|
summary: 'Research roles, projects, and publications.',
|
|
projects: featuredFirst(
|
|
researchGroups.flatMap((group) =>
|
|
group.projects.map((project) => ({ ...project, organization: project.organization ?? group.shortName }))
|
|
)
|
|
)
|
|
},
|
|
{
|
|
id: 'organizations',
|
|
title: 'Organizations',
|
|
icon: 'ph:users-three-duotone',
|
|
summary: 'Clubs and teams I lead and help run.',
|
|
projects: featuredFirst(organizationsData)
|
|
}
|
|
];
|
|
|
|
export function findProjectCategory(id: string): ProjectCategory | undefined {
|
|
return projectCategories.find((category) => category.id === id);
|
|
}
|
|
|
|
export function isProjectCategoryId(id: string): id is ProjectCategoryId {
|
|
return projectCategories.some((category) => category.id === id);
|
|
}
|