This commit is contained in:
DaKheera47 2026-01-21 16:42:57 +00:00
parent e3b0e263fb
commit 3e32b6c8c4
3 changed files with 71 additions and 6 deletions

View File

@ -20,6 +20,7 @@ import type {
VisaSponsorSearchResponse,
VisaSponsorStatusResponse,
VisaSponsor,
ResumeProfile,
} from '../../shared/types';
import { trackEvent } from "@/lib/analytics";
@ -174,8 +175,8 @@ export async function getProfileProjects(): Promise<ResumeProjectCatalogItem[]>
return fetchApi<ResumeProjectCatalogItem[]>('/profile/projects');
}
export async function getProfile(): Promise<any> {
return fetchApi<any>('/profile');
export async function getProfile(): Promise<ResumeProfile> {
return fetchApi<ResumeProfile>('/profile');
}

View File

@ -1,9 +1,10 @@
import { useEffect, useState } from 'react';
import * as api from '../api';
import type { ResumeProfile } from '../../shared/types';
let profileCache: any = null;
let profileCache: ResumeProfile | null = null;
let profileError: Error | null = null;
let subscribers: Set<(profile: any | null, error: Error | null) => void> = new Set();
let subscribers: Set<(profile: ResumeProfile | null, error: Error | null) => void> = new Set();
let isFetching = false;
/**
@ -11,7 +12,7 @@ let isFetching = false;
* Caches the result to avoid re-fetching.
*/
export function useProfile() {
const [profile, setProfile] = useState<any | null>(profileCache);
const [profile, setProfile] = useState<ResumeProfile | null>(profileCache);
const [error, setError] = useState<Error | null>(profileError);
useEffect(() => {
@ -22,7 +23,7 @@ export function useProfile() {
setError(profileError);
}
const handleUpdate = (newProfile: any | null, newError: Error | null) => {
const handleUpdate = (newProfile: ResumeProfile | null, newError: Error | null) => {
setProfile(newProfile);
setError(newError);
};

View File

@ -268,6 +268,69 @@ export interface ResumeProjectsSettings {
aiSelectableProjectIds: string[];
}
export interface ResumeProfile {
basics?: {
name?: string;
label?: string;
image?: string;
email?: string;
phone?: string;
url?: string;
summary?: string;
headline?: string;
location?: {
address?: string;
postalCode?: string;
city?: string;
countryCode?: string;
region?: string;
};
profiles?: Array<{
network?: string;
username?: string;
url?: string;
}>;
};
sections?: {
summary?: {
id?: string;
visible?: boolean;
name?: string;
content?: string;
};
skills?: {
id?: string;
visible?: boolean;
name?: string;
items?: Array<{
id: string;
name: string;
description: string;
level: number;
keywords: string[];
visible: boolean;
}>;
};
projects?: {
id?: string;
visible?: boolean;
name?: string;
items?: Array<{
id: string;
name: string;
description: string;
date: string;
summary: string;
visible: boolean;
keywords?: string[];
url?: string;
}>;
};
[key: string]: any;
};
[key: string]: any;
}
export interface AppSettings {
model: string;
defaultModel: string;