style: atualiza todo design interno da aplicacao
This commit is contained in:
110
app/components/Sidebar.vue
Normal file
110
app/components/Sidebar.vue
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<template>
|
||||||
|
<aside
|
||||||
|
class="sticky top-0 z-50 border-b border-[#e7e5e4] bg-white/90 backdrop-blur lg:h-screen lg:w-[280px] lg:shrink-0 lg:border-b-0 lg:border-r">
|
||||||
|
<div class="flex h-full min-h-0 flex-col gap-4 px-4 py-3 lg:px-5 lg:py-6">
|
||||||
|
<NuxtLink to="/home"
|
||||||
|
class="flex items-center gap-3 rounded-2xl px-1 text-base font-semibold tracking-[0.16px] text-[#0c0a09] lg:px-0">
|
||||||
|
<span class="inline-flex h-11 w-11 items-center justify-center rounded-xl bg-[#292524] text-white">
|
||||||
|
<Icon name="mdi:gamepad-variant" class="text-xl" />
|
||||||
|
</span>
|
||||||
|
<span>GameVerse</span>
|
||||||
|
</NuxtLink>
|
||||||
|
|
||||||
|
<nav
|
||||||
|
class="flex min-w-0 gap-2 overflow-x-auto pb-1 lg:min-h-0 lg:flex-1 lg:flex-col lg:overflow-y-auto lg:overflow-x-visible lg:pb-0"
|
||||||
|
aria-label="Rotas internas">
|
||||||
|
<NuxtLink v-for="item in navigationItems" :key="item.to" :to="item.to"
|
||||||
|
:aria-current="isActive(item.to) ? 'page' : undefined" :class="[
|
||||||
|
'inline-flex h-10 shrink-0 items-center gap-2 rounded-full border px-4 text-[14px] font-medium leading-none transition lg:w-full lg:justify-start',
|
||||||
|
isActive(item.to)
|
||||||
|
? 'border-[#292524] bg-[#292524] text-white'
|
||||||
|
: 'border-[#d6d3d1] bg-transparent text-[#0c0a09] hover:border-[#0c0a09]'
|
||||||
|
]">
|
||||||
|
<Icon :name="item.icon" class="text-base" />
|
||||||
|
<span>{{ item.label }}</span>
|
||||||
|
</NuxtLink>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<button type="button" :disabled="isLeaving" @click="sair"
|
||||||
|
class="inline-flex h-10 shrink-0 items-center justify-center gap-2 rounded-full bg-[#292524] px-4 text-[14px] font-medium leading-none text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70 lg:w-full">
|
||||||
|
<Icon v-if="isLeaving" name="mdi:loading" class="animate-spin text-base" />
|
||||||
|
<Icon v-else name="mdi:logout" class="text-base" />
|
||||||
|
<span>{{ isLeaving ? 'Saindo...' : 'Sair' }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const route = useRoute()
|
||||||
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
|
const token = useCookie('token', {
|
||||||
|
secure: true,
|
||||||
|
sameSite: 'lax',
|
||||||
|
maxAge: 900
|
||||||
|
})
|
||||||
|
|
||||||
|
const isLeaving = ref(false)
|
||||||
|
|
||||||
|
const navigationItems = [
|
||||||
|
{
|
||||||
|
label: 'Home',
|
||||||
|
to: '/home',
|
||||||
|
icon: 'mdi:view-dashboard-outline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Dados da conta',
|
||||||
|
to: '/dados-conta',
|
||||||
|
icon: 'mdi:account-circle-outline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Rankings',
|
||||||
|
to: '/ranking-jogos',
|
||||||
|
icon: 'mdi:trophy-outline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Perfil gamer',
|
||||||
|
to: '/perfil-gamer',
|
||||||
|
icon: 'mdi:account-star-outline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Gift card',
|
||||||
|
to: '/gift-card',
|
||||||
|
icon: 'mdi:gift-outline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Favoritos',
|
||||||
|
to: '/favoritos',
|
||||||
|
icon: 'mdi:heart-outline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Catálogo',
|
||||||
|
to: '/catalogo',
|
||||||
|
icon: 'mdi:controller-classic-outline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Novo jogo',
|
||||||
|
to: '/catalogo/criar',
|
||||||
|
icon: 'mdi:plus'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const isActive = (path) => {
|
||||||
|
if (path === '/catalogo') {
|
||||||
|
return (
|
||||||
|
route.path === '/catalogo' ||
|
||||||
|
(route.path.startsWith('/catalogo/') && route.path !== '/catalogo/criar')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return route.path === path
|
||||||
|
}
|
||||||
|
|
||||||
|
async function sair() {
|
||||||
|
isLeaving.value = true
|
||||||
|
token.value = null
|
||||||
|
$toast.success('Sessão encerrada com sucesso.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
8
app/layouts/protected.vue
Normal file
8
app/layouts/protected.vue
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<template>
|
||||||
|
<div class="min-h-screen bg-[#f5f5f5] font-sans text-[#0c0a09] lg:flex">
|
||||||
|
<Sidebar />
|
||||||
|
<div class="min-w-0 flex-1">
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -10,11 +10,6 @@
|
|||||||
class="m-0 inline-flex rounded-full bg-[rgba(196,184,232,0.6)] px-3 py-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#0c0a09]">
|
class="m-0 inline-flex rounded-full bg-[rgba(196,184,232,0.6)] px-3 py-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#0c0a09]">
|
||||||
Catálogo
|
Catálogo
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<NuxtLink to="/catalogo"
|
|
||||||
class="inline-flex h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Voltar
|
|
||||||
</NuxtLink>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div v-if="isLoading" class="grid gap-4" role="status" aria-live="polite">
|
<div v-if="isLoading" class="grid gap-4" role="status" aria-live="polite">
|
||||||
@@ -52,8 +47,19 @@
|
|||||||
:aria-label="isFavorited ? 'Remover dos favoritos' : 'Adicionar aos favoritos'"
|
:aria-label="isFavorited ? 'Remover dos favoritos' : 'Adicionar aos favoritos'"
|
||||||
@click="toggleFavorite"
|
@click="toggleFavorite"
|
||||||
class="inline-flex h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 text-[13px] font-medium transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-50">
|
class="inline-flex h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 text-[13px] font-medium transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-50">
|
||||||
<Icon :name="togglingFavorite ? 'mdi:loading' : isFavorited ? 'mdi:heart' : 'mdi:heart-outline'"
|
<Icon :name="togglingFavorite
|
||||||
:class="['text-sm', togglingFavorite ? 'animate-spin text-[#777169]' : isFavorited ? 'text-rose-500' : 'text-[#777169]']" />
|
? 'mdi:loading'
|
||||||
|
: isFavorited
|
||||||
|
? 'mdi:heart'
|
||||||
|
: 'mdi:heart-outline'
|
||||||
|
" :class="[
|
||||||
|
'text-sm',
|
||||||
|
togglingFavorite
|
||||||
|
? 'animate-spin text-[#777169]'
|
||||||
|
: isFavorited
|
||||||
|
? 'text-rose-500'
|
||||||
|
: 'text-[#777169]'
|
||||||
|
]" />
|
||||||
<span>{{ isFavorited ? 'Favoritado' : 'Favoritar' }}</span>
|
<span>{{ isFavorited ? 'Favoritado' : 'Favoritar' }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -85,14 +91,18 @@
|
|||||||
|
|
||||||
<div v-if="!isEditing" class="grid gap-6">
|
<div v-if="!isEditing" class="grid gap-6">
|
||||||
<div>
|
<div>
|
||||||
<p class="mb-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Descrição
|
<p class="mb-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Descrição
|
||||||
|
</p>
|
||||||
|
<p class="text-[15px] leading-[1.6] tracking-[0.15px] text-[#0c0a09]">
|
||||||
|
{{ game.description }}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-[15px] leading-[1.6] tracking-[0.15px] text-[#0c0a09]">{{ game.description }}</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-5 sm:grid-cols-2">
|
<div class="grid gap-5 sm:grid-cols-2">
|
||||||
<div>
|
<div>
|
||||||
<p class="mb-2 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Gêneros
|
<p class="mb-2 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Gêneros
|
||||||
</p>
|
</p>
|
||||||
<div class="flex flex-wrap gap-1.5">
|
<div class="flex flex-wrap gap-1.5">
|
||||||
<span v-for="genre in game.genres" :key="genre"
|
<span v-for="genre in game.genres" :key="genre"
|
||||||
@@ -104,7 +114,8 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p class="mb-2 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
<p class="mb-2 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
Plataformas</p>
|
Plataformas
|
||||||
|
</p>
|
||||||
<div class="flex flex-wrap gap-1.5">
|
<div class="flex flex-wrap gap-1.5">
|
||||||
<span v-for="platform in game.platforms" :key="platform"
|
<span v-for="platform in game.platforms" :key="platform"
|
||||||
class="inline-flex items-center rounded-full bg-[rgba(167,229,211,0.5)] px-2.5 py-1 text-[12px] font-semibold uppercase leading-none tracking-[0.8px] text-[#0c0a09]">
|
class="inline-flex items-center rounded-full bg-[rgba(167,229,211,0.5)] px-2.5 py-1 text-[12px] font-semibold uppercase leading-none tracking-[0.8px] text-[#0c0a09]">
|
||||||
@@ -114,11 +125,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div v-if="
|
||||||
v-if="game.system_requirements?.cpu || game.system_requirements?.gpu || game.system_requirements?.ram"
|
game.system_requirements?.cpu ||
|
||||||
class="rounded-xl border border-[#e7e5e4] bg-[#fafafa] p-4">
|
game.system_requirements?.gpu ||
|
||||||
|
game.system_requirements?.ram
|
||||||
|
" class="rounded-xl border border-[#e7e5e4] bg-[#fafafa] p-4">
|
||||||
<p class="mb-3 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
<p class="mb-3 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
Requisitos de sistema</p>
|
Requisitos de sistema
|
||||||
|
</p>
|
||||||
<dl class="grid gap-2">
|
<dl class="grid gap-2">
|
||||||
<div v-if="game.system_requirements.cpu" class="flex gap-3">
|
<div v-if="game.system_requirements.cpu" class="flex gap-3">
|
||||||
<dt class="w-10 shrink-0 text-[13px] font-semibold text-[#777169]">CPU</dt>
|
<dt class="w-10 shrink-0 text-[13px] font-semibold text-[#777169]">CPU</dt>
|
||||||
@@ -136,9 +150,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<span :class="['inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-semibold uppercase tracking-[0.8px]',
|
<span :class="[
|
||||||
game.active ? 'bg-emerald-50 text-emerald-700' : 'bg-[#f0efed] text-[#777169]']">
|
'inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-semibold uppercase tracking-[0.8px]',
|
||||||
<span :class="['h-1.5 w-1.5 rounded-full', game.active ? 'bg-emerald-500' : 'bg-[#d6d3d1]']"></span>
|
game.active ? 'bg-emerald-50 text-emerald-700' : 'bg-[#f0efed] text-[#777169]'
|
||||||
|
]">
|
||||||
|
<span :class="[
|
||||||
|
'h-1.5 w-1.5 rounded-full',
|
||||||
|
game.active ? 'bg-emerald-500' : 'bg-[#d6d3d1]'
|
||||||
|
]"></span>
|
||||||
{{ game.active ? 'Ativo' : 'Inativo' }}
|
{{ game.active ? 'Ativo' : 'Inativo' }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -250,8 +269,8 @@
|
|||||||
<div
|
<div
|
||||||
class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
<p>
|
<p>
|
||||||
Microsserviço consumido: <span
|
Microsserviço consumido:
|
||||||
class="font-medium text-[#4e4e4e]">https://catalogo-jogos-sd-production.up.railway.app</span>
|
<span class="font-medium text-[#4e4e4e]">https://catalogo-jogos-sd-production.up.railway.app</span>
|
||||||
· Feito por Lucas Kauã
|
· Feito por Lucas Kauã
|
||||||
</p>
|
</p>
|
||||||
<span class="inline-flex items-center gap-1.5">
|
<span class="inline-flex items-center gap-1.5">
|
||||||
@@ -266,7 +285,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
})
|
})
|
||||||
|
|
||||||
const CATALOG_API_BASE_URL = 'https://catalogo-jogos-sd-production.up.railway.app'
|
const CATALOG_API_BASE_URL = 'https://catalogo-jogos-sd-production.up.railway.app'
|
||||||
@@ -340,9 +360,12 @@ async function fetchGame() {
|
|||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await $fetch(`${CATALOG_API_BASE_URL}/api/v1/catalog/games/${route.params.id_ou_slug}`, {
|
const data = await $fetch(
|
||||||
headers: { Authorization: `Bearer ${token.value}` }
|
`${CATALOG_API_BASE_URL}/api/v1/catalog/games/${route.params.id_ou_slug}`,
|
||||||
})
|
{
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
}
|
||||||
|
)
|
||||||
game.value = data?.data ?? null
|
game.value = data?.data ?? null
|
||||||
|
|
||||||
if (!game.value) {
|
if (!game.value) {
|
||||||
@@ -370,7 +393,9 @@ async function fetchFavoriteStatus() {
|
|||||||
const data = await $fetch(`${WISHLIST_API_BASE_URL}/api/wishlist`, {
|
const data = await $fetch(`${WISHLIST_API_BASE_URL}/api/wishlist`, {
|
||||||
headers: { Authorization: `Bearer ${token.value}` }
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
})
|
})
|
||||||
const favorites = (data?.data ?? []).filter((item) => item.is_favorite === 1 || item.is_favorite === true)
|
const favorites = (data?.data ?? []).filter(
|
||||||
|
(item) => item.is_favorite === 1 || item.is_favorite === true
|
||||||
|
)
|
||||||
isFavorited.value = favorites.some((item) => item.game_id === game.value.title)
|
isFavorited.value = favorites.some((item) => item.game_id === game.value.title)
|
||||||
} catch {
|
} catch {
|
||||||
// falha silenciosa
|
// falha silenciosa
|
||||||
@@ -430,8 +455,18 @@ async function saveEdit() {
|
|||||||
title: editForm.title || undefined,
|
title: editForm.title || undefined,
|
||||||
description: editForm.description || undefined,
|
description: editForm.description || undefined,
|
||||||
developer: editForm.developer || undefined,
|
developer: editForm.developer || undefined,
|
||||||
genres: editForm.genresRaw ? editForm.genresRaw.split(',').map((s) => s.trim()).filter(Boolean) : undefined,
|
genres: editForm.genresRaw
|
||||||
platforms: editForm.platformsRaw ? editForm.platformsRaw.split(',').map((s) => s.trim()).filter(Boolean) : undefined,
|
? editForm.genresRaw
|
||||||
|
.split(',')
|
||||||
|
.map((s) => s.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
: undefined,
|
||||||
|
platforms: editForm.platformsRaw
|
||||||
|
? editForm.platformsRaw
|
||||||
|
.split(',')
|
||||||
|
.map((s) => s.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
: undefined,
|
||||||
active: editForm.active
|
active: editForm.active
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,6 @@
|
|||||||
Preencha os dados para adicionar um jogo ao catálogo.
|
Preencha os dados para adicionar um jogo ao catálogo.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<NuxtLink to="/catalogo"
|
|
||||||
class="inline-flex h-10 shrink-0 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Voltar
|
|
||||||
</NuxtLink>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
@@ -100,7 +95,8 @@
|
|||||||
class="inline-flex min-h-6 items-center rounded-full bg-[rgba(196,184,232,0.4)] px-2.5 py-1 text-xs font-semibold uppercase leading-none tracking-[0.96px] text-[#0c0a09]">
|
class="inline-flex min-h-6 items-center rounded-full bg-[rgba(196,184,232,0.4)] px-2.5 py-1 text-xs font-semibold uppercase leading-none tracking-[0.96px] text-[#0c0a09]">
|
||||||
Imagens
|
Imagens
|
||||||
</span>
|
</span>
|
||||||
<p class="mb-4 mt-3 text-[13px] leading-[1.5] text-[#777169]">Opcional — URLs públicas das imagens do jogo.
|
<p class="mb-4 mt-3 text-[13px] leading-[1.5] text-[#777169]">
|
||||||
|
Opcional — URLs públicas das imagens do jogo.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="grid gap-5 md:grid-cols-2">
|
<div class="grid gap-5 md:grid-cols-2">
|
||||||
@@ -179,7 +175,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
})
|
})
|
||||||
|
|
||||||
const CATALOG_API_BASE_URL = 'https://catalogo-jogos-sd-production.up.railway.app'
|
const CATALOG_API_BASE_URL = 'https://catalogo-jogos-sd-production.up.railway.app'
|
||||||
@@ -216,8 +213,14 @@ const clearToken = () => {
|
|||||||
async function submitForm() {
|
async function submitForm() {
|
||||||
formError.value = ''
|
formError.value = ''
|
||||||
|
|
||||||
const genres = form.genresRaw.split(',').map((s) => s.trim()).filter(Boolean)
|
const genres = form.genresRaw
|
||||||
const platforms = form.platformsRaw.split(',').map((s) => s.trim()).filter(Boolean)
|
.split(',')
|
||||||
|
.map((s) => s.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
const platforms = form.platformsRaw
|
||||||
|
.split(',')
|
||||||
|
.map((s) => s.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
|
||||||
if (!form.title || !form.description || !form.developer || !genres.length || !platforms.length) {
|
if (!form.title || !form.description || !form.developer || !genres.length || !platforms.length) {
|
||||||
formError.value = 'Preencha todos os campos obrigatórios.'
|
formError.value = 'Preencha todos os campos obrigatórios.'
|
||||||
@@ -271,7 +274,8 @@ async function submitForm() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
formError.value = error?.data?.message ?? 'Erro ao criar o jogo. Verifique os dados e tente novamente.'
|
formError.value =
|
||||||
|
error?.data?.message ?? 'Erro ao criar o jogo. Verifique os dados e tente novamente.'
|
||||||
$toast.error(formError.value, { duration: 8000 })
|
$toast.error(formError.value, { duration: 8000 })
|
||||||
} finally {
|
} finally {
|
||||||
isSubmitting.value = false
|
isSubmitting.value = false
|
||||||
|
|||||||
@@ -26,10 +26,6 @@
|
|||||||
<Icon name="mdi:plus" class="text-base" />
|
<Icon name="mdi:plus" class="text-base" />
|
||||||
Novo jogo
|
Novo jogo
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink to="/home"
|
|
||||||
class="inline-flex h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Voltar
|
|
||||||
</NuxtLink>
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@@ -71,13 +67,22 @@
|
|||||||
<Icon name="mdi:gamepad-variant-outline" class="text-4xl text-[#d6d3d1]" />
|
<Icon name="mdi:gamepad-variant-outline" class="text-4xl text-[#d6d3d1]" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" :disabled="togglingId === game.title"
|
<button type="button" :disabled="togglingId === game.title" :aria-label="favoriteIds.has(game.title) ? 'Remover dos favoritos' : 'Adicionar aos favoritos'
|
||||||
:aria-label="favoriteIds.has(game.title) ? 'Remover dos favoritos' : 'Adicionar aos favoritos'"
|
" @click="toggleFavorite(game)"
|
||||||
@click="toggleFavorite(game)"
|
|
||||||
class="absolute right-2 top-2 inline-flex h-8 w-8 items-center justify-center rounded-full bg-white/80 shadow backdrop-blur-sm transition hover:bg-white disabled:cursor-not-allowed disabled:opacity-50">
|
class="absolute right-2 top-2 inline-flex h-8 w-8 items-center justify-center rounded-full bg-white/80 shadow backdrop-blur-sm transition hover:bg-white disabled:cursor-not-allowed disabled:opacity-50">
|
||||||
<Icon
|
<Icon :name="togglingId === game.title
|
||||||
:name="togglingId === game.title ? 'mdi:loading' : favoriteIds.has(game.title) ? 'mdi:heart' : 'mdi:heart-outline'"
|
? 'mdi:loading'
|
||||||
:class="['text-base', togglingId === game.title ? 'animate-spin text-[#777169]' : favoriteIds.has(game.title) ? 'text-rose-500' : 'text-[#777169]']" />
|
: favoriteIds.has(game.title)
|
||||||
|
? 'mdi:heart'
|
||||||
|
: 'mdi:heart-outline'
|
||||||
|
" :class="[
|
||||||
|
'text-base',
|
||||||
|
togglingId === game.title
|
||||||
|
? 'animate-spin text-[#777169]'
|
||||||
|
: favoriteIds.has(game.title)
|
||||||
|
? 'text-rose-500'
|
||||||
|
: 'text-[#777169]'
|
||||||
|
]" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -134,8 +139,8 @@
|
|||||||
|
|
||||||
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
<p>
|
<p>
|
||||||
Microsserviço consumido: <span
|
Microsserviço consumido:
|
||||||
class="font-medium text-[#4e4e4e]">https://catalogo-jogos-sd-production.up.railway.app</span>
|
<span class="font-medium text-[#4e4e4e]">https://catalogo-jogos-sd-production.up.railway.app</span>
|
||||||
· Feito por Lucas Kauã
|
· Feito por Lucas Kauã
|
||||||
</p>
|
</p>
|
||||||
<span class="inline-flex items-center gap-1.5">
|
<span class="inline-flex items-center gap-1.5">
|
||||||
@@ -149,7 +154,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
})
|
})
|
||||||
|
|
||||||
const CATALOG_API_BASE_URL = 'https://catalogo-jogos-sd-production.up.railway.app'
|
const CATALOG_API_BASE_URL = 'https://catalogo-jogos-sd-production.up.railway.app'
|
||||||
@@ -299,7 +305,9 @@ async function confirmDelete(game) {
|
|||||||
confirmingDeleteId.value = null
|
confirmingDeleteId.value = null
|
||||||
$toast.success(`${game.title} removido do catálogo.`, { duration: 4000 })
|
$toast.success(`${game.title} removido do catálogo.`, { duration: 4000 })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
$toast.error(error?.data?.message ?? 'Erro ao remover o jogo. Tente novamente.', { duration: 6000 })
|
$toast.error(error?.data?.message ?? 'Erro ao remover o jogo. Tente novamente.', {
|
||||||
|
duration: 6000
|
||||||
|
})
|
||||||
} finally {
|
} finally {
|
||||||
deletingId.value = null
|
deletingId.value = null
|
||||||
}
|
}
|
||||||
|
|||||||
115
app/pages/(protected)/dados-conta/index.vue
Normal file
115
app/pages/(protected)/dados-conta/index.vue
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="relative min-h-[calc(100vh-66px)] overflow-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-5 sm:py-12 md:px-8 md:py-16">
|
||||||
|
<div
|
||||||
|
class="pointer-events-none absolute left-1/2 top-6 h-[360px] w-[min(94vw,760px)] -translate-x-1/2 rounded-[40px] bg-[radial-gradient(circle_at_20%_30%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(168,200,232,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(232,184,196,0.5),transparent_34%)] blur-2xl sm:top-8 sm:h-[420px] sm:rounded-[48px]"
|
||||||
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
|
<main class="relative mx-auto grid w-full max-w-[960px] gap-6 sm:gap-8" aria-labelledby="account-title">
|
||||||
|
<header class="min-w-0">
|
||||||
|
<p
|
||||||
|
class="m-0 inline-flex rounded-full bg-[rgba(168,200,232,0.56)] px-3 py-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
Conta
|
||||||
|
</p>
|
||||||
|
<h1 id="account-title"
|
||||||
|
class="my-4 max-w-[680px] break-words font-serif text-[34px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] sm:my-5 sm:text-[40px] md:text-[48px]">
|
||||||
|
Dados da conta
|
||||||
|
</h1>
|
||||||
|
<p
|
||||||
|
class="m-0 max-w-[540px] text-[15px] font-normal leading-[1.47] tracking-[0.15px] text-[#4e4e4e] sm:text-base sm:leading-6 sm:tracking-[0.16px]">
|
||||||
|
Estes são os dados retornados pelo perfil da sua sessão atual.
|
||||||
|
</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section
|
||||||
|
class="grid min-w-0 gap-5 rounded-xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:rounded-2xl sm:p-6 md:p-8"
|
||||||
|
aria-label="Dados do perfil autenticado">
|
||||||
|
<div>
|
||||||
|
<span
|
||||||
|
class="inline-flex min-h-6 items-center rounded-full bg-[rgba(167,229,211,0.62)] px-2.5 py-1 text-xs font-semibold uppercase leading-none tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
Perfil
|
||||||
|
</span>
|
||||||
|
<h2
|
||||||
|
class="mt-4 font-serif text-[26px] font-light leading-[1.13] tracking-[-0.32px] text-[#0c0a09] sm:text-3xl">
|
||||||
|
Dados da conta
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<dl class="grid min-w-0 gap-3 sm:gap-4">
|
||||||
|
<div v-for="item in profileRows" :key="item.label"
|
||||||
|
class="grid min-w-0 gap-1 border-t border-[#e7e5e4] pt-3 sm:grid-cols-[140px_minmax(0,1fr)] sm:gap-5 sm:pt-4 md:grid-cols-[160px_minmax(0,1fr)]">
|
||||||
|
<dt class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
{{ item.label }}
|
||||||
|
</dt>
|
||||||
|
<dd
|
||||||
|
class="m-0 min-w-0 text-[15px] leading-[1.47] tracking-[0.15px] text-[#0c0a09] sm:text-base sm:leading-6 sm:tracking-[0.16px]"
|
||||||
|
:class="item.isLong ? 'break-all' : 'break-words'">
|
||||||
|
{{ item.value }}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
definePageMeta({
|
||||||
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
|
const token = useCookie('token', {
|
||||||
|
secure: true,
|
||||||
|
sameSite: 'lax',
|
||||||
|
maxAge: 900
|
||||||
|
})
|
||||||
|
|
||||||
|
const clearToken = () => {
|
||||||
|
token.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data: profile, error } = await useAsyncData('profile-me-account', () =>
|
||||||
|
$fetch('/profile/me', {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token.value}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
if (error.value) {
|
||||||
|
clearToken()
|
||||||
|
|
||||||
|
if (import.meta.client) {
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
}
|
||||||
|
|
||||||
|
await navigateTo('/login')
|
||||||
|
}
|
||||||
|
|
||||||
|
const profileRows = computed(() => [
|
||||||
|
{
|
||||||
|
label: 'user_id',
|
||||||
|
value: profile.value?.user_id ?? profile.value?.id ?? '-'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'email',
|
||||||
|
value: profile.value?.email ?? '-'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'created_at',
|
||||||
|
value: profile.value?.created_at ?? '-'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'updated_at',
|
||||||
|
value: profile.value?.updated_at ?? '-'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'jwt_token',
|
||||||
|
value: token.value ?? '-',
|
||||||
|
isLong: true
|
||||||
|
}
|
||||||
|
])
|
||||||
|
</script>
|
||||||
@@ -19,17 +19,6 @@
|
|||||||
Jogos que você salvou como favoritos. Gerencie sua lista aqui.
|
Jogos que você salvou como favoritos. Gerencie sua lista aqui.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex gap-3">
|
|
||||||
<NuxtLink to="/ranking-jogos"
|
|
||||||
class="inline-flex h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Ver rankings
|
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink to="/home"
|
|
||||||
class="inline-flex h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Voltar
|
|
||||||
</NuxtLink>
|
|
||||||
</div>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
@@ -87,7 +76,9 @@
|
|||||||
class="inline-flex h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 text-[13px] font-medium leading-none text-[#777169] transition hover:border-red-300 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-50">
|
class="inline-flex h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 text-[13px] font-medium leading-none text-[#777169] transition hover:border-red-300 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-50">
|
||||||
<Icon :name="removingId === game.game_id ? 'mdi:loading' : 'mdi:heart-remove-outline'"
|
<Icon :name="removingId === game.game_id ? 'mdi:loading' : 'mdi:heart-remove-outline'"
|
||||||
:class="['text-sm', removingId === game.game_id && 'animate-spin']" />
|
:class="['text-sm', removingId === game.game_id && 'animate-spin']" />
|
||||||
<span class="hidden sm:inline">{{ removingId === game.game_id ? 'Removendo...' : 'Remover' }}</span>
|
<span class="hidden sm:inline">{{
|
||||||
|
removingId === game.game_id ? 'Removendo...' : 'Remover'
|
||||||
|
}}</span>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -96,8 +87,9 @@
|
|||||||
|
|
||||||
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
<p>
|
<p>
|
||||||
Microsserviço consumido: <span class="font-medium text-[#4e4e4e]">https://gameverse-wishlist-production.up.railway.app</span>
|
Microsserviço consumido:
|
||||||
· Feito por Edson
|
<span class="font-medium text-[#4e4e4e]">https://gameverse-wishlist-production.up.railway.app</span>
|
||||||
|
· Feito por Edson e Mateus Lima
|
||||||
</p>
|
</p>
|
||||||
<span class="inline-flex items-center gap-1.5">
|
<span class="inline-flex items-center gap-1.5">
|
||||||
<span class="h-1.5 w-1.5 rounded-full bg-emerald-500"></span>
|
<span class="h-1.5 w-1.5 rounded-full bg-emerald-500"></span>
|
||||||
@@ -110,7 +102,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
})
|
})
|
||||||
|
|
||||||
const WISHLIST_API_BASE_URL = 'https://gameverse-wishlist-production.up.railway.app'
|
const WISHLIST_API_BASE_URL = 'https://gameverse-wishlist-production.up.railway.app'
|
||||||
|
|||||||
@@ -19,11 +19,6 @@
|
|||||||
Crie cartões, consulte saldo por código e realize resgates com segurança.
|
Crie cartões, consulte saldo por código e realize resgates com segurança.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<NuxtLink to="/home"
|
|
||||||
class="inline-flex h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Voltar
|
|
||||||
</NuxtLink>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="grid gap-8 lg:grid-cols-2">
|
<div class="grid gap-8 lg:grid-cols-2">
|
||||||
@@ -76,7 +71,7 @@
|
|||||||
Código do cartão
|
Código do cartão
|
||||||
</label>
|
</label>
|
||||||
<input id="code" v-model="operationForm.code" type="text" required maxlength="10"
|
<input id="code" v-model="operationForm.code" type="text" required maxlength="10"
|
||||||
class="h-11 rounded-xl border border-[#e7e5e4] px-4 uppercase text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
class="h-11 rounded-xl border border-[#e7e5e4] px-4 text-[15px] uppercase text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
||||||
placeholder="AB12CD34EF" />
|
placeholder="AB12CD34EF" />
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" :disabled="isConsulting"
|
<button type="submit" :disabled="isConsulting"
|
||||||
@@ -105,7 +100,9 @@
|
|||||||
<div v-if="selectedCard"
|
<div v-if="selectedCard"
|
||||||
class="rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-4 text-[15px] leading-[1.47] text-[#292524]">
|
class="rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-4 text-[15px] leading-[1.47] text-[#292524]">
|
||||||
<p class="m-0"><strong>Código:</strong> {{ selectedCard.code }}</p>
|
<p class="m-0"><strong>Código:</strong> {{ selectedCard.code }}</p>
|
||||||
<p class="m-0 mt-2"><strong>Saldo:</strong> {{ formatCurrency(selectedCard.balance) }}</p>
|
<p class="m-0 mt-2">
|
||||||
|
<strong>Saldo:</strong> {{ formatCurrency(selectedCard.balance) }}
|
||||||
|
</p>
|
||||||
<p class="m-0 mt-2">
|
<p class="m-0 mt-2">
|
||||||
<strong>Status:</strong>
|
<strong>Status:</strong>
|
||||||
{{ selectedCard.is_active ? 'Ativo' : 'Desativado' }}
|
{{ selectedCard.is_active ? 'Ativo' : 'Desativado' }}
|
||||||
@@ -147,13 +144,19 @@
|
|||||||
<li v-for="card in giftCards" :key="card.id"
|
<li v-for="card in giftCards" :key="card.id"
|
||||||
class="flex flex-col gap-3 bg-white p-4 sm:flex-row sm:items-center sm:justify-between">
|
class="flex flex-col gap-3 bg-white p-4 sm:flex-row sm:items-center sm:justify-between">
|
||||||
<div class="grid gap-1">
|
<div class="grid gap-1">
|
||||||
<span class="font-mono text-base font-medium tracking-wider text-[#0c0a09]">{{ card.code }}</span>
|
<span class="font-mono text-base font-medium tracking-wider text-[#0c0a09]">{{
|
||||||
|
card.code
|
||||||
|
}}</span>
|
||||||
<span class="text-xs text-[#777169]">Criado em {{ formatDate(card.created_at) }}</span>
|
<span class="text-xs text-[#777169]">Criado em {{ formatDate(card.created_at) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-wrap items-center gap-3">
|
<div class="flex flex-wrap items-center gap-3">
|
||||||
<span class="text-[15px] font-medium text-[#292524]">{{ formatCurrency(card.balance) }}</span>
|
<span class="text-[15px] font-medium text-[#292524]">{{
|
||||||
<span class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold uppercase"
|
formatCurrency(card.balance)
|
||||||
:class="card.is_active ? 'bg-[rgba(167,229,211,0.62)] text-[#0c0a09]' : 'bg-[#f0efed] text-[#777169]'">
|
}}</span>
|
||||||
|
<span class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold uppercase" :class="card.is_active
|
||||||
|
? 'bg-[rgba(167,229,211,0.62)] text-[#0c0a09]'
|
||||||
|
: 'bg-[#f0efed] text-[#777169]'
|
||||||
|
">
|
||||||
{{ card.is_active ? 'Ativo' : 'Inativo' }}
|
{{ card.is_active ? 'Ativo' : 'Inativo' }}
|
||||||
</span>
|
</span>
|
||||||
<button type="button" class="text-[15px] font-medium text-[#0c0a09] underline-offset-2 hover:underline"
|
<button type="button" class="text-[15px] font-medium text-[#0c0a09] underline-offset-2 hover:underline"
|
||||||
@@ -168,8 +171,8 @@
|
|||||||
|
|
||||||
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
<p>
|
<p>
|
||||||
Microsserviço consumido: <span
|
Microsserviço consumido:
|
||||||
class="font-medium text-[#4e4e4e]">https://giftcardapipedro-production.up.railway.app/api</span>
|
<span class="font-medium text-[#4e4e4e]">https://giftcardapipedro-production.up.railway.app/api</span>
|
||||||
· Feito por Pedro Henrique e João Vitor
|
· Feito por Pedro Henrique e João Vitor
|
||||||
</p>
|
</p>
|
||||||
<span class="inline-flex items-center gap-1.5">
|
<span class="inline-flex items-center gap-1.5">
|
||||||
@@ -183,7 +186,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
})
|
})
|
||||||
|
|
||||||
const GIFT_CARD_API_BASE_URL = 'https://giftcardapipedro-production.up.railway.app/api'
|
const GIFT_CARD_API_BASE_URL = 'https://giftcardapipedro-production.up.railway.app/api'
|
||||||
|
|||||||
@@ -1,83 +1,264 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="relative min-h-screen overflow-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-5 sm:py-12 md:px-8 md:py-16">
|
class="relative min-h-[calc(100vh-66px)] overflow-hidden bg-[#f5f5f5] px-4 py-10 font-sans text-[#0c0a09] md:px-8 md:py-16">
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-6 h-[360px] w-[min(94vw,760px)] -translate-x-1/2 rounded-[40px] bg-[radial-gradient(circle_at_20%_30%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(168,200,232,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(232,184,196,0.5),transparent_34%)] blur-2xl sm:top-8 sm:h-[420px] sm:rounded-[48px]"
|
class="pointer-events-none absolute left-1/2 top-8 h-[500px] w-[min(94vw,900px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_18%_28%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_76%_22%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_54%_82%,rgba(168,200,232,0.56),transparent_34%)] blur-2xl"
|
||||||
aria-hidden="true"></div>
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
<main class="relative mx-auto grid w-full max-w-[960px] gap-6 sm:gap-8" aria-labelledby="home-title">
|
<main class="relative mx-auto grid w-full max-w-[1180px] gap-8" aria-labelledby="home-title">
|
||||||
<header class="flex min-w-0 flex-col gap-5 md:flex-row md:items-end md:justify-between">
|
<section class="grid gap-6 lg:grid-cols-[minmax(0,1.45fr)_minmax(300px,0.55fr)] lg:items-stretch">
|
||||||
<div class="min-w-0">
|
<div class="grid gap-6">
|
||||||
<p
|
<header>
|
||||||
class="m-0 inline-flex rounded-full bg-[rgba(168,200,232,0.56)] px-3 py-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#0c0a09]">
|
<p
|
||||||
Conta
|
class="m-0 inline-flex rounded-full bg-[rgba(167,229,211,0.62)] px-3 py-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#0c0a09]">
|
||||||
</p>
|
Dashboard
|
||||||
<h1 id="home-title"
|
</p>
|
||||||
class="my-4 max-w-[680px] break-words font-serif text-[34px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] sm:my-5 sm:text-[40px] md:text-[48px]">
|
<h1 id="home-title"
|
||||||
Olá, você está autenticado!
|
class="my-5 max-w-[760px] break-words font-serif text-[40px] font-light leading-[1.05] tracking-[-1.2px] text-[#0c0a09] md:text-[60px] md:tracking-[-1.6px]">
|
||||||
</h1>
|
Olá, {{ userName }}.
|
||||||
<p
|
</h1>
|
||||||
class="m-0 max-w-[540px] text-[15px] font-normal leading-[1.47] tracking-[0.15px] text-[#4e4e4e] sm:text-base sm:leading-6 sm:tracking-[0.16px]">
|
<p class="m-0 max-w-[620px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
Estes são os dados retornados pelo perfil da sua sessão atual.
|
Acompanhe sua sessão, ranking semanal, favoritos, catálogo, gift cards e perfil gamer
|
||||||
</p>
|
em um só lugar.
|
||||||
</div>
|
</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
<div class="flex shrink-0 flex-col items-start gap-3 sm:flex-row sm:items-center">
|
<div class="grid gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||||
<NuxtLink to="/ranking-jogos"
|
<NuxtLink v-for="card in dashboardCards" :key="card.label" :to="card.to"
|
||||||
class="inline-flex h-10 w-fit items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
class="grid min-h-[156px] content-between rounded-2xl border border-[#e7e5e4] bg-white p-5 shadow-[0_4px_16px_rgba(0,0,0,0.04)] transition hover:border-[#d6d3d1] hover:shadow-[0_8px_24px_rgba(0,0,0,0.07)]">
|
||||||
Ver rankings
|
<div class="flex items-center justify-between gap-3">
|
||||||
</NuxtLink>
|
<span class="inline-flex h-10 w-10 items-center justify-center rounded-xl" :class="card.accent">
|
||||||
<NuxtLink to="/perfil-gamer"
|
<Icon :name="card.icon" class="text-xl text-[#0c0a09]" />
|
||||||
class="inline-flex h-10 w-fit items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
</span>
|
||||||
Perfil Gamer
|
<Icon name="mdi:arrow-right" class="text-lg text-[#777169]" />
|
||||||
</NuxtLink>
|
</div>
|
||||||
<NuxtLink to="/gift-card"
|
|
||||||
class="inline-flex h-10 w-fit items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Gift Card
|
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink to="/favoritos"
|
|
||||||
class="inline-flex h-10 w-fit items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Meus favoritos
|
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink to="/catalogo"
|
|
||||||
class="inline-flex h-10 w-fit items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Catálogo
|
|
||||||
</NuxtLink>
|
|
||||||
<button type="button" :disabled="isLeaving" @click="sair"
|
|
||||||
class="inline-flex h-10 w-fit items-center justify-center gap-2 rounded-full bg-[#292524] px-5 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] active:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
|
||||||
<Icon v-if="isLeaving" name="mdi:loading" class="animate-spin text-base" />
|
|
||||||
<span v-else>Sair</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<section
|
<div class="grid gap-2">
|
||||||
class="grid min-w-0 gap-5 rounded-xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:rounded-2xl sm:p-6 md:p-8"
|
<p class="m-0 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
aria-label="Dados do perfil autenticado">
|
{{ card.label }}
|
||||||
<div>
|
</p>
|
||||||
<span
|
<strong class="break-words text-[22px] font-medium leading-[1.18] tracking-[0.16px] text-[#0c0a09]">
|
||||||
class="inline-flex min-h-6 items-center rounded-full bg-[rgba(167,229,211,0.62)] px-2.5 py-1 text-xs font-semibold uppercase leading-none tracking-[0.96px] text-[#0c0a09]">
|
{{ card.value }}
|
||||||
Perfil
|
</strong>
|
||||||
</span>
|
<p class="m-0 text-[13px] leading-[1.5] tracking-[0.13px] text-[#777169]">
|
||||||
<h2
|
{{ card.helper }}
|
||||||
class="mt-4 font-serif text-[26px] font-light leading-[1.13] tracking-[-0.32px] text-[#0c0a09] sm:text-3xl">
|
</p>
|
||||||
Dados da conta
|
</div>
|
||||||
</h2>
|
</NuxtLink>
|
||||||
</div>
|
|
||||||
|
|
||||||
<dl class="grid min-w-0 gap-3 sm:gap-4">
|
|
||||||
<div v-for="item in profileRows" :key="item.label"
|
|
||||||
class="grid min-w-0 gap-1 border-t border-[#e7e5e4] pt-3 sm:grid-cols-[140px_minmax(0,1fr)] sm:gap-5 sm:pt-4 md:grid-cols-[160px_minmax(0,1fr)]">
|
|
||||||
<dt class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
|
||||||
{{ item.label }}
|
|
||||||
</dt>
|
|
||||||
<dd
|
|
||||||
class="m-0 min-w-0 text-[15px] leading-[1.47] tracking-[0.15px] text-[#0c0a09] sm:text-base sm:leading-6 sm:tracking-[0.16px]"
|
|
||||||
:class="item.isLong ? 'break-all' : 'break-words'">
|
|
||||||
{{ item.value }}
|
|
||||||
</dd>
|
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</div>
|
||||||
|
|
||||||
|
<aside
|
||||||
|
class="grid min-w-0 gap-4 rounded-2xl border border-[#e7e5e4] bg-white p-5 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-6 md:p-8">
|
||||||
|
<div class="flex min-w-0 items-center gap-3">
|
||||||
|
<span
|
||||||
|
class="inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-[#292524] text-base font-semibold text-white">
|
||||||
|
{{ userInitial }}
|
||||||
|
</span>
|
||||||
|
<div class="min-w-0">
|
||||||
|
<p class="m-0 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Sessão ativa
|
||||||
|
</p>
|
||||||
|
<p class="m-0 mt-1 min-w-0 truncate text-[15px] font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
||||||
|
{{ profile?.email ?? '-' }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<dl class="grid gap-3 border-t border-[#e7e5e4] pt-5">
|
||||||
|
<div v-for="item in accountFacts" :key="item.label" class="grid gap-1">
|
||||||
|
<dt class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
{{ item.label }}
|
||||||
|
</dt>
|
||||||
|
<dd class="m-0 min-w-0 truncate text-[15px] leading-[1.47] tracking-[0.15px] text-[#0c0a09]">
|
||||||
|
{{ item.value }}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<NuxtLink to="/dados-conta"
|
||||||
|
class="inline-flex min-h-10 min-w-0 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 py-2 text-center text-[15px] font-medium leading-[1.2] text-white transition hover:bg-[#0c0a09]">
|
||||||
|
<span class="min-w-0 break-words">Ver dados da conta</span>
|
||||||
|
<Icon name="mdi:arrow-right" class="shrink-0 text-base" />
|
||||||
|
</NuxtLink>
|
||||||
|
</aside>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="grid gap-8 lg:grid-cols-[minmax(0,1.35fr)_minmax(320px,0.65fr)]">
|
||||||
|
<article
|
||||||
|
class="grid gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-6 shadow-[0_4px_16px_rgba(0,0,0,0.04)] md:p-8"
|
||||||
|
aria-labelledby="weekly-ranking-title">
|
||||||
|
<div class="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">
|
||||||
|
<div>
|
||||||
|
<span
|
||||||
|
class="inline-flex min-h-6 items-center rounded-full bg-[rgba(244,197,168,0.56)] px-2.5 py-1 text-xs font-semibold uppercase leading-none tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
Semana
|
||||||
|
</span>
|
||||||
|
<h2 id="weekly-ranking-title"
|
||||||
|
class="mt-4 font-serif text-3xl font-light leading-[1.13] tracking-[-0.32px] text-[#0c0a09]">
|
||||||
|
Ranking semanal em destaque
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<NuxtLink to="/ranking-jogos"
|
||||||
|
class="inline-flex h-10 w-fit items-center justify-center gap-2 rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
|
Ver ranking completo
|
||||||
|
<Icon name="mdi:arrow-right" class="text-base" />
|
||||||
|
</NuxtLink>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="ranking.isLoading" class="grid gap-3" role="status" aria-live="polite">
|
||||||
|
<div v-for="item in 5" :key="item" class="h-16 animate-pulse rounded-xl bg-[#f0efed]"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="ranking.error"
|
||||||
|
class="rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-[15px] leading-[1.47] tracking-[0.15px] text-red-700"
|
||||||
|
role="alert">
|
||||||
|
{{ ranking.error }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ol v-else-if="ranking.items.length" class="grid overflow-hidden rounded-xl border border-[#e7e5e4]">
|
||||||
|
<li v-for="(game, index) in ranking.items.slice(0, 5)" :key="game.id ?? game.name"
|
||||||
|
class="grid gap-3 border-b border-[#e7e5e4] bg-white p-4 last:border-b-0 sm:grid-cols-[56px_minmax(0,1fr)_minmax(120px,auto)_minmax(120px,auto)] sm:items-center">
|
||||||
|
<span
|
||||||
|
class="inline-flex h-9 w-9 items-center justify-center rounded-full bg-[#292524] text-[15px] font-medium leading-none text-white">
|
||||||
|
{{ index + 1 }}
|
||||||
|
</span>
|
||||||
|
<div class="min-w-0">
|
||||||
|
<strong class="block break-words text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
||||||
|
{{ game.name }}
|
||||||
|
</strong>
|
||||||
|
<span class="text-[13px] leading-[1.5] tracking-[0.13px] text-[#777169]">
|
||||||
|
{{ game.platform ?? 'Plataforma não informada' }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="text-[15px] leading-[1.47] tracking-[0.15px] text-[#292524]">
|
||||||
|
{{ formatNumber(game.active_players) }} jogadores
|
||||||
|
</span>
|
||||||
|
<span class="text-[15px] leading-[1.47] tracking-[0.15px] text-[#292524]">
|
||||||
|
{{ formatNumber(game.weekly_points) }} pts
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<div v-else
|
||||||
|
class="rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-8 text-center text-[15px] leading-[1.47] tracking-[0.15px] text-[#777169]">
|
||||||
|
Nenhum jogo encontrado no ranking semanal.
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<aside class="grid gap-4">
|
||||||
|
<article
|
||||||
|
class="grid gap-4 rounded-2xl border border-[#e7e5e4] bg-white p-6 shadow-[0_4px_16px_rgba(0,0,0,0.04)]"
|
||||||
|
aria-labelledby="profile-gamer-summary">
|
||||||
|
<div class="flex items-start justify-between gap-3">
|
||||||
|
<div>
|
||||||
|
<span
|
||||||
|
class="inline-flex min-h-6 items-center rounded-full bg-[rgba(232,184,196,0.55)] px-2.5 py-1 text-xs font-semibold uppercase leading-none tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
Perfil
|
||||||
|
</span>
|
||||||
|
<h2 id="profile-gamer-summary"
|
||||||
|
class="mt-4 font-serif text-2xl font-light leading-[1.13] tracking-[-0.24px] text-[#0c0a09]">
|
||||||
|
Perfil gamer
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<Icon name="mdi:account-star-outline" class="text-2xl text-[#777169]" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="gamerProfile.isLoading" class="grid gap-2" role="status" aria-live="polite">
|
||||||
|
<div class="h-5 animate-pulse rounded-xl bg-[#f0efed]"></div>
|
||||||
|
<div class="h-5 w-2/3 animate-pulse rounded-xl bg-[#f0efed]"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p v-else-if="gamerProfile.error" class="m-0 text-[15px] leading-[1.47] tracking-[0.15px] text-red-700">
|
||||||
|
{{ gamerProfile.error }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div v-else class="grid gap-2">
|
||||||
|
<p class="m-0 text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
||||||
|
{{ gamerProfile.data?.nickname ?? 'Perfil ainda não criado' }}
|
||||||
|
</p>
|
||||||
|
<p class="m-0 text-[13px] leading-[1.5] tracking-[0.13px] text-[#777169]">
|
||||||
|
{{ gamerProfileHelper }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<NuxtLink to="/perfil-gamer"
|
||||||
|
class="inline-flex h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
|
Abrir perfil gamer
|
||||||
|
</NuxtLink>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article
|
||||||
|
class="grid gap-4 rounded-2xl border border-[#e7e5e4] bg-white p-6 shadow-[0_4px_16px_rgba(0,0,0,0.04)]"
|
||||||
|
aria-labelledby="shortcuts-title">
|
||||||
|
<div>
|
||||||
|
<span
|
||||||
|
class="inline-flex min-h-6 items-center rounded-full bg-[rgba(168,200,232,0.56)] px-2.5 py-1 text-xs font-semibold uppercase leading-none tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
Acesso rápido
|
||||||
|
</span>
|
||||||
|
<h2 id="shortcuts-title"
|
||||||
|
class="mt-4 font-serif text-2xl font-light leading-[1.13] tracking-[-0.24px] text-[#0c0a09]">
|
||||||
|
Rotas internas
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-2">
|
||||||
|
<NuxtLink v-for="shortcut in shortcuts" :key="shortcut.to" :to="shortcut.to"
|
||||||
|
class="flex min-h-11 items-center justify-between gap-3 rounded-xl border border-[#e7e5e4] px-4 text-[15px] font-medium leading-[1.47] tracking-[0.15px] text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
|
<span class="inline-flex items-center gap-2">
|
||||||
|
<Icon :name="shortcut.icon" class="text-base text-[#777169]" />
|
||||||
|
{{ shortcut.label }}
|
||||||
|
</span>
|
||||||
|
<Icon name="mdi:arrow-right" class="text-base text-[#777169]" />
|
||||||
|
</NuxtLink>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</aside>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="grid gap-4 md:grid-cols-3" aria-label="Prévia dos serviços">
|
||||||
|
<article v-for="service in servicePreviews" :key="service.title"
|
||||||
|
class="grid gap-4 rounded-2xl border border-[#e7e5e4] bg-white p-6 shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
|
<div class="flex items-start justify-between gap-3">
|
||||||
|
<div>
|
||||||
|
<span
|
||||||
|
class="inline-flex min-h-6 items-center rounded-full px-2.5 py-1 text-xs font-semibold uppercase leading-none tracking-[0.96px] text-[#0c0a09]"
|
||||||
|
:class="service.badgeClass">
|
||||||
|
{{ service.badge }}
|
||||||
|
</span>
|
||||||
|
<h2 class="mt-4 font-serif text-2xl font-light leading-[1.13] tracking-[-0.24px] text-[#0c0a09]">
|
||||||
|
{{ service.title }}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<Icon :name="service.icon" class="text-2xl text-[#777169]" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="service.loading" class="grid gap-2" role="status" aria-live="polite">
|
||||||
|
<div v-for="item in 3" :key="item" class="h-5 animate-pulse rounded-xl bg-[#f0efed]"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p v-else-if="service.error" class="m-0 text-[15px] leading-[1.47] tracking-[0.15px] text-red-700">
|
||||||
|
{{ service.error }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul v-else-if="service.items.length" class="grid gap-2">
|
||||||
|
<li v-for="item in service.items" :key="item"
|
||||||
|
class="flex items-center gap-2 text-[15px] leading-[1.47] tracking-[0.15px] text-[#292524]">
|
||||||
|
<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-[#292524]"></span>
|
||||||
|
<span class="min-w-0 break-words">{{ item }}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p v-else class="m-0 text-[15px] leading-[1.47] tracking-[0.15px] text-[#777169]">
|
||||||
|
{{ service.empty }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<NuxtLink :to="service.to"
|
||||||
|
class="inline-flex h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
|
{{ service.action }}
|
||||||
|
</NuxtLink>
|
||||||
|
</article>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
@@ -85,9 +266,16 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const RANKINGS_API_BASE_URL = 'https://api-ranking-jogos-production.up.railway.app/api/v1'
|
||||||
|
const WISHLIST_API_BASE_URL = 'https://gameverse-wishlist-production.up.railway.app'
|
||||||
|
const CATALOG_API_BASE_URL = 'https://catalogo-jogos-sd-production.up.railway.app'
|
||||||
|
const GIFT_CARD_API_BASE_URL = 'https://giftcardapipedro-production.up.railway.app/api'
|
||||||
|
const PERFIL_GAMER_API_BASE_URL = 'https://perfilgameredivaldo-production.up.railway.app/api'
|
||||||
|
|
||||||
const { $toast } = useNuxtApp()
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
const token = useCookie('token', {
|
const token = useCookie('token', {
|
||||||
@@ -96,21 +284,21 @@ const token = useCookie('token', {
|
|||||||
maxAge: 900
|
maxAge: 900
|
||||||
})
|
})
|
||||||
|
|
||||||
const isLeaving = ref(false)
|
const authHeaders = () => ({
|
||||||
|
Authorization: `Bearer ${token.value}`
|
||||||
|
})
|
||||||
|
|
||||||
const clearToken = () => {
|
const clearToken = () => {
|
||||||
token.value = null
|
token.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data: profile, error } = await useAsyncData('profile-me', () =>
|
const { data: profile, error: profileError } = await useAsyncData('profile-me-home', () =>
|
||||||
$fetch('/profile/me', {
|
$fetch('/profile/me', {
|
||||||
headers: {
|
headers: authHeaders()
|
||||||
Authorization: `Bearer ${token.value}`
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
if (error.value) {
|
if (profileError.value) {
|
||||||
clearToken()
|
clearToken()
|
||||||
|
|
||||||
if (import.meta.client) {
|
if (import.meta.client) {
|
||||||
@@ -120,34 +308,332 @@ if (error.value) {
|
|||||||
await navigateTo('/login')
|
await navigateTo('/login')
|
||||||
}
|
}
|
||||||
|
|
||||||
const profileRows = computed(() => [
|
const ranking = reactive({
|
||||||
|
isLoading: true,
|
||||||
|
error: '',
|
||||||
|
items: []
|
||||||
|
})
|
||||||
|
|
||||||
|
const favorites = reactive({
|
||||||
|
isLoading: true,
|
||||||
|
error: '',
|
||||||
|
items: []
|
||||||
|
})
|
||||||
|
|
||||||
|
const catalog = reactive({
|
||||||
|
isLoading: true,
|
||||||
|
error: '',
|
||||||
|
items: []
|
||||||
|
})
|
||||||
|
|
||||||
|
const giftCards = reactive({
|
||||||
|
isLoading: true,
|
||||||
|
error: '',
|
||||||
|
items: []
|
||||||
|
})
|
||||||
|
|
||||||
|
const gamerProfile = reactive({
|
||||||
|
isLoading: true,
|
||||||
|
error: '',
|
||||||
|
data: null
|
||||||
|
})
|
||||||
|
|
||||||
|
const isRedirecting = ref(false)
|
||||||
|
|
||||||
|
const userName = computed(
|
||||||
|
() => gamerProfile.data?.nickname || profile.value?.email?.split('@')?.[0] || 'jogador'
|
||||||
|
)
|
||||||
|
const userInitial = computed(() => (profile.value?.email?.[0] ?? 'G').toUpperCase())
|
||||||
|
const userId = computed(() => profile.value?.user_id ?? profile.value?.id ?? '-')
|
||||||
|
|
||||||
|
const accountFacts = computed(() => [
|
||||||
{
|
{
|
||||||
label: 'user_id',
|
label: 'User ID',
|
||||||
value: profile.value?.user_id ?? profile.value?.id ?? '-'
|
value: userId.value
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'email',
|
label: 'Criada em',
|
||||||
value: profile.value?.email ?? '-'
|
value: formatDate(profile.value?.created_at)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'created_at',
|
label: 'Atualizada em',
|
||||||
value: profile.value?.created_at ?? '-'
|
value: formatDate(profile.value?.updated_at)
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'updated_at',
|
|
||||||
value: profile.value?.updated_at ?? '-'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'jwt_token',
|
|
||||||
value: token.value ?? '-',
|
|
||||||
isLong: true
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
async function sair() {
|
const topRanking = computed(() => ranking.items[0] ?? null)
|
||||||
isLeaving.value = true
|
const activeCatalogGames = computed(() => catalog.items.filter((game) => game.active !== false))
|
||||||
clearToken()
|
const totalGiftBalance = computed(() =>
|
||||||
$toast.success('Sessão encerrada com sucesso.', { duration: 8000 })
|
giftCards.items.reduce((sum, card) => sum + Number(card.balance ?? 0), 0)
|
||||||
await navigateTo('/login')
|
)
|
||||||
|
const favoriteNames = computed(() => favorites.items.map((item) => item.game_id).filter(Boolean))
|
||||||
|
const catalogNames = computed(() => catalog.items.map((item) => item.title).filter(Boolean))
|
||||||
|
const giftCardCodes = computed(() =>
|
||||||
|
giftCards.items.map((item) => `${item.code} · ${formatCurrency(item.balance)}`).filter(Boolean)
|
||||||
|
)
|
||||||
|
|
||||||
|
const gamerProfileHelper = computed(() => {
|
||||||
|
if (!gamerProfile.data) {
|
||||||
|
return 'Use a rota Perfil gamer para cadastrar nickname, bio, país e preferências.'
|
||||||
|
}
|
||||||
|
|
||||||
|
const platforms = Array.isArray(gamerProfile.data.platforms)
|
||||||
|
? gamerProfile.data.platforms.slice(0, 3).join(', ')
|
||||||
|
: ''
|
||||||
|
return platforms ? `Plataformas: ${platforms}` : 'Perfil gamer conectado à sua sessão.'
|
||||||
|
})
|
||||||
|
|
||||||
|
const dashboardCards = computed(() => [
|
||||||
|
{
|
||||||
|
label: 'Líder semanal',
|
||||||
|
value: ranking.isLoading ? 'Carregando...' : (topRanking.value?.name ?? 'Sem dados'),
|
||||||
|
helper:
|
||||||
|
ranking.error ||
|
||||||
|
(topRanking.value
|
||||||
|
? `${formatNumber(topRanking.value.active_players)} jogadores ativos`
|
||||||
|
: 'Ranking semanal'),
|
||||||
|
icon: 'mdi:trophy-outline',
|
||||||
|
to: '/ranking-jogos',
|
||||||
|
accent: 'bg-[rgba(244,197,168,0.56)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Favoritos',
|
||||||
|
value: favorites.isLoading ? 'Carregando...' : formatNumber(favorites.items.length),
|
||||||
|
helper: favorites.error || 'Jogos salvos por você',
|
||||||
|
icon: 'mdi:heart-outline',
|
||||||
|
to: '/favoritos',
|
||||||
|
accent: 'bg-[rgba(232,184,196,0.55)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Catálogo',
|
||||||
|
value: catalog.isLoading ? 'Carregando...' : formatNumber(activeCatalogGames.value.length),
|
||||||
|
helper: catalog.error || 'Jogos ativos no catálogo',
|
||||||
|
icon: 'mdi:controller-classic-outline',
|
||||||
|
to: '/catalogo',
|
||||||
|
accent: 'bg-[rgba(196,184,232,0.45)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Gift cards',
|
||||||
|
value: giftCards.isLoading ? 'Carregando...' : formatCurrency(totalGiftBalance.value),
|
||||||
|
helper: giftCards.error || `${formatNumber(giftCards.items.length)} cartões emitidos`,
|
||||||
|
icon: 'mdi:gift-outline',
|
||||||
|
to: '/gift-card',
|
||||||
|
accent: 'bg-[rgba(167,229,211,0.62)]'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const shortcuts = [
|
||||||
|
{
|
||||||
|
label: 'Dados da conta',
|
||||||
|
to: '/dados-conta',
|
||||||
|
icon: 'mdi:account-circle-outline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Ranking de jogos',
|
||||||
|
to: '/ranking-jogos',
|
||||||
|
icon: 'mdi:trophy-outline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Novo jogo no catálogo',
|
||||||
|
to: '/catalogo/criar',
|
||||||
|
icon: 'mdi:plus'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Gift cards',
|
||||||
|
to: '/gift-card',
|
||||||
|
icon: 'mdi:gift-outline'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const servicePreviews = computed(() => [
|
||||||
|
{
|
||||||
|
badge: 'Favoritos',
|
||||||
|
badgeClass: 'bg-[rgba(232,184,196,0.5)]',
|
||||||
|
title: 'Jogos salvos',
|
||||||
|
icon: 'mdi:heart-outline',
|
||||||
|
loading: favorites.isLoading,
|
||||||
|
error: favorites.error,
|
||||||
|
items: favoriteNames.value.slice(0, 3),
|
||||||
|
empty: 'Nenhum favorito encontrado.',
|
||||||
|
to: '/favoritos',
|
||||||
|
action: 'Ver favoritos'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
badge: 'Catálogo',
|
||||||
|
badgeClass: 'bg-[rgba(196,184,232,0.45)]',
|
||||||
|
title: 'Últimos jogos',
|
||||||
|
icon: 'mdi:controller-classic-outline',
|
||||||
|
loading: catalog.isLoading,
|
||||||
|
error: catalog.error,
|
||||||
|
items: catalogNames.value.slice(0, 3),
|
||||||
|
empty: 'Nenhum jogo encontrado no catálogo.',
|
||||||
|
to: '/catalogo',
|
||||||
|
action: 'Abrir catálogo'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
badge: 'Carteira',
|
||||||
|
badgeClass: 'bg-[rgba(167,229,211,0.62)]',
|
||||||
|
title: 'Gift cards',
|
||||||
|
icon: 'mdi:gift-outline',
|
||||||
|
loading: giftCards.isLoading,
|
||||||
|
error: giftCards.error,
|
||||||
|
items: giftCardCodes.value.slice(0, 3),
|
||||||
|
empty: 'Nenhum gift card emitido.',
|
||||||
|
to: '/gift-card',
|
||||||
|
action: 'Gerenciar gift cards'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const formatNumber = (value) => {
|
||||||
|
return new Intl.NumberFormat('pt-BR').format(Number(value ?? 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formatCurrency = (value) => {
|
||||||
|
return new Intl.NumberFormat('pt-BR', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'BRL'
|
||||||
|
}).format(Number(value ?? 0))
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatDate = (value) => {
|
||||||
|
if (!value) return '-'
|
||||||
|
|
||||||
|
return new Intl.DateTimeFormat('pt-BR', {
|
||||||
|
dateStyle: 'short',
|
||||||
|
timeStyle: 'short'
|
||||||
|
}).format(new Date(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
const getStatusCode = (error) =>
|
||||||
|
error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
|
||||||
|
async function tratarErroAuth(error) {
|
||||||
|
if (getStatusCode(error) !== 401) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isRedirecting.value) {
|
||||||
|
isRedirecting.value = true
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchRanking() {
|
||||||
|
ranking.isLoading = true
|
||||||
|
ranking.error = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await $fetch(`${RANKINGS_API_BASE_URL}/rankings/weekly`, {
|
||||||
|
headers: authHeaders()
|
||||||
|
})
|
||||||
|
|
||||||
|
ranking.items = Array.isArray(data) ? data : []
|
||||||
|
} catch (error) {
|
||||||
|
if (await tratarErroAuth(error)) return
|
||||||
|
|
||||||
|
ranking.items = []
|
||||||
|
ranking.error = error?.data?.message ?? 'Erro ao carregar o ranking semanal.'
|
||||||
|
} finally {
|
||||||
|
ranking.isLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchFavorites() {
|
||||||
|
favorites.isLoading = true
|
||||||
|
favorites.error = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await $fetch(`${WISHLIST_API_BASE_URL}/api/wishlist`, {
|
||||||
|
headers: authHeaders()
|
||||||
|
})
|
||||||
|
|
||||||
|
favorites.items = (data?.data ?? []).filter(
|
||||||
|
(item) => item.is_favorite === 1 || item.is_favorite === true
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
if (await tratarErroAuth(error)) return
|
||||||
|
|
||||||
|
favorites.items = []
|
||||||
|
favorites.error = error?.data?.message ?? 'Erro ao carregar os favoritos.'
|
||||||
|
} finally {
|
||||||
|
favorites.isLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchCatalog() {
|
||||||
|
catalog.isLoading = true
|
||||||
|
catalog.error = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await $fetch(`${CATALOG_API_BASE_URL}/api/v1/catalog/games`, {
|
||||||
|
headers: authHeaders()
|
||||||
|
})
|
||||||
|
|
||||||
|
catalog.items = data?.data ?? []
|
||||||
|
} catch (error) {
|
||||||
|
if (await tratarErroAuth(error)) return
|
||||||
|
|
||||||
|
catalog.items = []
|
||||||
|
catalog.error = error?.data?.message ?? 'Erro ao carregar o catálogo.'
|
||||||
|
} finally {
|
||||||
|
catalog.isLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchGiftCards() {
|
||||||
|
giftCards.isLoading = true
|
||||||
|
giftCards.error = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await $fetch(`${GIFT_CARD_API_BASE_URL}/giftcards`, {
|
||||||
|
headers: authHeaders()
|
||||||
|
})
|
||||||
|
|
||||||
|
giftCards.items = Array.isArray(data) ? data : []
|
||||||
|
} catch (error) {
|
||||||
|
if (await tratarErroAuth(error)) return
|
||||||
|
|
||||||
|
giftCards.items = []
|
||||||
|
giftCards.error = error?.data?.message ?? 'Erro ao carregar seus gift cards.'
|
||||||
|
} finally {
|
||||||
|
giftCards.isLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchGamerProfile() {
|
||||||
|
gamerProfile.isLoading = true
|
||||||
|
gamerProfile.error = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
gamerProfile.data = await $fetch(`${PERFIL_GAMER_API_BASE_URL}/profiles/me`, {
|
||||||
|
headers: authHeaders()
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
if (await tratarErroAuth(error)) return
|
||||||
|
|
||||||
|
if (getStatusCode(error) === 404) {
|
||||||
|
gamerProfile.data = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
gamerProfile.data = null
|
||||||
|
gamerProfile.error = error?.data?.message ?? 'Erro ao carregar o perfil gamer.'
|
||||||
|
} finally {
|
||||||
|
gamerProfile.isLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
Promise.all([
|
||||||
|
fetchRanking(),
|
||||||
|
fetchFavorites(),
|
||||||
|
fetchCatalog(),
|
||||||
|
fetchGiftCards(),
|
||||||
|
fetchGamerProfile()
|
||||||
|
])
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -19,11 +19,6 @@
|
|||||||
Gerencie seu apelido, bio, país e preferências de plataformas e jogos.
|
Gerencie seu apelido, bio, país e preferências de plataformas e jogos.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<NuxtLink to="/home"
|
|
||||||
class="inline-flex h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Voltar
|
|
||||||
</NuxtLink>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
@@ -120,8 +115,8 @@
|
|||||||
|
|
||||||
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
<p>
|
<p>
|
||||||
Microsserviço consumido: <span
|
Microsserviço consumido:
|
||||||
class="font-medium text-[#4e4e4e]">https://perfilgameredivaldo-production.up.railway.app/api</span>
|
<span class="font-medium text-[#4e4e4e]">https://perfilgameredivaldo-production.up.railway.app/api</span>
|
||||||
· Feito por Edivaldo Rodrigues
|
· Feito por Edivaldo Rodrigues
|
||||||
</p>
|
</p>
|
||||||
<span class="inline-flex items-center gap-1.5">
|
<span class="inline-flex items-center gap-1.5">
|
||||||
@@ -135,7 +130,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
})
|
})
|
||||||
|
|
||||||
const PERFIL_GAMER_API_BASE_URL = 'https://perfilgameredivaldo-production.up.railway.app/api'
|
const PERFIL_GAMER_API_BASE_URL = 'https://perfilgameredivaldo-production.up.railway.app/api'
|
||||||
@@ -165,7 +161,9 @@ const form = reactive({
|
|||||||
const isCreateMode = computed(() => !perfil.value)
|
const isCreateMode = computed(() => !perfil.value)
|
||||||
|
|
||||||
const modeLabel = computed(() => (isCreateMode.value ? 'Novo' : 'Editar'))
|
const modeLabel = computed(() => (isCreateMode.value ? 'Novo' : 'Editar'))
|
||||||
const modeTitle = computed(() => (isCreateMode.value ? 'Criar perfil gamer' : 'Editar perfil gamer'))
|
const modeTitle = computed(() =>
|
||||||
|
isCreateMode.value ? 'Criar perfil gamer' : 'Editar perfil gamer'
|
||||||
|
)
|
||||||
const submitLabel = computed(() => (isCreateMode.value ? 'Criar perfil' : 'Salvar alterações'))
|
const submitLabel = computed(() => (isCreateMode.value ? 'Criar perfil' : 'Salvar alterações'))
|
||||||
|
|
||||||
const clearToken = () => {
|
const clearToken = () => {
|
||||||
@@ -289,7 +287,8 @@ async function salvarPerfil() {
|
|||||||
|
|
||||||
const validationMessage = error?.data?.message
|
const validationMessage = error?.data?.message
|
||||||
const nicknameError = error?.data?.errors?.nickname?.[0]
|
const nicknameError = error?.data?.errors?.nickname?.[0]
|
||||||
errorMessage.value = nicknameError ?? validationMessage ?? 'Não foi possível salvar o perfil gamer.'
|
errorMessage.value =
|
||||||
|
nicknameError ?? validationMessage ?? 'Não foi possível salvar o perfil gamer.'
|
||||||
$toast.error(errorMessage.value, { duration: 8000 })
|
$toast.error(errorMessage.value, { duration: 8000 })
|
||||||
} finally {
|
} finally {
|
||||||
isSaving.value = false
|
isSaving.value = false
|
||||||
|
|||||||
@@ -19,11 +19,6 @@
|
|||||||
Acompanhe os jogos por período, plataforma e volume de jogadores ativos.
|
Acompanhe os jogos por período, plataforma e volume de jogadores ativos.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<NuxtLink to="/home"
|
|
||||||
class="inline-flex h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
|
||||||
Voltar
|
|
||||||
</NuxtLink>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
@@ -92,13 +87,24 @@
|
|||||||
<strong class="text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
<strong class="text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
||||||
{{ game.name }}
|
{{ game.name }}
|
||||||
</strong>
|
</strong>
|
||||||
<button type="button" :disabled="togglingId === game.name"
|
<button type="button" :disabled="togglingId === game.name" :aria-label="favoriteIds.has(game.name)
|
||||||
:aria-label="favoriteIds.has(game.name) ? 'Remover dos favoritos' : 'Adicionar aos favoritos'"
|
? 'Remover dos favoritos'
|
||||||
@click="toggleFavorite(game)"
|
: 'Adicionar aos favoritos'
|
||||||
|
" @click="toggleFavorite(game)"
|
||||||
class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-50">
|
class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-50">
|
||||||
<Icon
|
<Icon :name="togglingId === game.name
|
||||||
:name="togglingId === game.name ? 'mdi:loading' : favoriteIds.has(game.name) ? 'mdi:heart' : 'mdi:heart-outline'"
|
? 'mdi:loading'
|
||||||
:class="['text-base', togglingId === game.name ? 'animate-spin text-[#777169]' : favoriteIds.has(game.name) ? 'text-rose-500' : 'text-[#777169]']" />
|
: favoriteIds.has(game.name)
|
||||||
|
? 'mdi:heart'
|
||||||
|
: 'mdi:heart-outline'
|
||||||
|
" :class="[
|
||||||
|
'text-base',
|
||||||
|
togglingId === game.name
|
||||||
|
? 'animate-spin text-[#777169]'
|
||||||
|
: favoriteIds.has(game.name)
|
||||||
|
? 'text-rose-500'
|
||||||
|
: 'text-[#777169]'
|
||||||
|
]" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -119,8 +125,8 @@
|
|||||||
|
|
||||||
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
<p>
|
<p>
|
||||||
Microsserviço consumido: <span
|
Microsserviço consumido:
|
||||||
class="font-medium text-[#4e4e4e]">https://api-ranking-jogos-production.up.railway.app/api/v1</span>
|
<span class="font-medium text-[#4e4e4e]">https://api-ranking-jogos-production.up.railway.app/api/v1</span>
|
||||||
· Feito por Gabriel e Kaiky
|
· Feito por Gabriel e Kaiky
|
||||||
</p>
|
</p>
|
||||||
<span class="inline-flex items-center gap-1.5">
|
<span class="inline-flex items-center gap-1.5">
|
||||||
@@ -134,7 +140,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
})
|
})
|
||||||
|
|
||||||
const RANKINGS_API_BASE_URL = 'https://api-ranking-jogos-production.up.railway.app/api/v1'
|
const RANKINGS_API_BASE_URL = 'https://api-ranking-jogos-production.up.railway.app/api/v1'
|
||||||
@@ -222,7 +229,9 @@ const favoriteIds = ref(new Set())
|
|||||||
const togglingId = ref(null)
|
const togglingId = ref(null)
|
||||||
|
|
||||||
const selectedRankingMeta = computed(() => {
|
const selectedRankingMeta = computed(() => {
|
||||||
return rankingOptions.find((option) => option.value === selectedRanking.value) ?? rankingOptions[0]
|
return (
|
||||||
|
rankingOptions.find((option) => option.value === selectedRanking.value) ?? rankingOptions[0]
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const clearToken = () => {
|
const clearToken = () => {
|
||||||
@@ -284,7 +293,8 @@ async function fetchRankings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rankings.value = []
|
rankings.value = []
|
||||||
errorMessage.value = error?.data?.message ?? 'Erro ao carregar o ranking de jogos. Tente novamente.'
|
errorMessage.value =
|
||||||
|
error?.data?.message ?? 'Erro ao carregar o ranking de jogos. Tente novamente.'
|
||||||
$toast.error(errorMessage.value, { duration: 8000 })
|
$toast.error(errorMessage.value, { duration: 8000 })
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
|
|||||||
Reference in New Issue
Block a user