Skip to content
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
30 changes: 27 additions & 3 deletions messages/en/common/en_common.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"common": {
"loading": "Loading...",
"noData": "Not found",
"somethingWrong": "Something went wrong, please try again later.",
"breadcrumb": {
"home": "Home",
"resource": "Resources",
Expand All @@ -26,6 +28,8 @@
},
"button": {
"create": "Create New",
"detail": "Detail",
"download": "Download",
"createClass": "Add New Class",
"camera": "Open Camera",
"ready": "Ready",
Expand Down Expand Up @@ -135,7 +139,9 @@
"exportRSA": "Export RSA",
"exporting": "Exporting...",
"downloadAndPrint": "Download & Print",
"upgrade": "Upgrade Plan"
"upgrade": "Upgrade Plan",
"uploadFile": "Upload File",
"exportGLB": "Export GLB"
},
"message": {
"courseCreateSuccess": "Course created successfully!",
Expand Down Expand Up @@ -227,7 +233,8 @@
"score": "Score",
"correctAnswer": "Correct Answer",
"submissionDate": "Submission Date",
"studentGroup": "Student Group"
"studentGroup": "Student Group",
"quizDuration": "Duration"
},
"paging": {
"previous": "Previous",
Expand Down Expand Up @@ -269,7 +276,19 @@
"upcoming": "Upcoming",
"endsoon": "End Soon",
"inprogress": "In Progress",
"locked": "Locked"
"locked": "Locked",
"correct": "Correct",
"incorrect": "Incorrect",
"unanswered": "Unanswered"
},
"status2": {
"active": "Active",
"inactive": "Inactive",
"pending": "Pending",
"approved": "Approved",
"rejected": "Rejected",
"cancelled": "Cancelled",
"expired": "Expired"
},
"orgUserStatus": {
"active": "Active",
Expand All @@ -292,6 +311,11 @@
"organizationadmin": "Organization Admin",
"organization_admin": "Organization Admin"
},
"questionType": {
"multiplechoice": "Multiple Choice",
"singlechoice": "Single Choice",
"truefalse": "True / False"
},
"grade": "Grade"
}
}
1 change: 1 addition & 0 deletions messages/en/common/en_toast.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"removeItemFromCart": "Item removed from cart!",
"clearCart": "Cart cleared!",
"addToCart": "Item added to cart!",
"uploadFile": "Upload file(s) successfully!",
"uploadCSV": "Upload CSV Successfully",
"reorder": "Reordered Successfully",
"copiedToClipboard": "Copied to clipboard!"
Expand Down
19 changes: 18 additions & 1 deletion messages/en/lesson/en_content.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@
"createQuiz": "Create Quiz",
"createAssignment": "Create Assignment"
}
}
},
"guide": "Guide",
"upload": "Upload",
"templates": "Templates",
"image": "Image",
"video": "Video",
"document": "Document",
"insertBlock": "Insert Block",
"buttonLink": "Button Link",
"step": "Step",
"quiz": "Quiz",
"note": "Note",
"format": "Format",
"size": "Size",
"resolution": "Resolution",
"createAt": "Created At",
"tag": "Tag",
"noTag": "No Tag"
}
}
2 changes: 1 addition & 1 deletion messages/vi/assignment/vi_assignment.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"noAnswer": "Không có câu trả lời dạng văn bản.",
"submitFile": "Tệp đã nộp",
"viewFile": "Xem tệp đã nộp",
"rubric": "Rubric",
"rubric": "Tiêu chí",
"point": "Điểm",
"max": "Điểm tối đa",
"total": "Tổng điểm cho câu hỏi",
Expand Down
30 changes: 27 additions & 3 deletions messages/vi/common/vi_common.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"common": {
"loading": "Đang tải...",
"noData": "Không tìm thấy",
"somethingWrong": "Đã xảy ra lỗi. Vui lòng thử lại sau.",
"breadcrumb": {
"home": "Trang Chủ",
"course": "Khóa Học",
Expand All @@ -26,6 +28,8 @@
},
"button": {
"create": "Tạo Mới",
"detail": "Chi Tiết",
"download": "Tải Xuống",
"createClass": "Thêm Class mới",
"camera": "Mở Camera",
"ready": "Sẵn sàng",
Expand Down Expand Up @@ -135,7 +139,9 @@
"exportRSA": "Xuất RSA",
"exporting": "Đang Xuất...",
"downloadAndPrint": "Tải Xuống & In",
"upgrade": "Nâng Cấp Gói"
"upgrade": "Nâng Cấp Gói",
"uploadFile": "Tải Lên Tệp",
"exportGLB": "Xuất GLB"
},
"message": {
"courseCreateSuccess": "Khóa học được tạo thành công!",
Expand Down Expand Up @@ -178,6 +184,7 @@
"maxAge": "Tuổi tối đa",
"actions": "Hành Động",
"duration": "Thời Lượng",
"quizDuration": "Thời Gian Làm Bài",
"empty": "Không tìm thấy kết quả.",
"content": "Nội dung",
"plan": "Gói",
Expand Down Expand Up @@ -266,15 +273,27 @@
"deleted": "Đã Xóa",
"expired": "Hết Hạn",
"cancelled": "Đã hủy",
"failed": "Thất Bại",
"failed": "Trượt",
"resolved": "Giải Quyết",
"completed": "Hoàn Thành",
"passed": "Đạt",
"suspended": "Tạm Ngưng",
"upcoming": "Sắp Diễn Ra",
"endsoon": "Kết Thúc Sớm",
"inprogress": "Đang Diễn Ra",
"locked": "Khóa"
"locked": "Khóa",
"correct": "Đúng",
"incorrect": "Sai",
"unanswered": "Chưa Trả Lời"
},
"status2": {
"active": "Đang Hoạt Động",
"inactive": "Không Hoạt Động",
"pending": "Chưa Diễn Ra",
"approved": "Phê Duyệt",
"rejected": "Từ Chối",
"cancelled": "Đã hủy",
"expired": "Hết Hạn"
},
"orgUserStatus": {
"active": "Đã xác thực",
Expand All @@ -292,6 +311,11 @@
"organization_admin": "Quản Trị Viên Tổ Chức",
"organizationadmin": "Quản Trị Viên Tổ Chức"
},
"questionType": {
"multiplechoice": "Nhiều đáp án đúng",
"singlechoice": "Một đáp án đúng",
"truefalse": "Đúng / Sai"
},
"grade": "Khối"
}
}
1 change: 1 addition & 0 deletions messages/vi/common/vi_toast.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"removeItemFromCart": "Đã xóa sản phẩm khỏi giỏ hàng!",
"clearCart": "Đã xóa giỏ hàng!",
"addToCart": "Đã thêm sản phẩm vào giỏ hàng!",
"uploadFile": "Đã tải tệp tin thành công!",
"uploadCSV": "Đã tải CSV thành công",
"reorder": "Đã sắp xếp lại thành công",
"copiedToClipboard": "Đã sao chép vào clipboard!"
Expand Down
19 changes: 18 additions & 1 deletion messages/vi/lesson/vi_content.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@
"createQuiz": "Tạo Quiz",
"createAssignment": "Tạo Bài Thực Hành"
}
}
},
"guide": "Hướng dẫn",
"upload": "Tải lên",
"templates": "Mẫu",
"image": "Hình ảnh",
"video": "Video",
"document": "Tài liệu",
"insertBlock": "Chèn khối",
"buttonLink": "Nút liên kết",
"step": "Bước",
"quiz": "Quiz",
"note": "Ghi chú",
"format": "Định dạng",
"size": "Kích thước",
"resolution": "Độ phân giải",
"createAt": "Ngày tạo",
"tag": "Thẻ",
"noTag": "Không có thẻ"
}
}
2 changes: 1 addition & 1 deletion src/components/shared/loading/LoadingComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function LoadingComponent({ size = 75, textShow = true, text }: L
return (
<div className='flex flex-col items-center justify-center'>
<Image src='/images/loading.gif' alt='Loading Cat' width={size} height={size} />
{textShow && <p className='mt-4 text-[#8b949e]'>{text || 'One moment please...'}</p>}
{/* {textShow && <p className='mt-4 text-[#8b949e]'>{text || 'One moment please...'}</p>} */}
</div>
)
}
4 changes: 3 additions & 1 deletion src/components/tiptap/TiptapEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { usePostLessonAssetsMutation } from '@/features/resource/lesson-asset/ap
import { fileToBase64 } from '@/utils/index'
import { toast } from 'sonner'
import { useParams } from 'next/navigation'
import { useTranslations } from 'next-intl'

interface TiptapEditorProps {
content?: string
Expand All @@ -19,6 +20,7 @@ interface TiptapEditorProps {
}

export default function TiptapEditor({ content, onChange, children }: TiptapEditorProps) {
const tc = useTranslations('toast')
const { lessonId } = useParams()
const editor = useTiptapEditor({ content, onChange, isEditable: true })
const [uploadFiles, { isLoading }] = usePostLessonAssetsMutation()
Expand Down Expand Up @@ -52,7 +54,7 @@ export default function TiptapEditor({ content, onChange, children }: TiptapEdit
lessonId: Number(lessonId),
body: { lessonAssets }
}).unwrap()
toast.success('Uploaded files successfully')
toast.success(tc('successMessage.uploadFile'))
res.data.assets.forEach((asset: any) => {
editor.chain().focus().setImage({ src: asset.assetUrl, alt: asset.name }).run()
})
Expand Down
7 changes: 5 additions & 2 deletions src/components/tiptap/block/step/StepBlockComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import { PostLessonResponseBody } from '@/features/resource/lesson-asset/types/l
import { fileToBase64 } from '@/utils/index'
import { NodeViewWrapper, NodeViewProps } from '@tiptap/react'
import { ChevronLeft, ChevronRight, Loader2, Plus, Trash2, Upload, X } from 'lucide-react'
import { useTranslations } from 'next-intl'
import Image from 'next/image'
import { useParams } from 'next/navigation'
import { useRef, useState } from 'react'
import { toast } from 'sonner'

export default function StepBlockComponent({ node, updateAttributes, editor }: NodeViewProps) {
const tc = useTranslations('toast')
const { lessonId } = useParams()
const { steps, currentStep } = node.attrs
const stepsArray = Array.isArray(steps) ? steps : []
Expand Down Expand Up @@ -70,7 +72,8 @@ export default function StepBlockComponent({ node, updateAttributes, editor }: N

updateStep('images', [...(step.images || []), ...uploaded])

toast.success('Uploaded files successfully')
toast.success(tc('successMessage.uploadFile'))

event.target.value = ''
}

Expand All @@ -92,7 +95,7 @@ export default function StepBlockComponent({ node, updateAttributes, editor }: N
const uploaded = await uploadLessonFiles(files)

updateStep('images', [...(step.images || []), ...uploaded])
toast.success('Uploaded files successfully')
toast.success(tc('successMessage.uploadFile'))
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/tiptap/sidebar/TipTapSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { PanelContent, PanelKey, sidebarItems } from '@/features/resource/conten
import BackButton from '@/components/shared/button/BackButton'
import { useAppDispatch, useAppSelector } from '@/hooks/redux-hooks'
import { setActivePanel } from '@/components/tiptap/slice/tiptapSlice'
import { useLocale } from 'next-intl'
import { useLocale, useTranslations } from 'next-intl'
import { useParams } from 'next/navigation'

export default function TipTapSidebar() {
const tContent = useTranslations('content')
const dispatch = useAppDispatch()
const activePanel = useAppSelector((state) => state.tiptap.activePanel)
const locale = useLocale()
Expand All @@ -24,7 +25,6 @@ export default function TipTapSidebar() {

return (
<aside className={`flex h-full border-r transition-all duration-300 ease-in-out ${activePanel ? 'w-96' : 'w-18'}`}>
{/* Cột icon: chỉ chiếm không gian cần thiết */}
<div className='flex flex-shrink-0 flex-col items-center gap-2 border-r bg-gradient-to-b from-sky-50 to-emerald-50 p-2'>
<div>
<BackButton className='border' url={`/${locale}/admin/lesson/${lessonId}/pacing-guide`} />
Expand All @@ -41,7 +41,7 @@ export default function TipTapSidebar() {
onClick={() => togglePanel(key)}
>
<Icon size={20} />
<span className='text-[10px]'>{label}</span>
<span className='text-[10px]'>{tContent(label.toLowerCase())}</span>
</button>
</li>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ const FileInput = ({ file, onFileChange }: { file: File | null; onFileChange: (f
>
<UploadCloud className={`h-8 w-8 ${isDragging ? 'text-blue-600' : 'text-gray-400'}`} />
<p className='mt-2 text-sm text-gray-600'>
<span className='font-semibold text-blue-600'>Click to upload</span> or drag and drop
<span className='font-semibold text-blue-600'>Nhấn vào để upload</span> hoặc kéo thả
</p>
<p className='text-xs text-gray-500'>PDF, DOC, or DOCX</p>
<p className='text-xs text-gray-500'>PDF, DOC, hoặc DOCX</p>
<input
type='file'
className='absolute h-full w-full opacity-0'
onChange={handleFileChange}
accept='.pdf,.doc,.docx'
accept='.pdf,.doc,.docx, .mp4, .png, .jpg, .jpeg'
/>
</div>
)
Expand Down Expand Up @@ -159,10 +159,10 @@ export default function AssignmentSubmissionForm() {

try {
await createAttempt({ body: payload }).unwrap()
toast.success('Assignment submitted successfully!')
toast.success('Nộp bài thành công!')
router.back()
} catch (error) {
toast.error('Failed to submit assignment.')
toast.error('Nộp bài thất bại. Vui lòng thử lại sau.')
console.error(error)
}
}
Expand All @@ -189,8 +189,8 @@ export default function AssignmentSubmissionForm() {
{formatDate(selectedStudentAssignment.dueDate, { showTime: true, locale: locale === 'vi' ? 'vi' : 'en' })}
</div>
</div>

<Card className='border-blue-200 bg-blue-50'>
{/* TODO */}
{/* <Card className='border-blue-200 bg-blue-50'>
<CardContent className='p-4'>
<div className='flex items-start gap-3'>
<Sparkles className='mt-0.5 h-5 w-5 flex-shrink-0 text-blue-600' />
Expand All @@ -207,7 +207,7 @@ export default function AssignmentSubmissionForm() {
</div>
</div>
</CardContent>
</Card>
</Card> */}

{/* Tabs */}
<div className='border-b border-gray-200'>
Expand Down
Loading