apps/web/src/views/HomeView.vue (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
<script setup lang="ts">
import { computed } from "vue";
import { LOGIN_LINK } from "@/lib/constants";
import { useApiStore } from "@/stores/api";
const api = useApiStore();
const user = computed(() => api.user);
const actors = computed(() => api.actors);
const isAuthenticated = computed(() => api.isAuthenticated);
</script>
<template>
<div class="login" v-if="!isAuthenticated">
<h1>You're signed out</h1>
<p>To access the ticket system, you must be logged in.</p>
<a :href="LOGIN_LINK">Login</a>
</div>
<div class="hi" v-if="isAuthenticated">
<h1>hi {{ user?.displayName }}</h1>
<div class="guilds">
<RouterLink
v-for="actor in actors"
:key="actor.actorId"
:to="`/guilds/${actor.guild?.discordId}/tickets`"
class="guild"
>
<div class="guild-icon">
<img :src="actor.guild?.icon!" alt="guild icon" />
</div>
<div class="guild-name">Go to {{ actor.guild?.name }}</div>
</RouterLink>
</div>
</div>
</template>
<style scoped>
.guilds {
display: inline-flex;
flex-direction: column;
gap: 0.5rem;
.guild {
background-color: hsl(var(--crust));
border-radius: 5rem;
display: flex;
flex-direction: row;
align-items: center;
gap: 0.5rem;
padding: 0.5rem;
padding-right: 1.5rem;
text-decoration: none;
color: hsl(var(--text));
.guild-icon {
flex-shrink: 0;
width: 3rem;
height: 3rem;
img {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
&:hover {
background-color: hsl(var(--surface1));
&:active {
background-color: hsla(var(--surface1) / 0.75);
}
}
}
}
.login {
a {
display: inline-block;
margin-top: 0.5rem;
background-color: hsl(var(--accent));
color: hsl(var(--surface0));
padding: 0.5rem 1.5rem;
border-radius: 5rem;
text-decoration: none;
}
}
</style>
|