Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/AboutClan/About
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Sep 3, 2024
2 parents 3f2d5f8 + 0b68cb5 commit 2ca2619
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 30 deletions.
1 change: 0 additions & 1 deletion components/molecules/groups/ButtonGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default function ButtonGroups({
isEllipse = false,
type = "block",
}: IButtonGroups) {
console.log(buttonOptionsArr, currentValue);
return (
<Layout isWrap={isWrap}>
{buttonOptionsArr.map((buttonOptions, idx) => (
Expand Down
13 changes: 9 additions & 4 deletions components/organisms/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ function Calendar({ monthFirstDate, calendarContents }: CalendarProps) {
const isFirstDay = date === schedule.start;
const isEndDay = date === schedule.end;
if (schedule.start <= date && date <= schedule.end) {

acc.push({
content: schedule.content,
color: SCHEDULE_TYPE_TO_COLOR[schedule.type],
color: schedule?.color || SCHEDULE_TYPE_TO_COLOR[schedule.type],
isFirst: isFirstDay,
isLast: isEndDay,
blockIdx: schedule?.blockIdx,
Expand Down Expand Up @@ -118,9 +119,11 @@ function Calendar({ monthFirstDate, calendarContents }: CalendarProps) {
const day = idx % 7 === 0 ? "sun" : idx % 7 === 6 ? "sat" : null;
const isToday = monthFirstDate.date(item).isSame(dayjs(), "day");
const contentArr = getDaySchedules(item);
const dateInfo = Object.values(daySchedules).map((title) =>
contentArr?.find((c) => c.content === title),
);

const dateInfo = Object.values(daySchedules).map((title, index) => {
const matchedContents = contentArr.filter((c) => c.content === title);
return matchedContents[index]; // 순서를 고려하여 index에 해당하는 요소를 선택
});

endingSchedules.forEach((item) => deleteSchedule(item));
endingSchedules = [];
Expand Down Expand Up @@ -160,6 +163,7 @@ function Calendar({ monthFirstDate, calendarContents }: CalendarProps) {
</Flex>
<>
{dateInfo.map((item, idx2) => {

return (
<EventBlock
key={idx2}
Expand Down Expand Up @@ -195,6 +199,7 @@ const EventBlock = styled.div<{
z-index: ${(props) => (props.isFirst ? 4 : 0)};
padding-left: ${(props) => (props.isFirst ? "var(--gap-1)" : 0)};
padding-right: ${(props) => (props.isLast ? "var(--gap-1)" : 0)};
text-align: ${(props) => props.isFirst && props.isLast && "center"};
`;

export default Calendar;
12 changes: 10 additions & 2 deletions constants/contents/calendarSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ export interface CalendarContentProps {
content: string;
start: number;
end: number;
type: "event" | "schedule" | "main";
type?: "event" | "schedule" | "main";
text?: string;
blockIdx?: number;
color?: string;
}

export const EVENT_CONTENT_2023: Record<string, CalendarContentProps[]> = {
Expand Down Expand Up @@ -294,12 +295,19 @@ export const EVENT_CONTENT_2024: Record<string, CalendarContentProps[]> = {
text: "",
},
{
content: "지역 정기 스터디 주간",
content: "조모임 진행 주간",
start: 26,
end: 29,
type: "schedule",
text: "",
},
{
content: "시험대비 스터디 집중 ~ ",
start: 29,
end: 30,
type: "main",
text: "",
},
{
content: "ABOUT 빙고판 이벤트",
start: 17,
Expand Down
2 changes: 1 addition & 1 deletion modals/pop-up/LastWeekAttendPopUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function LastWeekAttendPopUp({ setIsModal }: IModal) {
);

const totalScore = scoreObj?.study + scoreObj?.gather;
console.log(2, filteredData, scoreObj);

const footerOptions: IFooterOptions = {
main: {},
sub: {
Expand Down
1 change: 0 additions & 1 deletion pageTemplates/home/HomeCalendarSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function HomeCalendarSection() {
<>
<Flex align="center" justify="space-between" my={4} mr={4} ml={2}>
<MonthNav monthNum={monthNum} changeMonth={setMonthFirstDate} />
<Box></Box>
<ColorLabelRow props={SCHEDULE_CATEGORIES} />
</Flex>
<Calendar monthFirstDate={monthFirstDate} calendarContents={calendarContents} />
Expand Down
9 changes: 1 addition & 8 deletions pageTemplates/home/study/HomeStudyChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ import dynamic from "next/dynamic";
import HighlightedTextButton from "../../../components/atoms/buttons/HighlightedTextButton";
import SectionBar from "../../../components/molecules/bars/SectionBar";
import { ChartStudyOptions } from "../../../components/organisms/chart/ChartOptions";
import { useToast } from "../../../hooks/custom/CustomToast";
import { VoteCntProps } from "../../../types/models/studyTypes/studyRecords";

interface HomeStudyChartProps {
voteCntArr: VoteCntProps[];
}

function HomeStudyChart({ voteCntArr }: HomeStudyChartProps) {
// const router = useRouter();
const toast = useToast();
const ApexCharts = dynamic(() => import("react-apexcharts"), { ssr: false });

const filtered: VoteCntProps[] = voteCntArr?.reduce((acc, cur) => {
Expand All @@ -36,15 +33,11 @@ function HomeStudyChart({ voteCntArr }: HomeStudyChartProps) {
xArr.push(dayjs(obj.date).date() + "");
});

const onClick = () => {
toast("warning", "24년 9월 5일 오픈");
};

return (
<>
<SectionBar
title="스터디 전체 통계"
rightComponent={<HighlightedTextButton text="더보기" onClick={onClick} />}
rightComponent={<HighlightedTextButton text="더보기" url="/calendar" />}
/>
<Box pt="16px" pr="16px">
<ApexCharts
Expand Down
12 changes: 6 additions & 6 deletions pageTemplates/record/RecordCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ interface IRecordCalendar {
monthFirstDate: Dayjs;
}
function RecordCalendar({ filterData, monthFirstDate }: IRecordCalendar) {
console.log(2, filterData);
const calendarContents: CalendarContentProps[] = filterData.flatMap((data) => {
const arrivedInfo = data?.arrivedInfoList;
const date = data?.date;
Expand All @@ -36,18 +35,19 @@ function RecordCalendar({ filterData, monthFirstDate }: IRecordCalendar) {
cnt: place.arrivedInfo.length,
});
});
console.log(24, arrivedInfo, openLocation, openStudyLocation);
let tempCnt = 0;

let tempCnt = 0;

const resData = Array.from(openStudyLocation)
.map((location, idx) => {
if (idx > 2 || location.cnt < 2) return null;
tempCnt++;

return {
content: "오픈",
content: "스터디",
start: date,
end: date,
type: "main" as "main" | "event" | "schedule",
color: LOCATION_TO_COLOR[location.location],
blockIdx: tempCnt - 1,
};
})
Expand All @@ -69,7 +69,7 @@ function RecordCalendar({ filterData, monthFirstDate }: IRecordCalendar) {
// });
// }
});
console.log(calendarContents);

return (
<Box mt={3} borderRadius={1}>
<Calendar
Expand Down
6 changes: 4 additions & 2 deletions pageTemplates/record/RecordLocationCategory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useEffect, useState } from "react";
import ButtonGroups from "../../components/molecules/groups/ButtonGroups";
import { LOCATION_OPEN, LOCATION_TO_COLOR, LOCATION_TO_FULLNAME } from "../../constants/location";
import { PLACE_TO_LOCATION } from "../../constants/serviceConstants/studyConstants/studyLocationConstants";
import { ALL_스터디인증 } from "../../constants/serviceConstants/studyConstants/studyPlaceConstants";
import { DispatchType } from "../../types/hooks/reactTypes";
import { IArrivedData } from "../../types/models/studyTypes/studyRecords";
import { ActiveLocationAll } from "../../types/services/locationTypes";
Expand All @@ -22,7 +23,8 @@ function RecordLocationCategory({ initialData, setFilterData }: IRecordLocationC
else {
const filtered = initialData.map((item) => {
const filteredArrived = item?.arrivedInfoList.filter(
(place) => PLACE_TO_LOCATION[place?.placeId] === category,
(place) =>
place?.placeId !== ALL_스터디인증 && PLACE_TO_LOCATION[place?.placeId] === category,
);
if (!filteredArrived) return;
return { ...item, arrivedInfoList: filteredArrived };
Expand Down Expand Up @@ -50,7 +52,7 @@ function RecordLocationCategory({ initialData, setFilterData }: IRecordLocationC
>
<ButtonGroups
buttonOptionsArr={buttonOptionsArr}
currentValue={category}
currentValue={LOCATION_TO_FULLNAME[category]}
type="text"
isWrap
/>
Expand Down
2 changes: 1 addition & 1 deletion pages/calendar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function Record() {
setFilterData(arrivedCalendar);
setIsLoading(false);
}, [arrivedCalendar]);

return (
<>
<Header title="스터디 기록" />
Expand Down
2 changes: 1 addition & 1 deletion pages/gather/writing/condition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function WritingCondition() {

const toggleSwitch = (e: ChangeEvent<HTMLInputElement>, type: GatherConditionType) => {
const isChecked = e.target.checked;
console.log(type);

if (type === "location" && isChecked) {
setLocation(session?.user.location);
}
Expand Down
2 changes: 1 addition & 1 deletion pages/profile/[uid].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function ProfilePage() {
enabled: !!uid,
});

console.log(uid, user);


useEffect(() => {
if (user) setTransferUserName(user.name);
Expand Down
2 changes: 1 addition & 1 deletion pages/square/secret/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function SecretSquareDetailPage() {
},
);
};
console.log(squareDetail);

return (
<>
<Header title="">
Expand Down
2 changes: 1 addition & 1 deletion pages/vote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function StudyVoteMap() {
enabled: !!location && !!date,
});

console.log(2, studyVoteData);


//메인 스터디 장소가 선택되면 3km 거리 이하의 장소들이 2지망으로 자동 선택
useEffect(() => {
Expand Down

0 comments on commit 2ca2619

Please sign in to comment.