Skip to content

Commit

Permalink
그룹 멤버 목록에 유저명 표시 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
tirr-c authored Sep 22, 2023
1 parent cb83443 commit 7da3472
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ export async function leaveGroup(groupIdx: string): Promise<void> {

const groupMemberSchema = z.object({
uid: z.number(),
username: z.string(),
name: z.string(),
studentNumber: z.string(),
studentNumbers: z.string().array(),
});
export type GroupMember = z.infer<typeof groupMemberSchema>;
export async function listGroupMembers(groupIdx: string): Promise<GroupMember[]> {
Expand Down
7 changes: 6 additions & 1 deletion app/[locale]/(authorized)/group/[id]/MemberItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ export default function MemberItem(props: Props) {
/>
</label>
</td>
<td className="text-right tabular-nums px-2 border-r">{props.studentNumber}</td>
<td className="px-2 border-r">{props.username}</td>
<td className="text-right tabular-nums px-2 border-r">
<ul>
{props.studentNumbers.map(sn => <li key={sn}>{sn}</li>)}
</ul>
</td>
<td className="px-2 border-r">{props.name}</td>
</tr>
);
Expand Down
8 changes: 5 additions & 3 deletions app/[locale]/(authorized)/group/[id]/MemberList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export default function MemberList(props: Props) {
}

return members.filter(
({ name, studentNumber }) => (
name.includes(deferredQuery) || studentNumber.includes(deferredQuery)
({ username, name, studentNumbers }) => (
username.includes(deferredQuery) || name.includes(deferredQuery)
|| studentNumbers.some(sn => sn.includes(deferredQuery))
),
);
},
Expand Down Expand Up @@ -179,7 +180,8 @@ export default function MemberList(props: Props) {
<thead>
<tr className="h-8">
<th className="border w-8"></th>
<th className="border w-1/3">학번</th>
<th className="border w-1/4">유저명</th>
<th className="border w-1/4">학번</th>
<th className="border">이름</th>
</tr>
</thead>
Expand Down

0 comments on commit 7da3472

Please sign in to comment.