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

View File

@@ -1,241 +1,58 @@
import type { PersonalInfo } from '@/types';
/**
* Data module (Legacy)
* This file is kept for backward compatibility
* All data has been moved to src/lib/data/ directory
*/
export const personalInfo: PersonalInfo = {
name: "Joy Zhao",
location: "China",
avatar: "https://avatars.githubusercontent.com/u/24975063?v=4",
email: "zhaoguiyang18@gmail.com",
github: "https://github.com/zguiyang",
linkedin: "https://linkedin.com/in/zhaoguiyang",
website: "https://zhaoguiyang.com",
twitter: "https://twitter.com/zhaoguiyang",
position: {
en: "Full Stack Engineer",
zh: "全栈工程师"
},
description: {
en: "Crafting elegant solutions to complex problems with clean code and innovative thinking. Welcome to my personal dev workspace where ideas come to life.",
zh: "用优雅的代码和创新的思维,为复杂问题打造精致的解决方案。欢迎来到我的个人开发工作空间,这里是想法变为现实的地方。"
},
about: {
en: [
"I started my programming journey in 2016 when I accidentally encountered programming. This opportunity became the catalyst for my coding adventure, and I fell in love with programming during my subsequent self-learning journey.",
"I enjoy creating websites and applications with code and sharing them with users. The sense of achievement I get from this process makes me increasingly fascinated. My dream is to become a lifelong coder.",
"I love reading, traveling (especially road trips), enjoying various cuisines (particularly hot pot), and playing mobile games like League of Legends, Honor of Kings, and PUBG Mobile."
],
zh: [
"在2016年一次偶然的机会中接触到了编程以此为契机开始了我的编程之旅并在后续的自学之旅中爱上了编程。",
"我喜欢用代码编写出一个个的网页、应用,分享给用户使用,这其中获得的成就感让我愈发着迷。梦想是成为一名终身编码者。",
"热爱生活、阅读以及编程,寻找远程工作的机会,探索自由职业的可能性。喜欢自驾,去追寻那些美丽的风景,尝试新的事物。"
]
},
stats: {
repositories: 152,
commits: "42K",
contributions: 87
},
skills: {
frontend: ["HTML", "CSS", "JavaScript", "Vue.js", "React.js", "TypeScript"],
backend: ["Node.js"],
database: ["MySQL", "MongoDB"],
devops: ["Linux", "Git", "Docker", "Nginx", "Apache"],
mobile: ["React Native", "Flutter"]
},
terminal: {
username: "joy@dev-workspace"
}
};
// Re-export all data from the new modules
export { personalInfo } from './data/personal-info';
export { projects } from './data/projects';
export { services } from './data/services';
export const projects = {
en: [
{
id: "taskify",
tag: "business",
title: "Taskify App",
icon: "📱",
color: "purple",
image: {
bg: "from-purple-500/20 to-purple-600/20",
hover: "from-purple-500/20 to-purple-600/20",
text: "text-purple-400",
},
description: [
"A comprehensive task management application with drag-and-drop functionality.",
"Built with React, TypeScript, and Tailwind CSS using modern development approaches.",
"Real-time collaboration through WebSocket integration for instant updates.",
"Advanced task filtering, sorting, and project management capabilities.",
],
tech: ["React", "Node.js", "MongoDB"],
link: "#",
},
{
id: "eshop",
tag: "ecommerce",
title: "E-Shop Platform",
icon: "🛒",
color: "green",
image: {
bg: "from-green-500/20 to-green-600/20",
hover: "from-green-500/20 to-green-600/20",
text: "text-green-400",
},
description: [
"Scalable e-commerce platform built with Next.js, Stripe payments, and TailwindCSS.",
"Mobile-first responsive design for optimal user experience across devices.",
"Integrated payment processing with Stripe for secure transactions.",
"Admin dashboard for inventory management and order processing.",
],
tech: ["Next.js", "Stripe", "TailwindCSS"],
link: "#",
},
{
id: "portfolio",
tag: "portfolio",
title: "Portfolio Site",
icon: "🌐",
color: "purple",
image: {
bg: "from-purple-500/20 to-purple-600/20",
hover: "from-purple-500/20 to-purple-600/20",
text: "text-purple-400",
},
description: [
"Personal portfolio showcasing my work, built with HTML, TailwindCSS, and Alpine.js.",
"Responsive design with dark mode support and smooth animations.",
"Optimized for performance with minimal JavaScript and efficient CSS.",
"Integrated blog section with markdown support for content management.",
],
tech: ["HTML", "TailwindCSS", "Alpine.js"],
link: "#",
},
],
zh: [
{
id: "taskify",
tag: "business",
title: "Taskify 应用",
icon: "📱",
color: "purple",
image: {
bg: "from-purple-500/20 to-purple-600/20",
hover: "from-purple-500/20 to-purple-600/20",
text: "text-purple-400",
},
description: [
"一个全面的任务管理应用,具有拖放功能。",
"使用React、TypeScript和Tailwind CSS构建采用现代开发方法。",
"通过WebSocket集成实现实时协作功能实现即时更新。",
"高级任务筛选、排序和项目管理功能。",
],
tech: ["React", "Node.js", "MongoDB"],
link: "#",
},
{
id: "eshop",
tag: "ecommerce",
title: "电商平台",
icon: "🛒",
color: "green",
image: {
bg: "from-green-500/20 to-green-600/20",
hover: "from-green-500/20 to-green-600/20",
text: "text-green-400",
},
description: [
"使用Next.js、Stripe支付和TailwindCSS构建的可扩展电子商务平台。",
"采用移动优先的响应式设计,提供最佳用户体验。",
"集成Stripe支付处理确保交易安全。",
"管理员仪表板,用于库存管理和订单处理。",
],
tech: ["Next.js", "Stripe", "TailwindCSS"],
link: "#",
},
{
id: "portfolio",
tag: "portfolio",
title: "个人作品集网站",
icon: "🌐",
color: "purple",
image: {
bg: "from-purple-500/20 to-purple-600/20",
hover: "from-purple-500/20 to-purple-600/20",
text: "text-purple-400",
},
description: [
"展示我的作品的个人作品集使用HTML、TailwindCSS和Alpine.js构建。",
"响应式设计,支持暗黑模式和平滑动画。",
"通过最小化JavaScript和高效CSS优化性能。",
"集成博客部分支持markdown内容管理。",
],
tech: ["HTML", "TailwindCSS", "Alpine.js"],
link: "#",
},
],
};
// For TypeScript type checking
import { personalInfo } from './data/personal-info';
import { projects } from './data/projects';
import { services } from './data/services';
export const services = {
en: [
{
title: "Outsourcing Projects",
icon: {
svg: `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path>`,
gradient: "from-blue-500 to-cyan-500",
},
items: [
"Provide outsourcing project services for overseas clients",
"Project packaging, can provide services in different packages",
"Use popular technologies: React, nest.js, next.js, etc.",
"Project delivery, provide three months of free maintenance",
"Regardless of project size, can provide services",
],
color: "blue",
},
{
title: "Bug Fixes",
icon: {
svg: `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>`,
gradient: "from-red-500 to-pink-500",
},
items: [
"Quickly locate and fix website issues, able to quickly locate and solve problems",
"Help you solve any problems encountered in the project, Bug, functional optimization issues",
"Application of Vue, React, Node and other technologies",
"Frontend automation, deployment, monitoring, automation, etc.",
"Only limited to Node.js projects",
],
color: "red",
},
],
zh: [
{
title: "外包项目",
icon: {
svg: `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path>`,
gradient: "from-blue-500 to-cyan-500",
},
items: [
"为海外客户提供外包项目服务",
"项目打包,可以提供不同套餐的服务",
"使用流行技术React、nest.js、next.js 等",
"项目交付,提供三个月免费维护",
"不论项目大小,都可以提供服务",
],
color: "blue",
},
{
title: "Bug 修复",
icon: {
svg: `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>`,
gradient: "from-red-500 to-pink-500",
},
items: [
"快速定位和修复网站问题,能够快速定位和解决问题",
"帮助您解决项目中遇到的任何问题Bug、功能优化问题",
"Vue、React、Node 等技术的应用",
"前端自动化、部署、监控、自动化等",
"仅限于 Node.js 项目",
],
color: "red",
},
],
};
// Type exports are now handled in src/types/index.ts
// This file is now just a re-export wrapper
// The actual data is in the respective files in src/lib/data/ directory
// export const projects = {
// en: [{
// id: "taskify",
// tag: "business",
// title: "Taskify App",
// icon: "📱",
// color: "purple",
// image: {
// bg: "from-purple-500/20 to-purple-600/20",
// hover: "from-purple-500/20 to-purple-600/20",
// text: "text-purple-400",
// },
// description: [
// "A comprehensive task management application with drag-and-drop functionality.",
// "Built with React, TypeScript, and Tailwind CSS using modern development approaches.",
// "Real-time collaboration through WebSocket integration for instant updates.",
// "Advanced task filtering, sorting, and project management capabilities.",
// ],
// tech: ["React", "Node.js", "MongoDB"],
// link: "#",
// },
// ...
// ],
// zh: [...]
// };
//
// export const services = {
// en: [
// {
// title: "Outsourcing Projects",
// icon: {...},
// items: [...],
// color: "blue",
// },
// ...
// ],
// zh: [...]
// };

9
src/lib/data/index.ts Normal file
View File

@@ -0,0 +1,9 @@
/**
* Data index module
* Re-exports all data modules to maintain backward compatibility
*/
// Re-export all data modules
export { personalInfo } from './personal-info';
export { projects } from './projects';
export { services } from './services';

View File

@@ -0,0 +1,55 @@
/**
* Personal information data module
* Contains all personal information used throughout the site
*/
import type { PersonalInfo } from '@/types';
/**
* Personal information data
* This data is used in various components like Header, Footer, and About sections
*/
export const personalInfo: PersonalInfo = {
name: "Joy Zhao",
location: "China",
avatar: "https://avatars.githubusercontent.com/u/24975063?v=4",
email: "zhaoguiyang18@gmail.com",
github: "https://github.com/zguiyang",
linkedin: "https://linkedin.com/in/zhaoguiyang",
website: "https://zhaoguiyang.com",
twitter: "https://twitter.com/zhaoguiyang",
position: {
en: "Full Stack Engineer",
zh: "全栈工程师"
},
description: {
en: "Crafting elegant solutions to complex problems with clean code and innovative thinking. Welcome to my personal dev workspace where ideas come to life.",
zh: "用优雅的代码和创新的思维,为复杂问题打造精致的解决方案。欢迎来到我的个人开发工作空间,这里是想法变为现实的地方。"
},
about: {
en: [
"I started my programming journey in 2016 when I accidentally encountered programming. This opportunity became the catalyst for my coding adventure, and I fell in love with programming during my subsequent self-learning journey.",
"I enjoy creating websites and applications with code and sharing them with users. The sense of achievement I get from this process makes me increasingly fascinated. My dream is to become a lifelong coder.",
"I love reading, traveling (especially road trips), enjoying various cuisines (particularly hot pot), and playing mobile games like League of Legends, Honor of Kings, and PUBG Mobile."
],
zh: [
"在2016年一次偶然的机会中接触到了编程以此为契机开始了我的编程之旅并在后续的自学之旅中爱上了编程。",
"我喜欢用代码编写出一个个的网页、应用,分享给用户使用,这其中获得的成就感让我愈发着迷。梦想是成为一名终身编码者。",
"热爱生活、阅读以及编程,寻找远程工作的机会,探索自由职业的可能性。喜欢自驾,去追寻那些美丽的风景,尝试新的事物。"
]
},
stats: {
repositories: 152,
commits: "42K",
contributions: 87
},
skills: {
frontend: ["HTML", "CSS", "JavaScript", "Vue.js", "React.js", "TypeScript"],
backend: ["Node.js"],
database: ["MySQL", "MongoDB"],
devops: ["Linux", "Git", "Docker", "Nginx", "Apache"],
mobile: ["React Native", "Flutter"]
},
terminal: {
username: "joy@dev-workspace"
}
};

136
src/lib/data/projects.ts Normal file
View File

@@ -0,0 +1,136 @@
/**
* Projects data module
* Contains all project information displayed in the projects page
*/
import type { Project } from '@/types';
/**
* Projects data with localization support
* Each project contains information like id, tag, title, description, tech stack, etc.
*/
export const projects = {
en: [
{
id: "taskify",
tag: "business",
title: "Taskify App",
icon: "📱",
color: "purple",
image: {
bg: "from-purple-500/20 to-purple-600/20",
hover: "from-purple-500/20 to-purple-600/20",
text: "text-purple-400",
},
description: [
"A comprehensive task management application with drag-and-drop functionality.",
"Built with React, TypeScript, and Tailwind CSS using modern development approaches.",
"Real-time collaboration through WebSocket integration for instant updates.",
"Advanced task filtering, sorting, and project management capabilities.",
],
tech: ["React", "Node.js", "MongoDB"],
link: "#",
},
{
id: "eshop",
tag: "ecommerce",
title: "E-Shop Platform",
icon: "🛒",
color: "green",
image: {
bg: "from-green-500/20 to-green-600/20",
hover: "from-green-500/20 to-green-600/20",
text: "text-green-400",
},
description: [
"Scalable e-commerce platform built with Next.js, Stripe payments, and TailwindCSS.",
"Mobile-first responsive design for optimal user experience across devices.",
"Integrated payment processing with Stripe for secure transactions.",
"Admin dashboard for inventory management and order processing.",
],
tech: ["Next.js", "Stripe", "TailwindCSS"],
link: "#",
},
{
id: "portfolio",
tag: "portfolio",
title: "Portfolio Site",
icon: "🌐",
color: "purple",
image: {
bg: "from-purple-500/20 to-purple-600/20",
hover: "from-purple-500/20 to-purple-600/20",
text: "text-purple-400",
},
description: [
"Personal portfolio showcasing my work, built with HTML, TailwindCSS, and Alpine.js.",
"Responsive design with dark mode support and smooth animations.",
"Optimized for performance with minimal JavaScript and efficient CSS.",
"Integrated blog section with markdown support for content management.",
],
tech: ["HTML", "TailwindCSS", "Alpine.js"],
link: "#",
},
],
zh: [
{
id: "taskify",
tag: "business",
title: "Taskify 应用",
icon: "📱",
color: "purple",
image: {
bg: "from-purple-500/20 to-purple-600/20",
hover: "from-purple-500/20 to-purple-600/20",
text: "text-purple-400",
},
description: [
"一个全面的任务管理应用,具有拖放功能。",
"使用React、TypeScript和Tailwind CSS构建采用现代开发方法。",
"通过WebSocket集成实现实时协作功能实现即时更新。",
"高级任务筛选、排序和项目管理功能。",
],
tech: ["React", "Node.js", "MongoDB"],
link: "#",
},
{
id: "eshop",
tag: "ecommerce",
title: "电商平台",
icon: "🛒",
color: "green",
image: {
bg: "from-green-500/20 to-green-600/20",
hover: "from-green-500/20 to-green-600/20",
text: "text-green-400",
},
description: [
"使用Next.js、Stripe支付和TailwindCSS构建的可扩展电子商务平台。",
"采用移动优先的响应式设计,提供最佳用户体验。",
"集成Stripe支付处理确保交易安全。",
"管理员仪表板,用于库存管理和订单处理。",
],
tech: ["Next.js", "Stripe", "TailwindCSS"],
link: "#",
},
{
id: "portfolio",
tag: "portfolio",
title: "个人作品集网站",
icon: "🌐",
color: "purple",
image: {
bg: "from-purple-500/20 to-purple-600/20",
hover: "from-purple-500/20 to-purple-600/20",
text: "text-purple-400",
},
description: [
"展示我的作品的个人作品集使用HTML、TailwindCSS和Alpine.js构建。",
"响应式设计,支持暗黑模式和平滑动画。",
"通过最小化JavaScript和高效CSS优化性能。",
"集成博客部分支持markdown内容管理。",
],
tech: ["HTML", "TailwindCSS", "Alpine.js"],
link: "#",
},
],
};

76
src/lib/data/services.ts Normal file
View File

@@ -0,0 +1,76 @@
/**
* Services data module
* Contains all service information displayed in the services section
*/
import type { Service } from '@/types';
/**
* Services data with localization support
* Each service contains information like title, icon, items, and color
*/
export const services = {
en: [
{
title: "Outsourcing Projects",
icon: {
svg: `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path>`,
gradient: "from-blue-500 to-cyan-500",
},
items: [
"Provide outsourcing project services for overseas clients",
"Project packaging, can provide services in different packages",
"Use popular technologies: React, nest.js, next.js, etc.",
"Project delivery, provide three months of free maintenance",
"Regardless of project size, can provide services",
],
color: "blue",
},
{
title: "Bug Fixes",
icon: {
svg: `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>`,
gradient: "from-red-500 to-pink-500",
},
items: [
"Quickly locate and fix website issues, able to quickly locate and solve problems",
"Help you solve any problems encountered in the project, Bug, functional optimization issues",
"Application of Vue, React, Node and other technologies",
"Frontend automation, deployment, monitoring, automation, etc.",
"Only limited to Node.js projects",
],
color: "red",
},
],
zh: [
{
title: "外包项目",
icon: {
svg: `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path>`,
gradient: "from-blue-500 to-cyan-500",
},
items: [
"为海外客户提供外包项目服务",
"项目打包,可以提供不同套餐的服务",
"使用流行技术React、nest.js、next.js 等",
"项目交付,提供三个月免费维护",
"不论项目大小,都可以提供服务",
],
color: "blue",
},
{
title: "Bug 修复",
icon: {
svg: `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>`,
gradient: "from-red-500 to-pink-500",
},
items: [
"快速定位和修复网站问题,能够快速定位和解决问题",
"帮助您解决项目中遇到的任何问题Bug、功能优化问题",
"Vue、React、Node 等技术的应用",
"前端自动化、部署、监控、自动化等",
"仅限于 Node.js 项目",
],
color: "red",
},
],
};

7
src/lib/index.ts Normal file
View File

@@ -0,0 +1,7 @@
/**
* Library index module
* Re-exports all data modules to maintain backward compatibility
*/
// Re-export all data modules from data directory
export * from './data';