Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed May 25, 2024
1 parent 47b00a7 commit 592a2c6
Show file tree
Hide file tree
Showing 35 changed files with 306 additions and 140 deletions.
2 changes: 1 addition & 1 deletion components/atoms/Icons/HeartLikeIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
import styled from "styled-components";

import { LIKE_HEART } from "../../../constants/keys/localStorage";
import { POINT_SYSTEM_PLUS } from "../../../constants/settingValue/pointSystem";
import { POINT_SYSTEM_PLUS } from "../../../constants/serviceConstants/pointSystemConstants";
import { useAdminPointMutation } from "../../../hooks/admin/mutation";
import { useCompleteToast, useErrorToast } from "../../../hooks/custom/CustomToast";
import { useInteractionMutation } from "../../../hooks/user/sub/interaction/mutations";
Expand Down
83 changes: 83 additions & 0 deletions components/atoms/InfoCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { Box, Flex } from "@chakra-ui/react";
import styled from "styled-components";

import Avatar from "./Avatar";

export interface IInfoCard {
name: string;
image: string;
text: string;
leftComponent?: React.ReactNode;
rightComponent?: React.ReactNode;
badge?: React.ReactNode;
}

export default function InfoCard({
image,
text,
name,
leftComponent,
rightComponent,
badge,
}: IInfoCard) {
console.log(23, leftComponent, rightComponent);
return (
<CardContainer>
{leftComponent && <Box mr="16px">{leftComponent}</Box>}
<Avatar image={image} size="md" />
<UserInfoContainer>
<UserNameBadgeContainer>
<span>{name}</span>
{badge}
</UserNameBadgeContainer>
<Flex alignItems="center">
<CommentText>{text}</CommentText>
</Flex>
</UserInfoContainer>
<RightComponentContainer>{rightComponent}</RightComponentContainer>
</CardContainer>
);
}

const Button = styled.button`
display: inline-block;
margin-left: 4px;
padding: 0 4px;
color: var(--gray-600);
`;

const CardContainer = styled.div`
display: flex;
align-items: center;
padding: 12px 16px;
border-bottom: var(--border-main);
line-height: 24px;
height: 72px;
`;

const UserInfoContainer = styled.div`
margin-left: 12px; /* ml-3 */
`;

const UserNameBadgeContainer = styled.div`
display: flex;
align-items: center;
font-size: 14px; /* text-sm */
font-weight: 600; /* font-semibold */
> span:first-child {
margin-right: 6px;
}
`;

const CommentText = styled.span`
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
color: var(--gray-600); /* text-gray-4 */
font-size: 13px;
`;

const RightComponentContainer = styled.div`
margin-left: auto;
`;
4 changes: 2 additions & 2 deletions components/atoms/RulletPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const Container = styled.div`
width: 100%;
border-radius: var(--rounded-lg); /* rounded-lg */
background-color: var(--gray-200); /* bg-gray-8 */
/* text-bg-2 */
overflow-y: hidden;
padding-top: 8px; /* py-2 */
padding-bottom: 8px; /* py-2 */
Expand All @@ -122,7 +122,7 @@ const Item = styled.div<{ isActive: boolean }>`
font-weight: 600; /* font-semibold */
font-size: 16px; /* text-base */
height: ${ITEM_HEIGHT}px;
color: ${({ isActive }) => (isActive ? "#FFFFFF" : "var(--gray-200)")}; /* Conditional color */
color: ${({ isActive }) => (isActive ? "#FFFFFF" : "var(--gray-600)")}; /* Conditional color */
`;

const Highlight = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion components/organisms/CardColumnLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function CardColumnLayout({ cardDataArr, url, func }: ICardColumnLayout)
<PostThumbnailCard postThumbnailCardProps={cardData} />
</Item>
))}
<ShadowBlockButton text="더보기" url={url} func={func} />
{/* <ShadowBlockButton text="더보기" url={url} func={func} /> */}
</Layout>
);
}
Expand Down
29 changes: 29 additions & 0 deletions components/organisms/InfoCardColumn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import styled from "styled-components";

import InfoCard, { IInfoCard } from "../atoms/InfoCard";

interface IInfoCardColumn {
placeCardArr: IInfoCard[];
}
export default function InfoCardColumn({ placeCardArr }: IInfoCardColumn) {
return (
<Layout>
{placeCardArr.map((userCard, idx) => (
<InfoCard
key={idx}
image={userCard.image}
text={userCard.text}
name={userCard.name}
leftComponent={userCard?.leftComponent}
rightComponent={userCard?.rightComponent}
/>
))}
</Layout>
);
}

const Layout = styled.div`
background-color: white;
border-radius: var(--rounded-lg);
`;
1 change: 1 addition & 0 deletions components/organisms/SearchLocation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Box } from "@chakra-ui/react";

import { KakaoLocationProps } from "../../types/externals/kakaoLocationSearch";
import { DispatchType } from "../../types/hooks/reactTypes";
import { Input } from "../atoms/Input";
Expand Down
8 changes: 4 additions & 4 deletions components/organisms/sliders/ImageTileSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ function ImageTileSlider({ imageTileArr, size, aspect = 1, slidesPerView }: IIma
);
}

const SlideItem = ({
function SlideItem({
imageTile,
size,
aspect,
}: {
imageTile: IImageTile;
size: Size;
aspect: number;
}) => (
<>
}) {
return <>
<Box p={size === "sm" && "4px"} bgColor="white">
<AspectRatio
ratio={aspect / 1}
Expand All @@ -81,7 +81,7 @@ const SlideItem = ({
</Box>
{imageTile?.text && <Text size={size}>{imageTile.text}</Text>}
</>
);
}

const Wrapper = styled.div<{ size: Size }>`
display: flex;
Expand Down
12 changes: 7 additions & 5 deletions components/services/studyVote/MapBottomNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { useQueryClient } from "react-query";
import { useRecoilValue, useSetRecoilState } from "recoil";
import styled from "styled-components";

import { STUDY_VOTE } from "../../../constants/keys/queryKeys";
import { STUDY_VOTE, STUDY_VOTE_CNT } from "../../../constants/keys/queryKeys";
import { PointSystemProp } from "../../../constants/serviceConstants/pointSystemConstants";
import { useToast, useTypeToast } from "../../../hooks/custom/CustomToast";
import { useStudyParticipationMutation } from "../../../hooks/study/mutations";
import { usePointSystemMutation } from "../../../hooks/user/mutations";
Expand All @@ -26,7 +27,7 @@ import StudyVoteTimeRulletDrawer from "./StudyVoteTimeRulletDrawer";

interface IMapBottomNav {
myVote: IStudyVote;
voteScore: number;
voteScore: PointSystemProp;
setMyVote: DispatchType<IStudyVote>;
morePlaces: string[];
}
Expand Down Expand Up @@ -101,7 +102,9 @@ function MapBottomNav({ morePlaces, myVote, voteScore, setMyVote }: IMapBottomNa

const handleSuccess = () => {
queryClient.refetchQueries([STUDY_VOTE, date, convertLocationLangTo(location, "kr")]);

queryClient.refetchQueries([
[STUDY_VOTE_CNT, location, dayjs(date).startOf("month"), dayjs(date).endOf("month")],
]);
if (myPrevVotePoint) {
getPoint({
message: "스터디 투표 취소",
Expand All @@ -110,8 +113,7 @@ function MapBottomNav({ morePlaces, myVote, voteScore, setMyVote }: IMapBottomNa
}
if (studyDateStatus === "not passed" && voteScore) {
getPoint({
value: voteScore,
message: "스터디 투표",
...voteScore,
sub: date,
});
toast("success", `투표 완료! ${!myStudy ? "포인트가 적립되었습니다." : ""}`);
Expand Down
12 changes: 9 additions & 3 deletions constants/serviceConstants/pointSystemConstants.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { IButtonCardProps } from "../../components/molecules/cards/ButtonCard";

export interface PointSystemProp {
value: number;
message: string;
}

export const POINT_SYSTEM_PLUS = {
STUDY_ATTEND_CHECK: { value: 5, message: "스터디 출석" },
STUDY_PRIVATE_ATTEND: { value: 2, message: "개인 스터디 인증" },
STUDY_VOTE: {
first: { value: 10, message: "스터디 투표" },
second: { value: 5, message: "스터디 투표" },
third: { value: 2, message: "스터디 투표" },
basic: { value: 5, message: "스터디 투표" },
first: { value: 10, message: "스터디 첫번째 투표" },
second: { value: 5, message: "스터디 두번째 투표" },
third: { value: 2, message: "스터디 세번째 투표" },
},
STUDY_INVITE: { value: 2, message: "친구 초대 보너스" },
DAILY_ATTEND: { value: 3, message: "일일 출석" },
Expand Down
40 changes: 0 additions & 40 deletions constants/settingValue/pointSystem.ts

This file was deleted.

14 changes: 14 additions & 0 deletions libs/study/getStudyVoteCnt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { IParticipation } from "../../types/models/studyTypes/studyDetails";

export const getStudyVoteCnt = (studyVoteData: IParticipation[], filterUid?: string) => {
const temp = new Set();

studyVoteData?.forEach((par) => {
if (par.place.brand === "자유 신청") return;
par?.attendences.forEach((who) => {
if (who?.user.uid === filterUid) return;
temp.add(who.user.uid);
});
});
return temp.size;
};
2 changes: 1 addition & 1 deletion modals/aboutHeader/DateCalendarModal.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "swiper/css";

import dayjs, { Dayjs } from "dayjs";
import { useSession } from "next-auth/react";
import { useRouter, useSearchParams } from "next/navigation";
import { useSession } from "next-auth/react";
import { useState } from "react";
import { useSetRecoilState } from "recoil";
import { Swiper, SwiperSlide } from "swiper/react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ListItem, UnorderedList } from "@chakra-ui/react";
import styled from "styled-components";

import { POINT_SYSTEM_DEPOSIT } from "../../../constants/settingValue/pointSystem";
import { POINT_SYSTEM_DEPOSIT } from "../../../constants/serviceConstants/pointSystemConstants";


function PointSystemsModalFee() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ListItem, UnorderedList } from "@chakra-ui/react";
import styled from "styled-components";

import { POINT_SYSTEM_PLUS } from "../../../constants/settingValue/pointSystem";
import { POINT_SYSTEM_PLUS } from "../../../constants/serviceConstants/pointSystemConstants";

function PointSystemsModalPoint() {
return (
Expand Down
2 changes: 1 addition & 1 deletion modals/study/StudyAbsentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { useRecoilValue } from "recoil";
import styled from "styled-components";

import { STUDY_VOTE } from "../../constants/keys/queryKeys";
import { POINT_SYSTEM_DEPOSIT } from "../../constants/serviceConstants/pointSystemConstants";
import { PLACE_TO_LOCATION } from "../../constants/serviceConstants/studyConstants/studyLocationConstants";
import { POINT_SYSTEM_DEPOSIT } from "../../constants/settingValue/pointSystem";
import { useToast, useTypeToast } from "../../hooks/custom/CustomToast";
import { useStudyAbsentMutation } from "../../hooks/study/mutations";
import { usePointSystemMutation } from "../../hooks/user/mutations";
Expand Down
6 changes: 4 additions & 2 deletions modals/study/StudyAttendCheckModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import ScreenOverlay from "../../components/atoms/ScreenOverlay";
import Spinner from "../../components/atoms/Spinner";
import ImageUploadInput from "../../components/molecules/ImageUploadInput";
import { STUDY_VOTE } from "../../constants/keys/queryKeys";
import { POINT_SYSTEM_PLUS } from "../../constants/serviceConstants/pointSystemConstants";
import { POINT_SYSTEM_DEPOSIT } from "../../constants/settingValue/pointSystem";
import {
POINT_SYSTEM_DEPOSIT,
POINT_SYSTEM_PLUS,
} from "../../constants/serviceConstants/pointSystemConstants";
import { useToast, useTypeToast } from "../../hooks/custom/CustomToast";
import { useImageUploadMutation } from "../../hooks/image/mutations";
import { useStudyAttendCheckMutation } from "../../hooks/study/mutations";
Expand Down
2 changes: 1 addition & 1 deletion modals/study/StudyChangeTimeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { useRecoilValue } from "recoil";

import RulletPickerTwo from "../../components/molecules/picker/RulletPickerTwo";
import { STUDY_VOTE } from "../../constants/keys/queryKeys";
import { POINT_SYSTEM_DEPOSIT } from "../../constants/serviceConstants/pointSystemConstants";
import { PLACE_TO_LOCATION } from "../../constants/serviceConstants/studyConstants/studyLocationConstants";
import { STUDY_VOTE_HOUR_ARR } from "../../constants/serviceConstants/studyConstants/studyTimeConstant";
import { POINT_SYSTEM_DEPOSIT } from "../../constants/settingValue/pointSystem";
import { useToast, useTypeToast } from "../../hooks/custom/CustomToast";
import { useStudyParticipationMutation } from "../../hooks/study/mutations";
import { usePointSystemMutation } from "../../hooks/user/mutations";
Expand Down
2 changes: 1 addition & 1 deletion modals/study/StudyInviteModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button } from "@chakra-ui/react";
import { useSession } from "next-auth/react";
import { useRouter } from "next/router";
import { useSession } from "next-auth/react";
import { useEffect, useState } from "react";
import styled from "styled-components";

Expand Down
2 changes: 1 addition & 1 deletion modals/study/StudyLightAbsentModal.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import dayjs from "dayjs";
import { useRouter } from "next/router";

import { POINT_SYSTEM_DEPOSIT } from "../../constants/serviceConstants/pointSystemConstants";
import { PLACE_TO_NAME } from "../../constants/serviceConstants/studyConstants/studyCafeNameConstants";
import { POINT_SYSTEM_DEPOSIT } from "../../constants/settingValue/pointSystem";
import { useCompleteToast, useErrorToast } from "../../hooks/custom/CustomToast";
import { useStudyAbsentMutation } from "../../hooks/study/mutations";
import { usePointSystemMutation } from "../../hooks/user/mutations";
Expand Down
2 changes: 1 addition & 1 deletion modals/userRequest/RequestPromotionRewardModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styled from "styled-components";

import { CopyBtn } from "../../components/atoms/Icons/CopyIcon";
import { PROMOTION_TEXT,PromotionComponent } from "../../constants/contentsText/Private";
import { POINT_SYSTEM_PLUS } from "../../constants/settingValue/pointSystem";
import { POINT_SYSTEM_PLUS } from "../../constants/serviceConstants/pointSystemConstants";
import { useCompleteToast, useErrorToast } from "../../hooks/custom/CustomToast";
import { usePointSystemMutation } from "../../hooks/user/mutations";
import { useUserRequestMutation } from "../../hooks/user/sub/request/mutations";
Expand Down
Loading

0 comments on commit 592a2c6

Please sign in to comment.