Skip to content

Commit

Permalink
Merge pull request #105 from IT-Cotato/fix/calendar_component
Browse files Browse the repository at this point in the history
[Refactor] NoLesson 컴포넌트 하나의 컴포넌트로 병합
  • Loading branch information
ahnsui authored Mar 6, 2025
2 parents 22d8bf8 + 8fc8d06 commit 9ae4cbd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 27 deletions.
6 changes: 1 addition & 5 deletions src/components/Calendar/CalendarInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Clicked } from '../../models/calendar.model';
import CalendarLesson from './CalendarLesson';
import CalendarDeposit from './CalendarDeposit';
import CalendarNolesson from './CalendarNolesson';
import CalendarNolessonStudent from './CalendarNolessonStudent';

type CalendarProps = { clickDate: Clicked; roleInfo: string };

Expand All @@ -15,10 +14,7 @@ const CalendarInfo = ({ clickDate, roleInfo }: CalendarProps) => {
<div className="flex flex-col gap-2">
{clickDate.roomname && <CalendarDeposit roomname={clickDate.roomname} type={'calendar'} />}
{clickDate.subjectAndRooms && <CalendarLesson subjectAndRooms={clickDate.subjectAndRooms} />}
{!clickDate.roomname && !clickDate.subjectAndRooms && roleInfo === 'TEACHER' && <CalendarNolesson />}
{!clickDate.roomname && !clickDate.subjectAndRooms && (roleInfo === 'PARENT' || roleInfo === 'STUDENT') && (
<CalendarNolessonStudent />
)}
{!clickDate.roomname && !clickDate.subjectAndRooms && <CalendarNolesson roleInfo={roleInfo} />}
</div>
</div>
);
Expand Down
11 changes: 7 additions & 4 deletions src/components/Calendar/CalendarNolesson.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import { getShareCode } from '../../api/roomList.api';

type Props = {
isShareLink?: boolean;
roleInfo: string;
};

const CalendarNolesson = ({ isShareLink }: Props) => {
const CalendarNolesson = ({ isShareLink, roleInfo }: Props) => {
const navigation = useNavigate();
const { roomId } = useParams();
const [toast, setToast] = useState(false);
Expand All @@ -28,7 +29,7 @@ const CalendarNolesson = ({ isShareLink }: Props) => {
} catch (e) {
alert('초대 코드 복사에 실패했습니다.');
}
} else {
} else if (roleInfo === 'TEACHER') {
navigation('/user/roomlist');
}
};
Expand All @@ -52,12 +53,14 @@ const CalendarNolesson = ({ isShareLink }: Props) => {
) : (
<>
<div className="text-gray-900 text-base font-semibold leading-7">오늘은 일정이 없어요!</div>
<div className="text-sm leading-6 tracking-[-0.042px]">과외방에서 일정을 추가할 수 있어요</div>
{roleInfo === 'TEACHER' && (
<div className="text-sm leading-6 tracking-[-0.042px]">과외방에서 일정을 추가할 수 있어요</div>
)}
</>
)}
</div>
</div>
<MdKeyboardArrowRight size={24} />
{roleInfo === 'TEACHER' && <MdKeyboardArrowRight size={24} />}
</div>
);
};
Expand Down
18 changes: 0 additions & 18 deletions src/components/Calendar/CalendarNolessonStudent.tsx

This file was deleted.

0 comments on commit 9ae4cbd

Please sign in to comment.