From c9aefa81ca1950121d2357fc66afe15eb400f537 Mon Sep 17 00:00:00 2001
From: Leonardo Bishop
Date: Fri, 15 Mar 2024 00:13:40 +0000
Subject: Fix eslint errors
---
components/editor/task/EditorTaskConfiguration.vue | 93 +++++++++++++++-------
.../editor/task/EditorTaskConfigurationRow.vue | 77 +++++++++++++-----
.../editor/task/modal/EditorTaskModalChange.vue | 24 ++++--
.../editor/task/modal/EditorTaskModalCreate.vue | 25 ++++--
4 files changed, 157 insertions(+), 62 deletions(-)
(limited to 'components/editor/task')
diff --git a/components/editor/task/EditorTaskConfiguration.vue b/components/editor/task/EditorTaskConfiguration.vue
index 5313767..dab5888 100644
--- a/components/editor/task/EditorTaskConfiguration.vue
+++ b/components/editor/task/EditorTaskConfiguration.vue
@@ -13,14 +13,21 @@ const taskType = computed(() => props.quest.tasks[props.taskId].config.type);
const taskDefintion = computed(() => sessionStore.getTaskDefinitionByTaskType(taskType.value));
const taskConfig = computed(() => {
- return Object.keys(props.quest.tasks[props.taskId].config).filter((fieldName) => fieldName !== 'type').reduce((acc, fieldName) => {
- acc[fieldName] = props.quest.tasks[props.taskId].config[fieldName];
- return acc;
- }, {} as { [key: string]: any });
+ return Object.keys(props.quest.tasks[props.taskId].config)
+ .filter((fieldName) => fieldName !== 'type')
+ .reduce(
+ (acc, fieldName) => {
+ acc[fieldName] = props.quest.tasks[props.taskId].config[fieldName];
+ return acc;
+ },
+ {} as { [key: string]: any }
+ );
});
const requiredFields = computed(() => {
- return Object.keys(taskDefintion.value.configuration).filter((fieldName) => taskDefintion.value.configuration[fieldName].required);
+ return Object.keys(taskDefintion.value.configuration).filter(
+ (fieldName) => taskDefintion.value.configuration[fieldName].required
+ );
});
// const givenRequiredFields = computed(() => {
@@ -32,13 +39,20 @@ const requiredFields = computed(() => {
// });
const remainingGivenFields = computed(() => {
- return Object.keys(taskConfig.value).filter((fieldName) => !requiredFields.value.includes(fieldName) && fieldName in taskDefintion.value.configuration);
+ return Object.keys(taskConfig.value).filter(
+ (fieldName) =>
+ !requiredFields.value.includes(fieldName) && fieldName in taskDefintion.value.configuration
+ );
});
-const configKeysOptions = computed(() => Object.keys(taskDefintion.value.configuration).filter((key) => !Object.keys(taskConfig.value).some((fieldName) => fieldName === key)));
+const configKeysOptions = computed(() =>
+ Object.keys(taskDefintion.value.configuration).filter(
+ (key) => !Object.keys(taskConfig.value).some((fieldName) => fieldName === key)
+ )
+);
// const configKeysOptions = computed(() => {
// const keys = Object.keys(taskDefintion.value.configuration).filter((key) => !Object.keys(taskConfig.value).some((fieldName) => fieldName === key));
-//
+//
// return keys.map((key) => {
// return {
// value: key,
@@ -49,7 +63,8 @@ const configKeysOptions = computed(() => Object.keys(taskDefintion.value.configu
// });
const onAddOption = (option: any) => {
- sessionStore.getQuestById(props.quest.id)!.tasks[props.taskId].config[option] = taskDefintion.value.configuration[option].default || null;
+ sessionStore.getQuestById(props.quest.id)!.tasks[props.taskId].config[option] =
+ taskDefintion.value.configuration[option].default || null;
};
const updateValue = (fieldName: string, value: any) => {
@@ -64,14 +79,14 @@ const showChangeModal = ref(false);
const updateTaskType = (newType: string) => {
sessionStore.getQuestById(props.quest.id)!.tasks[props.taskId].config = {
- type: newType
+ type: newType,
};
showChangeModal.value = false;
-}
+};
const deleteTaskType = (taskId: string) => {
delete sessionStore.getQuestById(props.quest.id)!.tasks[taskId];
-}
+};
@@ -82,43 +97,68 @@ const deleteTaskType = (taskId: string) => {
{{ props.taskId }}
- ( {{ taskType }})
+ ( {{ taskType }})
-
+
- Unable to edit task {{ props.taskId }}.
+ Unable to edit task {{ props.taskId }}.
- The quests web editor does not know how to configure task
- type {{ taskType }} as it has no task definition.
+ The quests web editor does not know how to configure task type
+ {{ taskType }} as it has no task definition.
-
updateValue(fieldName, newValue)" @delete="() => deleteValue(fieldName)" />
+ updateValue(fieldName, newValue)"
+ @delete="() => deleteValue(fieldName)"
+ />
-
+
-
+
\ No newline at end of file
+
diff --git a/components/editor/task/modal/EditorTaskModalChange.vue b/components/editor/task/modal/EditorTaskModalChange.vue
index 8ab5dbc..a6b05b8 100644
--- a/components/editor/task/modal/EditorTaskModalChange.vue
+++ b/components/editor/task/modal/EditorTaskModalChange.vue
@@ -18,7 +18,9 @@ const knownTaskTypes = computed(() => session.getKnownTaskTypes());
const newType = ref('');
const unknownTaskType = computed(() => !knownTaskTypes.value.includes(newType.value));
const noChange = computed(() => newType.value === props.currentTaskType);
-const newTypeDescription = computed(() => session.getTaskDefinitionByTaskType(newType.value)?.description);
+const newTypeDescription = computed(
+ () => session.getTaskDefinitionByTaskType(newType.value)?.description
+);
@@ -31,16 +33,26 @@ const newTypeDescription = computed(() => session.getTaskDefinitionByTaskType(ne
New type
-
+
Invalid task type.
{{ newTypeDescription }}
Any configured options for this task will be overwritten.
-
+
@@ -58,4 +70,4 @@ const newTypeDescription = computed(() => session.getTaskDefinitionByTaskType(ne
flex-direction: column;
gap: 0.5rem;
}
-
\ No newline at end of file
+
diff --git a/components/editor/task/modal/EditorTaskModalCreate.vue b/components/editor/task/modal/EditorTaskModalCreate.vue
index e5b2d7a..cdd955f 100644
--- a/components/editor/task/modal/EditorTaskModalCreate.vue
+++ b/components/editor/task/modal/EditorTaskModalCreate.vue
@@ -24,7 +24,9 @@ const unknownTaskType = computed(() => !knownTaskTypes.value.includes(newType.va
const invalidTaskId = computed(() => !validateTaskId(newId.value));
const duplicateTaskId = computed(() => knownTasks.value[newId.value] !== undefined);
-const newTypeDescription = computed(() => session.getTaskDefinitionByTaskType(newType.value)?.description);
+const newTypeDescription = computed(
+ () => session.getTaskDefinitionByTaskType(newType.value)?.description
+);
@@ -43,19 +45,26 @@ const newTypeDescription = computed(() => session.getTaskDefinitionByTaskType(ne
Task type
-
+
Invalid task type.
{{ newTypeDescription }}
A task ID must be unique, alphanumeric, and not contain any spaces.
-
-
-
+ @click="emit('add', newId, newType)"
+ >
@@ -73,4 +82,4 @@ const newTypeDescription = computed(() => session.getTaskDefinitionByTaskType(ne
flex-direction: column;
gap: 0.5rem;
}
-
\ No newline at end of file
+
--
cgit v1.2.3-70-g09d2