Files
pipeline/frontend/components/messenger/UserAvatar.tsx
T
syc0123 f558073ef8 [RAPID] feat: 메신저 기능 구현 (Socket.IO 실시간 채팅)
- DB: messenger_rooms/participants/messages/reactions/files 테이블 생성
- Backend: REST API 9개 엔드포인트 + Socket.IO 실시간 핸들러
- Frontend: Gmail 스타일 FAB + 모달, 채팅방 목록, 채팅 패널
- 기능: DM/그룹/채널, 파일 첨부, 이모지 리액션, 멘션, 스레드
- 알림: 토스트 on/off 토글, FAB 읽지 않은 배지

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

[RAPID-fix] 메신저 API snake_case→camelCase 변환 및 Socket.IO URL 수정

- useRooms/useMessages/useCompanyUsers 훅에서 DB 응답 camelCase 변환
- Socket.IO 기본 연결 URL 3001 → 8080 수정
- runMigration.ts 마이그레이션 파일 경로 수정 (../../ → ../../../)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

[RAPID-fix] 방 생성 API camelCase/snake_case 호환 처리

- createRoom 컨트롤러에서 participantIds/type/name (camelCase) fallback 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

[RAPID-fix] 메시지 전송 API 추가 (sendMessage 라우트/컨트롤러 누락)

- POST /api/messenger/rooms/:roomId/messages 라우트 등록
- MessengerController.sendMessage 메서드 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 12:20:40 +09:00

46 lines
1.1 KiB
TypeScript

"use client";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { cn } from "@/lib/utils";
interface UserAvatarProps {
photo?: string | null;
name: string;
size?: "sm" | "md" | "lg";
online?: boolean;
}
const sizeMap = {
sm: "h-7 w-7 text-xs",
md: "h-9 w-9 text-sm",
lg: "h-11 w-11 text-base",
};
const dotSizeMap = {
sm: "h-2 w-2",
md: "h-2.5 w-2.5",
lg: "h-3 w-3",
};
export function UserAvatar({ photo, name, size = "md", online }: UserAvatarProps) {
return (
<div className="relative inline-block shrink-0">
<Avatar className={cn(sizeMap[size])}>
{photo && <AvatarImage src={photo} alt={name} />}
<AvatarFallback className="bg-muted text-muted-foreground">
{name.charAt(0).toUpperCase()}
</AvatarFallback>
</Avatar>
{online !== undefined && (
<span
className={cn(
"absolute bottom-0 right-0 rounded-full border-2 border-background",
dotSizeMap[size],
online ? "bg-green-500" : "bg-gray-300"
)}
/>
)}
</div>
);
}