Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/api/rooms/getRoomMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface RoomMember {
imageUrl: string;
aliasName: string;
followerCount: number;
isMyself: boolean;
}

// 독서메이트 조회 응답 타입
Expand All @@ -26,6 +27,7 @@ export interface Member {
role: string;
followersCount?: number;
profileImageUrl?: string;
isMyself?: boolean;
}

export const convertRoomMembersToMembers = (roomMembers: RoomMember[]): Member[] => {
Expand All @@ -36,6 +38,7 @@ export const convertRoomMembersToMembers = (roomMembers: RoomMember[]): Member[]
role: member.aliasName || '독서메이트',
followersCount: member.followerCount || 0,
profileImageUrl: member.imageUrl || undefined,
isMyself: member.isMyself,
};

return convertedMember;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export const EmptyContainer = styled.div`
`;

export const EmptyText = styled.p`
color: #e0e0e0;};
color: #e0e0e0;
font-size: ${typography.fontSize.sm};
font-weight: ${typography.fontWeight.regular};
margin: 0;
Expand Down
1 change: 1 addition & 0 deletions src/components/creategroup/RoomInfoSection.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const TextArea = styled.textarea`
font-weight: ${typography.fontWeight.regular};
padding: 0;
margin: 0;
caret-color: ${colors.neongreen};

&::placeholder {
color: ${colors.grey[300]};
Expand Down
20 changes: 14 additions & 6 deletions src/components/createpost/PhotoSection.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef } from 'react';
import { useRef, useMemo, useEffect } from 'react';
import { Section, SectionTitle } from '../../pages/group/CommonSection.styled';
import {
PhotoContainer,
Expand Down Expand Up @@ -49,9 +49,17 @@ const PhotoSection = ({
e.target.value = '';
};

const createImageUrl = (file: File) => {
return URL.createObjectURL(file);
};
// 사진 파일들을 blob URL로 변환 (메모리 누수 방지)
const photoUrls = useMemo(() => {
return photos.map(file => URL.createObjectURL(file));
}, [photos]);

// 컴포넌트 언마운트 또는 photos 변경 시 기존 blob URL 해제
useEffect(() => {
return () => {
photoUrls.forEach(url => URL.revokeObjectURL(url));
};
}, [photoUrls]);

const totalImageCount = existingImageUrls.length + photos.length;
const isDisabled = totalImageCount >= 3 || readOnly || isEditMode;
Expand Down Expand Up @@ -81,12 +89,12 @@ const PhotoSection = ({
</div>
))}

{photos.map((photo, index) => (
{photos.map((_, index) => (
<div
key={`new-${index}`}
style={{ position: 'relative', width: '80px', height: '80px' }}
>
<PhotoImage src={createImageUrl(photo)} alt={`새 이미지 ${index + 1}`} />
<PhotoImage src={photoUrls[index]} alt={`새 이미지 ${index + 1}`} />
{!readOnly && (
<RemoveButton onClick={() => onPhotoRemove(index)}>
<img src={closeIcon} alt="삭제" />
Expand Down
27 changes: 25 additions & 2 deletions src/components/createpost/PostContentSection.styled.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
import { typography, semanticColors } from '../../styles/global/global';
import { typography, semanticColors, colors } from '../../styles/global/global';

export const TextAreaBox = styled.div`
position: relative;
Expand All @@ -18,9 +18,32 @@ export const TextArea = styled.textarea<{ readOnly?: boolean }>`
resize: none;
outline: none;
border: none;
overflow: hidden;
overflow-y: auto;
cursor: ${props => (props.readOnly ? 'not-allowed' : 'text')};
padding: 0;
caret-color: ${colors.neongreen};

/* 얇은 스크롤바 스타일 */
&::-webkit-scrollbar {
width: 4px;
}

&::-webkit-scrollbar-track {
background: transparent;
}

&::-webkit-scrollbar-thumb {
background-color: ${semanticColors.text.ghost};
border-radius: 2px;
}

&::-webkit-scrollbar-thumb:hover {
background-color: ${semanticColors.text.tertiary};
}

/* Firefox 스크롤바 스타일 */
scrollbar-width: thin;
scrollbar-color: ${semanticColors.text.ghost} transparent;

&::placeholder {
color: ${semanticColors.text.ghost};
Expand Down
16 changes: 10 additions & 6 deletions src/components/members/MemberList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ interface MemberListProps {
const MemberList = ({ members, onMemberClick }: MemberListProps) => {
const navigate = useNavigate();

const handleMemberClick = (memberId: string) => {
const handleMemberClick = (member: Member) => {
if (onMemberClick) {
onMemberClick(memberId);
onMemberClick(member.id);
} else {
// 기본 동작: 개별 유저 페이지로 이동
navigate(`/otherfeed/${memberId}`);
// isMyself가 true면 본인 프로필 페이지로, 아니면 다른 유저 페이지로 이동
if (member.isMyself) {
navigate(`/myfeed/${member.id}`);
} else {
navigate(`/otherfeed/${member.id}`);
}
}
};

Expand All @@ -39,11 +43,11 @@ const MemberList = ({ members, onMemberClick }: MemberListProps) => {
key={member.id}
role="button"
tabIndex={0}
onClick={() => handleMemberClick(member.id)}
onClick={() => handleMemberClick(member)}
onKeyDown={(e: KeyboardEvent) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
handleMemberClick(member.id);
handleMemberClick(member);
}
}}
>
Expand Down
8 changes: 5 additions & 3 deletions src/components/recordwrite/PageRangeSection.styled.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
import { colors, typography, semanticColors } from '../../styles/global/global';
import { typography, semanticColors } from '../../styles/global/global';

export const Section = styled.div`
display: flex;
Expand Down Expand Up @@ -50,10 +50,12 @@ export const PageInput = styled.input<{ inputLength?: number }>`
font-size: ${typography.fontSize.sm};
font-weight: ${typography.fontWeight.regular};
font-family: ${typography.fontFamily.primary};
width: ${props => (props.inputLength ? `${Math.max(27, props.inputLength * 8)}px` : '27px')};
width: ${props => {
if (!props.inputLength) return '12px';
return `${Math.max(9, props.inputLength * 8)}px`;
}};
padding: 0;
margin: 0;
caret-color: ${colors.white};
transition: width 0.2s ease;
flex-shrink: 0;

Expand Down
10 changes: 8 additions & 2 deletions src/pages/groupMembers/GroupMembers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@ const GroupMembers = () => {
};

const handleMemberClick = (memberId: string) => {
// 특정 사용자 페이지로 이동
navigate(`/otherfeed/${memberId}`);
// MemberList 컴포넌트에서 isMyself에 따른 네비게이션 처리를 담당하므로
// 여기서는 기본 동작을 유지
const member = members.find(m => m.id === memberId);
if (member?.isMyself) {
navigate(`/myfeed/${memberId}`);
} else {
navigate(`/otherfeed/${memberId}`);
}
};

// 로딩 상태
Expand Down
1 change: 1 addition & 0 deletions src/pages/pollwrite/PollWrite.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export const Container = styled.div`
padding: 96px 20px 100px 20px;
box-sizing: border-box;
gap: 32px;

`;
1 change: 1 addition & 0 deletions src/pages/recordwrite/RecordWrite.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export const Container = styled.div`
padding: 96px 20px 100px 20px;
box-sizing: border-box;
gap: 32px;

`;