Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

レイアウトと関数のバグ修正 #168

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/api/feedback/getKeywords.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {keyword} from '@/src/interfaces/feedback';
import req from '../apiUtils';

const getKeywords = async (cId: number, mId: number): Promise<keyword[]> => {
const getKeywords = async (cId: number, mId: number) => {
const response = await req(
`/class/${cId}/feedback/materials/${mId}/get-keyword`,
'get',
Expand Down
2 changes: 1 addition & 1 deletion src/app/classes/[cId]/[mId]/components/AttendanceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const AttendanceCard = ({cid}: {cid: number; uid: number}) => {
const uids = res.map((user: ClassUser) => ({
uid: user.uid,
cid: cid,
csid: 10,
csid: 19,
status: '',
}));
setSubmitUsers(uids);
Expand Down
29 changes: 27 additions & 2 deletions src/app/classes/[cId]/[mId]/components/FeedbackKeywordList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import Image from 'next/image';
import getKeywords from '@/src/api/feedback/getKeywords';
import {keyword} from '@/src/interfaces/feedback';
import getCheckRefer from '@/src/api/feedback/getCheckRefer';
import gifs from '@/public/gif';

const FeedbackKeywordList = ({cId, mId}: {cId: number; mId: number}) => {
const [references, setReferences] = useState<boolean>(false);
const [keywords, setKeywords] = useState<keyword[]>([]);
const [keyWord, setKeyWord] = useState<keyword | null>(null);
const [loading, setLoading] = useState(true);

console.log(keywords.length);

useEffect(() => {
getCheckRefer(cId, mId).then(res => {
setReferences(res);
Expand All @@ -24,7 +28,13 @@ const FeedbackKeywordList = ({cId, mId}: {cId: number; mId: number}) => {
setLoading(true);
getKeywords(cId, mId).then(res => {
console.log(res);
setKeywords(res);
if (Array.isArray(res)) {
setKeywords(res);
} else if (res.length === 1) {
setKeyWord(res[0]);
} else {
setKeyWord(res);
}
setLoading(false);
});
}, [references, cId, mId]);
Expand All @@ -37,13 +47,28 @@ const FeedbackKeywordList = ({cId, mId}: {cId: number; mId: number}) => {
loading ? (
<div className="text-3xl p-3 font-semibold">
<Image
src="/gif/loading.gif"
src={gifs.eclipse}
width={200}
height={112}
alt="gif"
style={{width: '200px', height: '112px'}}
></Image>
</div>
) : keyWord ? (
<div className="px-3">
<div className="w-52 h-64 bg-green-200 rounded-lg p-4 border border-green-400">
<div className="w-16 h-16 bg-green-500 rounded-full m-auto flex justify-center items-center text-4xl text-white">
P
</div>
<div className="p-1 font-semibold">{keyWord.page}</div>
<div className="font-semibold">KeyWord</div>
<ul>
<li>{keyWord.keywords[0]}</li>
<li>{keyWord.keywords[1]}</li>
<li>{keyWord.keywords[2]}</li>
</ul>
</div>
</div>
) : (
keywords.map((keyword, index) => (
<div className="px-3" key={index}>
Expand Down
2 changes: 1 addition & 1 deletion src/app/classes/[cId]/[mId]/components/QuizList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const QuizList = (props: {cId: number; mId: number; mName: string}) => {
className="py-2 px-4 bg-red-500 text-white rounded-3xl"
onClick={handleDeleteSet}
>
퀴즈 마감
퀴즈 삭제
</button>
) : (
<button
Expand Down
4 changes: 2 additions & 2 deletions src/app/classes/[cId]/[mId]/components/QuizSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const QuizSet = ({cId, mId}: {cId: number; mId: number}) => {
};

return (
<div className="py-2 w-[850px] m-auto">
<div className="py-2 w-[750px] m-auto">
<Swiper
onSwiper={swiper => (swiperRef.current = swiper)}
slidesPerView={1} // 表示されるスライス数
Expand All @@ -120,7 +120,7 @@ const QuizSet = ({cId, mId}: {cId: number; mId: number}) => {
>
{quizSet.map((quiz, index) => (
<SwiperSlide key={quiz.id} style={{width: 'auto'}}>
<div className="relative w-[750px] h-[800px] m-auto py-3">
<div className="relative w-[650px] h-[800px] m-auto py-3">
{isSubmit ? (
<Image
src={submitQuizList[index].result ? pngs.true : pngs.false}
Expand Down
10 changes: 5 additions & 5 deletions src/components/navbar/material/MaterialContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const MaterialContainer = () => {
}
}, [debounceVal]);

useEffect(() => {
setMaterials([]);
setBoardPage(1);
onLoadMore();
}, [param.cId]);
// useEffect(() => {
// setMaterials([]);
// setBoardPage(1);
// onLoadMore();
// }, [param.cId]);

const onLoadMore = () => {
setHasMore(false);
Expand Down
Loading