<template>
  <Auth v-if="showAuth" />
  <Chat v-if="!showAuth" />
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { Rpc } from '@entityseven/rage-fw-rpc';
import Auth from './components/Auth.vue';
import Chat from './components/Chat.vue';

const appRpc = new Rpc({ forceBrowserDevMode: typeof (window as any).mp === 'undefined' });
const showAuth = ref(true);

onMounted(() => {
  appRpc.register('app:showGame', () => {
    showAuth.value = false;
  });

  appRpc.register('app:showAuth', () => {
    showAuth.value = true;
  });
});
</script>

<style>
body, html {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  background-color: transparent;
  overflow: hidden;
  user-select: none;
}
</style>
