Skip to content

Commit 8ab8cb5

Browse files
SalleeMatthewsmile0711
authored andcommitted
Context Menu Component
Moved the context menu to its own component to clear up some clutter from chat.vue
1 parent 3dfc52b commit 8ab8cb5

3 files changed

Lines changed: 300 additions & 210 deletions

File tree

spa/src/components/Chat.vue

Lines changed: 43 additions & 209 deletions
Original file line numberDiff line numberDiff line change
@@ -208,223 +208,57 @@
208208
</ul>
209209
</div>
210210
</div>
211-
<div v-show="userMenu"
212-
class="
213-
absolute
214-
flex-none
215-
w-40
216-
text-black
217-
bg-gray-300
218-
cursor-pointer
219-
cls-context-menu
220-
"
221-
style="border: outset #EEE;"
222-
:style="{left: menuLeft, top: menuTop, bottom: menuBottom}"
223-
@mouseleave="closeMenu()"
224-
>
225-
<ul>
226-
<li
227-
class="
228-
p-1
229-
pl-3.5
230-
hover:text-white
231-
hover:bg-gray-500
232-
active:bg-gray-400
233-
"
234-
@click="closeMenu()">
235-
Close Menu
236-
</li>
237-
<li style="border: inset #EEE 3px;"></li>
238-
<li v-show="menuGoTo"
239-
class="
240-
p-1
241-
pl-3.5
242-
hover:text-white
243-
hover:bg-gray-500
244-
active:bg-gray-400
245-
"
246-
@click="goToPlace()">
247-
Go to
248-
</li>
249-
<li v-show="menuToggleRole"
250-
class="
251-
p-1
252-
pl-3.5
253-
hover:text-white
254-
hover:bg-gray-500
255-
active:bg-gray-400
256-
"
257-
>
258-
<input type="checkbox" id="role" v-model="showRole" />
259-
<label for="role"> Users Roles</label>
260-
</li>
261-
<li v-show="menuToggleXP"
262-
class="
263-
p-1
264-
pl-3.5
265-
hover:text-white
266-
hover:bg-gray-500
267-
active:bg-gray-400
268-
"
269-
>
270-
<input type="checkbox" id="XP" v-model="showXP" />
271-
<label for="XP"> Users XP</label>
272-
</li>
273-
<li v-show="menuToggleSpeech"
274-
class="
275-
p-1
276-
pl-3.5
277-
hover:text-white
278-
hover:bg-gray-500
279-
active:bg-gray-400
280-
"
281-
>
282-
<input type="checkbox" id="speech" v-model="tts" />
283-
<label for="speech"> Text To Speech</label>
284-
</li>
285-
<li v-show="menuBeamTo"
286-
class="
287-
p-1
288-
pl-3.5
289-
hover:text-white
290-
hover:bg-gray-500
291-
active:bg-gray-400
292-
"
293-
@click="beamTo()">
294-
Beam to
295-
</li>
296-
<li v-show="menuWhisper"
297-
class="
298-
p-1
299-
pl-3.5
300-
text-gray-500
301-
hover:text-white
302-
hover:bg-gray-500
303-
active:bg-gray-400
304-
"
305-
>
306-
Start Whisper
307-
</li>
308-
<li v-show="menuInviteChat"
309-
class="
310-
p-1
311-
pl-3.5
312-
text-gray-500
313-
hover:text-white
314-
hover:bg-gray-500
315-
active:bg-gray-400
316-
"
317-
>
318-
Invite Chat
319-
</li>
320-
<li v-show="menuIgnore"
321-
class="
322-
p-1
323-
pl-3.5
324-
hover:text-white
325-
hover:bg-gray-500
326-
active:bg-gray-400
327-
"
328-
@click="blockMember()"
329-
>
330-
Ignore
331-
</li>
332-
<li v-show="menuBuy"
333-
class="
334-
p-1
335-
pl-3.5
336-
hover:text-white
337-
hover:bg-gray-500
338-
active:bg-gray-400
339-
"
340-
@click="objectOpener()"
341-
>
342-
Buy
343-
</li>
344-
<li v-show="menuMove"
345-
class="
346-
p-1
347-
pl-3.5
348-
hover:text-white
349-
hover:bg-gray-500
350-
active:bg-gray-400
351-
"
352-
@click="moveObject()"
353-
>
354-
Move
355-
</li>
356-
<li v-show="menuTake"
357-
class="
358-
p-1
359-
pl-3.5
360-
hover:text-white
361-
hover:bg-gray-500
362-
active:bg-gray-400
363-
"
364-
@click="pickUpObject()"
365-
>
366-
Take
367-
</li>
368-
<li v-show="menuDrop"
369-
class="
370-
p-1
371-
pl-3.5
372-
hover:text-white
373-
hover:bg-gray-500
374-
active:bg-gray-400
375-
"
376-
@click="dropObject()"
377-
>
378-
Drop
379-
</li>
380-
<li v-show="menuDestroy"
381-
class="
382-
p-1
383-
pl-3.5
384-
text-gray-500
385-
hover:text-white
386-
hover:bg-gray-500
387-
active:bg-gray-400
388-
"
389-
>
390-
Destroy
391-
</li>
392-
<li v-show="menuProperties"
393-
class="
394-
p-1
395-
pl-3.5
396-
hover:text-white
397-
hover:bg-gray-500
398-
active:bg-gray-400
399-
"
400-
v-on:click="objectOpener()"
401-
>
402-
Properties
403-
</li>
404-
<li v-if="menuRequestBackpack && activePanel === 'users'" style="border:inset #EEE 3px;"></li>
405-
<li v-show="menuRequestBackpack"
406-
class="
407-
p-1
408-
pl-3.5
409-
hover:text-white
410-
hover:bg-gray-500
411-
active:bg-gray-400
412-
"
413-
@click="userBackpack()"
414-
>
415-
Request Objects
416-
</li>
417-
</ul>
418-
</div>
211+
<UserMenu
212+
:visible="userMenu"
213+
:menu-left="menuLeft"
214+
:menu-top="menuTop"
215+
:menu-bottom="menuBottom"
216+
:active-panel-users="activePanel === 'users'"
217+
:menu-go-to="menuGoTo"
218+
:menu-toggle-role="menuToggleRole"
219+
:menu-toggle-xp="menuToggleXP"
220+
:menu-toggle-speech="menuToggleSpeech"
221+
:menu-beam-to="menuBeamTo"
222+
:menu-whisper="menuWhisper"
223+
:menu-invite-chat="menuInviteChat"
224+
:menu-ignore="menuIgnore"
225+
:menu-drop="menuDrop"
226+
:menu-move="menuMove"
227+
:menu-take="menuTake"
228+
:menu-buy="menuBuy"
229+
:menu-destroy="menuDestroy"
230+
:menu-properties="menuProperties"
231+
:menu-request-backpack="menuRequestBackpack"
232+
:show-role="showRole"
233+
:show-xp="showXP"
234+
:tts="tts"
235+
@close="closeMenu"
236+
@go-to-place="goToPlace"
237+
@role-change="showRole = $event"
238+
@xp-change="showXP = $event"
239+
@speech-change="tts = $event"
240+
@beam-to="beamTo"
241+
@ignore="blockMember"
242+
@buy="objectOpener"
243+
@move-object="moveObject"
244+
@take-object="pickUpObject"
245+
@drop-object="dropObject"
246+
@properties="objectOpener"
247+
@request-backpack="userBackpack"
248+
/>
419249
</div>
420250
</template>
421251

422252
<script lang="ts">
423253
424254
import Vue from 'vue';
425255
import { debugMsg } from '@/helpers';
256+
import UserMenu from './UserMenu.vue';
426257
export default Vue.extend({
427258
name: "Chat",
259+
components: {
260+
UserMenu,
261+
},
428262
props: [
429263
"place",
430264
"sharedEvent",
@@ -1230,7 +1064,7 @@ export default Vue.extend({
12301064
this.messages.splice(index, 1);
12311065
}
12321066
},
1233-
},
1067+
} as any,
12341068
watch: {
12351069
place() {
12361070
this.startNewChat();

0 commit comments

Comments
 (0)