feat: course section reordering & migration to course v2 (#437)

* feat: reorder sections and lessons gracefully

* convert course into version 2

* feat: get next and prev working
This commit is contained in:
Rotimi Best
2024-08-17 17:10:15 +01:00
committed by GitHub
parent e18b4ca1b1
commit 1c9dc004a0
17 changed files with 425 additions and 143 deletions
@@ -287,7 +287,7 @@ export function updateLessonSection(section: any, sectionId: LessonSection['id']
.match({ id: sectionId });
}
export function updateLesson(lesson: any, lessonId: Lesson['id']) {
export async function updateLesson(lesson: any, lessonId: Lesson['id']) {
return supabase
.from('lesson')
.update({ ...lesson, id: undefined })
@@ -307,6 +307,14 @@ export function updateLessonCompletion(completion: LessonCompletion, shouldUpdat
}
}
export const upsertLessons = (data: { id: string; order: number }[]) => {
return supabase.from('lesson').upsert(data);
};
export const upsertLessonSections = (data: { id: string; order: number }[]) => {
return supabase.from('lesson_section').upsert(data);
};
export function deleteLesson(lessonId: Lesson['id']) {
// Need to implement soft delete
return supabase.from('lesson').delete().match({ id: lessonId });
@@ -801,14 +801,14 @@
},
"navItems": {
"nav_news_feed": "Neuigkeiten",
"nav_lessons": "Unterricht",
"nav_attendance": "Teilnahme",
"nav_submissions": "Einsendungen",
"nav_marks": "Markierungen",
"nav_people": "Menschen",
"nav_certificates": "Zertifikate",
"nav_landing_page": "Landingpage",
"nav_settings": "Einstellungen"
"nav_settings": "Einstellungen",
"nav_content": "Inhalt"
},
"not_permitted": {
"header": "Keine Erlaubnis",
@@ -464,7 +464,7 @@
"course": {
"navItems": {
"nav_news_feed": "News Feed",
"nav_lessons": "Lessons",
"nav_content": "Content",
"nav_attendance": "Attendance",
"nav_submissions": "Submissions",
"nav_marks": "Marks",
@@ -504,9 +504,18 @@
"lessons": {
"heading": "Lessons",
"heading_v2": "Content",
"drag": "drag a card to reorder",
"no_lesson": "No lessons yet",
"share_your_knowledge": "Share your knowledge with the world by creating engaging lessons. Start by clicking on the Add button.",
"section_prompt": {
"cta": "Enable Sections",
"header": "Enable Sections",
"title": "We Launched Course Sections",
"description": "You can now group lessons into sections to organize your content and make learning smoother for your students.",
"activate": "Activate",
"cancel": "Cancel"
},
"add_lesson": {
"button_title": "Add",
"start_reorder": "Reorder",
@@ -801,14 +801,14 @@
},
"navItems": {
"nav_news_feed": "Noticias",
"nav_lessons": "Lecciones",
"nav_attendance": "Asistencia",
"nav_submissions": "Envíos",
"nav_marks": "Marcas",
"nav_people": "Gente",
"nav_certificates": "Certificados",
"nav_landing_page": "Página de destino",
"nav_settings": "Ajustes"
"nav_settings": "Ajustes",
"nav_content": "Contenido"
},
"not_permitted": {
"header": "Sin autorización",
@@ -801,14 +801,14 @@
},
"navItems": {
"nav_news_feed": "Fil d'actualité",
"nav_lessons": "Cours",
"nav_attendance": "Présence",
"nav_submissions": "Soumissions",
"nav_marks": "Des marques",
"nav_people": "Personnes",
"nav_certificates": "Certificats",
"nav_landing_page": "Page de destination",
"nav_settings": "Paramètres"
"nav_settings": "Paramètres",
"nav_content": "Contenu"
},
"not_permitted": {
"header": "Aucune autorisation",
@@ -801,14 +801,14 @@
},
"navItems": {
"nav_news_feed": "समाचार फ़ीड",
"nav_lessons": "पाठ",
"nav_attendance": "उपस्थिति",
"nav_submissions": "प्रविष्टियों",
"nav_marks": "निशान",
"nav_people": "लोग",
"nav_certificates": "प्रमाण पत्र",
"nav_landing_page": "लैंडिंग पृष्ठ",
"nav_settings": "समायोजन"
"nav_settings": "समायोजन",
"nav_content": "सामग्री"
},
"not_permitted": {
"header": "अनुमति नहीं",
@@ -801,14 +801,14 @@
},
"navItems": {
"nav_news_feed": "Notícias",
"nav_lessons": "Lições",
"nav_attendance": "Comparecimento",
"nav_submissions": "Envios",
"nav_marks": "Marcas",
"nav_people": "Pessoas",
"nav_certificates": "Certificados",
"nav_landing_page": "Página inicial",
"nav_settings": "Configurações"
"nav_settings": "Configurações",
"nav_content": "Contente"
},
"not_permitted": {
"header": "Sem permissão",
@@ -801,14 +801,14 @@
},
"navItems": {
"nav_news_feed": "Новостная лента",
"nav_lessons": "Уроки",
"nav_attendance": "посещаемость",
"nav_submissions": "Материалы",
"nav_marks": "Метки",
"nav_people": "Люди",
"nav_certificates": "Сертификаты",
"nav_landing_page": "Целевая страница",
"nav_settings": "Настройки"
"nav_settings": "Настройки",
"nav_content": "Содержание"
},
"not_permitted": {
"header": "Нет разрешения",
@@ -801,14 +801,14 @@
},
"navItems": {
"nav_news_feed": "Nguồn cấp tin tức",
"nav_lessons": "Những bài học",
"nav_attendance": "Sự tham dự",
"nav_submissions": "bài nộp",
"nav_marks": "Điểm",
"nav_people": "Mọi người",
"nav_certificates": "Chứng chỉ",
"nav_landing_page": "Trang đích",
"nav_settings": "Cài đặt"
"nav_settings": "Cài đặt",
"nav_content": "Nội dung"
},
"not_permitted": {
"header": "Không cho phép",