Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1fb86c8
feat: 책 페이지 정보 조회 API 연동 함수 추가
ljh130334 Aug 16, 2025
8c42ca8
feat: RecordWrite 및 PollWrite 컴포넌트 API 연동
ljh130334 Aug 16, 2025
af7a6e3
feat: TypeScript 오류 수정 - 컴포넌트 타입 불일치 해결
ljh130334 Aug 16, 2025
dce5841
refactor: 하드코딩된 Record 객체 제거 - API 성공 시 기록장으로 바로 이동
ljh130334 Aug 17, 2025
4541112
fix: 총평 작성 시 페이지 검증 오류 해결
ljh130334 Aug 17, 2025
f2dc673
refactor: 총평보기 필터링 로직 프론트엔드로 이동
ljh130334 Aug 17, 2025
3fddcbd
fix: 일반 기록과 총평 기록 API 분리 호출로 모든 기록 가져오기
ljh130334 Aug 17, 2025
2a74cd2
Merge pull request #145 from THIP-TextHip/main
heeeeyong Aug 17, 2025
a438cfd
Merge pull request #129 from THIP-TextHip/feat/api-rooms-page
ljh130334 Aug 17, 2025
f0d603e
feat: 좋아요 상태 관리 API 연동 및 기록장 url 구조 수정
ljh130334 Aug 17, 2025
7ad406b
feat: 로그아웃 구현 완료
heeeeyong Aug 17, 2025
9929319
Merge pull request #146 from THIP-TextHip/chore/minor-updates
heeeeyong Aug 17, 2025
f053be7
fix: SortType 정의를 API 스펙에 맞게 수정 및 Memory.tsx TypeScript 오류 및 React Ho…
ljh130334 Aug 17, 2025
fed5cca
fix: Record, PollOption 타입 import 경로를 types/memory로 수정
ljh130334 Aug 17, 2025
9de997c
Merge pull request #147 from THIP-TextHip/feat/api-rooms-like
ljh130334 Aug 17, 2025
56924a8
feat: search 로직 변경, 무한 스크롤 추가
ho0010 Aug 17, 2025
7f6081c
fix: build error
ho0010 Aug 17, 2025
fcf2319
Merge pull request #148 from THIP-TextHip/feat/api-rooms
ho0010 Aug 17, 2025
407e036
feat: 비번방 입장 모달 구현
heeeeyong Aug 17, 2025
332d5a3
feat: 모임방 참가 성공 여부에 따른 분기처리 추가
heeeeyong Aug 17, 2025
a933763
Merge pull request #149 from THIP-TextHip/chore/minor-updates
heeeeyong Aug 17, 2025
99499d3
design: 탭바 애니메이션 추가
heeeeyong Aug 17, 2025
272fb63
fix: 마이페이지 리다이렉션 경로 추가
heeeeyong Aug 17, 2025
2eaf8cf
fix: 내 띱 목록 API 연동
heeeeyong Aug 17, 2025
c4da80d
fix: 내 띱 목록 변수 수정
heeeeyong Aug 17, 2025
ea3ca3e
fix: 내 띱 목록 API 연동 완료
heeeeyong Aug 17, 2025
34d785b
Merge pull request #150 from THIP-TextHip/chore/minor-updates
heeeeyong Aug 17, 2025
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
64 changes: 64 additions & 0 deletions src/api/roomPosts/postRoomPostLike.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { apiClient } from '../index';
import type { RoomPostLikeRequest, RoomPostLikeResponse } from '@/types/roomPostLike';

// 방 게시물(기록,투표) 좋아요 상태변경 API 함수
export const postRoomPostLike = async (
postId: number,
requestData: RoomPostLikeRequest,
): Promise<RoomPostLikeResponse> => {
try {
const response = await apiClient.post<RoomPostLikeResponse>(
`/room-posts/${postId}/likes`,
requestData,
);
return response.data;
} catch (error) {
console.error('방 게시물 좋아요 API 오류:', error);
throw error;
}
};

/*
사용 예시:

// 기록 게시물 좋아요
const likeRecordPost = async (postId: number, isLiked: boolean) => {
try {
const result = await postRoomPostLike(postId, {
type: !isLiked, // 현재 상태 반대로 전송
roomPostType: 'RECORD'
});

if (result.isSuccess) {
console.log('좋아요 상태 변경 성공:', result.data.isLiked);
console.log('게시물 ID:', result.data.postId);
// UI 업데이트 로직
} else {
console.error('좋아요 상태 변경 실패:', result.message);
// 에러 처리 로직
}
} catch (error) {
console.error('API 호출 오류:', error);
// 네트워크 에러 처리 로직
}
};

// 투표 게시물 좋아요
const likeVotePost = async (postId: number, isLiked: boolean) => {
try {
const result = await postRoomPostLike(postId, {
type: !isLiked, // 현재 상태 반대로 전송
roomPostType: 'VOTE'
});

if (result.isSuccess) {
console.log('좋아요 상태 변경 성공:', result.data.isLiked);
// UI 업데이트 로직
} else {
console.error('좋아요 상태 변경 실패:', result.message);
}
} catch (error) {
console.error('API 호출 오류:', error);
}
};
*/
48 changes: 48 additions & 0 deletions src/api/rooms/getBookPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { apiClient } from '../index';

// 책 페이지 정보 응답 데이터 타입
export interface BookPageData {
totalBookPage: number; // 책 전체 페이지 수
recentBookPage: number; // 최근 기록한 페이지 번호
isOverviewPossible: boolean; // 총평 작성 가능 여부
roomId: number; // 방 ID
}

// API 응답 타입
export interface BookPageResponse {
isSuccess: boolean;
code: number;
message: string;
data: BookPageData;
}

// 책 전체 페이지수 및 총평 작성 가능 여부 조회 API 함수
export const getBookPage = async (roomId: number): Promise<BookPageResponse> => {
try {
const response = await apiClient.get<BookPageResponse>(`/rooms/${roomId}/book-page`);
return response.data;
} catch (error) {
console.error('책 페이지 정보 조회 API 오류:', error);
throw error;
}
};

/*
사용 예시:
try {
const result = await getBookPage(1);
if (result.isSuccess) {
console.log("책 전체 페이지 수:", result.data.totalBookPage);
console.log("최근 기록한 페이지:", result.data.recentBookPage);
console.log("총평 작성 가능:", result.data.isOverviewPossible);
console.log("방 ID:", result.data.roomId);
// 성공 처리 로직
} else {
console.error("책 페이지 정보 조회 실패:", result.message);
// 실패 처리 로직
}
} catch (error) {
console.error("API 호출 오류:", error);
// 에러 처리 로직 (400: 파라미터 잘못, 403: 접근 권한 없음, 404: 방 없음)
}
*/
23 changes: 23 additions & 0 deletions src/api/rooms/postPassword.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { apiClient } from '../index';

export interface PostPasswordRequest {
password: string;
}

export interface PostPasswordResponse {
isSuccess: boolean;
code: number;
message: string;
data: {
matched: boolean;
roomId: number;
};
}

export const postPassword = async (
roomId: number,
data: PostPasswordRequest,
): Promise<PostPasswordResponse> => {
const response = await apiClient.post<PostPasswordResponse>(`/rooms/${roomId}/password`, data);
return response.data;
};
2 changes: 1 addition & 1 deletion src/api/users/getRecentFollowing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface GetRecentFollowingResponse {
code: number;
message: string;
data: {
recentWriters: RecentWriterData[];
myFollowingUsers: RecentWriterData[];
};
}

Expand Down
12 changes: 6 additions & 6 deletions src/components/feed/FollowList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getRecentFollowing, type RecentWriterData } from '@/api/users/getRecent

const FollowList = () => {
const navigate = useNavigate();
const [recentWriters, setRecentWriters] = useState<RecentWriterData[]>([]);
const [myFollowings, setMyFollowings] = useState<RecentWriterData[]>([]);
const [loading, setLoading] = useState(false);

// API에서 최근 글 작성한 팔로우 리스트 조회
Expand All @@ -19,14 +19,14 @@ const FollowList = () => {
const response = await getRecentFollowing();

if (response.isSuccess) {
setRecentWriters(response.data.recentWriters);
setMyFollowings(response.data.myFollowingUsers);
} else {
console.error('최근 팔로우 작성자 조회 실패:', response.message);
setRecentWriters([]);
setMyFollowings([]);
}
} catch (error) {
console.error('최근 팔로우 작성자 조회 중 오류:', error);
setRecentWriters([]);
setMyFollowings([]);
} finally {
setLoading(false);
}
Expand All @@ -37,8 +37,8 @@ const FollowList = () => {
fetchRecentFollowing();
}, []);

const hasFollowers = recentWriters.length > 0;
const visible = hasFollowers ? recentWriters.slice(0, 10) : [];
const hasFollowers = myFollowings.length > 0;
const visible = hasFollowers ? myFollowings.slice(0, 10) : [];

const handleFindClick = () => {
navigate('/feed/search');
Expand Down
19 changes: 17 additions & 2 deletions src/components/feed/TabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,41 @@ const TabButton = styled.div`
padding: 8px 4px;
font-size: var(--font-size-lg);
cursor: pointer;
position: relative;

&.active {
color: var(--color-white);
border-bottom: 2px solid var(--color-white);
font-weight: var(--font-weight-semibold);
line-height: 24px;
}
&.inactive {
color: var(--color-grey-300);
border-bottom: 2px solid transparent;
font-weight: var(--font-weight-medium);
line-height: 24px;
}
`;

const ActiveIndicator = styled.div<{ activeIndex: number }>`
position: absolute;
bottom: 0;
left: 20px;
width: 60px;
height: 2px;
background-color: var(--color-white);
transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
transform: translateX(${props => props.activeIndex * 80}px);
`;

interface TabProps {
tabs: string[];
activeTab: string;
onTabClick: (tab: string) => void;
}

const TabBar = ({ tabs, activeTab, onTabClick }: TabProps) => {
// 현재 활성 탭의 인덱스 계산
const activeIndex = tabs.findIndex(tab => tab === activeTab);

return (
<Container>
{tabs.map(tab => (
Expand All @@ -59,6 +72,8 @@ const TabBar = ({ tabs, activeTab, onTabClick }: TabProps) => {
{tab}
</TabButton>
))}
{/* 슬라이드 애니메이션 밑줄 */}
<ActiveIndicator activeIndex={activeIndex} />
</Container>
);
};
Expand Down
Loading