diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2024-03-12 17:48:23 +0000 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2024-03-12 17:48:23 +0000 |
| commit | addf95bc7e1e694cd9ba7797c8b0847bfecaf54c (patch) | |
| tree | 422e96cb24eb3b3ec9d4c96de555b8fa14239c59 /components/editor/quest/modal/EditorQuestModalYaml.vue | |
| parent | 8664ad155c89d47affd94f8b0385ebf39841f1f8 (diff) | |
Add nuxt prefixes back to component file names
Diffstat (limited to 'components/editor/quest/modal/EditorQuestModalYaml.vue')
| -rw-r--r-- | components/editor/quest/modal/EditorQuestModalYaml.vue | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/components/editor/quest/modal/EditorQuestModalYaml.vue b/components/editor/quest/modal/EditorQuestModalYaml.vue new file mode 100644 index 0000000..365055c --- /dev/null +++ b/components/editor/quest/modal/EditorQuestModalYaml.vue @@ -0,0 +1,59 @@ +<script setup lang="ts"> +import { stringify } from 'yaml'; +import { mapJsonQuestToYamlObject } from '~/lib/questsLoader'; + +const emit = defineEmits(['delete']); +const props = defineProps({ + questId: { + required: true, + type: String + }, +}); + +const session = useSessionStore(); + +const showModal = ref(false); +const yamlString = ref(''); + +const open = () => { + const quest = session.getQuestById(props.questId); + if (!quest) { + return + } + const mappedObject = mapJsonQuestToYamlObject(quest); + yamlString.value = stringify(mappedObject); + showModal.value = true; +} + +defineExpose({ + open +}) +</script> + +<template> + <Modal v-model="showModal"> + <template v-slot:header> + <h2>YAML</h2> + </template> + + <p>YAML file for <code>{{ props.questId }}</code></p> + + <textarea rows="20" :value="yamlString" readonly /> + + <div id="confirm" class="control-group"> + <Button type="solid" :icon="['fas', 'check']" :label="'Close'" @click="showModal = false"></Button> + </div> + </Modal> +</template> + +<style scoped> +#confirm { + display: flex; + justify-content: flex-end; + margin-top: 1rem; +} + +textarea { + width: 100%; +} +</style>
\ No newline at end of file |
