Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] 여러가지 수정사항 반영 #489

Merged
merged 15 commits into from
Feb 9, 2024
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
18 changes: 10 additions & 8 deletions src/app/home/FollowList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useRouter, useSearchParams } from 'next/navigation';
import { useFollowMembers } from '@/apis/follow';
import UserProfile from '@/app/home/UserProfile';
import { type FollowDataState } from '@/app/page';
import MotionDiv from '@/components/Motion/MotionDiv';
import { flex } from '@/styled-system/patterns';

import ProfileItem from './ProfileItem';
Expand All @@ -25,14 +26,15 @@ function FollowList() {
<UserProfile selected={id === null} onClick={onChangeFollowData} />
{data &&
data.map((profile) => (
<ProfileItem
key={profile.memberId}
id={profile.memberId}
onClick={onChangeFollowData}
url={profile.profileImageUrl}
name={profile.nickname}
selected={id === profile.memberId}
/>
<MotionDiv key={profile.memberId}>
<ProfileItem
id={profile.memberId}
onClick={onChangeFollowData}
url={profile.profileImageUrl}
name={profile.nickname}
selected={id === profile.memberId}
/>
</MotionDiv>
))}
</section>
);
Expand Down
16 changes: 10 additions & 6 deletions src/app/home/FollowMissionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MissionListSkeleton } from '@/app/home/home.styles';
import MissionBadge from '@/app/home/MissionBadge';
import Empty from '@/components/Empty/Empty';
import { TwoLineListItem } from '@/components/ListItem';
import StaggerWrapper from '@/components/Motion/StaggerWrapper';
import { MISSION_CATEGORY_LABEL } from '@/constants/mission';
import { ROUTER } from '@/constants/router';
import { css } from '@styled-system/css';
Expand All @@ -19,9 +20,8 @@ function FollowMissionList({ followId }: FollowMissionListProps) {
<h2 className={headingCss}>
<span>미션 목록</span>
</h2>
<ul className={listCss}>
<MissionFollowListInner followId={followId} />
</ul>

<MissionFollowListInner followId={followId} />
</div>
);
}
Expand Down Expand Up @@ -52,7 +52,11 @@ const listCss = flex({
export function MissionFollowListInner({ followId }: { followId: number }) {
const { data, isLoading } = useFollowMissions(followId);
if (isLoading) {
return <MissionListSkeleton />;
return (
<ul className={listCss}>
<MissionListSkeleton />
</ul>
);
}

if (!data) {
Expand All @@ -68,7 +72,7 @@ export function MissionFollowListInner({ followId }: { followId: number }) {
}

return (
<>
<StaggerWrapper wrapperOverrideCss={listCss}>
{data.followMissions.map((item) => {
const status = item.missionStatus;

Expand All @@ -84,6 +88,6 @@ export function MissionFollowListInner({ followId }: { followId: number }) {
</Link>
);
})}
</>
</StaggerWrapper>
);
}
5 changes: 2 additions & 3 deletions src/app/home/FollowSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Banner from '@/components/Banner/Banner';
import LevelProgressBar from '@/components/Graph/LevelProgressBar';
import Icon from '@/components/Icon';
import Thumbnail from '@/components/Thumbnail/Thumbnail';
import { LEVEL_SYSTEM } from '@/constants/level';
import { ROUTER } from '@/constants/router';
import { gradientTextCss } from '@/constants/style/gradient';
import { calcProgress, getLevel } from '@/utils/result';
Expand All @@ -21,7 +20,7 @@ function FollowSummary({ memberId: followId, nickname: followNickname, profileIm
const progress = calcProgress(symbolStack);

return (
<div>
<div key={followId}>
<div className={followSummaryTitleCss}>
<Thumbnail size={'h18'} url={profileImageUrl} variant="filled" />
<Link href={ROUTER.PROFILE.DETAIL(followId)}>
Expand All @@ -39,7 +38,7 @@ function FollowSummary({ memberId: followId, nickname: followNickname, profileIm
</div>
<p className={LevelNameCss}>{currentLevel.label}</p>
<div className={levelProgressBarWrapperCss}>
<LevelProgressBar current={progress} isLabel={false} backgroundColor={'purple.purple500'} />
<LevelProgressBar key={followId} current={progress} isLabel={false} backgroundColor={'purple.purple500'} />
</div>
</div>
</div>
Expand Down
11 changes: 9 additions & 2 deletions src/app/home/MissionInnerList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { MissionListSkeleton } from '@/app/home/home.styles';
import MissionBadge from '@/app/home/MissionBadge';
import MissionEmptyList from '@/app/home/MissionEmptyList';
import { TwoLineListItem } from '@/components/ListItem';
import StaggerWrapper from '@/components/Motion/StaggerWrapper';
import { MISSION_CATEGORY_LABEL } from '@/constants/mission';
import { ROUTER } from '@/constants/router';
import { css } from '@styled-system/css';
Expand All @@ -25,7 +26,7 @@ function MissionListInner() {
}

return (
<>
<StaggerWrapper wrapperOverrideCss={listCss}>
{missionList.map((item) => {
const isProgressingMission = progressMissionId === String(item.missionId);
const status = isProgressingMission ? MissionStatus.PROGRESSING : item.missionStatus;
Expand All @@ -47,12 +48,18 @@ function MissionListInner() {
</Link>
);
})}
</>
</StaggerWrapper>
);
}

export default MissionListInner;

const listCss = css({
flex: 1,
gap: '8px',
height: '100%',
});

const containerCss = css({
height: '100%',
padding: '60px 0',
Expand Down
7 changes: 5 additions & 2 deletions src/app/home/ProfileItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { type FollowDataState } from '@/app/page';
import Thumbnail from '@/components/Thumbnail/Thumbnail';
import { css, cx } from '@styled-system/css';

function ProfileItem(props: {
interface Props {
name: string;
id: number | null;
onClick: (props: FollowDataState) => void;
selected?: boolean;
url?: string;
}) {
}

function ProfileItem(props: Props) {
const handleClick = () => {
if (props.id === null) {
props.onClick(null);
Expand All @@ -20,6 +22,7 @@ function ProfileItem(props: {
nickname: props.name,
});
};

return (
<div className={itemCss} onClick={handleClick}>
<Thumbnail size="h52" selected={props.selected} url={props.url} variant={props.selected ? 'filled' : 'dimed'} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Image from 'next/image';
import MotionDiv from '@/components/Motion/MotionDiv';
import { css } from '@styled-system/css';

// TODO : banner 컴포넌트 분리
Expand All @@ -13,33 +14,38 @@ function MissionHistoryBanner({
}) {
return (
<div className={missionHistoryBannerCss}>
<Image width={36} height={36} alt={title} src={imageUrl} />
<div>
<p className={bannerTitleCss}>{title}</p>
<p className={bannerDescriptionCss}>{description}</p>
</div>
<MotionDiv className={bannerInnerCss}>
<Image width={36} height={36} alt={title} src={imageUrl} />
<div>
<p className={bannerTitleCss}>{title}</p>
<p className={bannerDescriptionCss}>{description}</p>
</div>
</MotionDiv>
</div>
);
}

export default MissionHistoryBanner;

export const missionHistoryBannerCss = css({
display: 'flex',
flexDirection: 'row',
padding: '16px',
gap: '8px',
borderRadius: '22px',
background: 'linear-gradient(93deg, rgba(25, 23, 27, 0.80) 0.82%, rgba(24, 25, 33, 0.80) 99.97%)',
boxShadow: '0px 5px 50px 4px rgba(92, 78, 122, 0.50) inset, 0px 4px 20px 0px rgba(16, 15, 23, 0.20)',
backdropFilter: 'blur(20px)',
boxShadow: '0px 5px 50px 4px #5C4E7A80 inset, 0px 4px 20px 0px #100F1733',
background: 'linear-gradient(92.59deg, rgba(25, 23, 27, 0.8) 0.82%, rgba(24, 25, 33, 0.8) 99.97%)',
transition: 'all 0.3s ease',

'& img': {
width: '36px',
height: '36px',
},
});

const bannerInnerCss = css({
display: 'flex',
flexDirection: 'row',
padding: '16px',
gap: '8px',
});

const bannerTitleCss = css({
textStyle: 'body1',
color: 'text.primary',
Expand Down
2 changes: 2 additions & 0 deletions src/app/mission/[id]/follow/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import MissionHistoryTab from '@/app/mission/[id]/detail/MissionHistoryTab';
import BottomDim from '@/components/BottomDim/BottomDim';
import Header from '@/components/Header/Header';
import Tab from '@/components/Tab/Tab';
import { css } from '@styled-system/css';
Expand All @@ -20,6 +21,7 @@ export default function FollowMissionDetailPage() {
<Tab tabs={tabs} activeTab={'mission-history'} />
</div>
<MissionHistoryTab isFollow={true} />
<BottomDim />
</main>
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/app/mypage/MyProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ export default function MyProfile() {
}

const tabWrapper = css({
margin: '20px 0',
padding: '16px 16px 0 16px',
margin: '36px 0 24px',
});

const profileEditButtonCss = css({
Expand Down
2 changes: 1 addition & 1 deletion src/app/profile/[id]/FollowButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const followingButtonCss = css({
border: '1px solid',
borderColor: 'gray.gray500',
borderRadius: '20px',
backgroundColor: 'transparent',
backgroundColor: 'transparent !',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
Expand Down
2 changes: 1 addition & 1 deletion src/app/profile/[id]/ProfileContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const myTabContainerCss = css({
backgroundColor: 'bg.surface2',
borderTopRightRadius: '28px',
borderTopLeftRadius: '28px',
padding: '52px 24px 0',
padding: '52px 16px 0',
});
const userNameCss = css({
color: 'text.primary',
Expand Down
2 changes: 2 additions & 0 deletions src/app/profile/[id]/follows/FollowingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { css } from '@/styled-system/css';
interface Props {
list: FollowerMemberWithStatusType[];
refetch: () => void;
isFetching: boolean;
}

function FollowingList(props: Props) {
Expand All @@ -30,6 +31,7 @@ function FollowingList(props: Props) {
onUpdateItem(_item);
props.refetch();
}}
isLoading={props.isFetching}
/>
</Link>
))}
Expand Down
23 changes: 19 additions & 4 deletions src/app/profile/[id]/follows/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function FollowListPage({ params }: { params: { id: string } }) {

const currentMemberId = Number(params.id);

const { data, refetch, isLoading } = useFetFollowList(Number(params.id));
const { data, refetch, isLoading, isFetching } = useFetFollowList(Number(params.id));

const followingCount = data?.followingList.length ?? '';
const followerCount = data?.followerList.length ?? '';
Expand Down Expand Up @@ -56,16 +56,31 @@ function FollowListPage({ params }: { params: { id: string } }) {
{/* 내 팔로잉/팔로우 */}
{isMyFollowList &&
(activeTab === 'following' ? (
<FollowingList key="my-following" list={data?.followingList ?? []} refetch={refetch} />
<FollowingList
key="my-following"
list={data?.followingList ?? []}
refetch={refetch}
isFetching={isFetching}
/>
) : (
<MyFollowerList key="my-follower" list={data?.followerList ?? []} refetch={refetch} />
))}
{/* 다른 사람 팔로잉/팔로우 */}
{!isMyFollowList &&
(activeTab === 'following' ? (
<FollowingList key={`${currentMemberId}-following`} list={data?.followingList ?? []} refetch={refetch} />
<FollowingList
key={`${currentMemberId}-following`}
list={data?.followingList ?? []}
refetch={refetch}
isFetching={isFetching}
/>
) : (
<FollowingList key={`${currentMemberId}-follower`} list={data?.followerList ?? []} refetch={refetch} />
<FollowingList
key={`${currentMemberId}-follower`}
list={data?.followerList ?? []}
refetch={refetch}
isFetching={isFetching}
/>
))}
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/app/record/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ const mainWrapperCss = css({
flexDirection: 'column',
backgroundColor: 'bg.surface2',
height: '100%',
paddingBottom: '60px',
});

const headerWrapperCss = css({
Expand Down
11 changes: 1 addition & 10 deletions src/app/record/success/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,7 @@ import { motion } from 'framer-motion';

export default function Layout({ children }: PropsWithChildren) {
return (
<motion.div
initial={{ x: 300, opacity: 0 }}
animate={{ x: 0, opacity: 1 }}
exit={{ x: 300, opacity: 0 }}
transition={{
type: 'spring',
stiffness: 260,
damping: 20,
}}
>
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: 0.3 }}>
<div className={containerCss}>{children}</div>
</motion.div>
);
Expand Down
10 changes: 5 additions & 5 deletions src/app/search/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function SearchPage() {
<>
<SearchBar placeholder="닉네임을 검색해 주세요." value={input} onChange={setInput} />
<Suspense fallback={<div></div>}>
<List nickname={input} />
<List nickname={input} key={input} />
</Suspense>
</>
);
Expand All @@ -25,7 +25,7 @@ function SearchPage() {
export default SearchPage;

function List({ nickname }: { nickname: string }) {
const { data, refetch } = useSuspenseGetSearchNickname(nickname);
const { data, refetch, isFetching } = useSuspenseGetSearchNickname(nickname);

const onButtonClick = () => {
refetch();
Expand All @@ -34,11 +34,11 @@ function List({ nickname }: { nickname: string }) {
return (
<StaggerWrapper wrapperOverrideCss={listContainer} staggerVariants={stagger(0.02)}>
{data.map((item) => (
<Link key={item.memberId} href={ROUTER.PROFILE.DETAIL(item.memberId)}>
<Link key={item.memberId + item.followStatus} href={ROUTER.PROFILE.DETAIL(item.memberId)}>
{item.followStatus === 'FOLLOWING' ? (
<FollowingMember {...item} onButtonClick={onButtonClick} />
<FollowingMember {...item} onButtonClick={onButtonClick} isLoading={isFetching} />
) : (
<NotFollowingMember {...item} onButtonClick={onButtonClick} />
<NotFollowingMember {...item} onButtonClick={onButtonClick} isLoading={isFetching} />
)}
</Link>
))}
Expand Down
1 change: 1 addition & 0 deletions src/components/BottomDim/BottomDim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ const containerCss = css({
zIndex: 'bottomDim',
background:
'linear-gradient(180deg, rgba(24, 24, 29, 0.00) 0%, rgba(24, 24, 29, 0.09) 7.58%, rgba(24, 24, 29, 0.59) 34.59%, rgba(24, 24, 29, 0.69) 41.18%, rgba(24, 24, 29, 0.83) 51.39%, #18181D 63.25%)',
pointerEvents: 'none',
});
Loading
Loading