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

Ver.2.0 배포 2차 #191

Merged
merged 26 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7e431d3
💄 style: /mypage 내가 쓴 글 탭 (아직 api, 디자인 안나옴)
kde98892 Feb 27, 2024
75c4137
✨ feat: /mypage 아티스트 탭 하단에 이벤트 리스트 추가 (디자인 시안 안나옴)
kde98892 Feb 27, 2024
dbcdf01
⚡️ fix(HeartButton.tsx): 하트 아이콘 UI 변경사항 반영
kde98892 Feb 27, 2024
e81987b
✨ feat: /mypage 게시글탭 모바일 UI 구현, api 연결
kde98892 Mar 6, 2024
9193b10
✨ feat: /mypage 게시글탭 삭제 api 연결, 모바일, 태블릿, pc UI 작업
kde98892 Mar 11, 2024
162e46d
💄 style: /mypage 아티스트탭 디자인 반영
kde98892 Mar 11, 2024
831500a
✨ feat: /mypage 후기탭 UI 반영, api 연결
kde98892 Mar 11, 2024
6274e42
Merge branch 'develop' of https://github.com/P1Z7/frontend into feat/…
kde98892 Mar 14, 2024
d5d5ca9
✨ feat: /mypage 게시글탭 무한스크롤
kde98892 Mar 14, 2024
9ad43fb
💄 style: /mypage 후기 수정 UI 삭제
kde98892 Mar 16, 2024
47de84c
💄 style: /mypage 캘린더 태블릿 사이즈 반영
kde98892 Mar 16, 2024
da8247f
Merge branch 'develop' of https://github.com/P1Z7/frontend into feat/…
kde98892 Mar 16, 2024
b739f53
💄 design: edit 페이지 pc 반응형 디자인
naya-h2 Mar 17, 2024
61ce01d
🩹 chore: 헤더 가려지는 문제 해결
kde98892 Mar 17, 2024
9a1f688
✨ feat: /mypage 게시글탭 무한스크롤
kde98892 Mar 17, 2024
12d2de9
💄 style: /mypage UI 깨지는 부분들 수정
kde98892 Mar 17, 2024
097a7f1
🩹 chore: 빌드 오류 해결
kde98892 Mar 17, 2024
7b2c43d
🩹 chore: 비밀번호 재설정 pr 리뷰 반영
kde98892 Mar 17, 2024
7fa1dcf
🩹 chore: 비밀번호 재설정 pr 리뷰 반영
kde98892 Mar 17, 2024
a7d296b
Merge branch 'develop' of https://github.com/P1Z7/frontend into feat/…
kde98892 Mar 17, 2024
fc3a373
Merge branch 'feat/mypage' of https://github.com/P1Z7/frontend into f…
kde98892 Mar 17, 2024
52e718b
Merge pull request #189 from P1Z7/feat/mypage
kde98892 Mar 17, 2024
fb66a91
✨ feat: 아티스트 모달 자동포커스 및 탭 키 적용
naya-h2 Mar 17, 2024
c26a9e3
Merge branch 'develop' of https://github.com/P1Z7/frontend into feat/…
naya-h2 Mar 17, 2024
a847a6e
Merge pull request #190 from naya-h2/feat/edit-v2
naya-h2 Mar 17, 2024
c483bc1
Merge branch 'main' into develop
naya-h2 Mar 17, 2024
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
81 changes: 81 additions & 0 deletions app/(route)/artist/[artistId]/_components/ArtistMap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { useEffect } from "react";
import { EventCardType } from "@/types/index";

interface Props {
scheduleData: EventCardType[];
setLocationInfo: (data: EventCardType) => void;
setSelectedCardId: (id: string | null) => void;
}

const ArtistMap = ({ scheduleData, setLocationInfo, setSelectedCardId }: Props) => {
useEffect(() => {
if (window.kakao) {
window.kakao.maps.load(() => {
const mapContainer = document.getElementById("map");
const mapOption = {
center: new window.kakao.maps.LatLng(37.566826, 126.9786567),
level: 9,
};
const map = new window.kakao.maps.Map(mapContainer, mapOption);
const geocoder = new window.kakao.maps.services.Geocoder();

const myMarker = (data: EventCardType) => {
const { address, placeName } = data;

geocoder.addressSearch(address, (result: any, status: any) => {
if (status === window.kakao.maps.services.Status.OK) {
const coords = new window.kakao.maps.LatLng(result[0].y, result[0].x);

const imageSrc = "/icon/marker.svg";
const imageSize = new window.kakao.maps.Size(20, 20);
const markerImage = new window.kakao.maps.MarkerImage(imageSrc, imageSize);

const marker = new window.kakao.maps.Marker({
map: map,
position: coords,
image: markerImage,
});
marker.setMap(map);

const content =
'<div class="relative w-fit rounded-full bg-gray-900 px-12 py-8 text-center text-14 font-600 text-white-black">' +
placeName +
'<div class="absolute -bottom-12 right-1/2 translate-x-1/2">' +
'<img src="/icon/marker-bottom.svg" />' +
"</div>" +
"</div>";

const customOverlay = new window.kakao.maps.CustomOverlay({
position: coords,
content: content,
yAnchor: 1.9,
});

window.kakao.maps.event.addListener(marker, "mouseover", () => {
customOverlay.setMap(map);
});
window.kakao.maps.event.addListener(marker, "mouseout", () => {
customOverlay.setMap(null);
});

window.kakao.maps.event.addListener(marker, "click", () => {
setLocationInfo(data);
setSelectedCardId(data.id);
});

map.setCenter(coords);
}
});
};

for (let i = 0; i < scheduleData.length; i++) {
myMarker(scheduleData[i]);
}
});
}
}, [scheduleData]);

return <div id="map" className="h-full w-full pc:rounded-lg" />;
};

export default ArtistMap;
2 changes: 1 addition & 1 deletion app/(route)/artist/[artistId]/_components/EventCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const EventCard = ({ data, isSelected, onCardClick, scrollRef }: Props) => {
return (
<div ref={scrollRef} onClick={onCardClick} className={`relative flex w-full cursor-pointer items-center gap-12 border-b border-gray-50 bg-white-black py-12`}>
<div className="flex-center absolute right-0 top-[1.3rem] z-heart flex-col text-12 font-500 text-gray-500" onClick={(e: SyntheticEvent) => e.stopPropagation()}>
<HeartButton isSmall isSelected={liked} onClick={handleClick} />
<HeartButton isSmall isSelected={liked} onClick={handleClick} isLined />
<div className="relative bottom-4">{likeCount}</div>
</div>
{isSelected && (
Expand Down
8 changes: 2 additions & 6 deletions app/(route)/artist/[artistId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ const ArtistIdPage = () => {

const handleButtonClick = () => {
setToggleTab((prev) => !prev);

if (toggleTab) {
setSelectedCard(null);
}
};

const [selectedCard, setSelectedCard] = useState<EventCardType | null>(null);
Expand All @@ -86,7 +82,7 @@ const ArtistIdPage = () => {

useEffect(() => {
scrollRef.current?.scrollIntoView({ behavior: "smooth", block: "nearest" });
}, [selectedCard?.id, toggleTab]);
}, [selectedCard?.id]);

const handleCardClick = (select: EventCardType) => {
setSelectedCard(select.id === selectedCard?.id ? null : select);
Expand All @@ -103,7 +99,7 @@ const ArtistIdPage = () => {
<div
className={`absolute left-0 top-0 z-zero h-full w-full ${toggleTab ? "tablet:pl-360 pc:pl-400" : ""} pb-344 tablet:pb-0 pc:h-[84rem] pc:rounded-lg pc:border pc:border-gray-100`}
>
<KakaoMap scheduleData={mapData} toggleTab={toggleTab} setToggleTab={setToggleTab} selectedCard={selectedCard} setSelectedCard={setSelectedCard} />
<KakaoMap scheduleData={mapData} selectedCard={selectedCard} setSelectedCard={setSelectedCard} />
</div>
<button
onClick={handleButtonClick}
Expand Down
27 changes: 14 additions & 13 deletions app/(route)/event/[eventId]/edit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import PinkLayout from "@/components/layout/PinkLayout";
import { useStore } from "@/store/index";
import { META_TAG } from "@/constants/metaTag";
import EditContent from "./_components/EditContent";
import DottedLayout from "@/components/layout/DottedLayout";

let INITIAL_DATA: PostType;

Expand Down Expand Up @@ -57,19 +58,19 @@ const Edit = () => {
return (
<>
<MetaTag title={META_TAG.edit["title"]} description={META_TAG.edit["description"]} />
<PinkLayout size="narrow">
<div className="p-20 pb-120 text-16 pc:p-0">
{init ? (
<GenericFormProvider formOptions={{ mode: "onChange", defaultValues: INITIAL_DATA, shouldFocusError: true }}>
<EditContent />
</GenericFormProvider>
) : (
<div className="flex h-[10vh] w-full items-center justify-center">
<LoadingDot />
</div>
)}
</div>
</PinkLayout>
<DottedLayout size="narrow">
<div className="p-20 pb-120 text-16 pc:p-0">
{init ? (
<GenericFormProvider formOptions={{ mode: "onChange", defaultValues: INITIAL_DATA, shouldFocusError: true }}>
<EditContent />
</GenericFormProvider>
) : (
<div className="flex h-[10vh] w-full items-center justify-center">
<LoadingDot />
</div>
)}
</div>
</DottedLayout>
</>
);
};
Expand Down
39 changes: 39 additions & 0 deletions app/(route)/mypage/_components/NoContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { useRouter } from "next/navigation";

const TAB = {
MyCalendar: {
title: "관심있는 행사에 좋아요를 눌러보세요!",
path: "/search",
sub: "행사 둘러보기",
},
MyReview: {
title: "아직 작성하신 후기가 없습니다😶",
},
MyPost: {
title: "작성하신 행사가 없습니다.",
path: "/post",
sub: "새 행사 등록하러 가기",
},
};

interface Props {
type: keyof typeof TAB;
}

const NoContent = ({ type }: Props) => {
const route = useRouter();
const tabType = TAB[type];

return (
<div className="flex-center flex-col gap-8 p-40">
<h1 className="text-16 font-500 ">{tabType.title}</h1>
{"path" in tabType && (
<button onClick={() => route.push(tabType.path)} className="text-14 text-sub-pink hover:underline">
{tabType.sub}
</button>
)}
</div>
);
};

export default NoContent;
2 changes: 1 addition & 1 deletion app/(route)/mypage/_components/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const UserProfile = () => {
const { session } = useAuth();

return (
<div className="flex items-center justify-between px-20 pt-44 pc:h-fit pc:w-[26.2rem] pc:flex-col pc:gap-28">
<div className="flex items-center justify-between px-20 pt-44 pc:sticky pc:top-40 pc:h-fit pc:w-[26.2rem] pc:flex-col pc:gap-28">
<div className="flex items-center justify-center gap-12 pc:flex-col">
<div className="relative h-56 w-56 pc:h-80 pc:w-80">
<Image
Expand Down
86 changes: 86 additions & 0 deletions app/(route)/mypage/_components/tab/MyArtistTab/MyArtistEvent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
"use client";

import SortButton from "@/(route)/search/_components/SortButton";
import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
import { useEffect, useState } from "react";
import HorizontalEventCard from "@/components/card/HorizontalEventCard";
import DeferredSuspense from "@/components/skeleton/DeferredSuspense";
import HorizontalEventCardSkeleton from "@/components/skeleton/HorizontalEventCardSkeleton";
import { instance } from "@/api/api";
import useInfiniteScroll from "@/hooks/useInfiniteScroll";
import { Res_Get_Type } from "@/types/getResType";
import SortIcon from "@/public/icon/sort.svg";
import NoContent from "../../NoContent";

const SIZE = 20;

const SORT = ["최신순", "인기순"] as const;

interface Props {
userId: string;
}

const MyArtistEvent = ({ userId }: Props) => {
const [sort, setSort] = useState<(typeof SORT)[number]>(SORT[0]);

const getArtistEvents = async ({ pageParam = 1 }) => {
const data: Res_Get_Type["artistEvent"] = await instance.get(`/event/${userId}/artist`, {
sort,
size: SIZE,
page: pageParam,
userId: userId,
});
return data;
};

const {
data: artistEvents,
fetchNextPage,
refetch,
isFetching,
} = useInfiniteQuery({
initialPageParam: 1,
queryKey: ["artistEvent"],
queryFn: getArtistEvents,
getNextPageParam: (lastPage) => lastPage && (lastPage.page * SIZE < lastPage.totalCount ? lastPage.page + 1 : null),
});

const containerRef = useInfiniteScroll({
handleScroll: fetchNextPage,
deps: [artistEvents],
});

useEffect(() => {
refetch();
}, [sort]);

return (
<>
<div className="flex-center w-full flex-col">
<div className="flex w-full flex-col items-start gap-16">
<h1 className="text-20 font-700 text-gray-900">내 아티스트 이벤트</h1>
<div className="flex w-fit items-center gap-8">
<SortIcon />
<SortButton onClick={() => setSort("최신순")} selected={sort === "최신순"}>
최신순
</SortButton>
<SortButton onClick={() => setSort("인기순")} selected={sort === "인기순"}>
인기순
</SortButton>
</div>
</div>
{artistEvents?.pages[0].totalCount ? (
<div className="flex w-full flex-wrap items-center gap-x-24">
{artistEvents?.pages.map((page) => page?.eventList.map((event) => <HorizontalEventCard key={event.id} data={event} isGrow />))}
<DeferredSuspense fallback={<HorizontalEventCardSkeleton />} isFetching={isFetching} />
<div ref={containerRef} className="h-16 w-full" />
</div>
) : (
<NoContent type="MyPost" />
)}
</div>
</>
);
};

export default MyArtistEvent;
40 changes: 40 additions & 0 deletions app/(route)/mypage/_components/tab/MyArtistTab/MyArtists.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { useRouter } from "next/navigation";
import ArtistCard from "@/components/ArtistCard";
import { ArtistType } from "@/types/index";

const MyArtists = ({ data }: { data: ArtistType[] }) => {
const router = useRouter();

return (
<div className="flex w-full flex-col gap-16">
<div className="flex w-full items-center justify-between">
<h1 className="text-20 font-700 text-gray-900">내 아티스트</h1>
<button className="pl- text-14 font-500 text-blue" onClick={() => router.push("/setting/my-artist")}>
팔로우 아티스트 수정하기
</button>
</div>
<div className="flex w-full flex-col items-center">
<div className="flex w-full flex-wrap justify-center gap-20 tablet:justify-start pc:gap-32">
{data.map((artist) => {
if (!artist) {
return null;
}
return (
<ArtistCard
key={artist.id}
profileImage={artist.image}
onClick={() => {
router.push(`/artist/${artist.id}`);
}}
>
{artist.name}
</ArtistCard>
);
})}
</div>
</div>
</div>
);
};

export default MyArtists;
Loading
Loading