Skip to content

Commit

Permalink
refactor code for guid
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsherlocked1891 committed Feb 3, 2025
1 parent 45fecb9 commit 400d250
Show file tree
Hide file tree
Showing 3 changed files with 318 additions and 158 deletions.
12 changes: 7 additions & 5 deletions webapp/src/components/home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ import DISCOllaboratives from "@/components/simple/DISCOllaboratives.vue";
import ButtonsCard from "@/components/containers/ButtonsCard.vue";
import { driver, type DriveStep } from "driver.js";
import "driver.js/dist/driver.css";
import { watch } from "vue";
import { nextTick, watch } from "vue";
import { useGuideStore } from "@/store/guide";
const router = useRouter();
Expand Down Expand Up @@ -253,11 +253,13 @@ driverObj.drive();
watch(
() => guideStoreTraining.showGuide,
(newValue) => {
driverObj.destroy();
console.log(router.currentRoute.value.path);
if (router.currentRoute.value.path == "/") {
async (newValue) => {

Check failure on line 256 in webapp/src/components/home/Home.vue

View workflow job for this annotation

GitHub Actions / lint-webapp

'newValue' is defined but never used. Allowed unused args must match /^_/u
if (driverObj.isActive()) {
await driverObj.destroy();
}
if (router.currentRoute.value.path === "/") {
driverObj.setSteps(steps);
await nextTick();
driverObj.drive();
}
},
Expand Down
38 changes: 17 additions & 21 deletions webapp/src/components/testing/Testing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<script lang="ts" setup>
import createDebug from "debug";
import { List } from "immutable";
import { computed, ref, onActivated, watch } from "vue";
import { computed, ref, onActivated, watch, nextTick } from "vue";
import { RouterLink, useRouter } from "vue-router";
import { VueSpinner } from "vue3-spinners";
Expand Down Expand Up @@ -296,7 +296,7 @@ function taskTitle(taskID: string): string | undefined {
return titled.displayInformation.taskTitle;
}
// Define the steps for the guide when no user's models are available
//Define the steps for the guide when no user's models are available
const modelEmptySteps: DriveStep[] = [
{
popover: {
Expand Down Expand Up @@ -425,27 +425,23 @@ const evaluationSteps: DriveStep[] = [
];
watch(
() => guideStoreTesting.showGuide,
(newValue) => {
driverTesting.destroy();
if (router.currentRoute.value.path == "/evaluate") {
if (validationStore.step === 0) {
if (models.infos.isEmpty()) {
driverTesting.setSteps(modelEmptySteps);
} else {
driverTesting.setSteps(modelSteps);
}
async (newValue) => {

Check failure on line 428 in webapp/src/components/testing/Testing.vue

View workflow job for this annotation

GitHub Actions / lint-webapp

'newValue' is defined but never used. Allowed unused args must match /^_/u
if (driverTesting.isActive()) {
await driverTesting.destroy();
}
if (router.currentRoute.value.path === "/evaluate") {
const stepsMap: Record<number, DriveStep[]> = {
0: models.infos.isEmpty() ? modelEmptySteps : modelSteps,
1: dataSteps,
2: evaluationSteps,
};
const steps = stepsMap[validationStore.step] || [];
if (steps.length) {
driverTesting.setSteps(steps);
await nextTick();
driverTesting.drive();
}
if (validationStore.step !== 0) {
if (validationStore.step === 1) {
driverTesting.setSteps(dataSteps);
driverTesting.drive();
}
if (validationStore.step === 2) {
driverTesting.setSteps(evaluationSteps);
driverTesting.drive();
}
}
}
},
);
Expand Down
Loading

0 comments on commit 400d250

Please sign in to comment.