aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Editor/Quest/Task/TaskConfiguration.vue
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2024-02-15 23:04:33 +0000
committerLeonardo Bishop <me@leonardobishop.com>2024-02-15 23:04:33 +0000
commit1195b085e31c44bc8fec6817d64063de9022eb66 (patch)
tree6f30cbfbf30acc19347890080cbc907ad094106b /src/components/Editor/Quest/Task/TaskConfiguration.vue
parent1869b5c5f9565b5e9e20697c4401a2f9ba9f2c3a (diff)
Partially add itemstack support
Diffstat (limited to 'src/components/Editor/Quest/Task/TaskConfiguration.vue')
-rw-r--r--src/components/Editor/Quest/Task/TaskConfiguration.vue16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/components/Editor/Quest/Task/TaskConfiguration.vue b/src/components/Editor/Quest/Task/TaskConfiguration.vue
index 7006f18..0646ad4 100644
--- a/src/components/Editor/Quest/Task/TaskConfiguration.vue
+++ b/src/components/Editor/Quest/Task/TaskConfiguration.vue
@@ -65,6 +65,16 @@ const deleteValue = (fieldName: string) => {
const showChangeModal = ref(false);
+const updateTaskType = (newType: string) => {
+ sessionStore.getQuestById(props.quest.id)!.tasks[props.taskId].config = {
+ type: newType
+ };
+ showChangeModal.value = false;
+}
+
+const deleteTaskType = (taskId: string) => {
+ delete sessionStore.getQuestById(props.quest.id)!.tasks[taskId];
+}
</script>
<template>
@@ -87,6 +97,7 @@ const showChangeModal = ref(false);
<Button
:icon="['fas', 'fa-trash']"
:label="'Delete'"
+ @click="deleteTaskType(props.taskId)"
></Button>
</div>
</div>
@@ -105,7 +116,7 @@ const showChangeModal = ref(false);
<div v-if="taskDefintion">
<TaskConfigurationRow
v-for="fieldName in [...givenRequiredFields, ...missingFields, ...remainingGivenFields]"
- :key="`${quest.id}-${props.taskId}-${fieldName}`"
+ :key="`${quest.id}-${props.taskId}-${taskType}-${fieldName}`"
:required="requiredFields.includes(fieldName)"
:configKey="fieldName"
:initialValue="taskConfig[fieldName]"
@@ -130,6 +141,9 @@ const showChangeModal = ref(false);
<ChangeTaskModal
v-model="showChangeModal"
:taskId="props.taskId"
+ :currentTaskType="taskType"
+ :key="`change-task-${props.taskId}`"
+ @update="updateTaskType"
/>
</template>