feat: lesson note version history (#374)

* chore: install diff package

* chore: add id to render component

* feat: implement language lesson version history

* chore: fix darkmode colors and use tailwind css

* chore: add screensize conditional

* refactor: list updating after data fetch

* change mode to view to prevent duplicate data being saved

* chore: remove raw text

* chore: db migration

* feat: properly format timestamp

* feat: add snackbar for success

* chore: group by minutes, use icons instead of texts for buttons

* docs: generate translations

* refactor

---------

Co-authored-by: Iniubong Obonguko <iniubongobonguko2018@gmail.com>
This commit is contained in:
Rotimi Best
2024-06-30 04:47:15 +01:00
committed by GitHub
co-authored by Iniubong Obonguko
parent decea8d1e5
commit 931ccb1a09
15 changed files with 407 additions and 29 deletions
@@ -185,6 +185,16 @@ export function fetchLesson(lessonId: Lesson['id']) {
.single();
}
export function fetchLesssonLanguageHistory(lessonId: string, locale: string, endRange: number) {
return supabase
.from('lesson_versions')
.select('*')
.range(0, endRange)
.eq('lesson_id', lessonId)
.eq('locale', locale)
.order('timestamp', { ascending: false });
}
export function createLesson(lesson: any) {
return supabase.from('lesson').insert(lesson).select();
}
@@ -47,7 +47,8 @@
},
"success": {
"complete_marked": "Als abgeschlossen markiert",
"complete_download": "Download abgeschlossen"
"complete_download": "Download abgeschlossen",
"version_restored": "Version erfolgreich wiederhergestellt"
}
},
"attendance": {
@@ -750,6 +751,12 @@
"disabled": "Funktion ist deaktiviert",
"next": "Nächste",
"prev": "Vorher",
"version_history": {
"title": "Versionsgeschichte",
"fetch_more_versions": "Weitere Versionen abrufen",
"current_version": "Aktuelle Version",
"restore_version": "Stellen Sie diese Version wieder her"
},
"drag": "Ziehen Sie eine Karte, um sie neu anzuordnen",
"no_lesson": "Noch kein Unterricht",
"share_your_knowledge": "Teilen Sie Ihr Wissen mit der Welt, indem Sie ansprechende Lektionen erstellen. Klicken Sie zunächst auf die Schaltfläche „Hinzufügen“."
@@ -1363,4 +1370,4 @@
"hyphen_rule": "Der Name der Organisation darf nicht mit einem Bindestrich beginnen oder enden"
}
}
}
}
@@ -747,6 +747,12 @@
"option_label": "Option Label",
"cancel": "Cancel",
"poll_question": "Poll Question"
},
"version_history": {
"title": "Version history",
"fetch_more_versions": "Fetch more versions",
"current_version": "Current version",
"restore_version": "Restore this version"
}
},
@@ -1243,7 +1249,8 @@
"lessons": {
"success": {
"complete_marked": "Marked as complete",
"complete_download": "Download Complete"
"complete_download": "Download Complete",
"version_restored": "Version restored sucessfully"
},
"error": {
"try_later": "Something's not right - Please try later"
@@ -47,7 +47,8 @@
},
"success": {
"complete_marked": "Marcado como completo",
"complete_download": "Descarga completa"
"complete_download": "Descarga completa",
"version_restored": "Versión restaurada exitosamente"
}
},
"attendance": {
@@ -750,6 +751,12 @@
"disabled": "La característica está deshabilitada",
"next": "Próximo",
"prev": "Anterior",
"version_history": {
"title": "Historial de versiones",
"fetch_more_versions": "Obtener más versiones",
"current_version": "Versión actual",
"restore_version": "Restaurar esta versión"
},
"drag": "arrastra una tarjeta para reordenar",
"no_lesson": "Aún no hay lecciones",
"share_your_knowledge": "Comparta sus conocimientos con el mundo creando lecciones interesantes. Comience haciendo clic en el botón Agregar."
@@ -1363,4 +1370,4 @@
"hyphen_rule": "El nombre de la organización no puede comenzar ni terminar con un guión."
}
}
}
}
@@ -47,7 +47,8 @@
},
"success": {
"complete_marked": "Marqué comme terminé",
"complete_download": "Téléchargement complet"
"complete_download": "Téléchargement complet",
"version_restored": "Version restaurée avec succès"
}
},
"attendance": {
@@ -750,6 +751,12 @@
"disabled": "La fonctionnalité est désactivée",
"next": "Suivant",
"prev": "Précédent",
"version_history": {
"title": "Historique des versions",
"fetch_more_versions": "Récupérer plus de versions",
"current_version": "Version actuelle",
"restore_version": "Restaurer cette version"
},
"drag": "faites glisser une carte pour réorganiser",
"no_lesson": "Pas encore de cours",
"share_your_knowledge": "Partagez vos connaissances avec le monde en créant des leçons engageantes. Commencez par cliquer sur le bouton Ajouter."
@@ -1363,4 +1370,4 @@
"hyphen_rule": "Le nom de l'organisation ne peut pas commencer ou se terminer par un trait d'union"
}
}
}
}
@@ -47,7 +47,8 @@
},
"success": {
"complete_marked": "पूर्ण के रूप में चिह्नित",
"complete_download": "डाउनलोड पूर्ण"
"complete_download": "डाउनलोड पूर्ण",
"version_restored": "संस्करण सफलतापूर्वक पुनर्स्थापित किया गया"
}
},
"attendance": {
@@ -750,6 +751,12 @@
"disabled": "सुविधा अक्षम है",
"next": "अगला",
"prev": "पिछला",
"version_history": {
"title": "संस्करण इतिहास",
"fetch_more_versions": "अधिक संस्करण प्राप्त करें",
"current_version": "वर्तमान संस्करण",
"restore_version": "इस संस्करण को पुनर्स्थापित करें"
},
"drag": "पुनः व्यवस्थित करने के लिए कार्ड खींचें",
"no_lesson": "अभी तक कोई सबक नहीं",
"share_your_knowledge": "आकर्षक पाठ बनाकर अपना ज्ञान दुनिया के साथ साझा करें। ऐड बटन पर क्लिक करके प्रारंभ करें।"
@@ -1363,4 +1370,4 @@
"hyphen_rule": "संगठन का नाम हाइफ़न से प्रारंभ या समाप्त नहीं हो सकता"
}
}
}
}
@@ -47,7 +47,8 @@
},
"success": {
"complete_marked": "Marcado como concluído",
"complete_download": "Download completo"
"complete_download": "Download completo",
"version_restored": "Versão restaurada com sucesso"
}
},
"attendance": {
@@ -750,6 +751,12 @@
"disabled": "O recurso está desativado",
"next": "Próximo",
"prev": "Anterior",
"version_history": {
"title": "Histórico de versões",
"fetch_more_versions": "Buscar mais versões",
"current_version": "Versão Atual",
"restore_version": "Restaurar esta versão"
},
"drag": "arraste um cartão para reordenar",
"no_lesson": "Ainda não há aulas",
"share_your_knowledge": "Compartilhe seu conhecimento com o mundo criando aulas envolventes. Comece clicando no botão Adicionar."
@@ -1363,4 +1370,4 @@
"hyphen_rule": "O nome da organização não pode começar ou terminar com um hífen"
}
}
}
}
@@ -47,7 +47,8 @@
},
"success": {
"complete_marked": "Помечено как завершенное",
"complete_download": "Загрузка завершена"
"complete_download": "Загрузка завершена",
"version_restored": "Версия успешно восстановлена"
}
},
"attendance": {
@@ -750,6 +751,12 @@
"disabled": "Функция отключена",
"next": "Следующий",
"prev": "Предыдущий",
"version_history": {
"title": "История версий",
"fetch_more_versions": "Получить больше версий",
"current_version": "Текущая версия",
"restore_version": "Восстановить эту версию"
},
"drag": "перетащите карточку, чтобы изменить порядок",
"no_lesson": "Уроков пока нет",
"share_your_knowledge": "Поделитесь своими знаниями со всем миром, создавая увлекательные уроки. Начните с нажатия кнопки «Добавить»."
@@ -1363,4 +1370,4 @@
"hyphen_rule": "Название организации не может начинаться или заканчиваться дефисом."
}
}
}
}
@@ -47,7 +47,8 @@
},
"success": {
"complete_marked": "Được đánh dấu là hoàn thành",
"complete_download": "Hoan thanh tải"
"complete_download": "Hoan thanh tải",
"version_restored": "Đã khôi phục phiên bản thành công"
}
},
"attendance": {
@@ -750,6 +751,12 @@
"disabled": "Tính năng bị vô hiệu hóa",
"next": "Kế tiếp",
"prev": "Trước đó",
"version_history": {
"title": "Lịch sử phiên bản",
"fetch_more_versions": "Tìm nạp thêm phiên bản",
"current_version": "Phiên bản hiện tại",
"restore_version": "Khôi phục phiên bản này"
},
"drag": "kéo thẻ để sắp xếp lại",
"no_lesson": "Chưa có bài học nào",
"share_your_knowledge": "Chia sẻ kiến ​​thức của bạn với thế giới bằng cách tạo ra những bài học hấp dẫn. Bắt đầu bằng cách nhấp vào nút Thêm."
@@ -1363,4 +1370,4 @@
"hyphen_rule": "Tên tổ chức không thể bắt đầu hoặc kết thúc bằng dấu gạch nối"
}
}
}
}