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
4 changes: 2 additions & 2 deletions src/api/comments/getComments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface CommentData {
creatorId: number;
creatorProfileImageUrl: string | null;
creatorNickname: string;
alias: string;
aliasName: string;
aliasColor: string;
postDate: string;
content: string;
Expand All @@ -21,7 +21,7 @@ export interface ReplyData {
creatorId: number;
creatorProfileImageUrl: string | null;
creatorNickname: string;
alias: string;
aliasName: string;
aliasColor: string;
postDate: string;
content: string;
Expand Down
2 changes: 1 addition & 1 deletion src/api/feeds/getFeedDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface FeedDetailData {
creatorId: number;
creatorNickname: string;
creatorProfileImageUrl: string;
alias: string;
aliasName: string;
aliasColor: string;
postDate: string;
isbn: string;
Expand Down
2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios, { type AxiosResponse, type AxiosError } from 'axios';

// 하드코딩된 액세스 토큰
const ACCESS_TOKEN =
'Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOjEsImlhdCI6MTc1NDIwMTY4OCwiZXhwIjoxNzU2NzkzNjg4fQ.oOyJ7JI_t2-Xq1-gfAv4ZaYNrbyplvqdxhCk76-Txe4';
'Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOjksImlhdCI6MTc1NDM4MjY1MiwiZXhwIjoxNzU2OTc0NjUyfQ.CCb_F6OGe02_ITYsE-tqc2_PvSkRsxd96t8NWNIa1pI';

// 토큰 관리 유틸리티
export const TokenManager = {
Expand Down
40 changes: 40 additions & 0 deletions src/api/rooms/createRoom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { apiClient } from '../index';
import type { CreateRoomRequest, CreateRoomData, ApiResponse } from '@/types/room';

// API 응답 타입
export type CreateRoomResponse = ApiResponse<CreateRoomData>;

// 방 생성 API 함수
export const createRoom = async (roomData: CreateRoomRequest) => {
const response = await apiClient.post<CreateRoomResponse>('rooms', roomData);
return response.data;
};

/*
사용 예시:
const roomData: CreateRoomRequest = {
isbn: "9788936434632",
category: "문학",
roomName: "문학 모임",
description: "문학을 사랑하는 사람들의 모임입니다.",
progressStartDate: "2023.10.01",
progressEndDate: "2023.10.31",
recruitCount: 5,
password: "1234",
isPublic: true
};

try {
const result = await createRoom(roomData);
if (result.isSuccess) {
console.log("생성된 방 ID:", result.data.roomId);
// 성공 처리 로직
} else {
console.error("방 생성 실패:", result.message);
// 실패 처리 로직
}
} catch (error) {
console.error("API 호출 오류:", error);
// 에러 처리 로직
}
*/
3 changes: 3 additions & 0 deletions src/assets/common/loadingspinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions src/components/common/LoadingSpinner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import styled from '@emotion/styled';
import LoadingSpinnerIcon from '@/assets/common/loadingspinner.svg';
import { colors, typography } from '@/styles/global/global';

interface LoadingSpinnerProps {
message?: string;
size?: 'small' | 'medium' | 'large';
fullHeight?: boolean;
}

const LoadingSpinner = ({
message = '로딩 중...',
size = 'medium',
fullHeight = false,
}: LoadingSpinnerProps) => {
return (
<Container fullHeight={fullHeight}>
<SpinnerImage size={size} src={LoadingSpinnerIcon} alt="로딩 중" />
{message && <LoadingText>{message}</LoadingText>}
</Container>
);
};

const Container = styled.div<{ fullHeight: boolean }>`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
${({ fullHeight }) =>
fullHeight &&
`
min-height: 100vh;
background-color: var(--color-black-main);
`}
`;

const SpinnerImage = styled.img<{ size: string }>`
${({ size }) => {
switch (size) {
case 'small':
return 'width: 24px; height: 24px;';
case 'large':
return 'width: 48px; height: 48px;';
default: // medium
return 'width: 32px; height: 32px;';
}
}}
`;

const LoadingText = styled.p`
margin-top: 20px;
color: ${colors.white};
font-size: ${typography.fontSize.lg};
font-weight: ${typography.fontWeight.semibold};
`;

export default LoadingSpinner;
8 changes: 4 additions & 4 deletions src/components/common/Post/PostHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from '@emotion/styled';
interface PostHeaderProps {
creatorProfileImageUrl?: string;
creatorNickname?: string;
alias?: string;
aliasName?: string;
aliasColor?: string;
postDate: string;
creatorId?: number;
Expand All @@ -13,8 +13,8 @@ interface PostHeaderProps {
const PostHeader = ({
creatorProfileImageUrl,
creatorNickname,
alias,
aliasColor = '#FFFFFF', // 기본값 설정
aliasName,
aliasColor,
postDate,
creatorId,
type = 'post',
Expand All @@ -34,7 +34,7 @@ const PostHeader = ({
<div className="infoBox">
<div className="username">{creatorNickname}</div>
<div className="usertitle" style={{ color: aliasColor }}>
{alias}
{aliasName}
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/Post/Reply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Reply = ({
creatorId,
creatorProfileImageUrl,
creatorNickname,
alias,
aliasName,
aliasColor,
postDate,
content,
Expand Down Expand Up @@ -117,7 +117,7 @@ const Reply = ({
<PostHeader
creatorProfileImageUrl={creatorProfileImageUrl || undefined}
creatorNickname={creatorNickname}
alias={alias}
aliasName={aliasName}
aliasColor={aliasColor}
postDate={postDate}
creatorId={creatorId}
Expand Down
9 changes: 4 additions & 5 deletions src/components/common/Post/SubReply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const SubReply = ({
creatorId,
creatorProfileImageUrl,
creatorNickname,
alias,
aliasName,
aliasColor,
postDate,
content,
Expand Down Expand Up @@ -139,7 +139,7 @@ const SubReply = ({
<PostHeader
creatorProfileImageUrl={creatorProfileImageUrl || ''}
creatorNickname={creatorNickname}
alias={alias}
aliasName={aliasName || ''}
aliasColor={aliasColor}
postDate={postDate}
creatorId={creatorId}
Expand All @@ -148,8 +148,7 @@ const SubReply = ({
<ReplySection onClick={handleMoreClick}>
<div className="left">
<div className="reply">
<div className="reply-nickname">@{parentCommentCreatorNickname} </div>
{content}
<span className="reply-nickname">@{parentCommentCreatorNickname}</span> {content}
</div>
<div
className="sub-reply"
Expand Down Expand Up @@ -229,7 +228,7 @@ const ReplySection = styled.div`
line-height: 20px;

.reply-nickname {
color: ${colors.grey[100]};
color: ${colors.white};
font-size: ${typography.fontSize.sm};
font-weight: ${typography.fontWeight.regular};
line-height: 20px;
Expand Down
Loading