Skip to content

Commit

Permalink
Merge branch '#743-create-referer-system' of https://github.com/sparc…
Browse files Browse the repository at this point in the history
…s-kaist/taxi-front into #743-create-referer-system
  • Loading branch information
predict-woo committed Feb 23, 2024
2 parents 24471f3 + a87f6bc commit a356acb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 29 deletions.
31 changes: 15 additions & 16 deletions packages/web/src/components/ModalPopup/ModalEvent2024SpringJoin.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import { useLocation } from "react-router-dom";

import { useEvent2024SpringQuestComplete } from "@/hooks/event/useEvent2024SpringQuestComplete";
import {
Expand All @@ -8,7 +7,6 @@ import {
useValueRecoilState,
} from "@/hooks/useFetchRecoilState";
import { useAxios } from "@/hooks/useTaxiAPI";
import useQuery from "@/hooks/useTaxiAPI";

import Button from "@/components/Button";
import DottedLine from "@/components/DottedLine";
Expand Down Expand Up @@ -39,9 +37,7 @@ const ModalEvent2024SpringJoin = ({
const isLogin = useIsLogin();
const { phoneNumber: phoneNumberFromLoginInfo } =
useValueRecoilState("loginInfo") || {};
const { isAgreeOnTermsOfEvent } =
useValueRecoilState("event2024SpringInfo") || {};
const { group: groupFromLoginInfo } =
const { isAgreeOnTermsOfEvent, group: groupFromLoginInfo } =
useValueRecoilState("event2024SpringInfo") || {};
const fetchLoginInfo = useFetchRecoilState("loginInfo");
//#region event2024Spring
Expand All @@ -60,7 +56,7 @@ const ModalEvent2024SpringJoin = ({
() =>
axios({
url: `/events/2024spring/invite/search/${inviterId}`,
method: "post",
method: "get",
onSuccess: (data) => {
setInvitorInfo(data);
},
Expand All @@ -69,8 +65,10 @@ const ModalEvent2024SpringJoin = ({
[inviterId]
);

const isInvited = !!inviterId;

useEffect(() => {
if (inviterId) getInvitorInfo();
if (!isAgreeOnTermsOfEvent && isInvited) getInvitorInfo();
}, [inviterId]);

const isValidPhoneNumber = useMemo(
Expand All @@ -79,10 +77,6 @@ const ModalEvent2024SpringJoin = ({
);
const isValidGroup = useMemo(() => group > 0 && group < 27, [group]);

const location = useLocation();
const path = location.pathname;
const isInvited = path.startsWith("/home/startEvent/");

const onClickJoin = useCallback(
() =>
axios({
Expand Down Expand Up @@ -117,7 +111,7 @@ const ModalEvent2024SpringJoin = ({
margin: "0 8px",
};
const styleInputWrap = {
margin: "12px 8px",
margin: "0 8px 12px",
display: "flex",
alignItems: "center",
color: theme.gray_text,
Expand Down Expand Up @@ -182,14 +176,15 @@ const ModalEvent2024SpringJoin = ({
지급됩니다.
</div>
<div css={{ height: "12px" }} />
<div css={{ ...styleText, marginBottom: "12px" }}>
<div css={styleText}>
• 본 약관은 동의 이후에도 {'"'}마이페이지{">"}새터반 택시대제전 이벤트
참여 약관{'"'}에서 다시 확인하실 수 있습니다.{" "}
</div>
{isAgreeOnTermsOfEvent ? (
<>
<div css={{ height: "12px" }} />
<DottedLine />
<div css={{ height: "12px" }} />
<div css={styleInputWrap}>
전화번호
<Input
Expand Down Expand Up @@ -219,10 +214,15 @@ const ModalEvent2024SpringJoin = ({
</>
) : (
<>
<DottedLine />
{isLogin && (
{(isLogin || (isInvited && inviterInfo)) && (
<>
<div css={{ height: "12px" }} />
<DottedLine />
</>
)}
<div css={{ height: "12px" }} />
{isLogin && (
<>
<div css={styleInputWrap}>
전화번호
<Input
Expand All @@ -249,7 +249,6 @@ const ModalEvent2024SpringJoin = ({
</div>
</>
)}

{isInvited && inviterInfo && (
<div css={styleInputWrap}>
추천인
Expand Down
8 changes: 4 additions & 4 deletions packages/web/src/pages/Event/Event2024Spring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ const Event2024Spring = () => {
<EventStep
step="STEP 2"
title="이벤트 종료 후"
subtitle="세터반 순위대로 상품 지급 !"
subtitle="새터반 순위대로 상품 지급 !"
>
<div
css={{
Expand All @@ -358,10 +358,10 @@ const Event2024Spring = () => {
}}
>
<span css={{ ...eventTheme.font12, width: "144px" }}>
1등 세터반
1등 새터반
</span>
<span css={{ ...eventTheme.font12, width: "144px" }}>
2등 세터반
2등 새터반
</span>
</div>
<div
Expand All @@ -381,7 +381,7 @@ const Event2024Spring = () => {
css={{ textDecoration: "none", width: "100%" }}
>
<EventButton
title="세터반 순위 보러가기"
title="새터반 순위 보러가기"
css={{ background: eventTheme.orange_button }}
/>
</Link>
Expand Down
36 changes: 27 additions & 9 deletions packages/web/src/pages/Mypage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import LinkLogout from "@/components/Link/LinkLogout";
import {
ModalCredit,
ModalEvent2023FallJoin,
ModalEvent2024SpringJoin,
ModalMypageModify,
ModalNotification,
ModalPrivacyPolicy,
Expand All @@ -31,6 +32,8 @@ const Mypage = () => {
const loginInfo = useValueRecoilState("loginInfo");
const notificationOptions = useValueRecoilState("notificationOptions");
const { id: userId } = loginInfo || {};
const { isAgreeOnTermsOfEvent } =
(eventMode && useValueRecoilState("event2024SpringInfo")) || {};

const [isOpenProfileModify, setIsOpenProfileModify] = useState(false);
const [isOpenNotification, setIsOpenNotification] = useState(false);
Expand Down Expand Up @@ -176,11 +179,17 @@ const Mypage = () => {
<Menu icon="policy" onClick={onClickPrivacyPolicy}>
{t("privacy_policy")}
</Menu>
{eventMode === "2023fall" && (
<Menu icon="policy" onClick={onClickEventPolicy}>
한가위 송편 이벤트 참여 약관
</Menu>
)}
{eventMode &&
isAgreeOnTermsOfEvent &&
(eventMode === "2023fall" ? (
<Menu icon="policy" onClick={onClickEventPolicy}>
한가위 송편 이벤트 참여 약관
</Menu>
) : eventMode === "2024spring" ? (
<Menu icon="policy" onClick={onClickEventPolicy}>
새내기 택시대제전 참여 약관
</Menu>
) : null)}
<Menu icon="credit" onClick={onClickMembers}>
{t("credit")}
</Menu>
Expand All @@ -197,10 +206,19 @@ const Mypage = () => {
onChangeIsOpen={setIsOpenPrivacyPolicy}
/>
<ModalTerms isOpen={isOpenPolicy} onChangeIsOpen={setIsOpenPolicy} />
<ModalEvent2023FallJoin
isOpen={isOpenEventPolicy}
onChangeIsOpen={setIsOpenEventPolicy}
/>
{eventMode &&
isAgreeOnTermsOfEvent &&
(eventMode === "2023fall" ? (
<ModalEvent2023FallJoin
isOpen={isOpenEventPolicy}
onChangeIsOpen={setIsOpenEventPolicy}
/>
) : eventMode === "2024spring" ? (
<ModalEvent2024SpringJoin
isOpen={isOpenEventPolicy}
onChangeIsOpen={setIsOpenEventPolicy}
/>
) : null)}
<ModalCredit isOpen={isOpenMembers} onChangeIsOpen={setOpenIsMembers} />
</AdaptiveDiv>
);
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/tools/day.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const day2str = (day: Dayjs, format = "LLLL") => {
return day.format(format);
};

/** 일을 기준으로 특정 날짜까지의 D-DAY를 반환합니다. */
export const getDday = (dateString: string) => {
const targetDate = dayjs(dateString);
const currentDate = dayNowServer().startOf("day"); // Get current server time
Expand Down

0 comments on commit a356acb

Please sign in to comment.