diff --git a/frontend/src/assets/icons/compass.svg b/frontend/src/assets/icons/compass.svg new file mode 100644 index 0000000..b71c924 --- /dev/null +++ b/frontend/src/assets/icons/compass.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/frontend/src/assets/icons/plus.svg b/frontend/src/assets/icons/plus.svg new file mode 100644 index 0000000..b51a170 --- /dev/null +++ b/frontend/src/assets/icons/plus.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/frontend/src/components/ClassCard/ClassCard.jsx b/frontend/src/components/ClassCard/ClassCard.jsx index 8a7f252..2691b29 100644 --- a/frontend/src/components/ClassCard/ClassCard.jsx +++ b/frontend/src/components/ClassCard/ClassCard.jsx @@ -1,5 +1,6 @@ import { Link } from 'react-router-dom'; import styles from './ClassCard.module.css'; +import CompassIcon from '/src/assets/icons/compass.svg?react'; export default function ClassCard({ img, path, children }) { return ( @@ -7,11 +8,17 @@ export default function ClassCard({ img, path, children }) { to={path} className={styles.card} > - 강의 이미지 + {img ? ( + 강의 이미지 + ) : ( +
+ +
+ )}
{children}
); diff --git a/frontend/src/components/ClassCard/ClassCard.module.css b/frontend/src/components/ClassCard/ClassCard.module.css index 1741799..ea3e80c 100644 --- a/frontend/src/components/ClassCard/ClassCard.module.css +++ b/frontend/src/components/ClassCard/ClassCard.module.css @@ -9,9 +9,13 @@ } .thumbnail { + display: flex; + justify-content: center; + align-items: center; width: 295px; height: 220px; border-radius: 20px; background-color: var(--background-secondary); + stroke: var(--text-color); box-sizing: border-box; } diff --git a/frontend/src/components/LiveRoom/LiveRoom.jsx b/frontend/src/components/LiveRoom/LiveRoom.jsx index 5295de5..38d94c6 100644 --- a/frontend/src/components/LiveRoom/LiveRoom.jsx +++ b/frontend/src/components/LiveRoom/LiveRoom.jsx @@ -115,7 +115,10 @@ export default function LiveRoom() { )} - + diff --git a/frontend/src/components/SideBar/SideBar.module.css b/frontend/src/components/SideBar/SideBar.module.css index 3f73801..3d9668b 100644 --- a/frontend/src/components/SideBar/SideBar.module.css +++ b/frontend/src/components/SideBar/SideBar.module.css @@ -18,7 +18,7 @@ .groupList { display: flex; flex-direction: column; - gap: 16px; + gap: 8px; list-style: none; padding: 0; margin: 0; diff --git a/frontend/src/components/SideBar/SideLink.module.css b/frontend/src/components/SideBar/SideLink.module.css index df232f1..3eec140 100644 --- a/frontend/src/components/SideBar/SideLink.module.css +++ b/frontend/src/components/SideBar/SideLink.module.css @@ -15,5 +15,4 @@ .active { font-weight: 700; - text-decoration: underline; } diff --git a/frontend/src/hooks/api/useNotices.js b/frontend/src/hooks/api/useNotices.js index b6fd154..dd4b671 100644 --- a/frontend/src/hooks/api/useNotices.js +++ b/frontend/src/hooks/api/useNotices.js @@ -1,9 +1,9 @@ -import { useQuery } from '@tanstack/react-query'; +import { useSuspenseQuery } from '@tanstack/react-query'; import instance from '../../utils/axios/instance'; import { API_URL } from '../../constants'; export function useNotices(lectureId, page = 0) { - return useQuery({ + return useSuspenseQuery({ queryKey: ['noticelist', lectureId, page], queryFn: () => instance.get(`${API_URL}/board?lectureId=${lectureId}&category=announcement&pageNo=${page}`), }); diff --git a/frontend/src/pages/LivePage/LivePage.jsx b/frontend/src/pages/LivePage/LivePage.jsx index 5356bd2..2a12864 100644 --- a/frontend/src/pages/LivePage/LivePage.jsx +++ b/frontend/src/pages/LivePage/LivePage.jsx @@ -1,31 +1,29 @@ import { LiveRoom } from '../../components/LiveRoom'; import { useParams } from 'react-router-dom'; -import { useCallback, useEffect } from 'react'; +import { useCallback, useEffect, useState } from 'react'; import { LiveKitRoom } from '@livekit/components-react'; import instance from '../../utils/axios/instance'; import { API_URL, ROOM_URL } from '../../constants'; -import useBoundStore from '../../store'; import '@livekit/components-styles'; import LoadingIndicator from '../../components/LoadingIndicator.jsx/LoadingIndicator'; export default function LivePage() { const { roomId } = useParams(); + const [liveToken, setLiveToken] = useState(null); const generateToken = useCallback(async () => { await instance.post(`${API_URL}/video/makeroom/${roomId}`); - const { data } = await instance.post(`${API_URL}/video/joinroom/${roomId}`); + const { data } = await instance.post(`${API_URL}/video/joinroom/${roomId}`).catch(() => { + alert('방에 입장할 수 없습니다.'); + }); return data.token; }, [roomId]); - const liveToken = useBoundStore((state) => state.liveToken); - useEffect(() => { - if (!liveToken) { - generateToken().then((token) => { - useBoundStore.setState({ liveToken: token }); - }); - } - }, [generateToken, liveToken]); + generateToken().then((token) => { + setLiveToken(token); + }); + }, [generateToken]); return liveToken ? ( { + instance.post(`${API_URL}/video/deleteroom/${roomId}`).catch(() => {}); + }} > diff --git a/frontend/src/pages/TeacherHomePage/TeacherHomePage.jsx b/frontend/src/pages/TeacherHomePage/TeacherHomePage.jsx index 0236ca9..cc730ec 100644 --- a/frontend/src/pages/TeacherHomePage/TeacherHomePage.jsx +++ b/frontend/src/pages/TeacherHomePage/TeacherHomePage.jsx @@ -1,17 +1,19 @@ +import styles from './TeacherHomePage.module.css'; +import { Link } from 'react-router-dom'; import { ClassCard } from '../../components/ClassCard'; import { ClassGrid } from '../../components/ClassGrid'; import { MaxWidthLayout } from '../../components/Layout'; import { useMyLectures } from '../../hooks/api/useMyLectures'; +import PlusIcon from '/src/assets/icons/plus.svg?react'; export default function TeacherHomePage() { const { data: myLectures } = useMyLectures(); const onGoingClasses = myLectures?.data ?? []; - console.log(onGoingClasses); - // TODO: 새 강의 만들기 스타일 추가, 추가 기능 필요시 추가 + return ( - {onGoingClasses.map?.((lecture) => ( + {onGoingClasses.map((lecture) => ( ))} - 새 강의 만들기 + + + 새 강의 만들기 + ); diff --git a/frontend/src/pages/TeacherHomePage/TeacherHomePage.module.css b/frontend/src/pages/TeacherHomePage/TeacherHomePage.module.css new file mode 100644 index 0000000..0e94798 --- /dev/null +++ b/frontend/src/pages/TeacherHomePage/TeacherHomePage.module.css @@ -0,0 +1,21 @@ +.add { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 20px; + margin-bottom: 32px; + background-color: var(--background); + color: var(--text-color); + stroke: var(--text-color); + font-size: 16px; + font-style: normal; + font-weight: 400; + line-height: 1.4; + border-radius: 20px; + transition: background-color 0.2s ease; + + &:hover { + background-color: var(--background-secondary); + } +} diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 7bf42e8..033afc3 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -3,7 +3,6 @@ import { userTypeSlice } from './userTypeSlice'; import { tokenSlice } from './tokenSlice'; import { userNameSlice } from './userNameSlice'; import { persist } from 'zustand/middleware'; -import { liveSlice } from './liveSlice'; const useBoundStore = create( persist( @@ -11,7 +10,6 @@ const useBoundStore = create( ...userTypeSlice(...a), ...tokenSlice(...a), ...userNameSlice(...a), - ...liveSlice(...a), }), { name: 'bound-store' } ) diff --git a/frontend/src/store/liveSlice.js b/frontend/src/store/liveSlice.js deleted file mode 100644 index 12e7014..0000000 --- a/frontend/src/store/liveSlice.js +++ /dev/null @@ -1,6 +0,0 @@ -export const liveSlice = (set) => ({ - liveToken: null, - setLiveToken: (liveToken) => set({ liveToken }), - participants: 0, - setParticipants: (participants) => set({ participants }), -});