Skip to content

Commit

Permalink
Merge pull request #187 from Make-A-Wish-Sopt/hotfix/186-wishes
Browse files Browse the repository at this point in the history
Hotfix/186 wishes
  • Loading branch information
myeongheonhong authored Jan 10, 2024
2 parents 50008c3 + 4aa3d1e commit cae60cb
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 58 deletions.
4 changes: 3 additions & 1 deletion components/Main/MainTopContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export default function MainTopContent() {
progressData.status === 'BEFORE' ? (
<>
{`${nickName}님\n`}
<Styled.Text>{`${progressData.dayCount}일 뒤 `}</Styled.Text>
<Styled.Text>{`${
progressData.dayCount < 1 ? 1 : progressData.dayCount
}일 뒤 `}</Styled.Text>
{`부터 소원링크를\n공유할 수 있어요!`}
</>
) : (
Expand Down
6 changes: 1 addition & 5 deletions components/Mypage/Letters/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CakeListButton from './CakeListButton';
import Image from 'next/image';
import { BorderImg } from '@/public/assets/images';
import { useEffect, useState } from 'react';
import { ArrowLeftIc, ArrowRightIc, BackBtnIc } from '@/public/assets/icons';
import { ArrowLeftIc, ArrowRightIc } from '@/public/assets/icons';
import { useRouter } from 'next/router';
import { CAKE_LIST } from '@/constant/cakeList';
import { useGetCakesInfo } from '@/hooks/queries/cakes';
Expand Down Expand Up @@ -44,10 +44,6 @@ export default function LettersContainer() {
setClickedBox(movedBox);
};

const handleMoveBack = () => {
window.history.back();
};

return (
<>
<CakeListButton
Expand Down
25 changes: 17 additions & 8 deletions components/Mypage/Links/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import NoWishLists from './NoWishLists';
import { useDeleteWishes, useGetWishLinks } from '@/hooks/queries/wishes';
import Image from 'next/image';
import { DeleteBtnIc } from '@/public/assets/icons';
import BackBtn from '@/components/Common/Button/BackBtn';

export default function LinksMainContainer() {
const [selectedLinks, setSelectedLinks] = useState<number[]>([]);
Expand Down Expand Up @@ -43,9 +44,12 @@ export default function LinksMainContainer() {
/>
</Modal>
)}
<Styled.DeleteIconButton onClick={() => selectedLinks.length > 0 && handleToggle()}>
<Image src={DeleteBtnIc} alt="삭제 아이콘" />
</Styled.DeleteIconButton>
<Styled.Hedaer>
<BackBtn />
<Styled.DeleteIconButton onClick={() => selectedLinks.length > 0 && handleToggle()}>
<Image src={DeleteBtnIc} alt="삭제 아이콘" />
</Styled.DeleteIconButton>
</Styled.Hedaer>

<Styled.Title>지난 소원 링크 모음</Styled.Title>
<Styled.Container>
Expand All @@ -64,7 +68,16 @@ export default function LinksMainContainer() {
}

const Styled = {
Hedaer: styled.header`
display: flex;
justify-content: space-between;
width: 100%;
`,

Container: styled.div`
position: relative;
margin: 0 1rem 0;
overflow: auto;
max-height: 80vh;
Expand All @@ -76,9 +89,5 @@ const Styled = {
margin: 2rem 1rem 2rem;
`,

DeleteIconButton: styled.button`
position: fixed;
top: 1.9rem;
right: 2.2rem;
`,
DeleteIconButton: styled.button``,
};
8 changes: 7 additions & 1 deletion components/Wishes/WishesForm/BankInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useEffect } from 'react';
import { validation } from '@/validation/input';
import AlertTextBox from '@/components/Common/AlertTextBox';
import { useGetUserAccount, usePutUserAccount } from '@/hooks/queries/user';
import { usePostWishes } from '@/hooks/queries/wishes';

interface BankInfoProps {
methods: UseFormReturn<WishesDataInputType, any, undefined>;
Expand All @@ -35,7 +36,12 @@ export default function BankInfo(props: BankInfoProps) {
const { methods, wishesStep } = props;
const { userAccountData } = useGetUserAccount();
const { checkBoxState, handleChangeCheckBoxState } = useCheckBox();
const { handlePutUserAccount } = usePutUserAccount(methods);
const { handlePutUserAccount, isSuccess } = usePutUserAccount(methods);
const { handlePostWishes } = usePostWishes(methods);

useEffect(() => {
isSuccess && handlePostWishes();
}, [isSuccess]);

useEffect(() => {
if (
Expand Down
11 changes: 1 addition & 10 deletions components/Wishes/WishesForm/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import WishesStepTitle from '../Common/WishesStepTitle';
import WishesStepBtn from '../Common/WishesStepBtn';
import { ColorSystemType } from '@/types/common/box/boxStyleType';
import { useEffect } from 'react';
import { usePostWishes } from '@/hooks/queries/wishes';
import ImageBox, { StyledImageBox } from '@/components/Common/Box/ImageBox';
import { StyledBox } from '@/components/Common/Box';

interface PreviewProps {
Expand All @@ -33,8 +31,6 @@ interface PreviewProps {
export default function Preview(props: PreviewProps) {
const { methods, wishesStep } = props;

const { postWishesData } = usePostWishes(methods);

useEffect(() => {
wishesStep.changeNextState(true);
}, []);
Expand Down Expand Up @@ -67,12 +63,7 @@ export default function Preview(props: PreviewProps) {
</InputContainer>
</div>

<WishesStepBtn
wishesStep={wishesStep}
handleClickFn={() => {
postWishesData();
}}
/>
<WishesStepBtn wishesStep={wishesStep} />
</Styled.Container>
</>
);
Expand Down
2 changes: 0 additions & 2 deletions components/Wishes/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import styled from 'styled-components';
import { useRouter } from 'next/router';
import Button from '../Common/Button';
import MainView from '../Common/mainView';
import { useGetSingleWishInfo } from '@/hooks/queries/wishes';
import { getPublicWishes } from '@/api/public';
import { useGetPublicWishes } from '@/hooks/queries/public';

export default function WishesContainer() {
Expand Down
13 changes: 8 additions & 5 deletions hooks/queries/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import { UseFormReturn } from 'react-hook-form';
import { useMutation, useQuery } from 'react-query';

export function usePutUserAccount(methods: UseFormReturn<WishesDataInputType, any, undefined>) {
const { mutate: handlePutUserAccount } = useMutation(() => putUserAccount(methods), {
onSuccess: () => {
router.push('/wishes/share');
const { mutate: handlePutUserAccount, ...restProps } = useMutation(
() => putUserAccount(methods),
{
onSuccess: () => {
router.push('/wishes/share');
},
},
});
);

return { handlePutUserAccount };
return { handlePutUserAccount, ...restProps };
}

export function useGetUserAccount() {
Expand Down
4 changes: 2 additions & 2 deletions hooks/queries/wishes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function usePatchProgressWishes() {
export function usePostWishes(methods: UseFormReturn<WishesDataInputType, any, undefined>) {
const setLoginUserInfo = useSetRecoilState(LoginUserInfo);

const { mutate: postWishesData } = useMutation(() => postWishes(methods), {
const { mutate: handlePostWishes } = useMutation(() => postWishes(methods), {
onSuccess: (data) => {
setLoginUserInfo((prevData) => ({
...prevData,
Expand All @@ -70,7 +70,7 @@ export function usePostWishes(methods: UseFormReturn<WishesDataInputType, any, u
},
});

return { postWishesData };
return { handlePostWishes };
}

/**
Expand Down
23 changes: 0 additions & 23 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import styled, { ThemeProvider } from 'styled-components';
import theme from '@/styles/theme';
import { useEffect } from 'react';
import Script from 'next/script';
import { useRouter } from 'next/router';
import Loading from '@/components/Common/Loading/Loading';

declare global {
Expand All @@ -23,38 +22,16 @@ export default function App({ Component, pageProps }: AppProps) {
queries: {
retry: 0,
refetchOnWindowFocus: false,
// suspense: true,
},
},
});

const router = useRouter();

// const setVh = () => {
// document.documentElement.style.setProperty('--vh', `${window.innerHeight}px`);
// };

useEffect(() => {
if (window.Kakao && !window.Kakao.isInitialized()) {
window.Kakao.init(process.env.NEXT_PUBLIC_KAKAO_JAVASCRIPT_KEY);
}
//높이 resize
// window.addEventListener('resize', setVh);
// setVh();
}, []);

// useEffect(() => {
// const handleRouteChange = (url: string) => {
// gtag.pageview(url);
// };
// router.events.on('routeChangeComplete', handleRouteChange);
// router.events.on('hashChangeComplete', handleRouteChange);
// return () => {
// router.events.off('routeChangeComplete', handleRouteChange);
// router.events.off('hashChangeComplete', handleRouteChange);
// };
// }, [router.events]);

return (
<>
{/* Global Site Tag (gtag.js) - Google Analytics */}
Expand Down
2 changes: 1 addition & 1 deletion pages/mypage/links/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import LinksMainContainer from '@/components/Mypage/Links';

export default function LinksMainPage() {
return (
<Layout layoutKey="header">
<Layout layoutKey="empty">
<LinksMainContainer />
</Layout>
);
Expand Down

1 comment on commit cae60cb

@vercel
Copy link

@vercel vercel bot commented on cae60cb Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.