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

#728 2024 봄 이벤트 퀘스트 페이지 만들기 #732

Merged
merged 15 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
2 changes: 2 additions & 0 deletions packages/web/src/atoms/event2024SpringInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export type Event2024SpringInfoType = Nullable<{
isAgreeOnTermsOfEvent: boolean;
completedQuests: QuestId[];
creditAmount: number;
groupCreditAmount: number;
group: number;
ticket1Amount: number;
ticket2Amount: number;
Comment on lines 7 to 12
Copy link
Member

Choose a reason for hiding this comment

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

추후에 이벤트 참가 가능 여부가 event2024SpringInfo API 에 담겨져서 넘어 올 것 같습니다.
이 값에 따라 이벤트 상태, 이벤트 참여 권장 컴포넌트 띄어지도록 수정되어야 할 것 같아요

quests: Quest[];
Expand Down
61 changes: 48 additions & 13 deletions packages/web/src/components/Event/CreditAmoutContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,61 @@
import { useValueRecoilState } from "@/hooks/useFetchRecoilState";

import WhiteContainer from "@/components/WhiteContainer";

import eventTheme from "@/tools/eventTheme";
import theme from "@/tools/theme";

import CoinIcon from "@/static/events/2024springCoin.gif";

import coin from "@/static/events/2024springCoin.gif";
type CreditAmountContainerProps = Parameters<typeof WhiteContainer>[0];

const CreditAmountContainer = () => {
const { creditAmount } = useValueRecoilState("event2024SpringInfo") || {};
const CreditAmountContainer = ({
...whiteContainerProps
}: CreditAmountContainerProps) => {
const { creditAmount, group, groupCreditAmount } =
useValueRecoilState("event2024SpringInfo") || {};

return (
<div
<WhiteContainer
css={{
...eventTheme.font16_bold,
display: "flex",
alignItems: "center",
justifyContent: "center",
gap: "8px",
color: eventTheme.white,
padding: "14px 16px",
background: eventTheme.black,
border: "1px solid #FFF",
}}
{...whiteContainerProps}
>
<img width="24px" src={coin} alt="coin" />
{creditAmount ? ("000" + creditAmount).slice(-4) : "000"}
</div>
<div
css={{
display: "flex",
gap: "8px",
alignItems: "center",
}}
>
<div css={{ color: theme.white, ...eventTheme.font16, flexGrow: 1 }}>
새터 {group}반 넙죽코인
</div>
<img width="27px" src={CoinIcon} alt="coin" />
<div css={{ color: theme.white, ...eventTheme.font16_bold }}>
{groupCreditAmount ? ("000" + groupCreditAmount).slice(-4) : "000"}
</div>
</div>
<div
css={{
display: "flex",
gap: "4px",
alignItems: "center",
marginTop: "12px",
}}
>
<div css={{ color: theme.white, ...eventTheme.font12, flexGrow: 1 }}>
내가 획득한 넙죽코인
</div>
<img width="16px" src={CoinIcon} alt="coin" />
<div css={{ color: theme.white, ...eventTheme.font12_bold }}>
{creditAmount ? ("000" + creditAmount).slice(-4) : "000"}
</div>
</div>
</WhiteContainer>
);
};

Expand Down
119 changes: 119 additions & 0 deletions packages/web/src/components/Event/SuggestJoinEventContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { useMemo, useState } from "react";

import { useIsLogin, useValueRecoilState } from "@/hooks/useFetchRecoilState";

import Button from "@/components/Button";
import {
ModalEvent2023FallJoin,
ModalNotification,
} from "@/components/ModalPopup";
import WhiteContainer from "@/components/WhiteContainer";

import eventTheme from "@/tools/eventTheme";
import theme from "@/tools/theme";

const SuggestJoinEventContainer = () => {
const isLogin = useIsLogin();
const { isAgreeOnTermsOfEvent, completedQuests } =
useValueRecoilState("event2023FallInfo") || {};

const randomToken = useMemo(() => !!Math.floor(Math.random() * 2), []);
const [isOpenJoin, setIsOpenJoin] = useState<boolean>(false);
const [isOpenNotification, setIsOpenNotification] = useState<boolean>(false);

const styleButton = {
padding: "12px",
borderRadius: "12px",
...eventTheme.font12_bold,
background: eventTheme.blue_title,
};
const styleTitle = {
...eventTheme.font16_bold,
background: eventTheme.blue_title,
backgroundClip: "text",
textFillColor: "transparent",
marginBottom: "4px",
};
const styleDescription = {
...eventTheme.font10,
color: theme.white,
margin: "12px",
};

return (
<>
{!isLogin ? null : !isAgreeOnTermsOfEvent ? (
<WhiteContainer
css={{
padding: "14px 16px",
background: eventTheme.black,
border: "1px solid #FFF",
}}
>
<div css={styleTitle}>🌟 첫 발걸음</div>
<div css={styleDescription}>
이벤트 참여 동의 이후 퀘스트 달성이 가능합니다. 많은 혜택과 기회를
놓치지 마세요!
</div>
<Button
type="purple"
css={styleButton}
onClick={() => setIsOpenJoin(true)}
>
이벤트 참여하기
</Button>
</WhiteContainer>
) : randomToken &&
completedQuests &&
!completedQuests.includes("adPushAgreement") ? (
<WhiteContainer>
<div css={styleTitle}>🌟 Taxi의 소울메이트</div>
<div css={styleDescription}>
Taxi 서비스를 잊지 않도록 가끔 찾아갈게요! 광고성 푸시 알림 수신
동의를 해주시면 방이 많이 모이는 시즌, 주변에 택시앱 사용자가 있을
때 알려드릴 수 있어요.
</div>
<Button
type="purple"
css={styleButton}
onClick={() => setIsOpenNotification(true)}
>
광고성 푸시 알림 수신 동의하고 넙죽코인 50개 얻기
</Button>
</WhiteContainer>
) : completedQuests && !completedQuests.includes("adPushAgreement") ? (
<WhiteContainer
css={{
padding: "14px 16px",
background: eventTheme.black,
border: "1px solid #FFF",
}}
>
<div css={styleTitle}>🌟 Taxi의 소울메이트</div>
<div css={styleDescription}>
Taxi 서비스를 잊지 않도록 가끔 찾아갈게요! 광고성 푸시 알림 수신
동의를 해주시면 방이 많이 모이는 시즌, 주변에 택시앱 사용자가 있을
때 알려드릴 수 있어요.
</div>
<Button
type="purple"
css={styleButton}
onClick={() => setIsOpenNotification(true)}
>
광고성 푸시 알림 수신 동의하고 넙죽코인 50개 얻기
</Button>
</WhiteContainer>
) : null}
<ModalEvent2023FallJoin
isOpen={isOpenJoin}
onChangeIsOpen={setIsOpenJoin}
/>
<ModalNotification
isOpen={isOpenNotification}
onChangeIsOpen={setIsOpenNotification}
/>
</>
);
};

export default SuggestJoinEventContainer;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
export default SuggestJoinEventContainer;
export default memo(SuggestJoinEventContainer);

메모이제이션 권장 드립니다.!

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import theme from "@/tools/theme";
const WhiteContainerSuggestJoinEvent = () => {
const isLogin = useIsLogin();
const { isAgreeOnTermsOfEvent, completedQuests } =
useValueRecoilState("event2023FallInfo") || {};
useValueRecoilState("event2024SpringInfo") || {};

const randomToken = useMemo(() => !!Math.floor(Math.random() * 2), []);
const [isOpenJoin, setIsOpenJoin] = useState<boolean>(false);
Expand Down
8 changes: 7 additions & 1 deletion packages/web/src/components/Skeleton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ const Skeleton = ({ children }: SkeletonProps) => {
)}
{children}
<ModalTerms isOpen={!!userId && !isAgreeOnTermsOfService} />
{isDisplayNavigation && <div css={{ height: "88px" }} />}
{isDisplayNavigation && (
<div
css={{
height: "88px",
}}
/>
)}
</>
)}
</Container>
Expand Down
11 changes: 11 additions & 0 deletions packages/web/src/hooks/event/useEventBackgroundEffect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useEffect } from "react";

export const useEventBackgroundEffect = (color: string = "#000000") => {
Copy link
Member

Choose a reason for hiding this comment

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

CSSProperties.background type 사용 가능합니다 !

useEffect(() => {
const prevBackground = document.body.style.background;
document.body.style.background = color;
return () => {
document.body.style.background = prevBackground;
};
}, [color]);
};
Loading