diff options
Diffstat (limited to 'components/editor/quest/modal')
| -rw-r--r-- | components/editor/quest/modal/Delete.vue | 30 | ||||
| -rw-r--r-- | components/editor/quest/modal/Duplicate.vue | 58 | ||||
| -rw-r--r-- | components/editor/quest/modal/Rename.vue | 58 |
3 files changed, 146 insertions, 0 deletions
diff --git a/components/editor/quest/modal/Delete.vue b/components/editor/quest/modal/Delete.vue new file mode 100644 index 0000000..47c6388 --- /dev/null +++ b/components/editor/quest/modal/Delete.vue @@ -0,0 +1,30 @@ +<script setup lang="ts"> +const model = defineModel(); + +const emit = defineEmits(['delete']); + +defineProps({ + questId: String, +}); +</script> + +<template> + <Modal v-model="model"> + <template v-slot:header> + <h2>Really delete quest '{{ questId }}'?</h2> + </template> + <p>Are you sure you want to delete this quest? The quests editor does not have undo functionality (yet)! </p> + <div id="confirm" class="control-group"> + <Button :icon="['fas', 'fa-times']" :label="'Cancel'" @click="model = false"></Button> + <Button type="solid" :icon="['fas', 'fa-trash']" :label="'Delete'" @click="emit('delete')"></Button> + </div> + </Modal> +</template> + +<style scoped> +#confirm { + display: flex; + justify-content: flex-end; + margin-top: 1rem; +} +</style>
\ No newline at end of file diff --git a/components/editor/quest/modal/Duplicate.vue b/components/editor/quest/modal/Duplicate.vue new file mode 100644 index 0000000..e089222 --- /dev/null +++ b/components/editor/quest/modal/Duplicate.vue @@ -0,0 +1,58 @@ +<script setup lang="ts"> +import { computed, ref } from 'vue'; +import { useSessionStore } from '@/stores/session'; + +const model = defineModel(); + +const emit = defineEmits(['duplicate']); + +const props = defineProps({ + questId: String, +}); + +const session = useSessionStore(); + +const newQuestId = ref(props.questId); + +const isDuplicate = computed(() => { + return session.getQuestById(newQuestId.value!) !== undefined; +}); + +</script> + +<template> + <Modal v-model="model"> + <template v-slot:header> + <h2>Duplicate '{{ questId }}'</h2> + </template> + + <template v-slot:body> + <div id="body"> + <div class="option-group"> + <label for="new-type">ID of new quest</label> + <input id="new-type" name="new-type" type="text" v-model="newQuestId" /> + </div> + <p v-if="isDuplicate" class="error-text">Name is not unique.</p> + <p>A Quest ID must be unique, alphanumeric, and not contain any spaces.</p> + <div id="confirm" class="control-group"> + <Button :icon="['fas', 'fa-times']" :label="'Cancel'" @click="model = false"></Button> + <Button type="solid" :icon="['fas', 'fa-check']" :label="'Duplicate'" :disabled="isDuplicate" + @click="emit('duplicate', newQuestId)"></Button> + </div> + </div> + </template> + </Modal> +</template> + +<style scoped> +#confirm { + display: flex; + justify-content: flex-end; +} + +#body { + display: flex; + flex-direction: column; + gap: 0.5rem; +} +</style>
\ No newline at end of file diff --git a/components/editor/quest/modal/Rename.vue b/components/editor/quest/modal/Rename.vue new file mode 100644 index 0000000..7339219 --- /dev/null +++ b/components/editor/quest/modal/Rename.vue @@ -0,0 +1,58 @@ +<script setup lang="ts"> +import { computed, ref } from 'vue'; +import { useSessionStore } from '@/stores/session'; + +const model = defineModel(); + +const emit = defineEmits(['update']); + +const props = defineProps({ + questId: String, +}); + +const session = useSessionStore(); + +const newQuestId = ref(props.questId); + +const isDuplicate = computed(() => { + return session.getQuestById(newQuestId.value!) !== undefined; +}); + +</script> + +<template> + <Modal v-model="model"> + <template v-slot:header> + <h2>Rename quest '{{ questId }}'</h2> + </template> + + <template v-slot:body> + <div id="body"> + <div class="option-group"> + <label for="new-type">New quest ID</label> + <input id="new-type" name="new-type" type="text" v-model="newQuestId" /> + </div> + <p v-if="isDuplicate" class="error-text">Name is not unique.</p> + <p>A Quest ID must be unique, alphanumeric, and not contain any spaces.</p> + <div id="confirm" class="control-group"> + <Button :icon="['fas', 'fa-times']" :label="'Cancel'" @click="model = false"></Button> + <Button type="solid" :icon="['fas', 'fa-check']" :label="'Rename'" :disabled="isDuplicate" + @click="emit('update', newQuestId)"></Button> + </div> + </div> + </template> + </Modal> +</template> + +<style scoped> +#confirm { + display: flex; + justify-content: flex-end; +} + +#body { + display: flex; + flex-direction: column; + gap: 0.5rem; +} +</style>
\ No newline at end of file |
