Skip to content

Commit 1df3289

Browse files
Merge pull request #79 from codersforcauses/issue-55-Add_member_social_media_info
Issue 55 add member social media info
2 parents 701ae83 + e903ff9 commit 1df3289

13 files changed

Lines changed: 231 additions & 38 deletions

client/src/components/main/MemberProfile.tsx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22

33
import Image from "next/image";
4+
import { SocialIcon } from "react-social-icons";
45

56
// unused atm, as the member isnt linked a project on the backend
67
/* export type MemberProfileProject = {
@@ -15,6 +16,10 @@ export type MemberProfileData = {
1516
about: string;
1617
pronouns?: string;
1718
profile_picture?: string;
19+
social_media?: {
20+
link: string;
21+
socialMediaUserName: string;
22+
}[];
1823
};
1924

2025
type MemberProfileProps = {
@@ -66,7 +71,37 @@ export function MemberProfile({ member }: MemberProfileProps) {
6671
<p className="min-w-fit font-jersey10 text-4xl">{member.name}</p>
6772
<hr className="ml-5 hidden w-full self-center border-light_2 lg:flex" />
6873
</div>
69-
<p className="text-lg">{member.pronouns}</p>
74+
<div className="flex items-center gap-2">
75+
{member.social_media && member.social_media.length > 0 && (
76+
<div className="w-full">
77+
<div className="mt-2 flex flex-wrap items-center gap-2">
78+
{member.social_media.map((sm) => (
79+
<span
80+
key={sm.link}
81+
className="ml-2 flex items-center gap-1"
82+
>
83+
<SocialIcon
84+
url={sm.link}
85+
style={{ height: 24, width: 24 }}
86+
/>
87+
<a
88+
href={sm.link}
89+
target="_blank"
90+
rel="noopener noreferrer"
91+
className="font-firaCode text-base underline hover:text-primary"
92+
>
93+
{sm.socialMediaUserName}
94+
</a>
95+
</span>
96+
))}
97+
</div>
98+
</div>
99+
)}
100+
</div>
101+
<div className="flex items-center gap-2">
102+
<p className="text-lg">{member.pronouns}</p>
103+
</div>
104+
70105
<p>{member.about}</p>
71106
</div>
72107
</div>

client/src/hooks/useGames.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ type Contributor = {
77
member_id: number;
88
name: string;
99
role: string;
10+
social_media?: Array<{
11+
socialMediaName: string;
12+
link: string;
13+
socialMediaUserName: string;
14+
}>;
1015
};
1116

1217
type ApiGame = {

client/src/hooks/useGameshowcase.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import api from "@/lib/api";
66
type Contributor = {
77
name: string;
88
role: string;
9+
social_media?: {
10+
socialMediaName: string;
11+
link: string;
12+
socialMediaUserName: string;
13+
}[];
914
};
1015

1116
type ApiShowcaseGame = {

client/src/hooks/useMember.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ type ApiMember = {
77
about: string;
88
pronouns?: string;
99
profile_picture?: string;
10+
social_media?: {
11+
link: string;
12+
socialMediaUserName: string;
13+
}[];
1014
};
1115

1216
// return api member, import id number from router, is not enabled if not a number type

client/src/pages/games/[id].tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Image from "next/image";
22
import { useRouter } from "next/router";
33
import React from "react";
4+
import { SocialIcon } from "react-social-icons";
45

56
import { ItchEmbed } from "@/components/ui/ItchEmbed";
67
import { useGame } from "@/hooks/useGames";
@@ -107,17 +108,29 @@ export default function IndividualGamePage() {
107108
Contributors
108109
</td>
109110
<td className="py-1 text-right sm:py-2">
110-
<div className="grid grid-cols-[auto_auto] gap-x-1 gap-y-1">
111+
<div className="flex flex-col gap-y-1">
111112
{game.contributors.map((c) => (
112-
<React.Fragment key={c.member_id}>
113+
<div
114+
key={c.member_id}
115+
className="flex items-center gap-x-2"
116+
>
113117
<a
114-
href={`/member/${c.member_id}`}
118+
href={`/members/${c.member_id}`}
115119
className="text-primary hover:underline"
116120
>
117121
{c.name}
118122
</a>
119-
<span>{c.role}</span>
120-
</React.Fragment>
123+
{Array.isArray(c.social_media) &&
124+
c.social_media.map((sm) => (
125+
<SocialIcon
126+
key={sm.link}
127+
url={sm.link}
128+
style={{ height: 24, width: 24 }}
129+
title={sm.socialMediaUserName}
130+
/>
131+
))}
132+
<span className="ml-auto">{c.role}</span>
133+
</div>
121134
))}
122135
</div>
123136
</td>

client/src/pages/games/index.tsx

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -125,28 +125,20 @@ export default function HomePage() {
125125
<span className="font-semibold text-foreground">
126126
{contributor.name}
127127
</span>
128-
<span
129-
className="text-foreground"
130-
style={{ marginLeft: 20 }}
131-
>
132-
- {contributor.role}
133-
</span>
134-
{/* Social icons placeholder */}
135-
{/* TODO: Add actual links */}
128+
{/* Social icons from API */}
136129
<span className="flex gap-2 text-primary">
137-
{/* Social icons using react-social-icons */}
138-
<SocialIcon
139-
url="https://facebook.com/"
140-
style={{ height: 24, width: 24 }}
141-
/>
142-
<SocialIcon
143-
url="https://instagram.com/"
144-
style={{ height: 24, width: 24 }}
145-
/>
146-
<SocialIcon
147-
url="https://github.com/"
148-
style={{ height: 24, width: 24 }}
149-
/>
130+
{Array.isArray(contributor.social_media) &&
131+
contributor.social_media.map((sm) => (
132+
<SocialIcon
133+
key={sm.link}
134+
url={sm.link}
135+
style={{ height: 24, width: 24 }}
136+
title={sm.socialMediaUserName}
137+
/>
138+
))}
139+
</span>
140+
<span className="ml-auto text-foreground">
141+
- {contributor.role}
150142
</span>
151143
</li>
152144
))}

server/game_dev/admin.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
from django.contrib import admin
2-
from .models import Member, Game, Event, GameContributor, GameShowcase, Committee
2+
from .models import Member, Game, Event, GameContributor, GameShowcase, Committee, SocialMedia
3+
4+
5+
class SocialMediaInline(admin.TabularInline):
6+
model = SocialMedia
7+
extra = 1
38

49

510
class MemberAdmin(admin.ModelAdmin):
611
list_display = ("id", "name", "active", "profile_picture", "about", "pronouns")
712
search_fields = ["name", "about"]
13+
inlines = [SocialMediaInline]
814

915

1016
# Sample EventsAdmin Class made
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Generated by Django 5.1.14 on 2026-01-31 06:18
2+
3+
import django.db.models.deletion
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
("game_dev", "0009_merge_20260131_1044"),
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name="SocialMedia",
16+
fields=[
17+
(
18+
"id",
19+
models.BigAutoField(
20+
auto_created=True,
21+
primary_key=True,
22+
serialize=False,
23+
verbose_name="ID",
24+
),
25+
),
26+
(
27+
"socialMediaName",
28+
models.CharField(
29+
choices=[
30+
("TWITTER", "Twitter"),
31+
("FACEBOOK", "Facebook"),
32+
("INSTAGRAM", "Instagram"),
33+
("LINKEDIN", "LinkedIn"),
34+
("GITHUB", "GitHub"),
35+
("OTHER", "Other"),
36+
],
37+
default="OTHER",
38+
max_length=20,
39+
),
40+
),
41+
("link", models.URLField(max_length=2083)),
42+
("socialMediaUserName", models.CharField(blank=True, max_length=200)),
43+
(
44+
"member",
45+
models.ForeignKey(
46+
on_delete=django.db.models.deletion.CASCADE,
47+
related_name="social_media_links",
48+
to="game_dev.member",
49+
),
50+
),
51+
],
52+
),
53+
]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Generated by Django 5.1.14 on 2026-02-03 03:27
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("game_dev", "0010_merge_20260131_1118"),
10+
("game_dev", "0010_socialmedia"),
11+
]
12+
13+
operations = []
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 5.1.14 on 2026-02-07 03:31
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("game_dev", "0011_merge_0010_merge_20260131_1118_0010_socialmedia"),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name="socialmedia",
15+
name="socialMediaName",
16+
),
17+
]

0 commit comments

Comments
 (0)