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
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<title>THIP, 독서를 기록하는 가장 힙한 방법</title>
<meta property="og:title" content="THIP, 독서를 기록하는 가장 힙한 방법" />
<meta property="og:description" content="커뮤니티형 독서 기록 플랫폼. 띱. THIP." />
<meta property="og:image" content="https://thip.co.kr/assets/thumbnail.png" />
<meta property="og:image" content="https://thip.co.kr/assets/thumbnail.jpeg" />
<meta property="og:url" content="https://thip.co.kr" />
</head>
<body>
Expand Down
Binary file added public/assets/custom_favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/assets/thumbnail.png
Binary file not shown.
4 changes: 2 additions & 2 deletions src/components/common/Post/PostBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ const PostBody = ({
</PostContent>
<ImageContainer>
{hasImage && (
<div className="imgContainer">
<>
{contentUrls.map((src: string, i: number) => (
<img key={i} src={src} />
))}
</div>
</>
)}
</ImageContainer>
</Container>
Expand Down
2 changes: 1 addition & 1 deletion src/components/feed/FollowList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getRecentFollowing, type RecentWriterData } from '@/api/users/getRecent
const FollowList = () => {
const navigate = useNavigate();
const [myFollowings, setMyFollowings] = useState<RecentWriterData[]>([]);
const [loading, setLoading] = useState(false);
const [loading, setLoading] = useState(true);

// API에서 최근 글 작성한 팔로우 리스트 조회
const fetchRecentFollowing = async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/feed/MyFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { colors, typography } from '@/styles/global/global';
import TotalBar from './TotalBar';
import { getMyProfile } from '@/api/feeds/getMyProfile';
import type { MyProfileData } from '@/types/profile';
import LoadingSpinner from '@/components/common/LoadingSpinner';

const MyFeed = ({ showHeader, posts = [], isLast = false }: FeedListProps) => {
const [profileData, setProfileData] = useState<MyProfileData | null>(null);
Expand All @@ -34,7 +33,8 @@ const MyFeed = ({ showHeader, posts = [], isLast = false }: FeedListProps) => {

if (loading || !profileData) {
return (
<LoadingSpinner message="내 피드 정보를 불러오는 중..." size="large" fullHeight={true} />
<></>
// <LoadingSpinner message="내 피드 정보를 불러오는 중..." size="large" fullHeight={true} />
);
}

Expand Down
47 changes: 33 additions & 14 deletions src/pages/feed/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import TabBar from '../../components/feed/TabBar';
import MyFeed from '../../components/feed/MyFeed';
import TotalFeed from '../../components/feed/TotalFeed';
import MainHeader from '@/components/common/MainHeader';
import LoadingSpinner from '../../components/common/LoadingSpinner';
import writefab from '../../assets/common/writefab.svg';
import { useNavigate, useLocation } from 'react-router-dom';
import { getTotalFeeds } from '@/api/feeds/getTotalFeed';
Expand Down Expand Up @@ -43,6 +44,11 @@ const Feed = () => {
const [myNextCursor, setMyNextCursor] = useState<string>('');
const [myIsLast, setMyIsLast] = useState(false);

// 탭 전환 시 로딩 상태
const [tabLoading, setTabLoading] = useState(false);
// 초기 로딩 상태 (첫 진입 시)
const [initialLoading, setInitialLoading] = useState(true);

const handleSearchButton = () => {
navigate('/feed/search');
};
Expand Down Expand Up @@ -157,10 +163,17 @@ const Feed = () => {
return;
}

if (activeTab === '피드') {
loadTotalFeeds();
} else if (activeTab === '내 피드') {
loadMyFeeds();
setTabLoading(true);

try {
if (activeTab === '피드') {
await loadTotalFeeds();
} else if (activeTab === '내 피드') {
await loadMyFeeds();
}
} finally {
setTabLoading(false);
setInitialLoading(false);
}
};

Expand All @@ -171,18 +184,24 @@ const Feed = () => {
<Container>
<MainHeader type="home" leftButtonClick={handleSearchButton} />
<TabBar tabs={tabs} activeTab={activeTab} onTabClick={setActiveTab} />
{activeTab === '피드' ? (
<>
<TotalFeed
showHeader={true}
posts={totalFeedPosts}
isMyFeed={false}
isLast={totalIsLast}
/>
</>
{initialLoading || tabLoading ? (
<LoadingSpinner size="large" fullHeight={true} />
) : (
<>
<MyFeed showHeader={false} posts={myFeedPosts} isMyFeed={true} isLast={myIsLast} />
{activeTab === '피드' ? (
<>
<TotalFeed
showHeader={true}
posts={totalFeedPosts}
isMyFeed={false}
isLast={totalIsLast}
/>
</>
) : (
<>
<MyFeed showHeader={false} posts={myFeedPosts} isMyFeed={true} isLast={myIsLast} />
</>
)}
</>
)}
<NavBar src={writefab} path="/post/create" />
Expand Down
27 changes: 24 additions & 3 deletions src/pages/mypage/Mypage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import styled from '@emotion/styled';
import { useNavigate } from 'react-router-dom';
import { colors, typography } from '@/styles/global/global';
import MenuButton from '@/components/Mypage/MenuButton';
import LoadingSpinner from '@/components/common/LoadingSpinner';
import { usePopupActions } from '@/hooks/usePopupActions';
import { useLogout } from '@/hooks/useLogout';
import alert from '../../assets/mypage/alert.svg';
Expand All @@ -17,14 +18,22 @@ import { useEffect, useState } from 'react';

const Mypage = () => {
const [profile, setProfile] = useState<GetMyProfileResponse['data'] | null>(null);
const [loading, setLoading] = useState(true);
const { openConfirm, closePopup } = usePopupActions();
const navigate = useNavigate();
const { handleLogout: logout } = useLogout();

useEffect(() => {
const fetchProfile = async () => {
const profile = await getMyProfile();
setProfile(profile);
try {
setLoading(true);
const profile = await getMyProfile();
setProfile(profile);
} catch (error) {
console.error('프로필 정보 로드 실패:', error);
} finally {
setLoading(false);
}
};
fetchProfile();
}, []);
Expand All @@ -33,8 +42,20 @@ const Mypage = () => {
navigate('/mypage/edit', { state: { profile } });
};

if (loading) {
return (
<Wrapper>
<LoadingSpinner message="내 정보를 불러오는 중..." size="large" fullHeight={true} />
</Wrapper>
);
}

if (!profile) {
return <div>로딩 중...</div>;
return (
<Wrapper>
<div>프로필 정보를 불러올 수 없습니다.</div>
</Wrapper>
);
}

const handleLogout = () => {
Expand Down