diff --git a/__tests__/CV/CVContent.test.tsx b/__tests__/CV/CVContent.test.tsx index f36e55fc..3f3c9e7a 100644 --- a/__tests__/CV/CVContent.test.tsx +++ b/__tests__/CV/CVContent.test.tsx @@ -4,6 +4,7 @@ import React from "react"; import { render, screen } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; import CVContent from "../../src/components/CV/CVContent.component"; const mockCVData = { @@ -24,10 +25,18 @@ const mockCVData = { description: "Studied various aspects of computer science", }, ], + volunteerWork: [ + { + period: "2023-2024", + organization: "AI Community", + role: "Technical Lead", + description: "Managing AI Discord community and developing bots", + }, + ], }; describe("CVContent", () => { - it("CVContent renders correctly with mock data", () => { + it("CVContent renders correctly with mock data", async () => { render(); // Check if the CV header is present @@ -44,12 +53,26 @@ describe("CVContent", () => { }); const experienceTab = screen.getByRole("tab", { name: /erfaring/i }); const educationTab = screen.getByRole("tab", { name: /utdanning/i }); + const volunteerWorkTab = screen.getByRole("tab", { name: /frivillig arbeid/i }); expect(qualificationsTab).toBeInTheDocument(); expect(experienceTab).toBeInTheDocument(); expect(educationTab).toBeInTheDocument(); + expect(volunteerWorkTab).toBeInTheDocument(); // Check if mock data is rendered (you might need to click on tabs to see this content) const qualification = screen.getByText(/qualification 1/i); expect(qualification).toBeInTheDocument(); + + // Set up user event + const user = userEvent.setup(); + + // Click on volunteer work tab and check its content + await user.click(volunteerWorkTab); + + // Check volunteer work content + const volunteerRole = await screen.findByText(/technical lead/i); + expect(volunteerRole).toBeInTheDocument(); + const volunteerOrg = await screen.findByText(/ai community/i); + expect(volunteerOrg).toBeInTheDocument(); }); }); diff --git a/src/components/CV/CVContent.component.tsx b/src/components/CV/CVContent.component.tsx index eb58347f..e1174173 100644 --- a/src/components/CV/CVContent.component.tsx +++ b/src/components/CV/CVContent.component.tsx @@ -16,6 +16,12 @@ interface CVData { degree: string; description: string; }>; + volunteerWork: Array<{ + period: string; + organization: string; + role: string; + description: string; + }>; } interface CVContentProps { @@ -76,6 +82,23 @@ const CVContent: React.FC = ({ cvData }) => { ), }, + { + id: "volunteerWork", + label: "Frivillig arbeid", + content: ( +
+ {cvData.volunteerWork?.map((vol) => ( +
+

+ {vol.period} - {vol.organization} +

+ {vol.role &&

{vol.role}

} +

{vol.description}

+
+ ))} +
+ ), + } ]; return ( @@ -84,7 +107,7 @@ const CVContent: React.FC = ({ cvData }) => { CV
-
+
diff --git a/src/components/UI/Tabs.component.tsx b/src/components/UI/Tabs.component.tsx index d5a83679..fa7d7392 100644 --- a/src/components/UI/Tabs.component.tsx +++ b/src/components/UI/Tabs.component.tsx @@ -37,7 +37,7 @@ const Tabs: React.FC = ({ tabs, orientation = "vertical" }) => { className={`flex ${isVertical ? "flex-col sm:flex-row" : "flex-col"} bg-gray-800 rounded-lg h-[calc(75vh-2rem)] mt-4`} >
= ({ tabs, orientation = "vertical" }) => { {activeTab === tab.id && ( diff --git a/src/lib/sanity/queries.ts b/src/lib/sanity/queries.ts index c3cf0969..912e8a70 100644 --- a/src/lib/sanity/queries.ts +++ b/src/lib/sanity/queries.ts @@ -38,6 +38,12 @@ export const cvQuery = groq` institution, degree, description + }, + volunteerWork[] { + period, + organization, + role, + description } } `; diff --git a/studio/schemaTypes/documents/cv.ts b/studio/schemaTypes/documents/cv.ts index 11b2e422..52ae29c1 100644 --- a/studio/schemaTypes/documents/cv.ts +++ b/studio/schemaTypes/documents/cv.ts @@ -36,8 +36,18 @@ export default { type: 'object', fields: [ {name: 'period', title: 'Period', type: 'string'}, - {name: 'company', title: 'Company', type: 'string'}, - {name: 'role', title: 'Role', type: 'string'}, + { + name: 'company', + title: 'Company/Project', + type: 'string', + description: 'Company name or personal project/community name' + }, + { + name: 'role', + title: 'Role', + type: 'string', + description: 'Job title or role in the project/community' + }, {name: 'description', title: 'Description', type: 'text'}, ], }, @@ -59,5 +69,36 @@ export default { }, ], }, + { + name: 'volunteerWork', + title: 'Volunteer work', + type: 'array', + of: [ + { + type: 'object', + fields: [ + {name: 'period', title: 'Period', type: 'string'}, + { + name: 'organization', + title: 'Organization', + type: 'string', + description: 'Name of the community or organization' + }, + { + name: 'role', + title: 'Role', + type: 'string', + description: 'Your role in the community' + }, + { + name: 'description', + title: 'Description', + type: 'text', + description: 'Describe your contributions and impact' + }, + ], + }, + ], + }, ], }