Skip to content

Commit

Permalink
feat : build시 오류나는 부분 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ChoiSangwon committed Dec 2, 2023
1 parent 20efb5a commit 7517e13
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 45 deletions.
8 changes: 4 additions & 4 deletions client/src/atoms/toastState.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { atom } from "jotai";
import { atom } from 'jotai';

export type ToastTheme = "negative" | "positive";
export type ToastTheme = 'negative' | 'positive';

interface ToastType {
isOpen: boolean;
Expand All @@ -10,8 +10,8 @@ interface ToastType {

export const toastState = atom<ToastType>({
isOpen: false,
theme: "positive",
content: "",
theme: 'positive',
content: '',
});

export const toastTransitionState = atom<boolean>(false);
4 changes: 2 additions & 2 deletions client/src/components/AddTemplate/CompanionsRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Link from 'next/link';
import { TYPO } from '@/styles/typo';
import { COLORS } from '@/styles/colors';
import { ItemButton } from '../Buttons';
import { useAtom, useSetAtom } from 'jotai';
import { useAtomValue, useSetAtom } from 'jotai';
import { MyTemplate } from '@/@types/MyTemplate';
import { templateAtom } from '.';

Expand Down Expand Up @@ -84,7 +84,7 @@ const CompanionsRoom = () => {
'7번',
];

const [template, setTemplate] = useAtom<MyTemplate>(templateAtom);
const template = useAtomValue<MyTemplate>(templateAtom);
const setAtomTemplate = useSetAtom(templateAtom);

const handleOnClickNext = () => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/AddTemplate/CompanionsSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const CompanionsSelect = () => {
const { selectedList, handleSelect } = useMate();
const router = useRouter();

const [template, setTemplate] = useAtom<MyTemplate>(templateAtom);
const [template] = useAtom<MyTemplate>(templateAtom);
const setAtomTemplate = useSetAtom(templateAtom);

const hanldeOnClickNext = () => {
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/AddTemplate/NameTimeType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { MenuTitle } from './common';
import { TextInput } from '../Field';
import { ItemButton } from '../Buttons';
import RoundButton from '../Buttons/Round';
import Link from 'next/link';
import { useAtom, useSetAtom } from 'jotai';
import { MyTemplate } from '@/@types/MyTemplate';
import { templateAtom } from '.';
Expand Down Expand Up @@ -73,7 +72,7 @@ const NameTimeType = () => {
setUsageBtns(newUsageBtns);
};

const [template, setTemplate] = useAtom<MyTemplate>(templateAtom);
const [template] = useAtom<MyTemplate>(templateAtom);
const setAtomTemplate = useSetAtom(templateAtom);

const AvailableTime = () => {
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/AddTemplate/TemplateTimeTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const TemplateTimeTable = () => {
}, []);

const [templateArr, setTemplateArr] = useState<MyTemplate[]>([]);
const [template, setTemplate] = useAtom<MyTemplate>(templateAtom);
const [template] = useAtom<MyTemplate>(templateAtom);
const [companions, setCompanions] = useState<CompanionProps[]>([
{
name: '',
Expand Down Expand Up @@ -70,15 +70,15 @@ const TemplateTimeTable = () => {
}, [templateArr]);

const route = useRouter();
const [processData, setProcessData] = useState<WeeklyData[]>(EmptyDate);
const [processData] = useState<WeeklyData[]>(EmptyDate);
const [isSelected, setIsSelected] = useState<boolean>(false);
const [selectedSlots, setSelectedSlots] = useState<string[]>([]);
const [isSuccess, setIsSuccess] = useState<boolean>(false);
const [isError, setIsError] = useState<ReserveError>({
isError: false,
errorMessage: '',
});
const [dates, setDates] = useState<string[]>([]);
const [dates] = useState<string[]>([]);

const roomMapping: { [key: number]: string[] } = {
3: ['1', '2', '3', '4', '5', '6', '7'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ export const Default: Story = {
type: 1,
date: '2023-11-09',
setIsSuccess: () => {},
createType: 'template',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ export const Default: Story = {
seminaRoom: [],
setSeminaRoom: () => {},
setIsSeminaRoomSelected: () => {},
type: 'template',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ const ReservationButton = styled.div<ReservationButtonProps>`
props.curScreen === 'confirm'
? COLORS.primary
: props.isChecked
? COLORS.primary
: COLORS.grey3};
? COLORS.primary
: COLORS.grey3};
color: #fff;
display: flex;
justify-content: center;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Home/MateList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Props extends ComponentProps<'div'> {
const MateList = ({ mates, ...props }: Props) => {
return (
<MateWrapper {...props}>
{mates.map((mate, idx) => (
{mates.map((mate) => (
<FriendCircle name={mate} type={'friend'} key={mate} />
))}
<FriendCircle type="plus" name="+" />
Expand Down
5 changes: 3 additions & 2 deletions client/src/components/Home/ReserveButtons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ReserveButtons = () => {
subtitle: '#회의 #미팅 #강의 #세션',
assets: assetArray[0],
buttonStyleType: 'blue',
onClick: () => router.push('/'),
onClick: () => router.push('/create/reserve'),
},
{
title: '개방형 세미나실',
Expand All @@ -35,7 +35,8 @@ const ReserveButtons = () => {
},
];

//@ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-expect-error
return <ButtonsWrapper>{configs.map(ReservationButton)}</ButtonsWrapper>;
};

Expand Down
14 changes: 7 additions & 7 deletions client/src/components/Modal/Portal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import type React from "react";
import { useLayoutEffect, useState } from "react";
import { createPortal } from "react-dom";
import type React from 'react';
import { useLayoutEffect, useState } from 'react';
import { createPortal } from 'react-dom';

const createWrapperAndAppendToBody = (wrapperId: string) => {
if (document.getElementById(wrapperId))
return document.getElementById(wrapperId) as HTMLDivElement;
else {
const wrapperElement = document.createElement("div");
wrapperElement.setAttribute("id", wrapperId);
const wrapperElement = document.createElement('div');
wrapperElement.setAttribute('id', wrapperId);
document.body.appendChild(wrapperElement);
return wrapperElement;
}
};

const ReactPortal = ({
children,
wrapperId = "react-portal-wrapper",
wrapperId = 'react-portal-wrapper',
}: {
children: React.ReactNode;
wrapperId: string;
}) => {
const [wrapperElement, setWrapperElement] = useState<HTMLDivElement | null>(
null
null,
);
useLayoutEffect(() => {
setWrapperElement(createWrapperAndAppendToBody(wrapperId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ export const Reserve: Story = {
title: '템플릿 제목',
beginTime: '목요일 13시',
endTime: '15시 30분',
place: '세미나룸 102호',
place: 3,
memo: '슈도비 회의 잊지말기',
friends: ['정명진 / 20181234', '이준규 / 20181234'],
friends: [
{ name: '정명진', sId: '2080199' },
{ name: '이준규', sId: '20801929' },
],
day: 'Sun',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export const TemplateComponent: Story = {
beginTime: '목요일 12시',
endTime: '15시',
place: '세미나룸 102호',
memo: '슈도비 회의 잊지말기',
friends: ['김수진 / 20191234', '이준규 / 20181234'],
type: 'RESERVE',
idx: 1,
friends: [{ name: '정명진', sId: '2080199' }],
},
};
1 change: 1 addition & 0 deletions client/src/components/Timetable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const Schedule: React.FC<TProps> = ({
}) => {
const days = ['', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'];

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [isDataAllFalse, setIsDataAllFalse] = useState(false);

const SeminarTimes = [
Expand Down
6 changes: 5 additions & 1 deletion client/src/constants/seminaAvailablePeople.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export const SEMINA_AVAILABLE_PEOPLE = {
export interface SeminaAvailablePeople {
[key: number]: number[];
}

export const SEMINA_AVAILABLE_PEOPLE: SeminaAvailablePeople = {
1: [3, 4, 5, 6, 7, 8],
2: [3, 4],
3: [3, 4, 5, 6],
Expand Down
2 changes: 1 addition & 1 deletion client/src/hooks/useTransition.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect } from "react";
import { useState, useEffect } from 'react';

/** transition이 true가 되면 닫는 애니메이션 실행 */
const useTransition = (delay = 1000) => {
Expand Down
18 changes: 4 additions & 14 deletions client/src/pages/create/timetable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { NavHeader } from '@/components/Layouts/Header';
import styled from '@emotion/styled';
import { useRouter } from 'next/router';
import { useState, useEffect } from 'react';
Expand All @@ -16,11 +15,11 @@ import RightArrow from '@/assets/svg/rightArrow.svg';
import { RESERVE_TIME } from '@/constants/reserveTime';
import { ROOM_USE_SECTION } from '@/constants/roomUseSection';
import { SEMINA_AVAILABLE_PEOPLE } from '@/constants/seminaAvailablePeople';
import { CompanionProps } from '@/utils/types/Companion';
import { ReserveError } from '@/utils/types/ReserveError';
import ConfirmModal from '@/components/Modal/Confrim';
import { TYPO } from '@/styles/typo';
import { COLORS } from '@/styles/colors';
import { CompanionProps } from '@/utils/types/Companion';

const Timetable = () => {
const isKeyOfReserveTime = (
Expand All @@ -41,6 +40,7 @@ const Timetable = () => {
? RESERVE_TIME[timeQuery]
: undefined;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [isOpenSeminar, setIsOpenSeminar] = useState<boolean>(false);
const [isSelected, setIsSelected] = useState<boolean>(false);
const [roomData, setRoomData] = useState<RoomData>();
Expand All @@ -63,7 +63,6 @@ const Timetable = () => {
if (roomdata === undefined) return;
setRoomData(roomdata as RoomData);
const pr = processAvailabilityData(roomdata, curSemina);
console.log(pr);
setProcessData(pr);
}

Expand Down Expand Up @@ -154,15 +153,13 @@ const Timetable = () => {
};

const handleReserveSuccess = () => {
route.replace('/schedule');
setIsSuccess(false);
};

useEffect(() => {
if (roomData === undefined) return;
if (selectedSlots.length === 0) return;
console.log(
selectedSlots[selectedSlots.length - 1].split('-')[3].slice(0, 2),
);
const availableRooms = getAvailableSeminarRooms(
roomData,
selectedSlots[0].slice(0, 10),
Expand All @@ -174,7 +171,6 @@ const Timetable = () => {
false,
);
setSeminaRoom(availableRooms);
console.log(availableRooms);
}, [roomData]);

useEffect(() => {
Expand All @@ -196,7 +192,6 @@ const Timetable = () => {

return (
<Container>
<NavHeader title="예약하기" />
<HeaderDiv>
<HeaderEachDiv>
<HeaderDivBoldText>사용시간</HeaderDivBoldText>
Expand Down Expand Up @@ -249,7 +244,7 @@ const Timetable = () => {
</Main>
{isSelected && !isSuccess && !isError.isError && (
<ReserveConfirmBottomModal
type={ROOM_USE_SECTION[useCaseQuery]}
type={ROOM_USE_SECTION[useCaseQuery as keyof typeof ROOM_USE_SECTION]}
setIsSuccess={setIsSuccess}
setIsError={setIsError}
semina={seminaRoom}
Expand Down Expand Up @@ -280,7 +275,6 @@ export default Timetable;

const Container = styled.div`
position: relative;
margin: 6rem auto;
`;

const Main = styled.main`
Expand Down Expand Up @@ -312,10 +306,6 @@ const TableContainBox = styled.div`
max-width: 36rem;
`;

// const FilterChild = styled.div`
// margin-top: 24px;
// margin-bottom: 20px;
// `;
const ArrowBox = styled.div`
width: 30px;
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion client/src/utils/func/templateTimeConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const getNextWeekdayDate = (
const dayOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].indexOf(
day,
);
let date = new Date(currentTime.getTime());
const date = new Date(currentTime.getTime());
date.setDate(date.getDate() + ((7 - date.getDay() + dayOfWeek) % 7 || 7));
if (date <= currentTime) {
// 이미 해당 요일이 지났다면 다음 주로 설정
Expand Down

0 comments on commit 7517e13

Please sign in to comment.