Skip to content

Commit

Permalink
Merge pull request #363 from sharemindteam/hotfix/open_consult_change…
Browse files Browse the repository at this point in the history
…_money

Hotfix/open consult change money
  • Loading branch information
rmdnps10 authored Jul 24, 2024
2 parents 9406aa7 + 877eca1 commit d6e621a
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import BuyerFinishPayment from 'pages/Buyer/BuyerFinishPayment';
import BuyerOpenConsultLikes from 'pages/Buyer/BuyerOpenConsultLikes';
import BuyerOpenConsultRecents from 'pages/Buyer/BuyerOpenConsultRecents';
import SellerProfitBankAccount from 'pages/Seller/SellerProfitBankAccount';
import ServerDown from 'pages/Common/ServerDown';

const Router = () => {
return (
Expand Down Expand Up @@ -168,6 +169,9 @@ const Router = () => {

{/* 서비스 소개 */}
<Route path="/service" element={<Service />} />

{/* 서버 상태를 나타내는 페이지 */}
<Route path="/service-unavailable" element={<ServerDown />} />
</Routes>
);
};
Expand Down
2 changes: 2 additions & 0 deletions src/api/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const getAdminsPedningProfilse = async () =>
await getInstance('/admins/pending-profiles');
export const getAdminsRefundWaiting = async () =>
await getInstance('/admins/refund-waiting');
export const getIsServerShutdown = async () =>
await axiosGet('/admins/managements');

// 판매자 사이드 letter list
export const getConselorLetters = async (params: any) =>
Expand Down
3 changes: 3 additions & 0 deletions src/assets/icons/server-fix.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/components/Common/AppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import styled from 'styled-components';
import { Grey6, White } from 'styles/color';
import { scrollLockState } from 'utils/atom';
import { APP_WIDTH } from 'styles/AppStyle';
import useManipulateServerDown from 'hooks/useManipulateSeverDown';

//
//
Expand Down Expand Up @@ -45,6 +46,11 @@ export const AppContainer = ({ children }: AppContainerProps) => {
isPaymentDetailPage ||
isProfilePage;

//
//
//
// Redirect to inspection page when service is shut down
useManipulateServerDown();
//
//
//
Expand Down
8 changes: 8 additions & 0 deletions src/hooks/useIntersectionObserver.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { useEffect, useState } from 'react';

//
//
//

interface useIntersectionObserverProps {
root?: null;
rootMargin?: string;
threshold?: number;
onIntersect: IntersectionObserverCallback;
}

//
//
//

const useIntersectionObserver = ({
root,
rootMargin,
Expand Down
6 changes: 4 additions & 2 deletions src/hooks/useIsAlreadyReply.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { getCounselorsIsWriteComments } from 'api/get';
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { NavigateFunction } from 'react-router-dom';

//
//
//
function useIsAlreadyReply(consultid: string, navigate: NavigateFunction) {
const [isAlreadyReply, setIsAlreadyReply] = useState<boolean>(false);
useEffect(() => {
Expand Down
28 changes: 28 additions & 0 deletions src/hooks/useManipulateSeverDown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useQuery } from '@tanstack/react-query';
import { getIsServerShutdown } from 'api/get';
import { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
//
//
//
const ADMIN_SERVER_QUERY_KEY = 'getIsServerShutdown';
type GetIsServerShutdownResponse = boolean;
//
//
//
function useManipulateServerDown() {
const navigate = useNavigate();

const { data: isShutDown } = useQuery<GetIsServerShutdownResponse>({
queryKey: [ADMIN_SERVER_QUERY_KEY],
queryFn: () => getIsServerShutdown().then((res) => res.data),
});

useEffect(() => {
if (isShutDown) {
navigate('/service-unavailable');
}
}, [isShutDown, navigate]);
}

export default useManipulateServerDown;
4 changes: 2 additions & 2 deletions src/pages/Buyer/BuyerOpenPaymentDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const BuyerOpenPaymentDetail = () => {
상품 금액
</Body1>
<Body1 color={Grey1} padding="1.2rem 0 0.8rem 0">
500원
1,000원
</Body1>
</div>
<div className="price-line-wrapper">
Expand All @@ -119,7 +119,7 @@ export const BuyerOpenPaymentDetail = () => {
결제 금액
</Body1>
<Body1 color={Green} padding="1.2rem 0 0.8rem 0">
500원
1,000원
</Body1>
</div>
</Box>
Expand Down
21 changes: 21 additions & 0 deletions src/pages/Common/ServerDown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Flex } from 'components/Common/Flex';
import { Header } from 'components/Common/Header';
import { ReactComponent as ServerFixIcon } from '../../assets/icons/server-fix.svg';
import { Heading } from 'styles/font';
import { Green } from 'styles/color';
//
//
//
function ServerDown() {
return (
<>
<Header isBuyer={false} />
<Flex height="calc(100vh - 6rem)" direction="column" gap={'1.5rem'}>
<ServerFixIcon />
<Heading color={Green}>서비스 점검 중 </Heading>
</Flex>
</>
);
}

export default ServerDown;

0 comments on commit d6e621a

Please sign in to comment.