Skip to content

Commit

Permalink
Merge pull request #174 from Lainari/feat/class-board-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Regulus0811 authored Jul 2, 2024
2 parents edf9fd2 + 9c56ca0 commit 059e356
Show file tree
Hide file tree
Showing 27 changed files with 167 additions and 154 deletions.
2 changes: 1 addition & 1 deletion src/app/classes/[cId]/[mId]/components/CalendarModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const CalendarModal = ({
>
<Calendar onChange={onChange} value={value} />
<div className="flex justify-center items-center py-2">
<span className="font-semibold">마감일시 :</span>
<span className="font-semibold">締切日時 :</span>
<TimePicker onChange={handleTimeSet} value={time} />
</div>
<div className="flex justify-center py-1">
Expand Down
10 changes: 5 additions & 5 deletions src/app/classes/[cId]/[mId]/components/QuizFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ const QuizFeedback = ({
id="modal-container"
>
<div>
<div className="text-xl font-semibold">ㅇㅇ님이 제출한 퀴즈</div>
<div className="text-xl font-semibold">OOさんが投稿したクイズ</div>
<div className="py-3">
<p className="pb-2">ㅇㅇ님에 대한 피드백</p>
<p className="pb-2">OOさんへのフィードバック</p>
{isWrite ? (
<div>{feedback}</div>
) : (
Expand All @@ -71,14 +71,14 @@ const QuizFeedback = ({
className="bg-blue-500 text-white px-4 py-2 rounded-lg font-semibold"
onClick={handleCreateFeedback}
>
작성
作成
</button>
</div>
)}
</div>
<div className="h-[280px] overflow-scroll">
<div className="font-bold py-2">
정답률 :{' '}
正解率 :{' '}
<span
className={
collectRate >= 50 ? 'text-green-500' : 'text-red-500'
Expand Down Expand Up @@ -110,7 +110,7 @@ const QuizFeedback = ({
className="p-2 border border-gray-500 rounded-lg"
onClick={() => setIsOpen(false)}
>
닫기
閉じる
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const ShowMain = () => {
<div className="w-full h-full mt-2">
<div className="border-4 rounded-lg border-gray-500 p-2 h-full overflow-auto">
<p className="text-center inline-block px-4 py-2 text-sm text-white bg-violet-300 rounded-lg w-full">
최상단 채팅 내용입니다
一番上のチャット内容です
</p>
{messages.map((msg, index) => {
const [id, message] = msg.split(': ');
Expand Down
12 changes: 6 additions & 6 deletions src/app/classes/[cId]/[mId]/quizForm/components/QuizForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const QuizForm = (props: {
<div className="text-lg font-medium p-1">Question</div>
<input
className="w-full border-2 p-3 rounded-lg leading-8"
placeholder="문제를 입력해주세요"
placeholder="問題を入力してください"
onChange={handleInputQuestion}
value={question}
/>
Expand All @@ -117,7 +117,7 @@ const QuizForm = (props: {
<input
name="a"
className="w-[calc(100%-25px)] outline-none"
placeholder="답변을 입력해주세요"
placeholder="回答を入力してください"
onChange={handleInputAnswer}
value={answer?.a}
/>
Expand All @@ -129,7 +129,7 @@ const QuizForm = (props: {
<input
name="b"
className="w-[calc(100%-25px)] outline-none"
placeholder="답변을 입력해주세요"
placeholder="回答を入力してください"
onChange={handleInputAnswer}
value={answer?.b}
/>
Expand All @@ -141,7 +141,7 @@ const QuizForm = (props: {
<input
name="c"
className="w-[calc(100%-25px)] outline-none"
placeholder="답변을 입력해주세요"
placeholder="回答を入力してください"
onChange={handleInputAnswer}
value={answer?.c}
/>
Expand All @@ -153,7 +153,7 @@ const QuizForm = (props: {
<input
name="d"
className="w-[calc(100%-25px)] outline-none"
placeholder="답변을 입력해주세요"
placeholder="回答を入力してください"
onChange={handleInputAnswer}
value={answer?.d}
/>
Expand Down Expand Up @@ -183,7 +183,7 @@ const QuizForm = (props: {
</div>
<textarea
className="font-medium bg-gray-100 pt-1 w-full outline-none resize-none"
placeholder="해설을 입력해주세요"
placeholder="解説を入力してください"
rows={5}
onChange={handleInputCommentary}
value={commentary?.content}
Expand Down
2 changes: 1 addition & 1 deletion src/app/classes/[cId]/components/card/MemberCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const MemberCard = ({
</option>
</select>
<button className="bg-white font-semibold text-black py-1 px-2 rounded hover:bg-gray-200 ml-2">
권한 변경
権限の変更
</button>
</div>
)}
Expand Down
12 changes: 6 additions & 6 deletions src/app/classes/[cId]/components/card/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ const PostCard = ({
}) => {
const dropdownItems = [
{
modalId: '게시글 수정',
modalId: '投稿の修正',
icon: icons.edit,
alt: 'Edit Icon',
text: '수정',
text: '修正',
},
{
modalId: '게시글 삭제',
modalId: '投稿の削除',
icon: icons.delete,
alt: 'Delete Icon',
text: '삭제',
text: '削除',
},
];
const [isModalOpen, setIsModalOpen] = useState(false);
Expand All @@ -35,7 +35,7 @@ const PostCard = ({
const setActiveModalId = (modalId: string) => {
setSelectedModalId(modalId);
setIsModalOpen(true);
if (modalId === '게시글 삭제') {
if (modalId === '投稿の削除') {
deletePost(postId);
}
};
Expand Down Expand Up @@ -80,7 +80,7 @@ const PostCard = ({
)}
</div>
</div>
{isModalOpen && selectedModalId === '게시글 수정' && <ClassEditPost />}
{isModalOpen && selectedModalId === '投稿の修正' && <ClassEditPost />}
</div>
);
};
Expand Down
12 changes: 6 additions & 6 deletions src/app/classes/[cId]/components/card/ScheduleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ const ScheduleCard = ({
}) => {
const dropdownItems = [
{
modalId: '일정 수정',
modalId: 'スケジュール修正',
icon: icons.edit,
alt: 'Edit Icon',
text: '수정',
text: '修正',
},
{
modalId: '일정 삭제',
modalId: 'スケジュール削除',
icon: icons.delete,
alt: 'Delete Icon',
text: '삭제',
text: '削除',
},
];
const [isModalOpen, setIsModalOpen] = useState(false);
Expand All @@ -38,7 +38,7 @@ const ScheduleCard = ({
const setActiveModalId = (modalId: string) => {
setSelectedModalId(modalId);
setIsModalOpen(true);
if (modalId === '일정 삭제') {
if (modalId === 'スケジュール削除') {
deleteSchedule(scheduleId);
}
};
Expand Down Expand Up @@ -70,7 +70,7 @@ const ScheduleCard = ({
</div>
</div>
<div className="my-2">
<p className="font-bold text-lg mb-2">날짜</p>
<p className="font-bold text-lg mb-2">日付</p>
<p className="ms-2 text-md mb-1">{startTime}</p>
<p className="ms-2 text-md">{endTime}</p>
</div>
Expand Down
22 changes: 14 additions & 8 deletions src/app/classes/[cId]/components/main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import icons from '@/public/svgs/_class';

const Main = ({managerRole, classId, userInfo}: RoleProps) => {
const [showDropdown, setShowDropdown] = useState<Record<string, boolean>>({
공지사항: true,
일정: true,
게시글: true,
お知らせ: true,
スケジュール: true,
投稿: true,
});
const [modalState, setModalState] = useState({
schedule: false,
Expand Down Expand Up @@ -54,18 +54,23 @@ const Main = ({managerRole, classId, userInfo}: RoleProps) => {

const mainSections: MainSectionProps[] = [
{
title: '공지사항',
title: 'お知らせ',
component: (
<Notice
managerRole={managerRole}
classId={classId}
userInfo={userInfo}
isOpen={showDropdown['공지사항']}
isOpen={showDropdown['お知らせ']}
/>
),
},
createSection('일정', Schedule, ClassCreateSchedule, 'schedule'),
createSection('게시글', Post, ClassCreatePost, 'post'),
createSection(
'スケジュール',
Schedule,
ClassCreateSchedule,
'スケジュール'
),
createSection('投稿', Post, ClassCreatePost, '投稿'),
];

return (
Expand Down Expand Up @@ -96,7 +101,8 @@ const Main = ({managerRole, classId, userInfo}: RoleProps) => {
{section.title}
</h3>
{managerRole &&
(section.title === '일정' || section.title === '게시글') && (
(section.title === 'スケジュール' ||
section.title === '投稿') && (
<div onClick={section.openModal}>
<Image
src={icons.addButton}
Expand Down
18 changes: 10 additions & 8 deletions src/app/classes/[cId]/components/main/Notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ const Notice = ({
}: RoleProps & {isOpen: boolean}) => {
const dropdownItems = [
{
modalId: '공지사항 수정',
modalId: 'お知らせの修正',
icon: icons.edit,
alt: 'Edit Icon',
text: '수정',
text: '修正',
},
{
modalId: '공지사항 삭제',
modalId: 'お知らせの削除',
icon: icons.delete,
alt: 'Delete Icon',
text: '삭제',
text: '削除',
},
];
const [classAnnounced, setClassAnnounced] = useState<
Expand All @@ -38,7 +38,7 @@ const Notice = ({
const deleteNotice = async (postId: number) => {
if (classId !== undefined && userInfo) {
try {
if (confirm('정말로 공지사항을 삭제하시겠습니까?')) {
if (confirm('本当にお知らせを削除しますか?')) {
await DeleteClassBoard(postId, classId, userInfo.id);
alert('Notice deleted successfully!');
}
Expand All @@ -60,7 +60,7 @@ const Notice = ({
const setActiveModalId = (modalId: string) => {
setSelectedModalId(modalId);
setIsModalOpen(true);
if (modalId === '공지사항 삭제') {
if (modalId === 'お知らせの削除') {
deleteNotice(classAnnounced[0].ID);
}
};
Expand Down Expand Up @@ -101,10 +101,12 @@ const Notice = ({
</>
)}
</div>
{isModalOpen && selectedModalId === 'noticeEdit' && <ClassEditPost />}
{isModalOpen && selectedModalId === 'お知らせの修正' && (
<ClassEditPost />
)}
</>
) : (
<p className="ms-2 text-xl font-bold">현재 공지사항이 없습니다...</p>
<p className="ms-2 text-xl font-bold">現在、お知らせはありません...</p>
)}
</div>
);
Expand Down
14 changes: 7 additions & 7 deletions src/app/classes/[cId]/components/main/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ const Post = ({
const deletePost = async (postId: number) => {
if (classId !== undefined && userInfo) {
try {
if (confirm('정말로 게시글을 삭제하시겠습니까?')) {
if (confirm('本当に投稿を削除しますか?')) {
await classBoardAPI.deleteClassBoard(postId, classId, userInfo.id);
alert('Post deleted successfully!');
alert('投稿は正常に削除されました!');
const posts = await classBoardAPI.getClassBoardList(
classId,
pageNum,
Expand All @@ -63,10 +63,10 @@ const Post = ({
}
} catch (error) {
console.error(error);
alert('Failed to delete post');
alert('投稿の削除に失敗しました');
}
} else {
alert('Failed to delete post');
alert('投稿の削除に失敗しました');
}
};

Expand Down Expand Up @@ -100,7 +100,7 @@ const Post = ({
<div className="flex justify-center mt-2 w-full">
<div className="flex w-1/2 border-4 justify-center items-center h-20">
<h1 className="text-3xl font-semibold">
현재 게시글이 존재하지 않습니다...
現在、投稿が存在しません...
</h1>
</div>
</div>
Expand Down Expand Up @@ -147,7 +147,7 @@ const Post = ({
<>
{renderPosts()}
<div className="flex justify-center mt-10">
{renderPageButton('이전', () => handlePageChange(-1))}
{renderPageButton('前へ', () => handlePageChange(-1))}
{pages.map(page => (
<button
className={`border w-12 h-10 rounded-full me-2 ${
Expand All @@ -159,7 +159,7 @@ const Post = ({
{page}
</button>
))}
{renderPageButton('다음', () => handlePageChange(1))}
{renderPageButton('次へ', () => handlePageChange(1))}
</div>
</>
);
Expand Down
10 changes: 5 additions & 5 deletions src/app/classes/[cId]/components/main/Schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const Schedule = ({
const deleteSchedule = async (scheduleId: number) => {
if (classId !== undefined) {
try {
if (confirm('정말로 일정을 삭제하시겠습니까?')) {
if (confirm('本当にスケジュールを削除しますか?')) {
await classScheduleAPI.deleteClassSchedule(
scheduleId,
classId,
user.id
);
alert('Schedule deleted successfully!');
alert('スケジュールは正常に削除されました!');
const schedules =
await classScheduleAPI.getClassScheduleList(classId);
if (Array.isArray(schedules.data)) {
Expand All @@ -35,10 +35,10 @@ const Schedule = ({
}
} catch (error) {
console.error(error);
alert('Failed to delete schedule');
alert('スケジュールの削除に失敗しました');
}
} else {
alert('Failed to delete schedule');
alert('スケジュールの削除に失敗しました');
}
};
const toKST = (date: string) => {
Expand Down Expand Up @@ -89,7 +89,7 @@ const Schedule = ({
<div className="flex justify-center mt-2 w-full">
<div className="flex w-1/2 border-4 justify-center items-center h-20">
<h1 className="text-3xl font-semibold">
현재 일정이 존재하지 않습니다...
現在スケジュールが存在しません...
</h1>
</div>
</div>
Expand Down
Loading

0 comments on commit 059e356

Please sign in to comment.