Added new optional fields to the PortfolioData projects interface: subtitle for additional project description, badges array for highlighting key features, and metrics object for complexity and team size. This enhances the portfolio data structure to support richer project representations.
100 lines
2.1 KiB
TypeScript
100 lines
2.1 KiB
TypeScript
import { useState, useEffect } from "react";
|
|
|
|
interface PortfolioData {
|
|
personal: {
|
|
name: string;
|
|
title: string;
|
|
location: string;
|
|
email: string;
|
|
phone: string;
|
|
linkedin: string;
|
|
github: string;
|
|
summary: string;
|
|
};
|
|
experiences: Array<{
|
|
id: string;
|
|
title: string;
|
|
company: string;
|
|
period: string;
|
|
location: string;
|
|
type: string;
|
|
description: string;
|
|
achievements: string[];
|
|
technologies: string[];
|
|
featured: boolean;
|
|
}>;
|
|
projects: Array<{
|
|
id: string;
|
|
title: string;
|
|
subtitle: string;
|
|
description: string;
|
|
longDescription: string;
|
|
technologies: string[];
|
|
features: string[];
|
|
status: string;
|
|
demoUrl: string;
|
|
githubUrl: string;
|
|
imageUrl: string;
|
|
badges: string[];
|
|
featured: boolean;
|
|
category: string;
|
|
metrics?: {
|
|
complexity: number;
|
|
teamSize?: string;
|
|
};
|
|
}>;
|
|
skills: {
|
|
technical: Array<{
|
|
category: string;
|
|
icon: string;
|
|
color: string;
|
|
bgColor: string;
|
|
skills: string[];
|
|
}>;
|
|
soft: Array<{
|
|
skill: string;
|
|
level: number;
|
|
}>;
|
|
};
|
|
contact: {
|
|
email: string;
|
|
phone: string;
|
|
whatsapp: string;
|
|
linkedin: string;
|
|
github: string;
|
|
location: string;
|
|
};
|
|
social: Array<{
|
|
name: string;
|
|
url: string;
|
|
icon: string;
|
|
}>;
|
|
}
|
|
|
|
export function usePortfolioData() {
|
|
const [data, setData] = useState<PortfolioData | null>(null);
|
|
const [loading, setLoading] = useState(true);
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
useEffect(() => {
|
|
const loadData = async () => {
|
|
try {
|
|
const response = await fetch("/portfolio-data.json");
|
|
if (!response.ok) {
|
|
throw new Error("Failed to load portfolio data");
|
|
}
|
|
const portfolioData: PortfolioData = await response.json();
|
|
setData(portfolioData);
|
|
} catch (err) {
|
|
setError(err instanceof Error ? err.message : "Unknown error");
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
};
|
|
|
|
loadData();
|
|
}, []);
|
|
|
|
return { data, loading, error };
|
|
}
|