Version 1.0.0 - Initialisation du depot
This commit is contained in:
117
src/views/Servers.vue
Normal file
117
src/views/Servers.vue
Normal file
@@ -0,0 +1,117 @@
|
||||
<script setup>
|
||||
import UserAction from '@/components/Features/UserAction.vue';
|
||||
import Splash from '@/components/Layout/Splash.vue';
|
||||
import Box from '@/components/UI/Box.vue';
|
||||
import SocketEnvironment from "../utils/SocketEnvironment.vue"
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useGlobalStore } from '@/stores/globalStore';
|
||||
import { useUserStore } from '@/stores/userStore';
|
||||
import Button from '@/components/UI/Button.vue';
|
||||
import ReturnHomeButton from '@/components/Actions/ReturnHomeButton.vue';
|
||||
import { ref } from 'vue';
|
||||
import ServerListItem from '@/components/Features/ServerListItem.vue';
|
||||
|
||||
const globalStore = useGlobalStore();
|
||||
const userStore = useUserStore();
|
||||
console.log("Last route:", globalStore.lastRoute);
|
||||
const router = useRouter();
|
||||
const hasLink = ref(false);
|
||||
const botInviteUrl = ref("");
|
||||
|
||||
console.log(globalStore.lastGuild);
|
||||
|
||||
fetch('/information.json')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
botInviteUrl.value = import.meta.env.DEV ? data.bot_invite.development : data.bot_invite.production;
|
||||
hasLink.value = true
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error fetching bot invite URL:", error);
|
||||
hasLink.value = false;
|
||||
});
|
||||
|
||||
function inviteSubsonics() {
|
||||
|
||||
window.open(botInviteUrl.value, '_blank');
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<SocketEnvironment>
|
||||
<Splash>
|
||||
<ReturnHomeButton v-if="globalStore.lastGuild"/>
|
||||
<div class="servers-div">
|
||||
<Box box-class="server-box" padding="closed">
|
||||
<div class="servers-content">
|
||||
<div class="servers-container">
|
||||
<div class="servers-list">
|
||||
<ServerListItem v-for="server in userStore.userInfo.guilds" :key="server.id" :server="server" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button :disabled="!hasLink" @click="inviteSubsonics()"><Icon icon="fa-solid fa-user-plus"/>Inviter Subsonics</Button>
|
||||
</div>
|
||||
</Box>
|
||||
<UserAction/>
|
||||
</div>
|
||||
</Splash>
|
||||
</SocketEnvironment>
|
||||
|
||||
</template>
|
||||
<style scoped>
|
||||
.servers-div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
width: 90%;
|
||||
max-width: 800px;;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.servers-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
|
||||
}
|
||||
|
||||
.server-box {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
|
||||
}
|
||||
|
||||
.servers-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap:10px;
|
||||
overflow-y: auto;
|
||||
width: 100%;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.servers-container {
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
padding-right: 5px;
|
||||
padding-left: 5px;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
max-height: 45vh;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 20px;;
|
||||
}
|
||||
|
||||
</style>
|
Reference in New Issue
Block a user