forked from noxious/client
Improvements
This commit is contained in:
parent
c5a19f3648
commit
1011b94096
@ -32,13 +32,13 @@
|
|||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import Modal from '@/components/utilities/Modal.vue'
|
import Modal from '@/components/utilities/Modal.vue'
|
||||||
import { useSocketStore } from '@/stores/socket'
|
import { useSocketStore } from '@/stores/socket'
|
||||||
import { useZoneEditorStore } from '@/stores/zoneEditor'
|
import { useZoneEditorStore } from '@/stores/zoneEditor'
|
||||||
|
import type { Zone } from '@/types'
|
||||||
|
|
||||||
const emit = defineEmits(['submitForm'])
|
|
||||||
const socket = useSocketStore()
|
const socket = useSocketStore()
|
||||||
const zoneEditorStore = useZoneEditorStore()
|
const zoneEditorStore = useZoneEditorStore()
|
||||||
|
|
||||||
@ -47,8 +47,9 @@ const width = ref(0)
|
|||||||
const height = ref(0)
|
const height = ref(0)
|
||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
socket.connection.emit('gm:zone_editor:zone:create', { name: name.value, width: width.value, height: height.value }, () => {})
|
socket.connection.emit('gm:zone_editor:zone:create', { name: name.value, width: width.value, height: height.value }, (response: Zone[]) => {
|
||||||
|
zoneEditorStore.setZoneList(response)
|
||||||
|
})
|
||||||
zoneEditorStore.toggleCreateZoneModal()
|
zoneEditorStore.toggleCreateZoneModal()
|
||||||
emit('submitForm')
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<CreateZone @submitForm="fetchZones" v-if="zoneEditorStore.isCreateZoneModalShown" />
|
<CreateZone v-if="zoneEditorStore.isCreateZoneModalShown" />
|
||||||
|
|
||||||
<Teleport to="body">
|
<Teleport to="body">
|
||||||
<Modal @modal:close="() => zoneEditorStore.toggleZoneListModal()" :is-resizable="false" :is-modal-open="true" :modal-width="300" :modal-height="360">
|
<Modal @modal:close="() => zoneEditorStore.toggleZoneListModal()" :is-resizable="false" :is-modal-open="true" :modal-width="300" :modal-height="360">
|
||||||
@ -8,8 +8,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #modalBody>
|
<template #modalBody>
|
||||||
<div class="my-[15px] mx-auto">
|
<div class="my-[15px] mx-auto">
|
||||||
<div class="text-center mb-4 px-2">
|
<div class="text-center mb-4 px-2 flex justify-around">
|
||||||
<button class="btn-cyan py-1.5 min-w-full" @click="() => zoneEditorStore.toggleCreateZoneModal()">New</button>
|
<button class="btn-cyan py-1.5 min-w-[48%]" @click="fetchZones">Refresh</button>
|
||||||
|
<button class="btn-cyan py-1.5 min-w-[48%]" @click="() => zoneEditorStore.toggleCreateZoneModal()">New</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="relative p-2.5 cursor-pointer flex gap-y-2.5 gap-x-5 flex-wrap" v-for="(zone, index) in zoneEditorStore.zoneList" :key="zone.id">
|
<div class="relative p-2.5 cursor-pointer flex gap-y-2.5 gap-x-5 flex-wrap" v-for="(zone, index) in zoneEditorStore.zoneList" :key="zone.id">
|
||||||
<div class="absolute left-0 top-0 w-full h-[1px] bg-cyan-200" v-if="index === 0"></div>
|
<div class="absolute left-0 top-0 w-full h-[1px] bg-cyan-200" v-if="index === 0"></div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user