-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'custom_path_picker' into develop
- Loading branch information
Showing
19 changed files
with
462 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
frontend/palworld-pal-editor-webui/src/components/PathPicker.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<script setup> | ||
import { usePalEditorStore } from '@/stores/paleditor' | ||
import { computed } from '@vue/reactivity'; | ||
import { ref, onMounted } from 'vue' | ||
import IconButton from './modules/IconButton.vue'; | ||
import InputArea from './modules/InputArea.vue' | ||
import BarButton from './modules/BarButton.vue' | ||
const palStore = usePalEditorStore() | ||
const sortedPathChildren = computed(() => { | ||
return Array.from(palStore.PATH_CONTEXT.entries()).sort((a, b) => { | ||
if (a[1].isDir && !b[1].isDir) { | ||
return -1; | ||
} else if (!a[1].isDir && b[1].isDir) { | ||
return 1; | ||
} | ||
return a[1].filename.localeCompare(b[1].filename); | ||
}) | ||
}) | ||
const savePickerResult = () => { | ||
palStore.SHOW_FILE_PICKER = false | ||
palStore.PAL_GAME_SAVE_PATH = palStore.PAL_FILE_PICKER_PATH | ||
} | ||
// const scrollElement = ref(null); | ||
// const checkScroll = () => { | ||
// if (!scrollElement.value) return; | ||
// const scrollTop = scrollElement.value.scrollTop; | ||
// const scrollHeight = scrollElement.value.scrollHeight; | ||
// const clientHeight = scrollElement.value.clientHeight; | ||
// scrollElement.value.classList.toggle('scrolled-top', scrollTop > 0); | ||
// scrollElement.value.classList.toggle('scrolled-bottom', scrollTop + clientHeight < scrollHeight); | ||
// }; | ||
// onMounted(() => { | ||
// if (scrollElement.value) { | ||
// scrollElement.value.addEventListener('scroll', checkScroll); | ||
// checkScroll(); // Initial check to update shadow state | ||
// } | ||
// }); | ||
</script> | ||
|
||
<template> | ||
<div class="popup"> | ||
<div class="currentPath"> | ||
<IconButton icon="⤴️" @click="palStore.path_back" /> | ||
<InputArea v-model="palStore.PAL_FILE_PICKER_PATH" /> | ||
<IconButton icon="➡️" @click="palStore.update_picker_result(palStore.PAL_FILE_PICKER_PATH)" /> | ||
</div> | ||
|
||
<ul ref="scrollElement"> | ||
<li v-for="([key, value], index) of sortedPathChildren" | ||
:key="index" | ||
:isdir="value.isDir" | ||
@click="() => { if (value.isDir) palStore.update_picker_result(key) }" | ||
:fullpath="key" | ||
> | ||
{{ value.isDir ? "📁" : "📄" }} {{ value.filename }} | ||
</li> | ||
</ul> | ||
<BarButton @click="savePickerResult" content="OK" :disabled="!palStore.IS_PAL_SAVE_PATH" /> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.popup { | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
border: none; | ||
outline: none; | ||
width: 75vw; | ||
height: 75vh; | ||
border-radius: 0.5rem; | ||
padding: 2rem 4rem; | ||
background-color: #515151; | ||
z-index: 10; | ||
box-shadow: 0 0 10px 10px rgba(0, 0, 0, 0.1); | ||
display: flex; | ||
flex-direction: column; | ||
gap: 2rem; | ||
} | ||
.popup .currentPath { | ||
display: flex; | ||
gap: 10px; | ||
align-items: center; | ||
} | ||
.popup ul { | ||
overflow-y: auto; | ||
list-style-type: none; | ||
padding: 0; | ||
flex: 1; | ||
} | ||
.popup li[isdir=true] { | ||
cursor: pointer; | ||
} | ||
.popup li { | ||
margin: .2rem .2rem; | ||
padding: .3rem .3rem; | ||
border-radius: 0.5rem; | ||
color: whitesmoke; | ||
} | ||
.popup li:hover[isdir=true] { | ||
background-color: #4b8d5e; | ||
} | ||
</style> |
37 changes: 37 additions & 0 deletions
37
frontend/palworld-pal-editor-webui/src/components/modules/BarButton.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<script setup> | ||
import { usePalEditorStore } from '@/stores/paleditor' | ||
const palStore = usePalEditorStore() | ||
defineProps(['content', 'name', 'value']) | ||
</script> | ||
|
||
<template> | ||
<button :name="name" :value="value" :disabled="palStore.LOADING_FLAG"> | ||
{{ content }} | ||
</button> | ||
</template> | ||
|
||
<style scoped> | ||
button { | ||
margin-bottom: 1rem; | ||
height: 3rem; | ||
background-color: #3365da; | ||
color: whitesmoke; | ||
border: none; | ||
outline: none; | ||
border-radius: 0.5rem; | ||
font-size: 1.2rem; | ||
transition: all 0.3s ease-in-out; | ||
} | ||
button:hover { | ||
background-color: #1b49b4; | ||
transition: all 0.3s ease-in-out; | ||
cursor: pointer; | ||
} | ||
button:disabled { | ||
background-color: #8a8a8a; | ||
cursor: auto; | ||
} | ||
</style> |
42 changes: 42 additions & 0 deletions
42
frontend/palworld-pal-editor-webui/src/components/modules/IconButton.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<script setup> | ||
import { usePalEditorStore } from '@/stores/paleditor' | ||
const palStore = usePalEditorStore() | ||
defineProps(['icon', 'name', 'value']) | ||
defineEmits([]) | ||
</script> | ||
|
||
<template> | ||
<button :name="name" :value="value" :disabled="palStore.LOADING_FLAG"> | ||
{{ icon }} | ||
</button> | ||
</template> | ||
|
||
<style scoped> | ||
button { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 2rem; | ||
height: 2rem; | ||
padding: 0; | ||
margin: 0; | ||
background-color: #73aa83; | ||
color: whitesmoke; | ||
border: none; | ||
outline: none; | ||
border-radius: 0.5rem; | ||
transition: all 0.15s ease-in-out; | ||
cursor: pointer; | ||
} | ||
button:hover { | ||
background-color: #4b8d5e; | ||
box-shadow: 0px 0px 10px rgb(38, 38, 38); | ||
transition: all 0.15s ease-in-out; | ||
} | ||
button:disabled { | ||
background-color: #8a8a8a; | ||
} | ||
</style> |
39 changes: 39 additions & 0 deletions
39
frontend/palworld-pal-editor-webui/src/components/modules/InputArea.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script setup> | ||
import { usePalEditorStore } from '@/stores/paleditor' | ||
const palStore = usePalEditorStore() | ||
defineProps(['placeholder']) | ||
const model = defineModel() | ||
</script> | ||
|
||
<template> | ||
<input type="text" v-model="model" :placeholder="placeholder" :disabled="palStore.LOADING_FLAG"> | ||
</template> | ||
|
||
<style scoped> | ||
input { | ||
display: flex; | ||
align-items: center; | ||
background-color: #34353a; | ||
height: 1.6rem; | ||
max-width: 100%; | ||
/* margin: .2rem; */ | ||
padding: .2rem .4rem; | ||
border-radius: .5rem; | ||
color: rgb(208, 212, 226); | ||
/* box-shadow: 2px 2px 10px rgb(38, 38, 38); */ | ||
transition: all 0.15s ease-in-out; | ||
border: none; | ||
outline: none; | ||
flex: 1; | ||
} | ||
input:focus { | ||
background-color: #b4b7be; | ||
transition: all 0.15s ease-in-out; | ||
color: rgb(0, 0, 0); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.