Skip to content

Conversation

@pphatdev
Copy link
Owner

@pphatdev pphatdev commented Jul 4, 2025

This pull request refactors the AboutTimeline and ExperienceCard components to improve type safety and enhance flexibility in handling skill icons and images. It introduces new TypeScript interfaces, updates data structures, and modifies rendering logic to accommodate both image-based and SVG-based icons.

TypeScript Interface Enhancements:

  • Added new interfaces SkillsType, WorkExperience, and CompaniesProps in src/lib/interfaces/skills.ts to define structured types for skills, work experiences, and companies. This improves type safety across components.

Data Structure Updates:

  • Updated the experiences array in src/app/(web)/(home)/sections/timeline.tsx to use the new CompaniesProps interface, replacing companyLogo with logo and icon with image in skill definitions.
  • Modified the ExperienceCard component in src/components/ui/experience-card.tsx to use the WorkExperience interface, replacing the previous custom props structure.

Rendering Logic Improvements:

  • Enhanced the rendering logic in ExperienceCard to differentiate between SVG-based icons and image-based icons, allowing dynamic handling of both types.
  • Updated the AboutTimeline component to use the new logo property instead of companyLogo for company logos.

@pphatdev pphatdev requested a review from Copilot July 4, 2025 07:31
@pphatdev pphatdev self-assigned this Jul 4, 2025
@vercel
Copy link

vercel bot commented Jul 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
v4 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2025 7:31am

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors AboutTimeline and ExperienceCard for stronger typing and flexible icon handling by introducing new interfaces, updating data structures, and adjusting rendering logic.

  • Introduced SkillsType, WorkExperience, and CompaniesProps interfaces for type-safe data modeling.
  • Updated the experiences array in timeline.tsx to use logo/image fields with the new interfaces.
  • Enhanced ExperienceCard to render both SVG-based and image-based skill icons dynamically.

Reviewed Changes

Copilot reviewed 3 out of 8 changed files in this pull request and generated 4 comments.

File Description
src/lib/interfaces/skills.ts Added SkillsType, WorkExperience, and CompaniesProps types.
src/components/ui/experience-card.tsx Switched props to WorkExperience, and improved icon rendering.
src/app/(web)/(home)/sections/timeline.tsx Migrated companyLogo/icon to logo/image and integrated SVG.
Comments suppressed due to low confidence (1)

src/lib/interfaces/skills.ts:13

  • [nitpick] The interface name CompaniesProps suggests multiple companies but defines a single company. Consider renaming it to CompanyProps for clarity.
export interface CompaniesProps {

@@ -0,0 +1,18 @@
export interface SkillsType {
title: string;
icon?: React.SVGProps<SVGSVGElement>;
Copy link

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The icon property is typed as React.SVGProps<SVGSVGElement> (an SVG props interface) but the code treats it as a React element. Consider changing this to ReactElement<SVGSVGElement> or JSX.Element to match usage.

Suggested change
icon?: React.SVGProps<SVGSVGElement>;
icon?: JSX.Element;

Copilot uses AI. Check for mistakes.
<div className="hidden absolute top-3 bottom-0 right-full mr-7 md:mr-[3.25rem] w-px bg-foreground/20 sm:block"> </div>
<div className="flex flex-col gap-12">
{experiences.map(({ works, title, companyLogo }, index) => (
{experiences.map(({ works, title, logo }, index) => (
Copy link

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the array index as the React key can lead to rendering issues. Consider using a stable identifier such as the company title or a unique ID instead.

Copilot uses AI. Check for mistakes.
@pphatdev pphatdev merged commit c00d411 into master Jul 4, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant