refactor: reorganize project structure and improve type definitions

- Split types into separate modules for better organization
- Move data files to dedicated directories with proper documentation
- Enhance i18n utilities with better type safety and performance
- Maintain backward compatibility with legacy imports
This commit is contained in:
joyzhao
2025-06-21 09:18:39 +08:00
parent e38ec6b12f
commit ea01dc6dd8
14 changed files with 784 additions and 523 deletions

88
src/types/data.ts Normal file
View File

@@ -0,0 +1,88 @@
/**
* Data types module
* Contains type definitions for all data structures used in the application
*/
import type { Lang } from './i18n.ts';
/**
* Multi-language text type
*/
export type LocalizedText = {
[K in Lang]: string;
};
/**
* Personal information interface
*/
export interface PersonalInfo {
name: string;
location: string;
avatar: string;
email: string;
github: string;
linkedin: string;
website: string;
twitter: string;
position: LocalizedText;
description: LocalizedText;
about: {
[K in Lang]: string[];
};
stats: {
repositories: number;
commits: string;
contributions: number;
};
skills: {
frontend: string[];
backend: string[];
database: string[];
devops: string[];
mobile: string[];
};
terminal: {
username: string;
};
}
/**
* Project image interface
*/
export interface ProjectImage {
bg: string;
hover: string;
text: string;
}
/**
* Project interface
*/
export interface Project {
id: string;
tag: string;
title: string;
icon: string;
color: string;
image: ProjectImage;
description: string[];
tech: string[];
link: string;
}
/**
* Service icon interface
*/
export interface ServiceIcon {
svg: string;
gradient: string;
}
/**
* Service interface
*/
export interface Service {
title: string;
icon: ServiceIcon;
items: string[];
color: string;
}