From addf95bc7e1e694cd9ba7797c8b0847bfecaf54c Mon Sep 17 00:00:00 2001
From: Leonardo Bishop <me@leonardobishop.com>
Date: Tue, 12 Mar 2024 17:48:23 +0000
Subject: Add nuxt prefixes back to component file names

---
 .../editor/quest/EditorQuestTasksOptionsPanel.vue  | 83 ++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 components/editor/quest/EditorQuestTasksOptionsPanel.vue

(limited to 'components/editor/quest/EditorQuestTasksOptionsPanel.vue')

diff --git a/components/editor/quest/EditorQuestTasksOptionsPanel.vue b/components/editor/quest/EditorQuestTasksOptionsPanel.vue
new file mode 100644
index 0000000..cb4b109
--- /dev/null
+++ b/components/editor/quest/EditorQuestTasksOptionsPanel.vue
@@ -0,0 +1,83 @@
+<script setup lang="ts">
+import { useSessionStore, type EditorQuest } from '@/stores/session';
+import { computed, ref } from 'vue';
+
+const props = defineProps<{
+  questId: string;
+}>();
+
+const sessionStore = useSessionStore();
+
+const quest = computed(() => {
+  return sessionStore.getQuestById(props.questId) as EditorQuest;
+});
+
+const showAddTaskModal = ref(false);
+
+const addTask = (newId: string, newType: string) => {
+  sessionStore.getQuestById(props.questId)!.tasks[newId] = {
+    id: newId,
+    config: {
+      type: newType,
+    },
+  };
+
+  showAddTaskModal.value = false;
+};
+</script>
+
+<template>
+  <EditorOptionsPanel v-if="quest">
+    <div id="options">
+      <h2>Tasks <code>({{ Object.keys(quest.tasks).length }})</code></h2>
+
+      <p v-if="Object.keys(quest.tasks).length === 0" class="error-text">This quest does not have any tasks.</p>
+      <EditorTaskConfiguration v-for="(task, taskId) in quest.tasks" :key="taskId" :taskId="String(taskId)"
+        :quest="quest" />
+
+      <div id="controls">
+        <Button id="add-task" :icon="['fas', 'plus']" type="solid" label="Add task" @click="showAddTaskModal = true" />
+      </div>
+    </div>
+  </EditorOptionsPanel>
+
+  <EditorTaskModalCreate v-if="quest" v-model="showAddTaskModal" :questId="questId" @add="addTask" />
+</template>
+
+
+<style scoped>
+#options {
+  display: flex;
+  flex-direction: column;
+  gap: 1rem;
+
+  #controls {
+    display: flex;
+    justify-content: flex-end;
+    gap: 1rem;
+  }
+}
+
+.option-group {
+  display: flex;
+  flex-direction: column;
+  gap: 0.5rem;
+}
+
+.description {
+  font-size: 0.8em;
+}
+
+label {
+  font-weight: 700;
+}
+
+h2 {
+  border-bottom: 1px solid var(--color-border);
+
+  code {
+    font-size: 0.8em;
+    color: var(--color-text-mute);
+  }
+}
+</style>
-- 
cgit v1.2.3-70-g09d2

