aboutsummaryrefslogtreecommitdiffstats
path: root/pages/editor
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2024-03-13 00:17:32 +0000
committerLeonardo Bishop <me@leonardobishop.com>2024-03-13 00:17:32 +0000
commit543aa0cd4a461285298d33a90ab3f11a9f084ca5 (patch)
treeffbaec5f495b2cf8b891690642df161464ac6e95 /pages/editor
parenta072c91cc0dc26e417c51f666e8547e08ef40942 (diff)
Add home page
Diffstat (limited to 'pages/editor')
-rw-r--r--pages/editor/category/[id].vue54
-rw-r--r--pages/editor/config.vue17
-rw-r--r--pages/editor/index.vue25
-rw-r--r--pages/editor/item/[id].vue51
-rw-r--r--pages/editor/quest/[id].vue109
5 files changed, 256 insertions, 0 deletions
diff --git a/pages/editor/category/[id].vue b/pages/editor/category/[id].vue
new file mode 100644
index 0000000..3189d2a
--- /dev/null
+++ b/pages/editor/category/[id].vue
@@ -0,0 +1,54 @@
+<script setup lang="ts">
+import { useSessionStore } from '@/stores/session';
+
+definePageMeta({
+ layout: 'editor'
+})
+
+const sessionStore = useSessionStore();
+const route = useRoute();
+
+const categoryId = route.params.id as string;
+
+const categoryName = sessionStore.getCategoryById(categoryId)?.display.name;
+</script>
+
+<template>
+ <PageHeader>
+ <span id="path">
+ <font-awesome-icon class="icon" :icon="['fas', 'fa-folder']" />
+ <span class="title" v-if="categoryName">{{ stripColorCodes(categoryName) }} </span>
+ <code>({{ categoryId }})</code>
+ </span>
+ <span id="controls" class="control-group">
+ <Button type="solid" :disabled="true" :icon="['fas', 'fa-save']" :label="'Save'"></Button>
+ </span>
+ </PageHeader>
+
+ <div id="options-container">
+ <EditorCategoryOptionsPanel :categoryId="categoryId" />
+ <EditorCategoryChildrenOptionsPanel :categoryId="categoryId" />
+ </div>
+</template>
+
+<style scoped>
+#pane-container {
+ width: 100%;
+ flex-grow: 1;
+ height: calc(100vh - 73px);
+ max-height: calc(100vh - 73px);
+}
+
+#options-container {
+ width: 100%;
+ display: flex;
+ gap: 1rem;
+ padding: 1rem;
+ overflow: auto;
+ max-height: calc(100% - 55px);
+}
+
+header {
+ border-bottom: 1px solid var(--color-border);
+}
+</style> \ No newline at end of file
diff --git a/pages/editor/config.vue b/pages/editor/config.vue
new file mode 100644
index 0000000..4dfc679
--- /dev/null
+++ b/pages/editor/config.vue
@@ -0,0 +1,17 @@
+<script setup lang="ts">
+definePageMeta({
+ layout: 'editor'
+})
+</script>
+
+<template>
+ <div id="title">
+ <h1>Config</h1>
+ </div>
+</template>
+
+<style lang="scss" scoped>
+#title {
+ text-align: center;
+}
+</style> \ No newline at end of file
diff --git a/pages/editor/index.vue b/pages/editor/index.vue
new file mode 100644
index 0000000..4e9815a
--- /dev/null
+++ b/pages/editor/index.vue
@@ -0,0 +1,25 @@
+<script setup lang="ts">
+definePageMeta({
+ layout: 'editor'
+})
+</script>
+
+<template>
+ <div id="title">
+ <b>Select a quest or category to continue</b>
+ </div>
+</template>
+
+<style lang="scss" scoped>
+#title {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ height: 90%;
+
+ b {
+ font-weight: bolder;
+ font-size: 1.5rem;
+ }
+}
+</style> \ No newline at end of file
diff --git a/pages/editor/item/[id].vue b/pages/editor/item/[id].vue
new file mode 100644
index 0000000..c2456be
--- /dev/null
+++ b/pages/editor/item/[id].vue
@@ -0,0 +1,51 @@
+<script setup lang="ts">
+import { useSessionStore } from '@/stores/session';
+
+definePageMeta({
+ layout: 'editor'
+})
+
+const sessionStore = useSessionStore();
+const route = useRoute();
+
+const itemId = route.params.id as string;
+
+const item = sessionStore.getItemById(itemId);
+</script>
+
+<template>
+ <PageHeader>
+ <span id="path">
+ <font-awesome-icon class="icon" :icon="['fas', 'cube']" />
+ <span class="title">{{ itemId }} </span>
+ </span>
+ <span id="controls" class="control-group">
+ <Button type="solid" :disabled="true" :icon="['fas', 'fa-save']" :label="'Save'"></Button>
+ </span>
+ </PageHeader>
+
+ <div id="options-container">
+ </div>
+</template>
+
+<style scoped>
+#pane-container {
+ width: 100%;
+ flex-grow: 1;
+ height: calc(100vh - 73px);
+ max-height: calc(100vh - 73px);
+}
+
+#options-container {
+ width: 100%;
+ display: flex;
+ gap: 1rem;
+ padding: 1rem;
+ overflow: auto;
+ max-height: calc(100% - 55px);
+}
+
+header {
+ border-bottom: 1px solid var(--color-border);
+}
+</style> \ No newline at end of file
diff --git a/pages/editor/quest/[id].vue b/pages/editor/quest/[id].vue
new file mode 100644
index 0000000..bc480d9
--- /dev/null
+++ b/pages/editor/quest/[id].vue
@@ -0,0 +1,109 @@
+<script setup lang="ts">
+import { useSessionStore } from '@/stores/session';
+import { computed, ref } from 'vue';
+import type EditorQuestModalYaml from '~/components/editor/quest/modal/EditorQuestModalYaml.vue';
+
+definePageMeta({
+ layout: 'editor'
+})
+
+const sessionStore = useSessionStore();
+const route = useRoute();
+
+const questId = route.params.id as string;
+const quest = sessionStore.getQuestById(questId);
+
+
+const categoryFromSelectedQuest = computed(() => {
+ const quest = sessionStore.getQuestById(questId);
+ if (quest) {
+ return sessionStore.getCategoryById(quest.options.category) || null;
+ } else {
+ return null;
+ }
+});
+
+const yamlModal = ref<InstanceType<typeof EditorQuestModalYaml> | null>(null);
+const showDeleteModal = ref(false);
+const showRenameModal = ref(false);
+const showDuplicateModal = ref(false);
+
+const renameQuest = (oldId: string, newId: string) => {
+ sessionStore.changeQuestId(oldId, newId);
+ navigateToEditorPane('quest', newId);
+ showRenameModal.value = false;
+};
+
+const deleteQuest = (questId: string) => {
+ sessionStore.deleteQuest(questId);
+ navigateToEditorPane(null);
+ showDeleteModal.value = false;
+};
+
+const duplicateQuest = (oldId: string, newId: string) => {
+ sessionStore.duplicateQuest(oldId, newId);
+ navigateToEditorPane('quest', newId);
+ showDuplicateModal.value = false;
+};
+
+const showYaml = () => {
+ yamlModal.value?.open();
+}
+</script>
+
+<template>
+ <PageHeader>
+ <span id="path">
+ <template v-if="categoryFromSelectedQuest">
+ <font-awesome-icon class="icon" :icon="['fas', 'fa-folder']" />
+ {{ stripColorCodes(categoryFromSelectedQuest?.display.name) }}
+ <font-awesome-icon class="chevron" :icon="['fas', 'fa-chevron-right']" />
+ </template>
+ <font-awesome-icon class="icon" :icon="['far', 'fa-compass']" />
+ <span class="title" v-if="quest">{{ stripColorCodes(quest.display.name) }} </span>
+ <code>({{ questId }})</code>
+ </span>
+ <span id="controls" class="control-group">
+ <Button :icon="['fas', 'fa-code']" :label="'YAML'" @click="showYaml"></Button>
+ <Button :icon="['fas', 'fa-copy']" :label="'Duplicate'" @click="showDuplicateModal = true"></Button>
+ <Button :icon="['fas', 'fa-pen']" :label="'Rename'" @click="showRenameModal = true"></Button>
+ <Button :icon="['fas', 'fa-trash']" :label="'Delete'" @click="showDeleteModal = true"></Button>
+ <Button type="solid" :disabled="true" :icon="['fas', 'fa-save']" :label="'Save'"></Button>
+ </span>
+ </PageHeader>
+
+ <div id="options-container">
+ <EditorQuestOptionsPanel :questId="questId" />
+ <EditorQuestTasksOptionsPanel :questId="questId" />
+ </div>
+
+ <EditorQuestModalYaml ref="yamlModal" :key="`yaml-quest-${questId}`" :questId="questId" />
+ <EditorQuestModalDelete v-model="showDeleteModal" :key="`delete-quest-${questId}`" :questId="questId"
+ @delete="() => questId && deleteQuest(questId)" />
+ <EditorQuestModalRename v-model="showRenameModal" :key="`rename-quest-${questId}`" :questId="questId"
+ @update="(newId: any) => questId && renameQuest(questId, newId)" />
+ <EditorQuestModalDuplicate v-model="showDuplicateModal" :key="`duplicate-quest-${questId}`" :questId="questId"
+ @duplicate="(newId: any) => questId && duplicateQuest(questId, newId)" />
+</template>
+
+<style scoped>
+#pane-container {
+ width: 100%;
+ flex-grow: 1;
+ height: calc(100vh - 73px);
+ max-height: calc(100vh - 73px);
+}
+
+#options-container {
+ width: 100%;
+ display: flex;
+ gap: 1rem;
+ padding: 1rem;
+ overflow: auto;
+ max-height: calc(100% - 55px);
+}
+
+header {
+ border-bottom: 1px solid var(--color-border);
+}
+</style> \ No newline at end of file