From 53e973cf5359e010a2024cb08ad0950394a76f83 Mon Sep 17 00:00:00 2001 From: Bernardo Simonassi Date: Wed, 29 Nov 2023 00:03:50 -0300 Subject: [PATCH] fix: website layout issues and gh issues --- apps/app/components/molecules/TaskModal.vue | 18 +-- apps/app/nuxt.config.ts | 1 + apps/app/pages/[...slug].vue | 7 +- apps/www/components/atoms/Header.vue | 7 +- apps/www/nuxt.config.ts | 20 ++-- apps/www/package.json | 3 +- packages/tailwind-config/package.json | 5 +- packages/tailwind-config/tailwind.config.ts | 3 + pnpm-lock.yaml | 117 -------------------- 9 files changed, 38 insertions(+), 143 deletions(-) diff --git a/apps/app/components/molecules/TaskModal.vue b/apps/app/components/molecules/TaskModal.vue index cb23cab..5aa37d8 100644 --- a/apps/app/components/molecules/TaskModal.vue +++ b/apps/app/components/molecules/TaskModal.vue @@ -7,11 +7,11 @@ const emit = defineEmits(["next"]); const taskModalStore = useTaskModalStore(); const submissionsStore = useSubmissionsStore(); -const coursesStore = useCoursesStore(); const config = useRuntimeConfig(); const loadingButton = ref(false); const loading = ref(true); -const toast: { error: Function } | undefined = inject("toast"); +const toast: { error: Function; success: Function } | undefined = + inject("toast"); const uploadedFile: Ref = ref(null); watch(taskModalStore, async (newValue) => { @@ -20,6 +20,10 @@ watch(taskModalStore, async (newValue) => { } }); +const taskNotSent = computed( + () => submissionsStore.submission?.SubmissionStatus === "Draft" +); + async function loadSubmission() { loading.value = true; try { @@ -70,7 +74,7 @@ async function sendSubmission(status: "Pending" | "Draft") { submissionsStore.submission.Filename = response.fileName; await submissionsStore.updateSubmission(); } - coursesStore.updateCourseLessons(currentLesson._id); + toast?.success("Tarefa enviada com sucesso!"); goToNextLesson(); } finally { loadingButton.value = false; @@ -146,11 +150,7 @@ async function uploadFile(file: File) { submissionsStore.submission?.SubmissionStatus || 'Pending' ) " - :status=" - submissionsStore.submission?.SubmissionStatus === 'Draft' - ? 'warning' - : 'success' - " + :status="taskNotSent ? 'warning' : 'success'" />
diff --git a/apps/app/nuxt.config.ts b/apps/app/nuxt.config.ts index 64ce643..c2f6c00 100644 --- a/apps/app/nuxt.config.ts +++ b/apps/app/nuxt.config.ts @@ -116,5 +116,6 @@ export default defineNuxtConfig({ }, tailwindcss: { cssPath: "@/styles/main.css", + viewer: false, }, }); diff --git a/apps/app/pages/[...slug].vue b/apps/app/pages/[...slug].vue index c42b0f4..e61ac0b 100644 --- a/apps/app/pages/[...slug].vue +++ b/apps/app/pages/[...slug].vue @@ -54,8 +54,13 @@ const hasTask = computed(() => { return ["Content", "Image"].includes(currentLesson?.submissionContent); }); -function redirectToNextLesson() { +async function redirectToNextLesson() { if (!nextLesson) return; + + if (sessionStore.isConnected()) { + await coursesStore.updateCourseLessons(currentLesson._id); + } + router.push(nextLesson._path as RouteLocationRaw); } diff --git a/apps/www/components/atoms/Header.vue b/apps/www/components/atoms/Header.vue index 4216798..50877c2 100644 --- a/apps/www/components/atoms/Header.vue +++ b/apps/www/components/atoms/Header.vue @@ -79,7 +79,10 @@ onMounted(() => { - +