From a072c91cc0dc26e417c51f666e8547e08ef40942 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Tue, 12 Mar 2024 23:18:23 +0000 Subject: Add import from file system --- components/base/ItemStack/ItemStackModal.vue | 5 +- components/base/Pulser.vue | 56 +++++++++++++ components/editor/EditorSidebarCategory.vue | 1 - components/editor/EditorSidebarQuest.vue | 3 +- .../editor/quest/EditorQuestOptionsPanel.vue | 2 +- components/editor/task/EditorTaskConfiguration.vue | 2 +- .../editor/task/modal/EditorTaskModalCreate.vue | 1 - components/header/SiteHeader.vue | 18 +++++ components/loader/LoaderFileSystemButton.vue | 40 ++++++++++ components/loader/LoaderFileSystemModal.vue | 81 +++++++++++++++++++ components/loader/LoaderTestDataButton.vue | 17 ++++ components/loader/LoaderTestDataModal.vue | 52 ++++++++++++ data/taskDefinitions.json | 4 + layouts/editor.vue | 10 +-- lib/util.ts | 30 ------- pages/category/[id].vue | 1 - pages/item/[id].vue | 1 - pages/quest/[id].vue | 1 - stores/loader.ts | 55 +++++++++++++ stores/session.ts | 6 +- utils/loader.ts | 93 ++++++++++++++++++++++ utils/util.ts | 29 +++++++ utils/validators.ts | 13 +++ 23 files changed, 471 insertions(+), 50 deletions(-) create mode 100644 components/base/Pulser.vue create mode 100644 components/loader/LoaderFileSystemButton.vue create mode 100644 components/loader/LoaderFileSystemModal.vue create mode 100644 components/loader/LoaderTestDataButton.vue create mode 100644 components/loader/LoaderTestDataModal.vue delete mode 100644 lib/util.ts create mode 100644 stores/loader.ts create mode 100644 utils/loader.ts create mode 100644 utils/util.ts create mode 100644 utils/validators.ts diff --git a/components/base/ItemStack/ItemStackModal.vue b/components/base/ItemStack/ItemStackModal.vue index 865c054..2a53926 100644 --- a/components/base/ItemStack/ItemStackModal.vue +++ b/components/base/ItemStack/ItemStackModal.vue @@ -47,7 +47,9 @@ const selectedQuestItem = computed({ }, set(newValue: string) { value.value = {} - value.value['quest-item'] = newValue; + if (newValue) { + value.value['quest-item'] = newValue; + } } }) const knownQuestItems = computed(() => { return session.session.items.map((item) => item.id) }); @@ -102,6 +104,7 @@ const confirm = () => {
+

Any items of this material will be matched.

diff --git a/components/base/Pulser.vue b/components/base/Pulser.vue new file mode 100644 index 0000000..796b3cc --- /dev/null +++ b/components/base/Pulser.vue @@ -0,0 +1,56 @@ + + + \ No newline at end of file diff --git a/components/editor/EditorSidebarCategory.vue b/components/editor/EditorSidebarCategory.vue index 9dedf33..cfabf39 100644 --- a/components/editor/EditorSidebarCategory.vue +++ b/components/editor/EditorSidebarCategory.vue @@ -1,7 +1,6 @@ + @@ -36,11 +44,21 @@ } +#controls { + padding: 1rem; + display: flex; + align-items: center; + justify-content: center; + gap: 1rem; +} + header { border-bottom: 1px solid var(--color-border); background-color: var(--color-header); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); position: relative; z-index: 1; + display: flex; + justify-content: space-between; } \ No newline at end of file diff --git a/components/loader/LoaderFileSystemButton.vue b/components/loader/LoaderFileSystemButton.vue new file mode 100644 index 0000000..0d02477 --- /dev/null +++ b/components/loader/LoaderFileSystemButton.vue @@ -0,0 +1,40 @@ + + + \ No newline at end of file diff --git a/components/loader/LoaderFileSystemModal.vue b/components/loader/LoaderFileSystemModal.vue new file mode 100644 index 0000000..27f4e12 --- /dev/null +++ b/components/loader/LoaderFileSystemModal.vue @@ -0,0 +1,81 @@ + + + + + \ No newline at end of file diff --git a/components/loader/LoaderTestDataButton.vue b/components/loader/LoaderTestDataButton.vue new file mode 100644 index 0000000..b01b0ee --- /dev/null +++ b/components/loader/LoaderTestDataButton.vue @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/components/loader/LoaderTestDataModal.vue b/components/loader/LoaderTestDataModal.vue new file mode 100644 index 0000000..36d2d6d --- /dev/null +++ b/components/loader/LoaderTestDataModal.vue @@ -0,0 +1,52 @@ + + + + + \ No newline at end of file diff --git a/data/taskDefinitions.json b/data/taskDefinitions.json index 92b728f..c8dce80 100644 --- a/data/taskDefinitions.json +++ b/data/taskDefinitions.json @@ -1,4 +1,8 @@ { + "aliases": { + "blockbreakcertain": "blockbreak", + "blockplacecertain": "blockplace" + }, "taskTypes": { "blockbreak": { "description": "Break a set amount of blocks.", diff --git a/layouts/editor.vue b/layouts/editor.vue index 7275651..d37a285 100644 --- a/layouts/editor.vue +++ b/layouts/editor.vue @@ -1,19 +1,11 @@ diff --git a/lib/util.ts b/lib/util.ts deleted file mode 100644 index 3a7e9aa..0000000 --- a/lib/util.ts +++ /dev/null @@ -1,30 +0,0 @@ -const COLOR_CODE_REGEX = /&[0-9a-fk-or]/i; -const VALID_ID_REGEX = /^[a-z0-9_]+$/i; - -export function stripColorCodes(str: string): string { - return str.replace(COLOR_CODE_REGEX, ''); -} - -export function validateQuestId(id: string): boolean { - return VALID_ID_REGEX.test(id); -} - -export function validateCategoryId(id: string): boolean { - return VALID_ID_REGEX.test(id); -} - -export function validateTaskId(id: string): boolean { - return VALID_ID_REGEX.test(id); -} - -export function navigateToEditorPane(type: 'quest' | 'category' | null, id?: string) { - if (id) { - if (type === 'category') { - navigateTo({ path: '/category/' + id }) - } else if (type === 'quest') { - navigateTo({ path: '/quest/' + id }) - } - } else if (!id && !type) { - navigateTo({ path: '/' }) - } -} \ No newline at end of file diff --git a/pages/category/[id].vue b/pages/category/[id].vue index da68bb5..3189d2a 100644 --- a/pages/category/[id].vue +++ b/pages/category/[id].vue @@ -1,6 +1,5 @@