diff --git a/apps/upskii/messages/en.json b/apps/upskii/messages/en.json index 1090935f1b..d63692663c 100644 --- a/apps/upskii/messages/en.json +++ b/apps/upskii/messages/en.json @@ -3524,7 +3524,9 @@ "edit_description": "Edit an existing course", "delete_confirm_title": "Deleting \"{name}\"", "card_view": "Card View", - "table_view": "Table View" + "table_view": "Table View", + "no_courses_found": "No courses found", + "no_description_provided": "No description provided" }, "ws-crawlers": { "plural": "Crawlers", @@ -4136,7 +4138,5 @@ "ai_teach_studio": "AI Teaching Studio", "users": "Users", "teams": "Teams" - }, - "no-courses-found": "No courses found", - "no-description-provided": "No description provided" + } } diff --git a/apps/upskii/messages/vi.json b/apps/upskii/messages/vi.json index 90934abef9..ac27cbed2a 100644 --- a/apps/upskii/messages/vi.json +++ b/apps/upskii/messages/vi.json @@ -3522,10 +3522,12 @@ "edit": "Chỉnh sửa khóa học", "name": "Tên khóa học", "edit_description": "Chỉnh sửa khóa học hiện có", - "delete_confirm_title": "Xác nhận xoá \"{name}\"", "course_description": "Mô tả khóa học", "card_view": "Dạng thẻ", - "table_view": "Dạng bảng" + "table_view": "Dạng bảng", + "no_courses_found": "Chưa có khóa học nào", + "no_description_provided": "Không có mô tả", + "delete_confirm_title": "Xác nhận xoá \"{name}\"" }, "ws-crawlers": { "plural": "Công cụ cào dữ liệu", @@ -4131,7 +4133,5 @@ "empty_state_description": "Hoàn thành các khóa học để giành chứng chỉ và thể hiện thành tích của bạn.", "browse_courses": "Xem các khóa học", "certified": "Được chứng nhận" - }, - "no-courses-found": "Chưa có khóa học nào", - "no-description-provided": "Không có mô tả" + } } diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/columns.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/columns.tsx index 54d17645fd..1a2856f15d 100644 --- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/columns.tsx +++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/columns.tsx @@ -1,8 +1,8 @@ 'use client'; -import { WorkspaceCourseModuleRowActions } from './row-actions'; import { ColumnDef } from '@tanstack/react-table'; import { WorkspaceCourseModule } from '@tuturuuu/types/db'; +import { WorkspaceCourseModuleRowActions } from '@tuturuuu/ui/custom/education/modules/course-module-row-actions'; import { DataTableColumnHeader } from '@tuturuuu/ui/custom/tables/data-table-column-header'; import { Check, X } from '@tuturuuu/ui/icons'; import moment from 'moment'; diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx index 14fbca3d58..83388b9a7a 100644 --- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx +++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx @@ -1,10 +1,7 @@ import { createClient } from '@tuturuuu/supabase/next/server'; import { UserGroup } from '@tuturuuu/types/primitives/UserGroup'; -import FeatureSummary from '@tuturuuu/ui/custom/feature-summary'; -import { GraduationCap } from '@tuturuuu/ui/icons'; +import { CourseHeader } from '@tuturuuu/ui/custom/education/courses/course-header'; import { Separator } from '@tuturuuu/ui/separator'; -import { getTranslations } from 'next-intl/server'; -import Link from 'next/link'; import { notFound } from 'next/navigation'; import { ReactNode } from 'react'; @@ -18,29 +15,12 @@ interface Props { } export default async function CourseDetailsLayout({ children, params }: Props) { - const t = await getTranslations(); const { wsId, courseId } = await params; const data = await getData(wsId, courseId); return ( <> - -
- - {t('ws-courses.singular')} -
- - {data.name || t('common.unknown')} - - - } - description={
{data.description || t('common.unknown')}
} - /> + {children} diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/content/page.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/content/page.tsx index 1c1af586d2..84b1e4b735 100644 --- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/content/page.tsx +++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/content/page.tsx @@ -1,8 +1,8 @@ -import ModuleContentEditor from './content-editor'; import { createClient } from '@tuturuuu/supabase/next/server'; import { Button } from '@tuturuuu/ui/button'; import FeatureSummary from '@tuturuuu/ui/custom/feature-summary'; import { Goal, Sparkles } from '@tuturuuu/ui/icons'; +import { ModuleContentEditor } from '@tuturuuu/ui/text-editor/content-editor'; import { JSONContent } from '@tuturuuu/ui/tiptap'; import { getTranslations } from 'next-intl/server'; diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/layout.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/layout.tsx index a81e545f33..75d83d63a1 100644 --- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/layout.tsx +++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/layout.tsx @@ -1,10 +1,10 @@ -import LinkButton from '../../link-button'; -import ModuleToggles from './toggles'; import { createClient, createDynamicClient, } from '@tuturuuu/supabase/next/server'; import { WorkspaceCourseModule } from '@tuturuuu/types/db'; +import LinkButton from '@tuturuuu/ui/custom/education/modules/link-button'; +import { ModuleToggles } from '@tuturuuu/ui/custom/education/modules/module-toggle'; import FeatureSummary from '@tuturuuu/ui/custom/feature-summary'; import { BookText, @@ -41,7 +41,7 @@ export default async function CourseDetailsLayout({ children, params }: Props) { const data = await getData(courseId, moduleId); const resources = await getResources({ - path: `${wsId}/courses/${courseId}/modules/${moduleId}/resources/`, + path: `${commonHref}/resources/`, }); const completionStatus = await getCompletionStatus(moduleId); diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/page.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/page.tsx index 0cd17885f8..ee52e3bece 100644 --- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/page.tsx +++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/page.tsx @@ -1,8 +1,5 @@ -import { CourseSection } from '../../section'; import ClientFlashcards from './flashcards/client-flashcards'; import ClientQuizzes from './quizzes/client-quizzes'; -import FileDisplay from './resources/file-display'; -import { YoutubeEmbed } from './youtube-links/embed'; import { extractYoutubeId } from '@/utils/url-helper'; import { createClient, @@ -10,6 +7,9 @@ import { } from '@tuturuuu/supabase/next/server'; import { WorkspaceCourseModule } from '@tuturuuu/types/db'; import { Accordion } from '@tuturuuu/ui/accordion'; +import { CourseSection } from '@tuturuuu/ui/custom/education/modules/content-section'; +import { FileDisplay } from '@tuturuuu/ui/custom/education/modules/resources/file-display'; +import { YoutubeEmbed } from '@tuturuuu/ui/custom/education/modules/youtube/embed'; import { BookText, Goal, diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/resources/page.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/resources/page.tsx index 9824697928..555d37fada 100644 --- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/resources/page.tsx +++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/resources/page.tsx @@ -1,7 +1,7 @@ -import DeleteResourceButton from './delete-resource'; -import FileDisplay from './file-display'; -import { StorageObjectForm } from '@/app/[locale]/(dashboard)/[wsId]/drive/form'; import { createDynamicClient } from '@tuturuuu/supabase/next/server'; +import { DeleteResourceButton } from '@tuturuuu/ui/custom/education/modules/resources/delete-resource'; +import { FileDisplay } from '@tuturuuu/ui/custom/education/modules/resources/file-display'; +import { StorageObjectForm } from '@tuturuuu/ui/custom/education/modules/resources/file-upload-form'; import FeatureSummary from '@tuturuuu/ui/custom/feature-summary'; import { Paperclip } from '@tuturuuu/ui/icons'; import { Separator } from '@tuturuuu/ui/separator'; diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/toggles.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/toggles.tsx deleted file mode 100644 index 64f1cdf6a7..0000000000 --- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/toggles.tsx +++ /dev/null @@ -1,92 +0,0 @@ -'use client'; - -import { createClient } from '@tuturuuu/supabase/next/client'; -import { Checkbox } from '@tuturuuu/ui/checkbox'; -import { useTranslations } from 'next-intl'; -import { useState } from 'react'; - -export default function ModuleToggles({ - courseId, - moduleId, - // isPublic: initialIsPublic, - isPublished: initialIsPublished, -}: { - courseId: string; - moduleId: string; - isPublic: boolean; - isPublished: boolean; -}) { - const t = useTranslations(); - const supabase = createClient(); - - const [loading, setLoading] = useState(false); - // const [isPublic, setIsPublic] = useState(initialIsPublic); - const [isPublished, setIsPublished] = useState(initialIsPublished); - - // const handlePublicChange = async (checked: boolean) => { - // setLoading(true); - - // const { error } = await supabase - // .from('workspace_course_modules') - // .update({ is_public: checked }) - // .eq('course_id', courseId) - // .eq('id', moduleId); - - // if (error) { - // setLoading(false); - // throw error; - // } - - // setIsPublic(checked); - // setLoading(false); - // }; - - const handlePublishedChange = async (checked: boolean) => { - const { error } = await supabase - .from('workspace_course_modules') - .update({ is_published: checked }) - .eq('course_id', courseId) - .eq('id', moduleId); - - if (error) { - setLoading(false); - throw error; - } - - setIsPublished(checked); - setLoading(false); - }; - - return ( -
- {/*
- - -
*/} -
- - -
-
- ); -} diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx deleted file mode 100644 index ca40c2a106..0000000000 --- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { useTranslations } from 'next-intl'; - -export const YoutubeEmbed = ({ embedId }: { embedId: string | undefined }) => { - const t = useTranslations(); - - return embedId ? ( -