blob: 36d2d6d535617017d3906a2b1ff7e047b5ff1560 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<script setup lang="ts">
import { loadCategoriesFromJson, loadItemsFromJson, loadQuestsFromJson } from '~/lib/questsLoader';
import testData from '@/data/testData.json';
const session = useSessionStore();
const showModal = ref(false);
const open = () => {
showModal.value = true;
}
const confirm = () => {
const quests = loadQuestsFromJson(testData.quests);
const categories = loadCategoriesFromJson(testData.categories);
const items = loadItemsFromJson(testData.items);
session.setQuests(quests);
session.setCategories(categories);
session.setItems(items);
showModal.value = false;
}
defineExpose({
open
})
</script>
<template>
<Modal v-model="showModal">
<template v-slot:header>
<h2>Import test data</h2>
</template>
<p>You can view a demo of the Quests editor by loading test data. This will replace your current workspace.
Do you want to continue?</p>
<div id="controls" class="control-group">
<Button :icon="['fas', 'xmark']" :label="'Cancel'" @click="showModal = false"></Button>
<Button type="solid" :icon="['fas', 'check']" :label="'Confirm'" @click="confirm"></Button>
</div>
</Modal>
</template>
<style scoped>
#controls {
display: flex;
justify-content: flex-end;
margin-top: 1rem;
}
</style>
|