Skip to content

Commit ab73657

Browse files
committed
Migrate to strapi v5.
Signed-off-by: vLuckyyy <[email protected]>
1 parent 23ac5c3 commit ab73657

File tree

9 files changed

+27
-32
lines changed

9 files changed

+27
-32
lines changed

components/page/projects/ProjectItem.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function ProjectItem({ repo, index }: ProjectItemProps) {
1616
return (
1717
<motion.div
1818
ref={ref}
19-
key={repo.id}
19+
key={repo.documentId}
2020
className={`flex flex-col items-center justify-between gap-12 text-center sm:flex-row sm:text-left ${
2121
index % 2 === 0 ? "sm:flex-row-reverse" : ""
2222
}`}
@@ -32,18 +32,18 @@ export default function ProjectItem({ repo, index }: ProjectItemProps) {
3232
animate={{ y: 0, opacity: 1 }}
3333
transition={{ duration: 0.3 }}
3434
>
35-
{repo.attributes.name}
35+
{repo.name}
3636
</motion.h1>
3737
<motion.p
3838
className="mb-6 max-w-2xl font-light text-gray-500 dark:text-gray-400 md:text-lg lg:mb-8 lg:text-xl"
3939
initial={{ y: -50, opacity: 0 }}
4040
animate={{ y: 0, opacity: 1 }}
4141
transition={{ duration: 0.3 }}
4242
>
43-
{repo.attributes.description}
43+
{repo.description}
4444
</motion.p>
4545
<div className="flex justify-center sm:justify-start">
46-
<a href={repo.attributes.repository_url} target="_blank" rel="noreferrer">
46+
<a href={repo.repository_url} target="_blank" rel="noreferrer">
4747
<ProjectButton title="Repository" />
4848
</a>
4949
</div>
@@ -57,8 +57,8 @@ export default function ProjectItem({ repo, index }: ProjectItemProps) {
5757
transition={{ duration: 0.3 }}
5858
>
5959
<Image
60-
alt={`${repo.attributes.name} project image`}
61-
src={repo.attributes.banner_url}
60+
alt={`${repo.name} project image`}
61+
src={repo.banner_url}
6262
className="mx-auto hidden rounded-xl object-cover sm:block"
6363
height={500}
6464
width={1000}

components/page/projects/Projects.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function Projects() {
5252
{/* Projects list with alternating layout */}
5353
<div className="lg:alternate mt-8 space-y-8 lg:mt-12">
5454
{projects.map((repo, index) => (
55-
<ProjectItem key={repo.id} repo={repo} index={index} />
55+
<ProjectItem key={repo.documentId} repo={repo} index={index} />
5656
))}
5757
</div>
5858
</div>

components/page/projects/projectService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function fetchProjects(): Promise<Project[]> {
1414

1515
const data = (await response.json()) as ApiResponse;
1616

17-
// Validate response structure
17+
// Now data.data is already an array of Project (no attributes nesting)
1818
if (data && Array.isArray(data.data)) {
1919
return data.data;
2020
} else {

components/page/projects/types.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
export interface Project {
2-
id: string;
3-
attributes: {
4-
name: string;
5-
description: string;
6-
repository_url: string;
7-
banner_url: string;
8-
};
2+
documentId: string;
3+
name: string;
4+
description: string;
5+
repository_url: string;
6+
banner_url: string;
97
}
108

119
export interface ProjectItemProps {

components/page/team/Team.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default function Team() {
6060
staggerDelay={0.18}
6161
>
6262
{members.map((member, index) => (
63-
<TeamMember key={member.id} member={member.attributes} index={index} />
63+
<TeamMember key={member.documentId || index} member={member} index={index} />
6464
))}
6565
</AnimatedContainer>
6666
</div>

components/page/team/TeamMember.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export default function TeamMember({ member }: TeamMemberProps) {
4747
</h3>
4848

4949
{/* Member roles */}
50-
{member.team_roles.data.map((role, roleIndex) => (
51-
<p key={roleIndex}>{role.attributes.name}</p>
50+
{(member.team_roles?.data ?? []).map((role, roleIndex) => (
51+
<p key={roleIndex}>{role.name}</p>
5252
))}
5353

5454
{/* Social links with hover animations */}

components/page/team/teamService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export async function fetchTeamMembers(): Promise<Member[]> {
1212

1313
const data = (await response.json()) as StrapiResponse;
1414

15-
// Validate response structure
15+
// Now data.data is already an array of Member (no attributes nesting)
1616
if (data && Array.isArray(data.data)) {
1717
return data.data;
1818
} else {

components/page/team/types.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
export interface TeamRole {
2-
attributes: {
3-
name: string;
4-
};
2+
name: string;
53
}
64

7-
export interface MemberData {
5+
export interface Member {
6+
documentId: string;
87
avatar_url: string;
98
name: string;
10-
team_roles: {
11-
data: TeamRole[];
12-
};
9+
team_roles: { data: TeamRole[] };
1310
github?: string;
1411
linkedin?: string;
1512
}
1613

1714
export interface TeamMemberProps {
18-
member: MemberData;
15+
member: Member;
1916
index: number;
2017
}
2118

22-
export interface Member {
23-
id: string;
24-
attributes: MemberData;
25-
}
26-
2719
export interface StrapiResponse {
2820
data: Member[];
2921
meta?: Record<string, unknown>;

next.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ const nextConfig = {
2626
hostname: "avatars-githubusercontent.webp.se",
2727
port: "",
2828
},
29+
{
30+
protocol: "https",
31+
hostname: "private-user-images.githubusercontent.com",
32+
port: "",
33+
},
2934
{
3035
protocol: "https",
3136
hostname: "i.imgur.com",

0 commit comments

Comments
 (0)