Skip to content

Commit

Permalink
[frontend] avatar の props の変更に対応 (user id を渡す)
Browse files Browse the repository at this point in the history
  • Loading branch information
kotto5 committed Feb 17, 2024
1 parent 735ce18 commit fb2427c
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion frontend/app/pong/GameCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function UserCard({ user }: { user: PublicUserEntity }) {
size="medium"
href={`/user/${user.id}`}
alt={user.name}
online={true}
id={user.id}
/>
</div>
</>
Expand Down
6 changes: 5 additions & 1 deletion frontend/app/room/[id]/sidebar-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export default function SidebarItem({
<>
<ContextMenu>
<ContextMenuTrigger className="flex gap-2 items-center group hover:opacity-60">
<Avatar avatarURL={user.user.avatarURL} size="small" />
<Avatar
avatarURL={user.user.avatarURL}
size="small"
id={user.userId}
/>
<span className="text-muted-foreground text-sm whitespace-nowrap group-hover:text-primary">
{truncateString(user.user.name, 15)}
{room.accessLevel !== "DIRECT" && isUserOwner && " 👑"}
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/ui/room/ban-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function BanItem({

return (
<div key={user.id} className="flex items-center gap-x-2 mb-6">
<Avatar avatarURL={user.avatarURL} size="medium" />
<Avatar avatarURL={user.avatarURL} size="medium" id={user.id} />
<div className="flex flex-col gap-y-1">
<div className="text-xs font-semibold flex items-center gap-x-1">
{user.name}
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/ui/room/invite-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function InviteItem({

return (
<div key={user.id} className="flex items-center gap-x-2 mb-6">
<Avatar avatarURL={user.avatarURL} size="medium" />
<Avatar avatarURL={user.avatarURL} size="medium" id={user.id} />
<div className="flex flex-col gap-y-1">
<div className="text-xs font-semibold flex items-center gap-x-1">
{user.name}
Expand Down
1 change: 1 addition & 0 deletions frontend/app/ui/room/message-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function MessageItem({
avatarURL={message.user.avatarURL}
size="medium"
href={`/user/${message.user.id}`}
id={message.user.id}
></Avatar>
</TooltipProvider>
)}
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/ui/room/unban-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function UnbanItem({

return (
<div key={user.id} className="flex items-center gap-x-2 mb-6">
<Avatar avatarURL={user.avatarURL} size="medium" />
<Avatar avatarURL={user.avatarURL} size="medium" id={user.id} />
<div className="flex flex-col gap-y-1">
<div className="text-xs font-semibold flex items-center gap-x-1">
{user.name}
Expand Down
1 change: 1 addition & 0 deletions frontend/app/ui/user/match-history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function MatchDetailItem({
avatarURL={detail.user.avatarURL}
href={`/user/${detail.user.id}`}
size="medium"
id={detail.user.id}
/>
<div>{detail.user.name}</div>
<div className={`font-bold ${textColor}`}>
Expand Down
5 changes: 1 addition & 4 deletions frontend/app/ui/user/user-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import type { PublicUserEntity } from "@/app/lib/dtos";
import { TooltipProvider } from "@/components/ui/tooltip";
import { Avatar, AvatarSize } from "./avatar";
import { OnlineContext } from "@/app/lib/hooks/useOnlineStatus";
import { useContext } from "react";

export default function UserList({
users,
Expand All @@ -13,7 +11,6 @@ export default function UserList({
users: PublicUserEntity[];
avatarSize: AvatarSize;
}) {
const onlineStatus = useContext(OnlineContext);
return (
<TooltipProvider delayDuration={0}>
<div className="flex flex-wrap gap-2">
Expand All @@ -24,7 +21,7 @@ export default function UserList({
size={avatarSize}
href={`/user/${u.id}`}
alt={u.name}
online={onlineStatus[u.id] === 1}
id={u.id}
key={u.id}
/>
))}
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/user/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default async function FindUser({
return (
<div className="flex flex-col gap-4">
<div>
<Avatar avatarURL={user.avatarURL} size="large" />
<Avatar avatarURL={user.avatarURL} size="large" id={user.id} />
</div>
<div className="text-3xl font-bold">{user.name}</div>
{user.id !== currentUserId && (
Expand Down

0 comments on commit fb2427c

Please sign in to comment.