Skip to content

Commit

Permalink
Merge pull request #115 from Goorm-Lucky7/dev
Browse files Browse the repository at this point in the history
[Deploy] hotfix
  • Loading branch information
kangsinbeom authored Jul 3, 2024
2 parents 6022a37 + 019d692 commit 73ee6c5
Show file tree
Hide file tree
Showing 14 changed files with 565 additions and 28 deletions.
16 changes: 7 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function App() {
<GlobalBoundary>
<Routes location={state?.backgroundLocation || location}>
{routes.map(({ Element, path, withNav, withAuth }) => {
const elemet = withAuth ? (
const element = withAuth ? (
<ProtectedRoute path={path}>
<Element />
</ProtectedRoute>
Expand All @@ -29,22 +29,20 @@ function App() {
if (withNav) {
return (
<Route key={path} path="/" element={<Navbar />}>
<Route path={path} element={elemet} />
<Route path={path} element={element} />
</Route>
);
}
return <Route key={path} path={path} element={elemet} />;
return <Route key={path} path={path} element={element} />;
})}
</Routes>

{state?.backgroundLocation && (
<Routes>
<Route path="/info/:galleryId" element={<GalleryInfoPortal />} />
</Routes>
)}
<Routes>
<Route path="/info/:galleryId" element={<GalleryInfoPortal />} />
</Routes>
</GlobalBoundary>
</TanstackProvider>
);
}

export default App;
export default App;
2 changes: 1 addition & 1 deletion src/apis/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ instance.interceptors.response.use(
},
);

export default instance;
export default instance;
4 changes: 0 additions & 4 deletions src/components/alert/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export const Container = styled.div`
margin: 20px 0 30px 0;
}
@media (max-width : 500px) {
width : 90vw;
}
${mediaQueries.mobile(`
position: absolute;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/gallery/components/galleryHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const GalleryHeader = ({ galleryId, galleryNick, chatRoomId, title, thumbnail, c
auth: { nickname },
accessToken,
} = memberStore();
const location = `https://dartgallery.site/info/${galleryId}`;

const location = `https://www.dartgallery.site/info/${galleryId}`;

const mutation = useMutation({
mutationKey: ['review'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const BtnBlock = styled.div`
display: flex;
justify-content : space-between;
gap: 20px;
padding : 0 40px;
padding : 0 20px;
z-index : 9;
`;

Expand Down
9 changes: 9 additions & 0 deletions src/pages/gallery/components/reviewModal/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export const Container = styled.div`
flex-direction : column;
gap : 15px;
}
@media (max-width: 500px) {
width : 90vw;
}
`;

export const ScoreBox = styled.div`
Expand Down Expand Up @@ -60,6 +64,11 @@ export const TextReview = styled.textarea<{ width: number; height: number; }>`
&:focus {
border-color: ${colors.black};
}
@media (max-width: 500px) {
width : 86vw;
height : 300px;
}
`;

export const ToReview = styled.p`
Expand Down
15 changes: 15 additions & 0 deletions src/pages/gallery/components/shareModal/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export const Container = styled.div`
flex-direction: column;
gap : 30px;
padding : 20px;
@media (max-width : 500px) {
width : 90vw;
height : 300px;
}
`;

export const UrlBox = styled.div`
Expand All @@ -20,6 +25,10 @@ export const UrlBox = styled.div`
gap : 20px;
padding : 10px;
border-radius : 10px;
@media (max-width : 500px) {
width : 90vw;
}
`;

export const UrlText = styled.input`
Expand Down Expand Up @@ -48,6 +57,12 @@ export const CopyBtn = styled.button`
&:hover {
${buttonTypeMap.rectangleGray};
}
@media (max-width : 500px) {
width : 50px;
height : 30px;
${typographyMap.t9};
}
`;

export const SocialBox = styled.div`
Expand Down
1 change: 1 addition & 0 deletions src/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export { default as MemberInfoPage } from './memberInfo';
export { default as PaymentPage } from './payment';
export { default as SuccessPage } from './payment/success';
export { default as FailPage } from './payment/fail';
export { default as InfoPage } from './info';
186 changes: 186 additions & 0 deletions src/pages/info/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
import { getGalleryInfo } from "@/apis/gallery";
import { CircleLoader, Icon, Text } from "@/components";
import { useQuery } from "@tanstack/react-query";
import { useParams } from "react-router-dom"
import * as S from './styles';
import useCustomNavigate from "@/hooks/useCustomNavigate";
import Logo from '@/assets/images/mainLogo.png';
import parseDate from "@/utils/parseDate";
import { alertStore } from "@/stores/modal";
import { useState } from "react";
import KakaoMap from "@/pages/main/components/kakaoMap";
import { starRate } from "@/pages/main/hooks/starRate";
import Bg from '@/assets/images/display.png';

const InfoPage = () => {
const { galleryId } = useParams<{ galleryId: string }>();
const customNavigate = useCustomNavigate();
const openModal = alertStore((state) => state.open);
const [openMap, setOpenMap] = useState(false);
const hasEnded = false;

const { data, isLoading } = useQuery({
queryKey: ['detail'],
queryFn: () => {
if (galleryId) {
return getGalleryInfo(parseInt(galleryId, 10));
}
throw new Error('galleryId is undefined');
},
enabled:!!galleryId,
});

const onHandlePay = (ticket: boolean, fee: number, isOpen: boolean) => {
const showModal = (title: string, description: string, onClickButton: () => void) => {
openModal({
title,
description,
buttonLabel: '확인',
onClickButton,
});
};

if (!isOpen) {
showModal(
'입장 불가',
'전시가 예정 및 종료 상태로 입장이 불가능합니다.',
async () => close(),
);
return;
}

if (ticket || fee === 0) {
customNavigate(`/gallery/${galleryId}`);
} else {
customNavigate(`/payment/${galleryId}/ticket`, { hasAuth: true });
}
};

const onHandleRequest = () => {
// 재전시 요청 api 완성시 구문 작성
openModal({
title: '재전시 요청',
description: '서비스 준비 중입니다.',
buttonLabel: '확인',
onClickButton: () => close(),
});
};

const onHandleMap = () => {
setOpenMap(!openMap);
};

if (isLoading) return <CircleLoader />;

return (
<S.Wrapper infoBg={Bg}>
<S.Container>
<S.InfoBox thumbnail={data.thumbnail}>
<S.Overlay />
<S.CancelIcon value="cancel" size={20} onClick={() => customNavigate('/')} color="white" />
<S.MainLogo alt="main-logo" src={Logo} />
<S.DescriptionBlock>
<S.Top>
<Text typography="t5" color="white" bold="medium">
{data.title}
</Text>
<S.User
onClick={() => {
customNavigate(`/member/${data.nickname}`);
}}
>
<S.Circle />
<Text typography="t7" bold="regular" color="white">
{data.nickname}
</Text>
</S.User>
</S.Top>
<p id="descript">{data.content}</p>
<Icon value="galaxy" size={20} />
<Text typography="t7" bold="regular" color="white">
{parseDate(data.startDate)} <span>~</span>{' '}
{parseDate(data.endDate) === '1970.01.01' ? null : parseDate(data.endDate)}
</Text>
<S.HashTags>
{data.hashtags.map((tag: string, index: number) => (
<Text key={index} typography="t7" bold="regular" color="gray300">
{`#${tag}`}
</Text>
))}
</S.HashTags>
</S.DescriptionBlock>
<S.ButtonBlock>
{hasEnded ? (
<div className="topay" onClick={() => onHandleRequest()}>
재전시 요청
</div>
) : (
<>
<div className="price">{data.fee}</div>
<div
className="topay"
onClick={() => onHandlePay(data.hasTicket, data.fee, data.isOpen)}
>
입장하기
</div>
</>
)}
</S.ButtonBlock>
{data.address && (
<S.MapBlock onClick={onHandleMap}>
<Icon value='mapMarker' size={20} />
<Text typography='t8' bold='thin' color='gray300'>{data.address}</Text>
</S.MapBlock>
)}
{data.address && openMap && (
<KakaoMap galleryAddress={data.address}/>
)}
</S.InfoBox>
<S.ReviewBox>
<Text typography="t7" color="white" bold="thin" className="reviewText">
관람객 평점
</Text>
<S.ScoreBlock>
<S.ScoreWrap>
<S.Score>
<Text color="white" bold="bold" typography="t3">
{data.reviewAverage}&nbsp;
</Text>
<Text color="white" bold="bold" typography="t3">
/ 5
</Text>
</S.Score>
<S.StarBox>
{starRate(data.reviewAverage)}
</S.StarBox>
<Text
typography="t7"
color="gray300"
bold="thin"
className="reactText"
onClick={() => {
customNavigate(`/review/${galleryId}`);
}}
>
상세 리뷰 보기 &gt;
</Text>
</S.ScoreWrap>
<Text
typography="t7"
color="gray300"
bold="thin"
className="originalText"
onClick={() => {
customNavigate(`/review/${galleryId}`);
}}
>
상세 리뷰 보기 &gt;
</Text>
</S.ScoreBlock>
</S.ReviewBox>
</S.Container>
</S.Wrapper>
)
}

export default InfoPage
Loading

0 comments on commit 73ee6c5

Please sign in to comment.