Compare commits
14 Commits
6cc39725fa
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 19650a3b93 | |||
| bdd9af59c8 | |||
| 60649fbf50 | |||
| d4108f5634 | |||
| 8df22b5d2b | |||
| 010ee8add4 | |||
| b37c9d6f7b | |||
| 8ed08e2869 | |||
| eaadbbc7de | |||
| add4d4512a | |||
| f643a32a90 | |||
| 98bdc96b6a | |||
| f5375c42ee | |||
| dfe8eb3a80 |
@@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<NuxtLoadingIndicator color="#292524" :height="8" />
|
||||||
<NuxtLayout>
|
<NuxtLayout>
|
||||||
<NuxtPage />
|
<NuxtPage />
|
||||||
</NuxtLayout>
|
</NuxtLayout>
|
||||||
|
|||||||
120
app/components/Sidebar.vue
Normal file
120
app/components/Sidebar.vue
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<template>
|
||||||
|
<aside
|
||||||
|
class="sticky top-0 z-50 w-full min-w-0 border-b border-[#e7e5e4] bg-white/90 backdrop-blur lg:fixed lg:inset-y-0 lg:left-0 lg:h-screen lg:w-[248px] lg:border-b-0 lg:border-r xl:w-[280px]">
|
||||||
|
<div class="flex h-full min-h-0 w-full min-w-0 flex-col gap-4 px-3 py-3 sm:px-4 lg:px-5 lg:py-6">
|
||||||
|
<NuxtLink to="/home"
|
||||||
|
class="flex min-w-0 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 shrink-0 items-center justify-center rounded-xl bg-[#292524] text-white">
|
||||||
|
<Icon name="mdi:gamepad-variant" class="text-xl" />
|
||||||
|
</span>
|
||||||
|
<span class="min-w-0 truncate">GameVerse</span>
|
||||||
|
</NuxtLink>
|
||||||
|
|
||||||
|
<nav
|
||||||
|
class="flex w-full 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:min-w-0 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="shrink-0 text-base" />
|
||||||
|
<span class="min-w-0 truncate">{{ 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 por Período',
|
||||||
|
to: '/ranking-jogos',
|
||||||
|
icon: 'mdi:trophy-outline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Ranking por Plataforma',
|
||||||
|
to: '/ranking-plataforma',
|
||||||
|
icon: 'mdi:layers-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: 'Reviews',
|
||||||
|
to: '/reviews',
|
||||||
|
icon: 'mdi:star-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 overflow-x-hidden bg-[#f5f5f5] font-sans text-[#0c0a09]">
|
||||||
|
<Sidebar />
|
||||||
|
<div class="min-w-0 overflow-x-hidden lg:pl-[248px] xl:pl-[280px]">
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -4,6 +4,11 @@
|
|||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-10 h-[420px] w-[min(92vw,760px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(232,184,196,0.58),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(167,229,211,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(244,197,168,0.5),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-10 h-[420px] w-[min(92vw,760px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(232,184,196,0.58),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(167,229,211,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(244,197,168,0.5),transparent_34%)] blur-2xl"
|
||||||
aria-hidden="true"></div>
|
aria-hidden="true"></div>
|
||||||
|
<NuxtLink to="/"
|
||||||
|
class="absolute left-4 top-4 z-10 inline-flex h-10 items-center justify-center gap-2 rounded-full border border-[#d6d3d1] bg-white/80 px-4 text-[14px] font-medium leading-none text-[#0c0a09] shadow-[0_4px_16px_rgba(0,0,0,0.04)] backdrop-blur transition hover:border-[#0c0a09] md:left-8 md:top-8">
|
||||||
|
<Icon name="mdi:arrow-left" class="text-base" />
|
||||||
|
Início
|
||||||
|
</NuxtLink>
|
||||||
|
|
||||||
<main
|
<main
|
||||||
class="relative grid w-full max-w-[1120px] grid-cols-1 items-center gap-8 md:grid-cols-[minmax(0,1fr)_minmax(340px,440px)] md:gap-16"
|
class="relative grid w-full max-w-[1120px] grid-cols-1 items-center gap-8 md:grid-cols-[minmax(0,1fr)_minmax(340px,440px)] md:gap-16"
|
||||||
@@ -93,6 +98,16 @@ import { z } from 'zod'
|
|||||||
|
|
||||||
definePageMeta({ middleware: 'guest' })
|
definePageMeta({ middleware: 'guest' })
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Redefinir senha | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Defina uma nova senha de acesso usando o token de recuperação da conta GameVerse.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { $toast } = useNuxtApp()
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-10 h-[420px] w-[min(92vw,760px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(200,184,224,0.5),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-10 h-[420px] w-[min(92vw,760px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(200,184,224,0.5),transparent_34%)] blur-2xl"
|
||||||
aria-hidden="true"></div>
|
aria-hidden="true"></div>
|
||||||
|
<NuxtLink to="/"
|
||||||
|
class="absolute left-4 top-4 z-10 inline-flex h-10 items-center justify-center gap-2 rounded-full border border-[#d6d3d1] bg-white/80 px-4 text-[14px] font-medium leading-none text-[#0c0a09] shadow-[0_4px_16px_rgba(0,0,0,0.04)] backdrop-blur transition hover:border-[#0c0a09] md:left-8 md:top-8">
|
||||||
|
<Icon name="mdi:arrow-left" class="text-base" />
|
||||||
|
Início
|
||||||
|
</NuxtLink>
|
||||||
|
|
||||||
<main
|
<main
|
||||||
class="relative grid w-full max-w-[1120px] grid-cols-1 items-center gap-8 md:grid-cols-[minmax(0,1fr)_minmax(340px,420px)] md:gap-16"
|
class="relative grid w-full max-w-[1120px] grid-cols-1 items-center gap-8 md:grid-cols-[minmax(0,1fr)_minmax(340px,420px)] md:gap-16"
|
||||||
@@ -87,6 +92,16 @@ import { z } from 'zod'
|
|||||||
|
|
||||||
definePageMeta({ middleware: 'guest' })
|
definePageMeta({ middleware: 'guest' })
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Criar conta | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Crie sua conta GameVerse de forma simples e rápida com email e senha.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
const { $toast } = useNuxtApp()
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
@@ -96,8 +111,8 @@ const toStr = (val) => (val == null ? '' : String(val))
|
|||||||
const schema = toTypedSchema(
|
const schema = toTypedSchema(
|
||||||
z.object({
|
z.object({
|
||||||
email: z.preprocess(toStr, z.string().min(1, 'Email é obrigatório').email('Email inválido')),
|
email: z.preprocess(toStr, z.string().min(1, 'Email é obrigatório').email('Email inválido')),
|
||||||
password: z.preprocess(toStr, z.string().min(8, 'A senha deve ter no mínimo 8 caracteres')),
|
password: z.preprocess(toStr, z.string().min(8, 'A senha deve ter no mínimo 8 caracteres'))
|
||||||
}),
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
async function criarConta({ email, password }) {
|
async function criarConta({ email, password }) {
|
||||||
@@ -105,7 +120,7 @@ async function criarConta({ email, password }) {
|
|||||||
try {
|
try {
|
||||||
await $fetch('/auth/register', {
|
await $fetch('/auth/register', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: { email, password },
|
body: { email, password }
|
||||||
})
|
})
|
||||||
|
|
||||||
$toast.success('Conta criada com sucesso!', { duration: 8000 })
|
$toast.success('Conta criada com sucesso!', { duration: 8000 })
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-10 h-[420px] w-[min(92vw,760px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(200,184,224,0.5),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-10 h-[420px] w-[min(92vw,760px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(200,184,224,0.5),transparent_34%)] blur-2xl"
|
||||||
aria-hidden="true"></div>
|
aria-hidden="true"></div>
|
||||||
|
<NuxtLink to="/"
|
||||||
|
class="absolute left-4 top-4 z-10 inline-flex h-10 items-center justify-center gap-2 rounded-full border border-[#d6d3d1] bg-white/80 px-4 text-[14px] font-medium leading-none text-[#0c0a09] shadow-[0_4px_16px_rgba(0,0,0,0.04)] backdrop-blur transition hover:border-[#0c0a09] md:left-8 md:top-8">
|
||||||
|
<Icon name="mdi:arrow-left" class="text-base" />
|
||||||
|
Início
|
||||||
|
</NuxtLink>
|
||||||
<main
|
<main
|
||||||
class="relative grid w-full max-w-[1120px] grid-cols-1 items-center gap-8 md:grid-cols-[minmax(0,1fr)_minmax(340px,420px)] md:gap-16"
|
class="relative grid w-full max-w-[1120px] grid-cols-1 items-center gap-8 md:grid-cols-[minmax(0,1fr)_minmax(340px,420px)] md:gap-16"
|
||||||
aria-labelledby="create-account-title">
|
aria-labelledby="create-account-title">
|
||||||
@@ -91,6 +96,16 @@ import { z } from 'zod'
|
|||||||
|
|
||||||
definePageMeta({ middleware: 'guest' })
|
definePageMeta({ middleware: 'guest' })
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Login | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Acesse sua conta GameVerse com email e senha.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
const { $toast } = useNuxtApp()
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
const token = useCookie('token', {
|
const token = useCookie('token', {
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-10 h-[420px] w-[min(92vw,760px)] -translate-x-1/2 rounded-[48px] 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"
|
class="pointer-events-none absolute left-1/2 top-10 h-[420px] w-[min(92vw,760px)] -translate-x-1/2 rounded-[48px] 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"
|
||||||
aria-hidden="true"></div>
|
aria-hidden="true"></div>
|
||||||
|
<NuxtLink to="/"
|
||||||
|
class="absolute left-4 top-4 z-10 inline-flex h-10 items-center justify-center gap-2 rounded-full border border-[#d6d3d1] bg-white/80 px-4 text-[14px] font-medium leading-none text-[#0c0a09] shadow-[0_4px_16px_rgba(0,0,0,0.04)] backdrop-blur transition hover:border-[#0c0a09] md:left-8 md:top-8">
|
||||||
|
<Icon name="mdi:arrow-left" class="text-base" />
|
||||||
|
Início
|
||||||
|
</NuxtLink>
|
||||||
|
|
||||||
<main
|
<main
|
||||||
class="relative grid w-full max-w-[1120px] grid-cols-1 items-center gap-8 md:grid-cols-[minmax(0,1fr)_minmax(340px,440px)] md:gap-16"
|
class="relative grid w-full max-w-[1120px] grid-cols-1 items-center gap-8 md:grid-cols-[minmax(0,1fr)_minmax(340px,440px)] md:gap-16"
|
||||||
@@ -73,6 +78,16 @@ import { z } from 'zod'
|
|||||||
|
|
||||||
definePageMeta({ middleware: 'guest' })
|
definePageMeta({ middleware: 'guest' })
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Recuperar senha | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Informe seu email para iniciar a recuperação da senha da sua conta GameVerse.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
const { $toast } = useNuxtApp()
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative min-h-screen overflow-hidden bg-[#f5f5f5] px-4 py-10 font-sans text-[#0c0a09] md:px-8 md:py-16">
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(196,184,232,0.6),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.56),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(196,184,232,0.6),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.56),transparent_34%)] blur-2xl"
|
||||||
aria-hidden="true"></div>
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
<main class="relative mx-auto grid w-full max-w-[800px] gap-8">
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[800px] gap-6 md:gap-8">
|
||||||
<header class="flex flex-col gap-5 sm:flex-row sm:items-center sm:justify-between">
|
<header class="flex flex-col gap-5 sm:flex-row sm:items-center sm:justify-between">
|
||||||
<p
|
<p
|
||||||
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">
|
||||||
@@ -31,15 +27,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-else-if="game">
|
<template v-else-if="game">
|
||||||
<div class="overflow-hidden rounded-2xl border border-[#e7e5e4] bg-white shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
<div
|
||||||
|
class="min-w-0 overflow-hidden rounded-2xl border border-[#e7e5e4] bg-white shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
<div v-if="game.images?.header" class="relative h-48 w-full overflow-hidden bg-[#f0efed] sm:h-64">
|
<div v-if="game.images?.header" class="relative h-48 w-full overflow-hidden bg-[#f0efed] sm:h-64">
|
||||||
<img :src="game.images.header" :alt="game.title" class="h-full w-full object-cover" />
|
<img :src="game.images.header" :alt="game.title" class="h-full w-full object-cover" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-6 p-6 md:p-8">
|
<div class="grid min-w-0 gap-6 p-4 sm:p-5 md:p-6 xl:p-8">
|
||||||
<div class="flex flex-wrap items-start justify-between gap-4">
|
<div class="flex min-w-0 flex-col items-start justify-between gap-4 lg:flex-row">
|
||||||
<div class="grid gap-2">
|
<div class="grid min-w-0 gap-2">
|
||||||
<h1 class="font-serif text-[32px] font-light leading-[1.1] tracking-[-0.64px] text-[#0c0a09]">
|
<h1
|
||||||
|
class="min-w-0 break-words font-serif text-[28px] font-light leading-[1.1] tracking-[-0.64px] text-[#0c0a09] sm:text-[32px]">
|
||||||
{{ game.title }}
|
{{ game.title }}
|
||||||
</h1>
|
</h1>
|
||||||
<p class="text-[15px] leading-[1.47] tracking-[0.15px] text-[#777169]">
|
<p class="text-[15px] leading-[1.47] tracking-[0.15px] text-[#777169]">
|
||||||
@@ -47,36 +45,47 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-wrap gap-2">
|
<div class="flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:flex-wrap">
|
||||||
<button type="button" :disabled="togglingFavorite"
|
<button type="button" :disabled="togglingFavorite"
|
||||||
: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 min-h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 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>
|
||||||
|
|
||||||
<button v-if="!isEditing" type="button" @click="startEditing"
|
<button v-if="!isEditing" type="button" @click="startEditing"
|
||||||
class="inline-flex h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 text-[13px] font-medium text-[#0c0a09] transition hover:bg-[#f0efed]">
|
class="inline-flex min-h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#0c0a09] transition hover:bg-[#f0efed]">
|
||||||
<Icon name="mdi:pencil-outline" class="text-sm" />
|
<Icon name="mdi:pencil-outline" class="text-sm" />
|
||||||
Editar
|
Editar
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div v-if="confirmingDelete" class="flex gap-2">
|
<div v-if="confirmingDelete" class="flex flex-col gap-2 sm:flex-row">
|
||||||
<button type="button" :disabled="isDeleting" @click="deleteGame"
|
<button type="button" :disabled="isDeleting" @click="deleteGame"
|
||||||
class="inline-flex h-9 items-center justify-center gap-1 rounded-full bg-red-50 px-4 text-[13px] font-medium text-red-600 transition hover:bg-red-100 disabled:opacity-50">
|
class="inline-flex min-h-9 items-center justify-center gap-1 rounded-full bg-red-50 px-4 py-2 text-[13px] font-medium text-red-600 transition hover:bg-red-100 disabled:opacity-50">
|
||||||
<Icon :name="isDeleting ? 'mdi:loading' : 'mdi:check'" class="text-sm"
|
<Icon :name="isDeleting ? 'mdi:loading' : 'mdi:check'" class="text-sm"
|
||||||
:class="isDeleting && 'animate-spin'" />
|
:class="isDeleting && 'animate-spin'" />
|
||||||
Confirmar
|
Confirmar
|
||||||
</button>
|
</button>
|
||||||
<button type="button" @click="confirmingDelete = false"
|
<button type="button" @click="confirmingDelete = false"
|
||||||
class="inline-flex h-9 items-center justify-center rounded-full border border-[#e7e5e4] px-4 text-[13px] font-medium text-[#777169] transition hover:border-[#0c0a09]">
|
class="inline-flex min-h-9 items-center justify-center rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#777169] transition hover:border-[#0c0a09]">
|
||||||
Cancelar
|
Cancelar
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<button v-else type="button" @click="confirmingDelete = true"
|
<button v-else type="button" @click="confirmingDelete = true"
|
||||||
class="inline-flex h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 text-[13px] font-medium text-[#777169] transition hover:border-red-300 hover:text-red-600">
|
class="inline-flex min-h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#777169] transition hover:border-red-300 hover:text-red-600">
|
||||||
<Icon name="mdi:trash-can-outline" class="text-sm" />
|
<Icon name="mdi:trash-can-outline" class="text-sm" />
|
||||||
Deletar
|
Deletar
|
||||||
</button>
|
</button>
|
||||||
@@ -85,16 +94,20 @@
|
|||||||
|
|
||||||
<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 min-w-0 gap-5 lg: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 min-w-0 flex-wrap gap-1.5">
|
||||||
<span v-for="genre in game.genres" :key="genre"
|
<span v-for="genre in game.genres" :key="genre"
|
||||||
class="inline-flex items-center rounded-full bg-[rgba(196,184,232,0.4)] 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(196,184,232,0.4)] px-2.5 py-1 text-[12px] font-semibold uppercase leading-none tracking-[0.8px] text-[#0c0a09]">
|
||||||
{{ genre }}
|
{{ genre }}
|
||||||
@@ -104,8 +117,9 @@
|
|||||||
|
|
||||||
<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
|
||||||
<div class="flex flex-wrap gap-1.5">
|
</p>
|
||||||
|
<div class="flex min-w-0 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]">
|
||||||
{{ platform }}
|
{{ platform }}
|
||||||
@@ -114,31 +128,45 @@
|
|||||||
</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>
|
||||||
<dd class="text-[13px] text-[#0c0a09]">{{ game.system_requirements.cpu }}</dd>
|
<dd class="min-w-0 break-words text-[13px] text-[#0c0a09]">
|
||||||
|
{{ game.system_requirements.cpu }}
|
||||||
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="game.system_requirements.gpu" class="flex gap-3">
|
<div v-if="game.system_requirements.gpu" class="flex gap-3">
|
||||||
<dt class="w-10 shrink-0 text-[13px] font-semibold text-[#777169]">GPU</dt>
|
<dt class="w-10 shrink-0 text-[13px] font-semibold text-[#777169]">GPU</dt>
|
||||||
<dd class="text-[13px] text-[#0c0a09]">{{ game.system_requirements.gpu }}</dd>
|
<dd class="min-w-0 break-words text-[13px] text-[#0c0a09]">
|
||||||
|
{{ game.system_requirements.gpu }}
|
||||||
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="game.system_requirements.ram" class="flex gap-3">
|
<div v-if="game.system_requirements.ram" class="flex gap-3">
|
||||||
<dt class="w-10 shrink-0 text-[13px] font-semibold text-[#777169]">RAM</dt>
|
<dt class="w-10 shrink-0 text-[13px] font-semibold text-[#777169]">RAM</dt>
|
||||||
<dd class="text-[13px] text-[#0c0a09]">{{ game.system_requirements.ram }}</dd>
|
<dd class="min-w-0 break-words text-[13px] text-[#0c0a09]">
|
||||||
|
{{ game.system_requirements.ram }}
|
||||||
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</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>
|
||||||
@@ -155,72 +183,72 @@
|
|||||||
<label
|
<label
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Título</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Título</label>
|
||||||
<input v-model="editForm.title" type="text"
|
<input v-model="editForm.title" type="text"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label
|
<label
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Descrição</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Descrição</label>
|
||||||
<textarea v-model="editForm.description" rows="3"
|
<textarea v-model="editForm.description" rows="3"
|
||||||
class="w-full resize-none rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white"></textarea>
|
class="w-full min-w-0 resize-none rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label
|
<label
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Developer</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Developer</label>
|
||||||
<input v-model="editForm.developer" type="text"
|
<input v-model="editForm.developer" type="text"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-5 md:grid-cols-2">
|
<div class="grid min-w-0 gap-5 xl:grid-cols-2">
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label
|
<label
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Gêneros</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Gêneros</label>
|
||||||
<input v-model="editForm.genresRaw" type="text" placeholder="Separe com vírgula"
|
<input v-model="editForm.genresRaw" type="text" placeholder="Separe com vírgula"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label
|
<label
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Plataformas</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Plataformas</label>
|
||||||
<input v-model="editForm.platformsRaw" type="text" placeholder="Separe com vírgula"
|
<input v-model="editForm.platformsRaw" type="text" placeholder="Separe com vírgula"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-5 md:grid-cols-2">
|
<div class="grid min-w-0 gap-5 xl:grid-cols-2">
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label
|
<label
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Thumbnail
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Thumbnail
|
||||||
URL</label>
|
URL</label>
|
||||||
<input v-model="editForm.thumbnail" type="url"
|
<input v-model="editForm.thumbnail" type="url"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Header
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">Header
|
||||||
URL</label>
|
URL</label>
|
||||||
<input v-model="editForm.header" type="url"
|
<input v-model="editForm.header" type="url"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-5 md:grid-cols-3">
|
<div class="grid min-w-0 gap-5 xl:grid-cols-3">
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label
|
<label
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">CPU</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">CPU</label>
|
||||||
<input v-model="editForm.cpu" type="text"
|
<input v-model="editForm.cpu" type="text"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label
|
<label
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">GPU</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">GPU</label>
|
||||||
<input v-model="editForm.gpu" type="text"
|
<input v-model="editForm.gpu" type="text"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label
|
<label
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">RAM</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">RAM</label>
|
||||||
<input v-model="editForm.ram" type="text"
|
<input v-model="editForm.ram" type="text"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -232,13 +260,13 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-end gap-3 border-t border-[#e7e5e4] pt-5">
|
<div class="flex flex-col gap-3 border-t border-[#e7e5e4] pt-5 sm:flex-row sm:justify-end">
|
||||||
<button type="button" @click="cancelEditing"
|
<button type="button" @click="cancelEditing"
|
||||||
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]">
|
class="inline-flex min-h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 py-2 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
Cancelar
|
Cancelar
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" :disabled="isSaving"
|
<button type="submit" :disabled="isSaving"
|
||||||
class="inline-flex h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
class="inline-flex min-h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 py-2 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
||||||
<Icon v-if="isSaving" name="mdi:loading" class="animate-spin text-base" />
|
<Icon v-if="isSaving" name="mdi:loading" class="animate-spin text-base" />
|
||||||
<span>{{ isSaving ? 'Salvando...' : 'Salvar alterações' }}</span>
|
<span>{{ isSaving ? 'Salvando...' : 'Salvar alterações' }}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -250,8 +278,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 +294,18 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Detalhes do jogo | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Consulte detalhes, informações e opções de gerenciamento de um jogo do catálogo.'
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
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 +379,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 +412,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 +474,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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative min-h-screen overflow-hidden bg-[#f5f5f5] px-4 py-10 font-sans text-[#0c0a09] md:px-8 md:py-16">
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(196,184,232,0.6),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.56),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(196,184,232,0.6),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.56),transparent_34%)] blur-2xl"
|
||||||
aria-hidden="true"></div>
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
<main class="relative mx-auto grid w-full max-w-[720px] gap-8" aria-labelledby="criar-title">
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[720px] gap-6 md:gap-8" aria-labelledby="criar-title">
|
||||||
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<p
|
<p
|
||||||
@@ -12,22 +13,17 @@
|
|||||||
Catálogo
|
Catálogo
|
||||||
</p>
|
</p>
|
||||||
<h1 id="criar-title"
|
<h1 id="criar-title"
|
||||||
class="my-5 max-w-[720px] font-serif text-[40px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] md:text-[48px]">
|
class="my-5 max-w-[720px] break-words font-serif text-[34px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] sm:text-[40px] md:text-[48px]">
|
||||||
Novo jogo
|
Novo jogo
|
||||||
</h1>
|
</h1>
|
||||||
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
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
|
||||||
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"
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl:p-8"
|
||||||
aria-label="Formulário de criação de jogo" @submit.prevent="submitForm">
|
aria-label="Formulário de criação de jogo" @submit.prevent="submitForm">
|
||||||
<div>
|
<div>
|
||||||
<span
|
<span
|
||||||
@@ -51,7 +47,7 @@
|
|||||||
Título <span class="text-red-500">*</span>
|
Título <span class="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input id="title" v-model="form.title" type="text" placeholder="Ex: Counter-Strike 2" required
|
<input id="title" v-model="form.title" type="text" placeholder="Ex: Counter-Strike 2" required
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
@@ -60,7 +56,7 @@
|
|||||||
Descrição <span class="text-red-500">*</span>
|
Descrição <span class="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<textarea id="description" v-model="form.description" rows="3" placeholder="Descreva o jogo..." required
|
<textarea id="description" v-model="form.description" rows="3" placeholder="Descreva o jogo..." required
|
||||||
class="w-full resize-none rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white"></textarea>
|
class="w-full min-w-0 resize-none rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
@@ -69,17 +65,17 @@
|
|||||||
Developer <span class="text-red-500">*</span>
|
Developer <span class="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input id="developer" v-model="form.developer" type="text" placeholder="Ex: Valve" required
|
<input id="developer" v-model="form.developer" type="text" placeholder="Ex: Valve" required
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-5 md:grid-cols-2">
|
<div class="grid min-w-0 gap-5 xl:grid-cols-2">
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label for="genres"
|
<label for="genres"
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
Gêneros <span class="text-red-500">*</span>
|
Gêneros <span class="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input id="genres" v-model="form.genresRaw" type="text" placeholder="Ex: FPS, Ação, Multiplayer" required
|
<input id="genres" v-model="form.genresRaw" type="text" placeholder="Ex: FPS, Ação, Multiplayer" required
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
<p class="text-xs leading-[1.4] text-[#777169]">Separe com vírgula</p>
|
<p class="text-xs leading-[1.4] text-[#777169]">Separe com vírgula</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -89,7 +85,7 @@
|
|||||||
Plataformas <span class="text-red-500">*</span>
|
Plataformas <span class="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input id="platforms" v-model="form.platformsRaw" type="text" placeholder="Ex: PC, PlayStation 5" required
|
<input id="platforms" v-model="form.platformsRaw" type="text" placeholder="Ex: PC, PlayStation 5" required
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
<p class="text-xs leading-[1.4] text-[#777169]">Separe com vírgula</p>
|
<p class="text-xs leading-[1.4] text-[#777169]">Separe com vírgula</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -100,17 +96,18 @@
|
|||||||
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 min-w-0 gap-5 xl:grid-cols-2">
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label for="thumbnail"
|
<label for="thumbnail"
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
Thumbnail URL
|
Thumbnail URL
|
||||||
</label>
|
</label>
|
||||||
<input id="thumbnail" v-model="form.thumbnail" type="url" placeholder="https://..."
|
<input id="thumbnail" v-model="form.thumbnail" type="url" placeholder="https://..."
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
@@ -119,7 +116,7 @@
|
|||||||
Header URL
|
Header URL
|
||||||
</label>
|
</label>
|
||||||
<input id="header" v-model="form.header" type="url" placeholder="https://..."
|
<input id="header" v-model="form.header" type="url" placeholder="https://..."
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -131,24 +128,24 @@
|
|||||||
</span>
|
</span>
|
||||||
<p class="mb-4 mt-3 text-[13px] leading-[1.5] text-[#777169]">Opcional.</p>
|
<p class="mb-4 mt-3 text-[13px] leading-[1.5] text-[#777169]">Opcional.</p>
|
||||||
|
|
||||||
<div class="grid gap-5 md:grid-cols-3">
|
<div class="grid min-w-0 gap-5 xl:grid-cols-3">
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label for="cpu"
|
<label for="cpu"
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">CPU</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">CPU</label>
|
||||||
<input id="cpu" v-model="form.cpu" type="text" placeholder="Ex: Intel i5-8400"
|
<input id="cpu" v-model="form.cpu" type="text" placeholder="Ex: Intel i5-8400"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label for="gpu"
|
<label for="gpu"
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">GPU</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">GPU</label>
|
||||||
<input id="gpu" v-model="form.gpu" type="text" placeholder="Ex: GTX 1060"
|
<input id="gpu" v-model="form.gpu" type="text" placeholder="Ex: GTX 1060"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
<label for="ram"
|
<label for="ram"
|
||||||
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">RAM</label>
|
class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">RAM</label>
|
||||||
<input id="ram" v-model="form.ram" type="text" placeholder="Ex: 8 GB"
|
<input id="ram" v-model="form.ram" type="text" placeholder="Ex: 8 GB"
|
||||||
class="w-full rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -161,13 +158,13 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-end gap-3 border-t border-[#e7e5e4] pt-5">
|
<div class="flex flex-col gap-3 border-t border-[#e7e5e4] pt-5 sm:flex-row sm:justify-end">
|
||||||
<NuxtLink to="/catalogo"
|
<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]">
|
class="inline-flex min-h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 py-2 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
Cancelar
|
Cancelar
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<button type="submit" :disabled="isSubmitting"
|
<button type="submit" :disabled="isSubmitting"
|
||||||
class="inline-flex h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
class="inline-flex min-h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 py-2 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
||||||
<Icon v-if="isSubmitting" name="mdi:loading" class="animate-spin text-base" />
|
<Icon v-if="isSubmitting" name="mdi:loading" class="animate-spin text-base" />
|
||||||
<span>{{ isSubmitting ? 'Salvando...' : 'Salvar jogo' }}</span>
|
<span>{{ isSubmitting ? 'Salvando...' : 'Salvar jogo' }}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -179,7 +176,18 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Novo jogo | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Preencha os dados para adicionar um novo jogo ao catálogo GameVerse.'
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
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 +224,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 +285,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
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative min-h-screen overflow-hidden bg-[#f5f5f5] px-4 py-10 font-sans text-[#0c0a09] md:px-8 md:py-16">
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(196,184,232,0.6),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.56),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(196,184,232,0.6),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.56),transparent_34%)] blur-2xl"
|
||||||
aria-hidden="true"></div>
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
<main class="relative mx-auto grid w-full max-w-[1120px] gap-8" aria-labelledby="catalogo-title">
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[1120px] gap-6 md:gap-8" aria-labelledby="catalogo-title">
|
||||||
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<p
|
<p
|
||||||
@@ -12,7 +13,7 @@
|
|||||||
Catálogo
|
Catálogo
|
||||||
</p>
|
</p>
|
||||||
<h1 id="catalogo-title"
|
<h1 id="catalogo-title"
|
||||||
class="my-5 max-w-[720px] font-serif text-[40px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] md:text-[48px]">
|
class="my-5 max-w-[720px] break-words font-serif text-[34px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] sm:text-[40px] md:text-[48px]">
|
||||||
Catálogo de jogos
|
Catálogo de jogos
|
||||||
</h1>
|
</h1>
|
||||||
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
@@ -20,30 +21,27 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex shrink-0 flex-col gap-3 sm:flex-row sm:items-center">
|
<div class="flex min-w-0 shrink-0 flex-col gap-3 sm:flex-row sm:items-center">
|
||||||
<NuxtLink to="/catalogo/criar"
|
<NuxtLink to="/catalogo/criar"
|
||||||
class="inline-flex h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09]">
|
class="inline-flex min-h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 py-2 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09]">
|
||||||
<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>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
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"
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl:p-8"
|
||||||
aria-label="Lista do catálogo de jogos">
|
aria-label="Lista do catálogo de jogos">
|
||||||
<div class="grid gap-5 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:items-end">
|
<div class="grid min-w-0 gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] xl:items-end">
|
||||||
<AppSelect id="genre-filter" v-model="selectedGenre" label="Gênero" :options="genreOptions"
|
<AppSelect id="genre-filter" v-model="selectedGenre" label="Gênero" :options="genreOptions"
|
||||||
:disabled="isLoading" />
|
:disabled="isLoading" />
|
||||||
<AppSelect id="platform-filter" v-model="selectedPlatform" label="Plataforma" :options="platformOptions"
|
<AppSelect id="platform-filter" v-model="selectedPlatform" label="Plataforma" :options="platformOptions"
|
||||||
:disabled="isLoading" />
|
:disabled="isLoading" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="isLoading" class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3" role="status" aria-live="polite">
|
<div v-if="isLoading" class="grid min-w-0 gap-4 md:grid-cols-2 2xl:grid-cols-3" role="status"
|
||||||
|
aria-live="polite">
|
||||||
<div v-for="item in 6" :key="item" class="h-56 animate-pulse rounded-xl bg-[#f0efed]"></div>
|
<div v-for="item in 6" :key="item" class="h-56 animate-pulse rounded-xl bg-[#f0efed]"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -61,9 +59,9 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
<div v-else class="grid min-w-0 gap-4 md:grid-cols-2 2xl:grid-cols-3">
|
||||||
<article v-for="game in filteredGames" :key="game.id"
|
<article v-for="game in filteredGames" :key="game.id"
|
||||||
class="flex flex-col overflow-hidden rounded-xl border border-[#e7e5e4] bg-white transition hover:shadow-[0_4px_16px_rgba(0,0,0,0.08)]">
|
class="flex min-w-0 flex-col overflow-hidden rounded-xl border border-[#e7e5e4] bg-white transition hover:shadow-[0_4px_16px_rgba(0,0,0,0.08)]">
|
||||||
<div class="relative h-36 bg-[#f0efed]">
|
<div class="relative h-36 bg-[#f0efed]">
|
||||||
<img v-if="game.images?.thumbnail" :src="game.images.thumbnail" :alt="game.title"
|
<img v-if="game.images?.thumbnail" :src="game.images.thumbnail" :alt="game.title"
|
||||||
class="h-full w-full object-cover" />
|
class="h-full w-full object-cover" />
|
||||||
@@ -71,19 +69,28 @@
|
|||||||
<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>
|
||||||
|
|
||||||
<div class="flex flex-1 flex-col gap-3 p-4">
|
<div class="flex flex-1 flex-col gap-3 p-4">
|
||||||
<div class="grid gap-1">
|
<div class="grid gap-1">
|
||||||
<h3 class="text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
<h3 class="min-w-0 break-words text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
||||||
{{ game.title }}
|
{{ game.title }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
<p class="text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
@@ -102,8 +109,9 @@
|
|||||||
{{ game.description }}
|
{{ game.description }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="flex items-center justify-between gap-2 border-t border-[#f0efed] pt-3">
|
<div
|
||||||
<div v-if="confirmingDeleteId === game.id" class="flex gap-2">
|
class="flex min-w-0 flex-col gap-2 border-t border-[#f0efed] pt-3 sm:flex-row sm:items-center sm:justify-between">
|
||||||
|
<div v-if="confirmingDeleteId === game.id" class="flex flex-wrap gap-2">
|
||||||
<button type="button" :disabled="deletingId === game.id" @click="confirmDelete(game)"
|
<button type="button" :disabled="deletingId === game.id" @click="confirmDelete(game)"
|
||||||
class="inline-flex h-7 items-center justify-center gap-1 rounded-full bg-red-50 px-3 text-[12px] font-medium text-red-600 transition hover:bg-red-100 disabled:opacity-50">
|
class="inline-flex h-7 items-center justify-center gap-1 rounded-full bg-red-50 px-3 text-[12px] font-medium text-red-600 transition hover:bg-red-100 disabled:opacity-50">
|
||||||
<Icon :name="deletingId === game.id ? 'mdi:loading' : 'mdi:check'" class="text-xs"
|
<Icon :name="deletingId === game.id ? 'mdi:loading' : 'mdi:check'" class="text-xs"
|
||||||
@@ -122,7 +130,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<NuxtLink :to="`/catalogo/${game.id}`"
|
<NuxtLink :to="`/catalogo/${game.id}`"
|
||||||
class="inline-flex h-7 items-center justify-center gap-1 rounded-full border border-[#e7e5e4] px-3 text-[12px] font-medium text-[#0c0a09] transition hover:border-[#0c0a09]">
|
class="inline-flex min-h-7 items-center justify-center gap-1 rounded-full border border-[#e7e5e4] px-3 py-1 text-center text-[12px] font-medium text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
Ver detalhes
|
Ver detalhes
|
||||||
<Icon name="mdi:arrow-right" class="text-xs" />
|
<Icon name="mdi:arrow-right" class="text-xs" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
@@ -134,8 +142,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 +157,18 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Catálogo de jogos | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Explore o catálogo completo de jogos e filtre por gênero e plataforma.'
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
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 +318,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
|
||||||
}
|
}
|
||||||
|
|||||||
125
app/pages/(protected)/dados-conta/index.vue
Normal file
125
app/pages/(protected)/dados-conta/index.vue
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="relative min-h-[calc(100vh-66px)] overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 sm:py-12 md:px-6 md:py-16 xl:px-8">
|
||||||
|
<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 min-w-0 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 lg:grid-cols-[140px_minmax(0,1fr)] lg:gap-5 lg:pt-4 xl: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'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Dados da conta | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Consulte os dados retornados pelo perfil da sua sessão atual no GameVerse.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
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>
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative min-h-screen overflow-hidden bg-[#f5f5f5] px-4 py-10 font-sans text-[#0c0a09] md:px-8 md:py-16">
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(232,184,196,0.6),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(168,200,232,0.56),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(232,184,196,0.6),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,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-[1120px] gap-8" aria-labelledby="favoritos-title">
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[1120px] gap-6 md:gap-8" aria-labelledby="favoritos-title">
|
||||||
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<p
|
<p
|
||||||
@@ -12,28 +13,17 @@
|
|||||||
Favoritos
|
Favoritos
|
||||||
</p>
|
</p>
|
||||||
<h1 id="favoritos-title"
|
<h1 id="favoritos-title"
|
||||||
class="my-5 max-w-[720px] font-serif text-[40px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] md:text-[48px]">
|
class="my-5 max-w-[720px] break-words font-serif text-[34px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] sm:text-[40px] md:text-[48px]">
|
||||||
Meus favoritos
|
Meus favoritos
|
||||||
</h1>
|
</h1>
|
||||||
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
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
|
||||||
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"
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl:p-8"
|
||||||
aria-label="Lista de jogos favoritos">
|
aria-label="Lista de jogos favoritos">
|
||||||
<div>
|
<div>
|
||||||
<span
|
<span
|
||||||
@@ -67,27 +57,29 @@
|
|||||||
|
|
||||||
<div v-else class="overflow-hidden rounded-xl border border-[#e7e5e4]">
|
<div v-else class="overflow-hidden rounded-xl border border-[#e7e5e4]">
|
||||||
<div
|
<div
|
||||||
class="hidden bg-[#fafafa] px-4 py-3 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] md:grid md:grid-cols-[minmax(0,1fr)_160px] md:gap-4">
|
class="hidden bg-[#fafafa] px-4 py-3 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] lg:grid lg:grid-cols-[minmax(0,1fr)_160px] lg:gap-4">
|
||||||
<span>Jogo</span>
|
<span>Jogo</span>
|
||||||
<span>Ação</span>
|
<span>Ação</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="grid divide-y divide-[#e7e5e4]">
|
<ul class="grid divide-y divide-[#e7e5e4]">
|
||||||
<li v-for="game in favorites" :key="game.id"
|
<li v-for="game in favorites" :key="game.id"
|
||||||
class="grid items-center gap-4 bg-white p-4 md:grid-cols-[minmax(0,1fr)_160px] md:gap-4">
|
class="grid min-w-0 items-center gap-4 bg-white p-4 lg:grid-cols-[minmax(0,1fr)_160px] lg:gap-4">
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex min-w-0 items-center gap-3">
|
||||||
<Icon name="mdi:heart" class="shrink-0 text-rose-500" />
|
<Icon name="mdi:heart" class="shrink-0 text-rose-500" />
|
||||||
<span class="text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
<span class="min-w-0 break-words text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
||||||
{{ game.game_id }}
|
{{ game.game_id }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" :disabled="removingId === game.game_id"
|
<button type="button" :disabled="removingId === game.game_id"
|
||||||
:aria-label="`Remover ${game.game_id} dos favoritos`" @click="removeFavorite(game)"
|
:aria-label="`Remover ${game.game_id} dos favoritos`" @click="removeFavorite(game)"
|
||||||
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 min-h-9 w-full items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium leading-none text-[#777169] transition hover:border-red-300 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-50 sm:w-fit lg:w-full">
|
||||||
<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 +88,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 +103,18 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Favoritos | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Gerencie os jogos que você salvou como favoritos no GameVerse.'
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
const WISHLIST_API_BASE_URL = 'https://gameverse-wishlist-production.up.railway.app'
|
const WISHLIST_API_BASE_URL = 'https://gameverse-wishlist-production.up.railway.app'
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative min-h-screen overflow-hidden bg-[#f5f5f5] px-4 py-10 font-sans text-[#0c0a09] md:px-8 md:py-16">
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(244,197,168,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(167,229,211,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(168,200,232,0.52),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(244,197,168,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(167,229,211,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(168,200,232,0.52),transparent_34%)] blur-2xl"
|
||||||
aria-hidden="true"></div>
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
<main class="relative mx-auto grid w-full max-w-[1120px] gap-8" aria-labelledby="gift-card-title">
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[1120px] gap-6 md:gap-8" aria-labelledby="gift-card-title">
|
||||||
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<p
|
<p
|
||||||
@@ -12,23 +13,18 @@
|
|||||||
Carteira
|
Carteira
|
||||||
</p>
|
</p>
|
||||||
<h1 id="gift-card-title"
|
<h1 id="gift-card-title"
|
||||||
class="my-5 max-w-[720px] font-serif text-[40px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] md:text-[48px]">
|
class="my-5 max-w-[720px] break-words font-serif text-[34px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] sm:text-[40px] md:text-[48px]">
|
||||||
Gift Cards
|
Gift Cards
|
||||||
</h1>
|
</h1>
|
||||||
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
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 min-w-0 gap-6 md:gap-8 xl:grid-cols-2">
|
||||||
<section
|
<section
|
||||||
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"
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl:p-8"
|
||||||
aria-label="Criar gift card">
|
aria-label="Criar gift card">
|
||||||
<div>
|
<div>
|
||||||
<span
|
<span
|
||||||
@@ -46,11 +42,11 @@
|
|||||||
Valor inicial (R$)
|
Valor inicial (R$)
|
||||||
</label>
|
</label>
|
||||||
<input id="balance" v-model.number="createForm.balance" type="number" min="1" step="0.01" required
|
<input id="balance" v-model.number="createForm.balance" type="number" min="1" step="0.01" required
|
||||||
class="h-11 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
class="h-11 w-full min-w-0 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
||||||
placeholder="100.00" />
|
placeholder="100.00" />
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" :disabled="isCreating"
|
<button type="submit" :disabled="isCreating"
|
||||||
class="inline-flex h-10 w-fit items-center justify-center gap-2 rounded-full bg-[#292524] px-6 text-[15px] font-medium text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
class="inline-flex min-h-10 w-full items-center justify-center gap-2 rounded-full bg-[#292524] px-6 py-2 text-[15px] font-medium text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70 sm:w-fit">
|
||||||
<Icon v-if="isCreating" name="mdi:loading" class="animate-spin text-base" />
|
<Icon v-if="isCreating" name="mdi:loading" class="animate-spin text-base" />
|
||||||
<span>{{ isCreating ? 'Criando...' : 'Criar gift card' }}</span>
|
<span>{{ isCreating ? 'Criando...' : 'Criar gift card' }}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -58,7 +54,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
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"
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl:p-8"
|
||||||
aria-label="Consultar e resgatar gift card">
|
aria-label="Consultar e resgatar gift card">
|
||||||
<div>
|
<div>
|
||||||
<span
|
<span
|
||||||
@@ -76,11 +72,11 @@
|
|||||||
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 w-full min-w-0 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"
|
||||||
class="inline-flex h-10 w-fit items-center justify-center gap-2 rounded-full border border-[#d6d3d1] bg-transparent px-6 text-[15px] font-medium text-[#0c0a09] transition hover:border-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
class="inline-flex min-h-10 w-full items-center justify-center gap-2 rounded-full border border-[#d6d3d1] bg-transparent px-6 py-2 text-[15px] font-medium text-[#0c0a09] transition hover:border-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70 sm:w-fit">
|
||||||
<Icon v-if="isConsulting" name="mdi:loading" class="animate-spin text-base" />
|
<Icon v-if="isConsulting" name="mdi:loading" class="animate-spin text-base" />
|
||||||
<span>{{ isConsulting ? 'Consultando...' : 'Consultar saldo' }}</span>
|
<span>{{ isConsulting ? 'Consultando...' : 'Consultar saldo' }}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -92,11 +88,11 @@
|
|||||||
Valor do resgate (R$)
|
Valor do resgate (R$)
|
||||||
</label>
|
</label>
|
||||||
<input id="amount" v-model.number="operationForm.amount" type="number" min="0.01" step="0.01" required
|
<input id="amount" v-model.number="operationForm.amount" type="number" min="0.01" step="0.01" required
|
||||||
class="h-11 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
class="h-11 w-full min-w-0 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
||||||
placeholder="25.00" />
|
placeholder="25.00" />
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" :disabled="isRedeeming"
|
<button type="submit" :disabled="isRedeeming"
|
||||||
class="inline-flex h-10 w-fit items-center justify-center gap-2 rounded-full bg-[#292524] px-6 text-[15px] font-medium text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
class="inline-flex min-h-10 w-full items-center justify-center gap-2 rounded-full bg-[#292524] px-6 py-2 text-[15px] font-medium text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70 sm:w-fit">
|
||||||
<Icon v-if="isRedeeming" name="mdi:loading" class="animate-spin text-base" />
|
<Icon v-if="isRedeeming" name="mdi:loading" class="animate-spin text-base" />
|
||||||
<span>{{ isRedeeming ? 'Resgatando...' : 'Resgatar valor' }}</span>
|
<span>{{ isRedeeming ? 'Resgatando...' : 'Resgatar valor' }}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -105,7 +101,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' }}
|
||||||
@@ -115,7 +113,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
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"
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl:p-8"
|
||||||
aria-label="Meus gift cards">
|
aria-label="Meus gift cards">
|
||||||
<div>
|
<div>
|
||||||
<span
|
<span
|
||||||
@@ -145,15 +143,20 @@
|
|||||||
<div v-else class="overflow-hidden rounded-xl border border-[#e7e5e4]">
|
<div v-else class="overflow-hidden rounded-xl border border-[#e7e5e4]">
|
||||||
<ul class="grid divide-y divide-[#e7e5e4]">
|
<ul class="grid divide-y divide-[#e7e5e4]">
|
||||||
<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 min-w-0 flex-col gap-3 bg-white p-4 lg:flex-row lg:items-center lg:justify-between">
|
||||||
<div class="grid gap-1">
|
<div class="grid min-w-0 gap-1">
|
||||||
<span class="font-mono text-base font-medium tracking-wider text-[#0c0a09]">{{ card.code }}</span>
|
<span class="min-w-0 break-words 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 min-w-0 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,18 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Gift Cards | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Crie cartões, consulte saldo por código e realize resgates com segurança.'
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
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,268 @@
|
|||||||
<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-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl: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 min-w-0 max-w-[1180px] gap-6 md: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 min-w-0 gap-6 2xl:grid-cols-[minmax(0,1.45fr)_minmax(300px,0.55fr)] 2xl:items-stretch">
|
||||||
<div class="min-w-0">
|
<div class="grid min-w-0 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-[34px] font-light leading-[1.05] tracking-[-1.2px] text-[#0c0a09] sm:text-[40px] md:text-[52px] xl:text-[60px] xl: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 min-w-0 gap-4 md:grid-cols-2 2xl: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] min-w-0 content-between rounded-2xl border border-[#e7e5e4] bg-white p-4 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)] sm:p-5">
|
||||||
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="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]">
|
class="min-w-0 break-words text-[22px] font-medium leading-[1.18] tracking-[0.16px] text-[#0c0a09]">
|
||||||
Perfil
|
{{ card.value }}
|
||||||
</span>
|
</strong>
|
||||||
<h2
|
<p class="m-0 text-[13px] leading-[1.5] tracking-[0.13px] text-[#777169]">
|
||||||
class="mt-4 font-serif text-[26px] font-light leading-[1.13] tracking-[-0.32px] text-[#0c0a09] sm:text-3xl">
|
{{ card.helper }}
|
||||||
Dados da conta
|
</p>
|
||||||
</h2>
|
</div>
|
||||||
</div>
|
</NuxtLink>
|
||||||
|
|
||||||
<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 min-w-0 gap-6 md:gap-8 2xl:grid-cols-[minmax(0,1.35fr)_minmax(320px,0.65fr)]">
|
||||||
|
<article
|
||||||
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl: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 min-h-10 w-full min-w-0 items-center justify-center gap-2 rounded-full border border-[#d6d3d1] bg-transparent px-5 py-2 text-center text-[15px] font-medium leading-[1.2] text-[#0c0a09] transition hover:border-[#0c0a09] sm:w-fit">
|
||||||
|
<span class="min-w-0 break-words">Ver ranking completo</span>
|
||||||
|
<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="flex min-w-0 flex-col gap-3 border-b border-[#e7e5e4] bg-white p-4 last:border-b-0 sm:flex-row sm:items-center">
|
||||||
|
<span
|
||||||
|
class="inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-[#292524] text-[15px] font-medium leading-none text-white">
|
||||||
|
{{ index + 1 }}
|
||||||
|
</span>
|
||||||
|
<div class="min-w-0 flex-1">
|
||||||
|
<strong
|
||||||
|
class="block min-w-0 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>
|
||||||
|
<div class="flex min-w-0 flex-wrap gap-x-4 gap-y-1 sm:justify-end">
|
||||||
|
<span class="whitespace-nowrap text-[15px] leading-[1.47] tracking-[0.15px] text-[#292524]">
|
||||||
|
{{ formatNumber(game.active_players) }} jogadores
|
||||||
|
</span>
|
||||||
|
<span class="whitespace-nowrap text-[15px] leading-[1.47] tracking-[0.15px] text-[#292524]">
|
||||||
|
{{ formatNumber(game.weekly_points) }} pts
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</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 min-w-0 gap-4">
|
||||||
|
<article
|
||||||
|
class="grid min-w-0 gap-4 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6"
|
||||||
|
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 min-h-10 min-w-0 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 py-2 text-center text-[15px] font-medium leading-[1.2] text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
|
Abrir perfil gamer
|
||||||
|
</NuxtLink>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article
|
||||||
|
class="grid min-w-0 gap-4 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6"
|
||||||
|
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 min-w-0 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 min-w-0 items-center gap-2">
|
||||||
|
<Icon :name="shortcut.icon" class="shrink-0 text-base text-[#777169]" />
|
||||||
|
{{ shortcut.label }}
|
||||||
|
</span>
|
||||||
|
<Icon name="mdi:arrow-right" class="shrink-0 text-base text-[#777169]" />
|
||||||
|
</NuxtLink>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</aside>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="grid min-w-0 gap-4 sm:grid-cols-2 xl:grid-cols-4" aria-label="Prévia dos serviços">
|
||||||
|
<article v-for="service in servicePreviews" :key="service.title"
|
||||||
|
class="grid min-w-0 gap-4 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6">
|
||||||
|
<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 +270,28 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Home | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content:
|
||||||
|
'Acompanhe sua sessão, ranking semanal, favoritos, catálogo, gift cards e perfil gamer em um só lugar.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const RANKINGS_API_BASE_URL = 'https://api-ranking-jogos-production.up.railway.app/api/v1'
|
||||||
|
const COMPARE_API_BASE_URL = 'https://ranking-plataforma.onrender.com'
|
||||||
|
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 +300,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 +324,377 @@ 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 rankingPlataforma = reactive({
|
||||||
|
isLoading: true,
|
||||||
|
error: '',
|
||||||
|
items: []
|
||||||
|
})
|
||||||
|
|
||||||
|
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 rankingPlataformaItems = computed(() =>
|
||||||
|
rankingPlataforma.items.slice(0, 3).map((g) => `${g.name} · ${g.platform} · ${g.score}`)
|
||||||
|
)
|
||||||
|
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: 'Ranking por plataforma',
|
||||||
|
to: '/ranking-plataforma',
|
||||||
|
icon: 'mdi:layers-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'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
badge: 'Plataformas',
|
||||||
|
badgeClass: 'bg-[rgba(196,184,232,0.56)]',
|
||||||
|
title: 'Ranking por plataforma',
|
||||||
|
icon: 'mdi:layers-outline',
|
||||||
|
loading: rankingPlataforma.isLoading,
|
||||||
|
error: rankingPlataforma.error,
|
||||||
|
items: rankingPlataformaItems.value,
|
||||||
|
empty: 'Nenhum dado disponível.',
|
||||||
|
to: '/ranking-plataforma',
|
||||||
|
action: 'Ver ranking completo'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
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 fetchRankingPlataforma() {
|
||||||
|
rankingPlataforma.isLoading = true
|
||||||
|
rankingPlataforma.error = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await $fetch(`${COMPARE_API_BASE_URL}/compare`, {
|
||||||
|
headers: authHeaders()
|
||||||
|
})
|
||||||
|
rankingPlataforma.items = Array.isArray(data?.data) ? data.data : []
|
||||||
|
} catch (error) {
|
||||||
|
if (await tratarErroAuth(error)) return
|
||||||
|
rankingPlataforma.items = []
|
||||||
|
rankingPlataforma.error = error?.data?.message ?? 'Erro ao carregar ranking por plataforma.'
|
||||||
|
} finally {
|
||||||
|
rankingPlataforma.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(),
|
||||||
|
fetchRankingPlataforma()
|
||||||
|
])
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative min-h-screen overflow-hidden bg-[#f5f5f5] px-4 py-10 font-sans text-[#0c0a09] md:px-8 md:py-16">
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(232,184,196,0.55),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(168,200,232,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.58),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(232,184,196,0.55),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(168,200,232,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.58),transparent_34%)] blur-2xl"
|
||||||
aria-hidden="true"></div>
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
<main class="relative mx-auto grid w-full max-w-[960px] gap-8" aria-labelledby="perfil-gamer-title">
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[960px] gap-6 md:gap-8"
|
||||||
|
aria-labelledby="perfil-gamer-title">
|
||||||
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<p
|
<p
|
||||||
@@ -12,22 +14,17 @@
|
|||||||
Perfil
|
Perfil
|
||||||
</p>
|
</p>
|
||||||
<h1 id="perfil-gamer-title"
|
<h1 id="perfil-gamer-title"
|
||||||
class="my-5 max-w-[720px] font-serif text-[40px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] md:text-[48px]">
|
class="my-5 max-w-[720px] break-words font-serif text-[34px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] sm:text-[40px] md:text-[48px]">
|
||||||
Perfil Gamer
|
Perfil Gamer
|
||||||
</h1>
|
</h1>
|
||||||
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
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
|
||||||
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"
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl:p-8"
|
||||||
aria-label="Formulário do perfil gamer">
|
aria-label="Formulário do perfil gamer">
|
||||||
<div>
|
<div>
|
||||||
<span
|
<span
|
||||||
@@ -55,7 +52,7 @@
|
|||||||
Nickname
|
Nickname
|
||||||
</label>
|
</label>
|
||||||
<input id="nickname" v-model="form.nickname" type="text" required maxlength="80"
|
<input id="nickname" v-model="form.nickname" type="text" required maxlength="80"
|
||||||
class="h-11 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
class="h-11 w-full min-w-0 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
||||||
placeholder="Seu apelido no GameVerse" />
|
placeholder="Seu apelido no GameVerse" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -64,7 +61,7 @@
|
|||||||
Bio
|
Bio
|
||||||
</label>
|
</label>
|
||||||
<textarea id="bio" v-model="form.bio" rows="4"
|
<textarea id="bio" v-model="form.bio" rows="4"
|
||||||
class="rounded-xl border border-[#e7e5e4] px-4 py-3 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] px-4 py-3 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
||||||
placeholder="Conte um pouco sobre você como jogador"></textarea>
|
placeholder="Conte um pouco sobre você como jogador"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -73,7 +70,7 @@
|
|||||||
País
|
País
|
||||||
</label>
|
</label>
|
||||||
<input id="country" v-model="form.country" type="text" maxlength="80"
|
<input id="country" v-model="form.country" type="text" maxlength="80"
|
||||||
class="h-11 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
class="h-11 w-full min-w-0 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
||||||
placeholder="Brasil" />
|
placeholder="Brasil" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -82,7 +79,7 @@
|
|||||||
Plataformas favoritas
|
Plataformas favoritas
|
||||||
</label>
|
</label>
|
||||||
<input id="platforms" v-model="form.platformsText" type="text"
|
<input id="platforms" v-model="form.platformsText" type="text"
|
||||||
class="h-11 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
class="h-11 w-full min-w-0 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
||||||
placeholder="Steam, Epic Games, PlayStation" />
|
placeholder="Steam, Epic Games, PlayStation" />
|
||||||
<p class="m-0 text-xs text-[#777169]">Separe por vírgula.</p>
|
<p class="m-0 text-xs text-[#777169]">Separe por vírgula.</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -92,7 +89,7 @@
|
|||||||
Jogos favoritos
|
Jogos favoritos
|
||||||
</label>
|
</label>
|
||||||
<input id="games" v-model="form.gamesText" type="text"
|
<input id="games" v-model="form.gamesText" type="text"
|
||||||
class="h-11 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
class="h-11 w-full min-w-0 rounded-xl border border-[#e7e5e4] px-4 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09]"
|
||||||
placeholder="Valorant, Elden Ring, Hades" />
|
placeholder="Valorant, Elden Ring, Hades" />
|
||||||
<p class="m-0 text-xs text-[#777169]">Separe por vírgula.</p>
|
<p class="m-0 text-xs text-[#777169]">Separe por vírgula.</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -103,15 +100,15 @@
|
|||||||
class="h-20 w-20 rounded-full border border-[#e7e5e4] object-cover" />
|
class="h-20 w-20 rounded-full border border-[#e7e5e4] object-cover" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-wrap gap-3 pt-2">
|
<div class="flex flex-col gap-3 pt-2 sm:flex-row sm:flex-wrap">
|
||||||
<button type="submit" :disabled="isSaving"
|
<button type="submit" :disabled="isSaving"
|
||||||
class="inline-flex h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-6 text-[15px] font-medium text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
class="inline-flex min-h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-6 py-2 text-[15px] font-medium text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
||||||
<Icon v-if="isSaving" name="mdi:loading" class="animate-spin text-base" />
|
<Icon v-if="isSaving" name="mdi:loading" class="animate-spin text-base" />
|
||||||
<span>{{ isSaving ? 'Salvando...' : submitLabel }}</span>
|
<span>{{ isSaving ? 'Salvando...' : submitLabel }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button v-if="perfil" type="button" :disabled="isSaving" @click="removerPerfil"
|
<button v-if="perfil" type="button" :disabled="isSaving" @click="removerPerfil"
|
||||||
class="inline-flex h-10 items-center justify-center rounded-full border border-red-300 bg-transparent px-6 text-[15px] font-medium text-red-700 transition hover:border-red-500 disabled:cursor-not-allowed disabled:opacity-70">
|
class="inline-flex min-h-10 items-center justify-center rounded-full border border-red-300 bg-transparent px-6 py-2 text-[15px] font-medium text-red-700 transition hover:border-red-500 disabled:cursor-not-allowed disabled:opacity-70">
|
||||||
Remover perfil
|
Remover perfil
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -120,8 +117,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 +132,18 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Perfil gamer | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Gerencie seu apelido, bio, país e preferências de plataformas e jogos.'
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
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 +173,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 +299,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
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative min-h-screen overflow-hidden bg-[#f5f5f5] px-4 py-10 font-sans text-[#0c0a09] md:px-8 md:py-16">
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(168,200,232,0.56),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,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-[1120px] gap-8" aria-labelledby="ranking-title">
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[1120px] gap-6 md:gap-8" aria-labelledby="ranking-title">
|
||||||
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<p
|
<p
|
||||||
@@ -12,24 +13,19 @@
|
|||||||
Rankings
|
Rankings
|
||||||
</p>
|
</p>
|
||||||
<h1 id="ranking-title"
|
<h1 id="ranking-title"
|
||||||
class="my-5 max-w-[720px] font-serif text-[40px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] md:text-[48px]">
|
class="my-5 max-w-[720px] break-words font-serif text-[34px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] sm:text-[40px] md:text-[48px]">
|
||||||
Ranking de jogos
|
Ranking de jogos
|
||||||
</h1>
|
</h1>
|
||||||
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
Acompanhe os jogos por período, plataforma e volume de jogadores ativos.
|
Acompanhe os jogos por período 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
|
||||||
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"
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl:p-8"
|
||||||
aria-label="Lista de ranking de jogos">
|
aria-label="Lista de ranking de jogos">
|
||||||
<div class="grid gap-5 md:grid-cols-[minmax(0,1fr)_minmax(240px,320px)] md:items-end">
|
<div class="grid min-w-0 gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(240px,320px)] xl:items-end">
|
||||||
<div>
|
<div>
|
||||||
<span
|
<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]">
|
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]">
|
||||||
@@ -61,7 +57,7 @@
|
|||||||
|
|
||||||
<div v-else class="overflow-hidden rounded-xl border border-[#e7e5e4]">
|
<div v-else class="overflow-hidden rounded-xl border border-[#e7e5e4]">
|
||||||
<div
|
<div
|
||||||
class="hidden bg-[#fafafa] px-4 py-3 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] md:grid md:grid-cols-[72px_minmax(180px,1.5fr)_minmax(130px,1fr)_repeat(4,minmax(100px,1fr))] md:gap-4">
|
class="hidden bg-[#fafafa] px-4 py-3 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] xl:grid xl:grid-cols-[72px_minmax(180px,1.5fr)_minmax(130px,1fr)_repeat(4,minmax(100px,1fr))] xl:gap-4">
|
||||||
<span>Posição</span>
|
<span>Posição</span>
|
||||||
<span>Jogo</span>
|
<span>Jogo</span>
|
||||||
<span>Plataforma</span>
|
<span>Plataforma</span>
|
||||||
@@ -73,9 +69,9 @@
|
|||||||
|
|
||||||
<ol class="grid divide-y divide-[#e7e5e4]">
|
<ol class="grid divide-y divide-[#e7e5e4]">
|
||||||
<li v-for="(game, index) in rankings" :key="game.id"
|
<li v-for="(game, index) in rankings" :key="game.id"
|
||||||
class="grid gap-4 bg-white p-4 md:grid-cols-[72px_minmax(180px,1.5fr)_minmax(130px,1fr)_repeat(4,minmax(100px,1fr))] md:items-center md:gap-4">
|
class="grid min-w-0 gap-4 bg-white p-4 xl:grid-cols-[72px_minmax(180px,1.5fr)_minmax(130px,1fr)_repeat(4,minmax(100px,1fr))] xl:items-center xl:gap-4">
|
||||||
<div class="flex items-center justify-between gap-3 md:block">
|
<div class="flex items-center justify-between gap-3 xl:block">
|
||||||
<span class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] md:hidden">
|
<span class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] xl:hidden">
|
||||||
Posição
|
Posição
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
@@ -85,30 +81,42 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-1">
|
<div class="grid gap-1">
|
||||||
<span class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] md:hidden">
|
<span class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] xl:hidden">
|
||||||
Jogo
|
Jogo
|
||||||
</span>
|
</span>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex min-w-0 items-center gap-2">
|
||||||
<strong class="text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
<strong class="min-w-0 break-words 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>
|
||||||
|
|
||||||
<div v-for="stat in getGameStats(game)" :key="stat.label"
|
<div v-for="stat in getGameStats(game)" :key="stat.label"
|
||||||
class="flex items-center justify-between gap-3 md:block">
|
class="flex min-w-0 items-center justify-between gap-3 xl:block">
|
||||||
<span class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] md:hidden">
|
<span class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] xl:hidden">
|
||||||
{{ stat.label }}
|
{{ stat.label }}
|
||||||
</span>
|
</span>
|
||||||
<span class="text-[15px] leading-[1.47] tracking-[0.15px] text-[#292524]">
|
<span
|
||||||
|
class="min-w-0 break-words text-right text-[15px] leading-[1.47] tracking-[0.15px] text-[#292524] xl:text-left">
|
||||||
{{ stat.value }}
|
{{ stat.value }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -119,8 +127,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 +142,18 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: 'auth'
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Ranking de jogos | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Acompanhe jogos por período, plataforma e volume de jogadores ativos.'
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
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'
|
||||||
@@ -162,41 +181,6 @@ const rankingOptions = [
|
|||||||
badge: 'Ano',
|
badge: 'Ano',
|
||||||
title: 'Ranking anual'
|
title: 'Ranking anual'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: 'Steam',
|
|
||||||
value: 'steam',
|
|
||||||
endpoint: '/rankings/platforms/Steam',
|
|
||||||
badge: 'Steam',
|
|
||||||
title: 'Ranking da Steam'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Epic Games',
|
|
||||||
value: 'epic-games',
|
|
||||||
endpoint: '/rankings/platforms/Epic Games',
|
|
||||||
badge: 'Epic Games',
|
|
||||||
title: 'Ranking da Epic Games'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Riot Launcher',
|
|
||||||
value: 'riot-launcher',
|
|
||||||
endpoint: '/rankings/platforms/Riot Launcher',
|
|
||||||
badge: 'Riot Launcher',
|
|
||||||
title: 'Ranking da Riot Launcher'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Multiplataforma',
|
|
||||||
value: 'multi-platform',
|
|
||||||
endpoint: '/rankings/platforms/Multiplataforma',
|
|
||||||
badge: 'Multiplataforma',
|
|
||||||
title: 'Ranking multiplataforma'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Battle.net',
|
|
||||||
value: 'battle-net',
|
|
||||||
endpoint: '/rankings/platforms/Battle.net',
|
|
||||||
badge: 'Battle.net',
|
|
||||||
title: 'Ranking da Battle.net'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Mais jogados',
|
label: 'Mais jogados',
|
||||||
value: 'most-played',
|
value: 'most-played',
|
||||||
@@ -222,7 +206,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 +270,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
|
||||||
|
|||||||
318
app/pages/(protected)/ranking-plataforma/index.vue
Normal file
318
app/pages/(protected)/ranking-plataforma/index.vue
Normal file
@@ -0,0 +1,318 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
|
<div
|
||||||
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(196,184,232,0.5),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(168,200,232,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.56),transparent_34%)] blur-2xl"
|
||||||
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[1120px] gap-6 md:gap-8"
|
||||||
|
aria-labelledby="ranking-plataforma-title">
|
||||||
|
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
||||||
|
<div>
|
||||||
|
<p
|
||||||
|
class="m-0 inline-flex rounded-full bg-[rgba(196,184,232,0.56)] px-3 py-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
Rankings
|
||||||
|
</p>
|
||||||
|
<h1 id="ranking-plataforma-title"
|
||||||
|
class="my-5 max-w-[720px] break-words font-serif text-[34px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] sm:text-[40px] md:text-[48px]">
|
||||||
|
Ranking por plataforma
|
||||||
|
</h1>
|
||||||
|
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
|
Compare os jogos mais bem avaliados de cada plataforma em um ranking unificado por pontuação.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section
|
||||||
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl:p-8"
|
||||||
|
aria-label="Lista de ranking por plataforma">
|
||||||
|
<div class="grid min-w-0 gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(240px,320px)] xl:items-end">
|
||||||
|
<div>
|
||||||
|
<span
|
||||||
|
class="inline-flex min-h-6 items-center rounded-full bg-[rgba(196,184,232,0.56)] px-2.5 py-1 text-xs font-semibold uppercase leading-none tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
{{ selectedPlatform === 'all' ? 'Todas as plataformas' : selectedPlatform }}
|
||||||
|
</span>
|
||||||
|
<h2 class="mt-4 font-serif text-3xl font-light leading-[1.13] tracking-[-0.32px] text-[#0c0a09]">
|
||||||
|
{{ selectedPlatform === 'all' ? 'Ranking geral por plataforma' : `Ranking — ${selectedPlatform}` }}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<AppSelect id="platform-filter" v-model="selectedPlatform" label="Filtrar por plataforma"
|
||||||
|
:options="platformOptions" :disabled="isLoading" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="isLoading" class="grid gap-3" role="status" aria-live="polite">
|
||||||
|
<div v-for="item in 4" :key="item" class="h-20 animate-pulse rounded-xl bg-[#f0efed]"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="errorMessage"
|
||||||
|
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">
|
||||||
|
{{ errorMessage }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="!filteredRankings.length"
|
||||||
|
class="rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-6 text-center text-[15px] leading-[1.47] tracking-[0.15px] text-[#777169]">
|
||||||
|
Nenhum jogo encontrado para esta plataforma.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Mobile: cards horizontais -->
|
||||||
|
<ol class="grid gap-2.5 xl:hidden">
|
||||||
|
<li v-for="game in filteredRankings" :key="game.rank"
|
||||||
|
class="flex items-center gap-3 rounded-xl border border-[#e7e5e4] bg-white p-3">
|
||||||
|
<span
|
||||||
|
class="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[#292524] text-[13px] font-semibold leading-none text-white">
|
||||||
|
{{ game.rank }}
|
||||||
|
</span>
|
||||||
|
<img v-if="game.image" :src="game.image" :alt="game.name" class="w-24 shrink-0 rounded-lg" loading="lazy" />
|
||||||
|
<div v-else class="h-14 w-24 shrink-0 rounded-lg bg-[#f0efed]"></div>
|
||||||
|
<div class="flex min-w-0 flex-1 flex-col gap-2">
|
||||||
|
<strong
|
||||||
|
class="min-w-0 line-clamp-2 text-[13px] font-medium leading-[1.35] tracking-[0.1px] text-[#0c0a09]">
|
||||||
|
{{ game.name }}
|
||||||
|
</strong>
|
||||||
|
<div class="flex items-center gap-1.5">
|
||||||
|
<span
|
||||||
|
:class="['inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase leading-none tracking-[0.6px] text-[#0c0a09]', platformBadgeClass(game.platform)]">
|
||||||
|
{{ game.platform }}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center justify-center rounded-full bg-[#292524] px-2 py-0.5 text-[12px] font-semibold leading-none text-white">
|
||||||
|
{{ game.score }}
|
||||||
|
</span>
|
||||||
|
<button type="button" :disabled="togglingId === game.name"
|
||||||
|
:aria-label="favoriteIds.has(game.name) ? 'Remover dos favoritos' : 'Adicionar aos favoritos'"
|
||||||
|
@click="toggleFavorite(game)"
|
||||||
|
class="inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-50">
|
||||||
|
<Icon
|
||||||
|
:name="togglingId === game.name ? 'mdi:loading' : favoriteIds.has(game.name) ? 'mdi:heart' : 'mdi:heart-outline'"
|
||||||
|
:class="['text-sm', togglingId === game.name ? 'animate-spin text-[#777169]' : favoriteIds.has(game.name) ? 'text-rose-500' : 'text-[#777169]']" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<!-- Desktop: tabela -->
|
||||||
|
<div class="hidden overflow-hidden rounded-xl border border-[#e7e5e4] xl:block">
|
||||||
|
<div
|
||||||
|
class="bg-[#fafafa] px-4 py-3 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] xl:grid xl:grid-cols-[72px_minmax(220px,2fr)_minmax(140px,1fr)_120px] xl:gap-4">
|
||||||
|
<span>Posição</span>
|
||||||
|
<span>Jogo</span>
|
||||||
|
<span>Plataforma</span>
|
||||||
|
<span>Pontuação</span>
|
||||||
|
</div>
|
||||||
|
<ol class="grid divide-y divide-[#e7e5e4]">
|
||||||
|
<li v-for="game in filteredRankings" :key="game.rank"
|
||||||
|
class="grid grid-cols-[72px_minmax(220px,2fr)_minmax(140px,1fr)_120px] items-center gap-4 bg-white p-4">
|
||||||
|
<span
|
||||||
|
class="inline-flex h-9 min-w-9 items-center justify-center rounded-full bg-[#292524] px-3 text-[15px] font-medium leading-none text-white">
|
||||||
|
{{ game.rank }}
|
||||||
|
</span>
|
||||||
|
<div class="flex min-w-0 items-center gap-3">
|
||||||
|
<img v-if="game.image" :src="game.image" :alt="game.name"
|
||||||
|
class="h-16 w-28 shrink-0 rounded-lg object-cover shadow-sm" loading="lazy" />
|
||||||
|
<div v-else class="h-16 w-28 shrink-0 rounded-lg bg-[#f0efed]"></div>
|
||||||
|
<strong class="min-w-0 break-words text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
||||||
|
{{ game.name }}
|
||||||
|
</strong>
|
||||||
|
<button type="button" :disabled="togglingId === game.name"
|
||||||
|
:aria-label="favoriteIds.has(game.name) ? 'Remover dos favoritos' : '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">
|
||||||
|
<Icon
|
||||||
|
:name="togglingId === game.name ? 'mdi:loading' : 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>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
:class="['inline-flex items-center rounded-full px-2.5 py-1 text-[12px] font-semibold uppercase leading-none tracking-[0.8px] text-[#0c0a09]', platformBadgeClass(game.platform)]">
|
||||||
|
{{ game.platform }}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center justify-center rounded-full bg-[#292524] px-3 py-1 text-[13px] font-semibold leading-none text-white">
|
||||||
|
{{ game.score }}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
|
<p>
|
||||||
|
Microsserviço consumido:
|
||||||
|
<span class="font-medium text-[#4e4e4e]">https://ranking-plataforma.onrender.com</span>
|
||||||
|
· Feito por Ingrid e Marcelo
|
||||||
|
</p>
|
||||||
|
<span class="inline-flex items-center gap-1.5">
|
||||||
|
<span class="h-1.5 w-1.5 rounded-full bg-emerald-500"></span>
|
||||||
|
Sistema de validação de token funcional
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
definePageMeta({
|
||||||
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Ranking por plataforma | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Compare os jogos mais bem avaliados de cada plataforma em um ranking unificado por pontuação.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const COMPARE_API_BASE_URL = 'https://ranking-plataforma.onrender.com'
|
||||||
|
const WISHLIST_API_BASE_URL = 'https://gameverse-wishlist-production.up.railway.app'
|
||||||
|
|
||||||
|
const platformOptions = [
|
||||||
|
{ label: 'Todas as plataformas', value: 'all' },
|
||||||
|
{ label: 'Steam', value: 'Steam' },
|
||||||
|
{ label: 'PlayStation', value: 'PlayStation' },
|
||||||
|
{ label: 'Xbox', value: 'Xbox' },
|
||||||
|
{ label: 'Epic', value: 'Epic' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const platformBadgeClasses = {
|
||||||
|
Steam: 'bg-[rgba(167,229,211,0.56)]',
|
||||||
|
PlayStation: 'bg-[rgba(168,200,232,0.56)]',
|
||||||
|
Xbox: 'bg-[rgba(167,229,211,0.4)]',
|
||||||
|
Epic: 'bg-[rgba(196,184,232,0.4)]'
|
||||||
|
}
|
||||||
|
|
||||||
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
|
const token = useCookie('token', {
|
||||||
|
secure: true,
|
||||||
|
sameSite: 'lax',
|
||||||
|
maxAge: 900
|
||||||
|
})
|
||||||
|
|
||||||
|
const selectedPlatform = ref('all')
|
||||||
|
const rankings = ref([])
|
||||||
|
const isLoading = ref(false)
|
||||||
|
const errorMessage = ref('')
|
||||||
|
const favoriteIds = ref(new Set())
|
||||||
|
const togglingId = ref(null)
|
||||||
|
|
||||||
|
const filteredRankings = computed(() => {
|
||||||
|
if (selectedPlatform.value === 'all') return rankings.value
|
||||||
|
return rankings.value.filter((game) => game.platform === selectedPlatform.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
const platformBadgeClass = (platform) => {
|
||||||
|
return platformBadgeClasses[platform] ?? 'bg-[rgba(167,229,211,0.4)]'
|
||||||
|
}
|
||||||
|
|
||||||
|
const clearToken = () => {
|
||||||
|
token.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchRanking() {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoading.value = true
|
||||||
|
errorMessage.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await $fetch(`${COMPARE_API_BASE_URL}/compare`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token.value}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
rankings.value = Array.isArray(data?.data) ? data.data : []
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rankings.value = []
|
||||||
|
errorMessage.value =
|
||||||
|
error?.data?.message ?? 'Erro ao carregar o ranking por plataforma. Tente novamente.'
|
||||||
|
$toast.error(errorMessage.value, { duration: 8000 })
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchFavorites() {
|
||||||
|
if (!token.value) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await $fetch(`${WISHLIST_API_BASE_URL}/api/wishlist`, {
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
|
||||||
|
favoriteIds.value = new Set(
|
||||||
|
(data?.data ?? [])
|
||||||
|
.filter((item) => item.is_favorite === 1 || item.is_favorite === true)
|
||||||
|
.map((item) => item.game_id)
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Erro ao carregar os favoritos. Tente novamente.', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toggleFavorite(game) {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const gameId = game.name
|
||||||
|
togglingId.value = gameId
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (favoriteIds.value.has(gameId)) {
|
||||||
|
await $fetch(`${WISHLIST_API_BASE_URL}/api/wishlist/${encodeURIComponent(gameId)}`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
favoriteIds.value = new Set([...favoriteIds.value].filter((id) => id !== gameId))
|
||||||
|
$toast.success(`${gameId} removido dos favoritos.`, { duration: 4000 })
|
||||||
|
} else {
|
||||||
|
await $fetch(`${WISHLIST_API_BASE_URL}/api/wishlist`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` },
|
||||||
|
body: { game_id: gameId, is_wishlist: false, is_favorite: true, price_alert: false }
|
||||||
|
})
|
||||||
|
favoriteIds.value = new Set([...favoriteIds.value, gameId])
|
||||||
|
$toast.success(`${gameId} adicionado aos favoritos!`, { duration: 4000 })
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$toast.error('Erro ao atualizar favoritos. Tente novamente.', { duration: 6000 })
|
||||||
|
} finally {
|
||||||
|
togglingId.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchRanking()
|
||||||
|
fetchFavorites()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
651
app/pages/(protected)/reviews/index.vue
Normal file
651
app/pages/(protected)/reviews/index.vue
Normal file
@@ -0,0 +1,651 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
|
<div
|
||||||
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(196,184,232,0.6),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.56),transparent_34%)] blur-2xl"
|
||||||
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[800px] gap-6 md:gap-8">
|
||||||
|
<header class="flex flex-col gap-4">
|
||||||
|
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
||||||
|
<p
|
||||||
|
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]">
|
||||||
|
Reviews
|
||||||
|
</p>
|
||||||
|
<button type="button" @click="showCreateForm = !showCreateForm"
|
||||||
|
class="inline-flex min-h-9 items-center justify-center gap-2 self-start rounded-full bg-[#292524] px-4 py-2 text-[13px] font-medium text-white transition hover:bg-[#0c0a09] sm:self-auto">
|
||||||
|
<Icon :name="showCreateForm ? 'mdi:close' : 'mdi:pencil-plus-outline'" class="text-sm" />
|
||||||
|
{{ showCreateForm ? 'Cancelar' : 'Escrever review' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Toggle Meus reviews / Todos -->
|
||||||
|
<div class="inline-flex rounded-full border border-[#e7e5e4] bg-white p-1 shadow-[0_2px_8px_rgba(0,0,0,0.04)]">
|
||||||
|
<button type="button" @click="setView(true)" :class="[
|
||||||
|
'inline-flex min-h-8 items-center gap-2 rounded-full px-4 py-1.5 text-[13px] font-medium transition',
|
||||||
|
showOnlyMine ? 'bg-[#292524] text-white' : 'text-[#777169] hover:text-[#0c0a09]'
|
||||||
|
]">
|
||||||
|
<Icon name="mdi:account-outline" class="text-sm" />
|
||||||
|
Meus reviews
|
||||||
|
</button>
|
||||||
|
<button type="button" @click="setView(false)" :class="[
|
||||||
|
'inline-flex min-h-8 items-center gap-2 rounded-full px-4 py-1.5 text-[13px] font-medium transition',
|
||||||
|
!showOnlyMine ? 'bg-[#292524] text-white' : 'text-[#777169] hover:text-[#0c0a09]'
|
||||||
|
]">
|
||||||
|
<Icon name="mdi:earth" class="text-sm" />
|
||||||
|
Todos os reviews
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Formulário de criar review -->
|
||||||
|
<div v-if="showCreateForm"
|
||||||
|
class="overflow-hidden rounded-2xl border border-[#e7e5e4] bg-white shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
|
<div class="grid gap-5 p-4 sm:p-5 md:p-6">
|
||||||
|
<h2 class="font-serif text-[22px] font-light leading-[1.2] tracking-[-0.32px] text-[#0c0a09]">
|
||||||
|
Novo review
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div v-if="createError"
|
||||||
|
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">
|
||||||
|
{{ createError }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form class="grid gap-4" @submit.prevent="createReview">
|
||||||
|
<div class="grid gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
ID do jogo
|
||||||
|
</label>
|
||||||
|
<input v-model="createForm.idJogo" type="number" min="1" placeholder="Ex: 123" required
|
||||||
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Nota
|
||||||
|
</label>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<button v-for="n in 5" :key="n" type="button" @click="createForm.nota = n" :class="[
|
||||||
|
'inline-flex h-10 w-10 items-center justify-center rounded-xl border text-[15px] font-semibold transition',
|
||||||
|
createForm.nota === n
|
||||||
|
? 'border-[#292524] bg-[#292524] text-white'
|
||||||
|
: 'border-[#e7e5e4] bg-[#fafafa] text-[#777169] hover:border-[#0c0a09]'
|
||||||
|
]">
|
||||||
|
{{ n }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Comentário
|
||||||
|
</label>
|
||||||
|
<textarea v-model="createForm.comentario" rows="3" placeholder="Escreva seu review..." required
|
||||||
|
class="w-full min-w-0 resize-none rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-end">
|
||||||
|
<button type="submit" :disabled="isCreating || !createForm.nota"
|
||||||
|
class="inline-flex min-h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 py-2 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
||||||
|
<Icon v-if="isCreating" name="mdi:loading" class="animate-spin text-base" />
|
||||||
|
<span>{{ isCreating ? 'Publicando...' : 'Publicar review' }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Filtros -->
|
||||||
|
<div class="overflow-hidden rounded-2xl border border-[#e7e5e4] bg-white shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
|
<div class="grid gap-4 p-4 sm:p-5 md:p-6">
|
||||||
|
<div class="flex flex-col gap-3 sm:flex-row sm:items-end">
|
||||||
|
<div class="grid flex-1 gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Filtrar por ID do jogo
|
||||||
|
</label>
|
||||||
|
<input v-model="filterIdJogo" type="number" min="1" placeholder="Deixe em branco para ver todos"
|
||||||
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white"
|
||||||
|
@keydown.enter.prevent="applyFilter" />
|
||||||
|
</div>
|
||||||
|
<button type="button" @click="applyFilter"
|
||||||
|
class="inline-flex min-h-10 shrink-0 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#0c0a09] transition hover:bg-[#f0efed]">
|
||||||
|
<Icon name="mdi:magnify" class="text-sm" />
|
||||||
|
Buscar
|
||||||
|
</button>
|
||||||
|
<button v-if="activeFilter" type="button" @click="clearFilter"
|
||||||
|
class="inline-flex min-h-10 shrink-0 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#777169] transition hover:border-[#0c0a09]">
|
||||||
|
<Icon name="mdi:close" class="text-sm" />
|
||||||
|
Limpar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Nota média -->
|
||||||
|
<div v-if="activeFilter && mediaData" class="rounded-xl border border-[#e7e5e4] bg-[#fafafa] p-4">
|
||||||
|
<div v-if="isLoadingMedia" class="flex items-center gap-2">
|
||||||
|
<div class="h-4 w-4 animate-spin rounded-full border-2 border-[#d6d3d1] border-t-[#0c0a09]"></div>
|
||||||
|
<span class="text-[13px] text-[#777169]">Carregando média...</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
|
||||||
|
<div>
|
||||||
|
<p class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Nota média — Jogo #{{ activeFilter }}
|
||||||
|
</p>
|
||||||
|
<div class="mt-2 flex items-baseline gap-2">
|
||||||
|
<span class="font-serif text-[32px] font-light leading-none tracking-[-0.64px] text-[#0c0a09]">
|
||||||
|
{{ mediaData.media !== null ? mediaData.media.toFixed(1) : '—' }}
|
||||||
|
</span>
|
||||||
|
<span class="text-[15px] text-[#777169]">/ 5</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-right">
|
||||||
|
<p class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Avaliações
|
||||||
|
</p>
|
||||||
|
<p class="mt-1 text-[22px] font-medium leading-none text-[#0c0a09]">
|
||||||
|
{{ mediaData.numeroAvaliacoes.toLocaleString('pt-BR') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Lista de reviews -->
|
||||||
|
<div v-if="isLoading" class="grid gap-3" role="status" aria-live="polite">
|
||||||
|
<div v-for="i in 4" :key="i" class="h-28 animate-pulse rounded-2xl bg-[#f0efed]"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="errorMessage"
|
||||||
|
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">
|
||||||
|
{{ errorMessage }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<div v-if="reviews.length === 0"
|
||||||
|
class="rounded-2xl border border-[#e7e5e4] bg-white px-6 py-12 text-center shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
|
<Icon name="mdi:star-off-outline" class="mb-3 text-4xl text-[#d6d3d1]" />
|
||||||
|
<p class="text-[15px] leading-[1.47] tracking-[0.15px] text-[#777169]">
|
||||||
|
{{ showOnlyMine ? 'Você ainda não escreveu nenhum review.' : 'Nenhum review encontrado.' }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="grid gap-3">
|
||||||
|
<div v-for="review in reviews" :key="review.idReview"
|
||||||
|
class="overflow-hidden rounded-2xl border border-[#e7e5e4] bg-white shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
|
|
||||||
|
<!-- Modo visualização -->
|
||||||
|
<div v-if="editingReviewId !== review.idReview" class="grid gap-4 p-4 sm:p-5">
|
||||||
|
<div class="flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
|
||||||
|
<div class="flex min-w-0 items-center gap-3">
|
||||||
|
<span :class="[
|
||||||
|
'inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl text-sm font-bold',
|
||||||
|
review.nota >= 4
|
||||||
|
? 'bg-emerald-50 text-emerald-700'
|
||||||
|
: review.nota === 3
|
||||||
|
? 'bg-amber-50 text-amber-700'
|
||||||
|
: 'bg-red-50 text-red-700'
|
||||||
|
]">
|
||||||
|
{{ review.nota }}
|
||||||
|
</span>
|
||||||
|
<div class="min-w-0">
|
||||||
|
<p class="min-w-0 truncate text-[15px] font-medium leading-[1.47] tracking-[0.15px] text-[#0c0a09]">
|
||||||
|
{{ displayNames[String(review.idUsuario)] ?? review.nomeUsuario ?? '...' }}
|
||||||
|
</p>
|
||||||
|
<p class="text-[13px] leading-[1.5] tracking-[0.13px] text-[#777169]">
|
||||||
|
Jogo #{{ review.idJogo }} · {{ formatDate(review.dataCriacao) }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="userId && String(review.idUsuario) === String(userId)" class="flex shrink-0 gap-2">
|
||||||
|
<button type="button" @click="startEdit(review)"
|
||||||
|
class="inline-flex min-h-8 items-center justify-center gap-1.5 rounded-full border border-[#e7e5e4] px-3 py-1.5 text-[12px] font-medium text-[#0c0a09] transition hover:bg-[#f0efed]">
|
||||||
|
<Icon name="mdi:pencil-outline" class="text-xs" />
|
||||||
|
Editar
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div v-if="confirmingDeleteId === review.idReview" class="flex gap-1.5">
|
||||||
|
<button type="button" :disabled="isDeleting" @click="deleteReview(review.idReview)"
|
||||||
|
class="inline-flex min-h-8 items-center justify-center gap-1 rounded-full bg-red-50 px-3 py-1.5 text-[12px] font-medium text-red-600 transition hover:bg-red-100 disabled:opacity-50">
|
||||||
|
<Icon :name="isDeleting ? 'mdi:loading' : 'mdi:check'" class="text-xs"
|
||||||
|
:class="isDeleting && 'animate-spin'" />
|
||||||
|
Confirmar
|
||||||
|
</button>
|
||||||
|
<button type="button" @click="confirmingDeleteId = null"
|
||||||
|
class="inline-flex min-h-8 items-center justify-center rounded-full border border-[#e7e5e4] px-3 py-1.5 text-[12px] font-medium text-[#777169] transition hover:border-[#0c0a09]">
|
||||||
|
Cancelar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<button v-else type="button" @click="confirmingDeleteId = review.idReview"
|
||||||
|
class="inline-flex min-h-8 items-center justify-center gap-1.5 rounded-full border border-[#e7e5e4] px-3 py-1.5 text-[12px] font-medium text-[#777169] transition hover:border-red-300 hover:text-red-600">
|
||||||
|
<Icon name="mdi:trash-can-outline" class="text-xs" />
|
||||||
|
Deletar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="text-[15px] leading-[1.6] tracking-[0.15px] text-[#0c0a09]">
|
||||||
|
{{ review.comentario }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modo edição inline -->
|
||||||
|
<form v-else class="grid gap-4 p-4 sm:p-5" @submit.prevent="saveEdit(review.idReview)">
|
||||||
|
<div v-if="editError"
|
||||||
|
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">
|
||||||
|
{{ editError }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Nota
|
||||||
|
</label>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<button v-for="n in 5" :key="n" type="button" @click="editForm.nota = n" :class="[
|
||||||
|
'inline-flex h-10 w-10 items-center justify-center rounded-xl border text-[15px] font-semibold transition',
|
||||||
|
editForm.nota === n
|
||||||
|
? 'border-[#292524] bg-[#292524] text-white'
|
||||||
|
: 'border-[#e7e5e4] bg-[#fafafa] text-[#777169] hover:border-[#0c0a09]'
|
||||||
|
]">
|
||||||
|
{{ n }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Comentário
|
||||||
|
</label>
|
||||||
|
<textarea v-model="editForm.comentario" rows="3" required
|
||||||
|
class="w-full min-w-0 resize-none rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-end gap-3">
|
||||||
|
<button type="button" @click="cancelEdit"
|
||||||
|
class="inline-flex min-h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 py-2 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
|
Cancelar
|
||||||
|
</button>
|
||||||
|
<button type="submit" :disabled="isSaving || !editForm.nota"
|
||||||
|
class="inline-flex min-h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 py-2 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
||||||
|
<Icon v-if="isSaving" name="mdi:loading" class="animate-spin text-base" />
|
||||||
|
<span>{{ isSaving ? 'Salvando...' : 'Salvar alterações' }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Paginação -->
|
||||||
|
<div v-if="total > tamanhoPagina" class="flex items-center justify-between gap-3">
|
||||||
|
<button type="button" :disabled="pagina <= 1" @click="goToPage(pagina - 1)"
|
||||||
|
class="inline-flex min-h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#0c0a09] transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-40">
|
||||||
|
<Icon name="mdi:chevron-left" class="text-sm" />
|
||||||
|
Anterior
|
||||||
|
</button>
|
||||||
|
<span class="text-[13px] leading-[1.5] tracking-[0.13px] text-[#777169]">
|
||||||
|
Página {{ pagina }} · {{ total }} resultado{{ total !== 1 ? 's' : '' }}
|
||||||
|
</span>
|
||||||
|
<button type="button" :disabled="pagina * tamanhoPagina >= total" @click="goToPage(pagina + 1)"
|
||||||
|
class="inline-flex min-h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#0c0a09] transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-40">
|
||||||
|
Próxima
|
||||||
|
<Icon name="mdi:chevron-right" class="text-sm" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
|
<p>
|
||||||
|
Microsserviço consumido:
|
||||||
|
<span class="font-medium text-[#4e4e4e]">https://temp-reviews.onrender.com</span>
|
||||||
|
· Feito por Kate e Luan
|
||||||
|
</p>
|
||||||
|
<span class="inline-flex items-center gap-1.5">
|
||||||
|
<span class="h-1.5 w-1.5 rounded-full bg-emerald-500"></span>
|
||||||
|
Sistema de validação de token funcional
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
definePageMeta({
|
||||||
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Reviews | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Veja, crie e gerencie reviews de jogos do catálogo GameVerse.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const REVIEWS_API_BASE_URL = 'https://temp-reviews.onrender.com'
|
||||||
|
|
||||||
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
|
const token = useCookie('token', {
|
||||||
|
secure: true,
|
||||||
|
sameSite: 'lax',
|
||||||
|
maxAge: 900
|
||||||
|
})
|
||||||
|
|
||||||
|
const reviews = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
const isLoading = ref(false)
|
||||||
|
const errorMessage = ref('')
|
||||||
|
|
||||||
|
// Mapa de idUsuario → nome de exibição, populado após cada fetch
|
||||||
|
const displayNames = ref({})
|
||||||
|
|
||||||
|
async function resolveDisplayNames(items) {
|
||||||
|
const uniqueIds = [...new Set(items.map((r) => String(r.idUsuario)))]
|
||||||
|
const toFetch = uniqueIds.filter((id) => !(id in displayNames.value))
|
||||||
|
if (!toFetch.length) return
|
||||||
|
|
||||||
|
const results = await Promise.allSettled(
|
||||||
|
toFetch.map((id) =>
|
||||||
|
$fetch(`/api/profile/${id}`, {
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
const patch = {}
|
||||||
|
toFetch.forEach((id, i) => {
|
||||||
|
const result = results[i]
|
||||||
|
patch[id] =
|
||||||
|
result.status === 'fulfilled' && result.value?.displayName
|
||||||
|
? result.value.displayName
|
||||||
|
: 'Usuário Anônimo (externo)'
|
||||||
|
})
|
||||||
|
|
||||||
|
displayNames.value = { ...displayNames.value, ...patch }
|
||||||
|
}
|
||||||
|
|
||||||
|
const mediaData = ref(null)
|
||||||
|
const isLoadingMedia = ref(false)
|
||||||
|
|
||||||
|
const filterIdJogo = ref('')
|
||||||
|
const activeFilter = ref('')
|
||||||
|
const pagina = ref(1)
|
||||||
|
const tamanhoPagina = 10
|
||||||
|
|
||||||
|
const userId = ref(null)
|
||||||
|
const showOnlyMine = ref(true)
|
||||||
|
|
||||||
|
const showCreateForm = ref(false)
|
||||||
|
const createForm = reactive({ idJogo: '', nota: 0, comentario: '' })
|
||||||
|
const isCreating = ref(false)
|
||||||
|
const createError = ref('')
|
||||||
|
|
||||||
|
const editingReviewId = ref(null)
|
||||||
|
const editForm = reactive({ nota: 0, comentario: '' })
|
||||||
|
const isSaving = ref(false)
|
||||||
|
const editError = ref('')
|
||||||
|
|
||||||
|
const isDeleting = ref(false)
|
||||||
|
const confirmingDeleteId = ref(null)
|
||||||
|
|
||||||
|
const clearToken = () => {
|
||||||
|
token.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDate(iso) {
|
||||||
|
if (!iso) return ''
|
||||||
|
return new Intl.DateTimeFormat('pt-BR', { day: '2-digit', month: '2-digit', year: 'numeric' }).format(
|
||||||
|
new Date(iso)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchProfile() {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const data = await $fetch('/profile/me', {
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
userId.value = data?.user_id ?? data?.id ?? null
|
||||||
|
console.log('[Reviews] userId carregado:', userId.value)
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[Reviews] Falha ao carregar perfil:', e)
|
||||||
|
// falha silenciosa — usuário ainda pode visualizar reviews
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchReviews() {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoading.value = true
|
||||||
|
errorMessage.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const query = {
|
||||||
|
pagina: pagina.value,
|
||||||
|
tamanho_pagina: tamanhoPagina
|
||||||
|
}
|
||||||
|
if (showOnlyMine.value && userId.value) query.id_usuario = userId.value
|
||||||
|
if (activeFilter.value) query.id_jogo = Number(activeFilter.value)
|
||||||
|
|
||||||
|
const data = await $fetch(`${REVIEWS_API_BASE_URL}/api/v1/reviews`, {
|
||||||
|
query,
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
|
||||||
|
reviews.value = data?.itens ?? []
|
||||||
|
total.value = data?.total ?? 0
|
||||||
|
resolveDisplayNames(reviews.value)
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
errorMessage.value = error?.data?.message ?? 'Erro ao carregar reviews. Tente novamente.'
|
||||||
|
$toast.error(errorMessage.value, { duration: 8000 })
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchMedia() {
|
||||||
|
if (!activeFilter.value) {
|
||||||
|
mediaData.value = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoadingMedia.value = true
|
||||||
|
try {
|
||||||
|
const data = await $fetch(
|
||||||
|
`${REVIEWS_API_BASE_URL}/api/v1/reviews/jogo/${activeFilter.value}/media`,
|
||||||
|
{ headers: { Authorization: `Bearer ${token.value}` } }
|
||||||
|
)
|
||||||
|
mediaData.value = data
|
||||||
|
} catch {
|
||||||
|
mediaData.value = null
|
||||||
|
} finally {
|
||||||
|
isLoadingMedia.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setView(onlyMine) {
|
||||||
|
showOnlyMine.value = onlyMine
|
||||||
|
pagina.value = 1
|
||||||
|
filterIdJogo.value = ''
|
||||||
|
activeFilter.value = ''
|
||||||
|
mediaData.value = null
|
||||||
|
await fetchReviews()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function applyFilter() {
|
||||||
|
activeFilter.value = filterIdJogo.value
|
||||||
|
pagina.value = 1
|
||||||
|
await fetchReviews()
|
||||||
|
await fetchMedia()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function clearFilter() {
|
||||||
|
filterIdJogo.value = ''
|
||||||
|
activeFilter.value = ''
|
||||||
|
mediaData.value = null
|
||||||
|
pagina.value = 1
|
||||||
|
await fetchReviews()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function goToPage(n) {
|
||||||
|
pagina.value = n
|
||||||
|
await fetchReviews()
|
||||||
|
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createReview() {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!createForm.nota) return
|
||||||
|
|
||||||
|
isCreating.value = true
|
||||||
|
createError.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
await $fetch(`${REVIEWS_API_BASE_URL}/api/v1/reviews`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` },
|
||||||
|
body: {
|
||||||
|
idUsuario: userId.value,
|
||||||
|
idJogo: Number(createForm.idJogo),
|
||||||
|
nota: createForm.nota,
|
||||||
|
comentario: createForm.comentario
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$toast.success('Review publicado com sucesso!', { duration: 4000 })
|
||||||
|
showCreateForm.value = false
|
||||||
|
createForm.idJogo = ''
|
||||||
|
createForm.nota = 0
|
||||||
|
createForm.comentario = ''
|
||||||
|
pagina.value = 1
|
||||||
|
await fetchReviews()
|
||||||
|
if (activeFilter.value) await fetchMedia()
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (statusCode === 409) {
|
||||||
|
createError.value = error?.data?.mensagem ?? 'Você já realizou um review deste jogo.'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
createError.value = error?.data?.mensagem ?? error?.data?.message ?? 'Erro ao publicar review. Tente novamente.'
|
||||||
|
} finally {
|
||||||
|
isCreating.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function startEdit(review) {
|
||||||
|
editingReviewId.value = review.idReview
|
||||||
|
editForm.nota = review.nota
|
||||||
|
editForm.comentario = review.comentario
|
||||||
|
editError.value = ''
|
||||||
|
confirmingDeleteId.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelEdit() {
|
||||||
|
editingReviewId.value = null
|
||||||
|
editError.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveEdit(idReview) {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isSaving.value = true
|
||||||
|
editError.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const updated = await $fetch(`${REVIEWS_API_BASE_URL}/api/v1/reviews/${idReview}`, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` },
|
||||||
|
body: { nota: editForm.nota, comentario: editForm.comentario }
|
||||||
|
})
|
||||||
|
|
||||||
|
const idx = reviews.value.findIndex((r) => r.idReview === idReview)
|
||||||
|
if (idx !== -1) reviews.value[idx] = updated
|
||||||
|
|
||||||
|
editingReviewId.value = null
|
||||||
|
$toast.success('Review atualizado com sucesso!', { duration: 4000 })
|
||||||
|
if (activeFilter.value) await fetchMedia()
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
editError.value = error?.data?.mensagem ?? error?.data?.message ?? 'Erro ao salvar alterações. Tente novamente.'
|
||||||
|
$toast.error(editError.value, { duration: 8000 })
|
||||||
|
} finally {
|
||||||
|
isSaving.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteReview(idReview) {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isDeleting.value = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
await $fetch(`${REVIEWS_API_BASE_URL}/api/v1/reviews/${idReview}`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
|
||||||
|
reviews.value = reviews.value.filter((r) => r.idReview !== idReview)
|
||||||
|
total.value = Math.max(0, total.value - 1)
|
||||||
|
confirmingDeleteId.value = null
|
||||||
|
$toast.success('Review removido com sucesso.', { duration: 4000 })
|
||||||
|
if (activeFilter.value) await fetchMedia()
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$toast.error('Erro ao remover review. Tente novamente.', { duration: 6000 })
|
||||||
|
} finally {
|
||||||
|
isDeleting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await fetchProfile()
|
||||||
|
await fetchReviews()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -1,63 +1,326 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div class="relative min-h-screen overflow-hidden bg-[#f5f5f5] px-4 py-8 font-sans text-[#0c0a09] md:px-8 md:py-12">
|
||||||
class="relative grid min-h-screen place-items-center overflow-hidden bg-[#f5f5f5] px-4 py-12 font-sans text-[#0c0a09] md:py-24"
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute left-1/2 top-10 h-[420px] w-[min(92vw,760px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(200,184,224,0.5),transparent_34%)] blur-2xl"
|
class="pointer-events-none absolute left-1/2 top-8 h-[560px] w-[min(94vw,1040px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_18%_24%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_78%_28%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_86%,rgba(168,200,232,0.52),transparent_34%)] blur-2xl"
|
||||||
aria-hidden="true"
|
aria-hidden="true"></div>
|
||||||
></div>
|
|
||||||
|
|
||||||
<main
|
<main class="relative mx-auto grid w-full max-w-[1180px] gap-10" aria-labelledby="landing-title">
|
||||||
class="relative grid w-full max-w-[960px] gap-8 rounded-2xl border border-[#e7e5e4] bg-white p-6 shadow-[0_4px_16px_rgba(0,0,0,0.04)] md:grid-cols-[minmax(0,1fr)_auto] md:items-end md:p-8"
|
<nav class="flex items-center justify-between gap-4" aria-label="Acesso publico">
|
||||||
aria-labelledby="landing-title"
|
<NuxtLink to="/"
|
||||||
>
|
class="flex min-w-0 items-center gap-3 text-base font-semibold tracking-[0.16px] text-[#0c0a09]">
|
||||||
<section>
|
<span class="inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-[#292524] text-white">
|
||||||
<p
|
<Icon name="mdi:gamepad-variant" class="text-xl" />
|
||||||
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]"
|
</span>
|
||||||
>
|
<span>GameVerse</span>
|
||||||
Autenticação
|
</NuxtLink>
|
||||||
</p>
|
|
||||||
<h1
|
<div class="flex shrink-0 items-center gap-2">
|
||||||
id="landing-title"
|
<NuxtLink :to="hasToken ? '/home' : '/login'"
|
||||||
class="my-5 max-w-[640px] font-serif text-[40px] font-light leading-[1.05] tracking-[-1.2px] text-[#0c0a09] md:text-[64px] md:tracking-[-1.92px]"
|
class="inline-flex h-10 items-center justify-center rounded-full bg-[#292524] px-5 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] active:bg-[#0c0a09]">
|
||||||
>
|
{{ hasToken ? 'Ir para home' : 'Entrar' }}
|
||||||
Acesse sua conta
|
</NuxtLink>
|
||||||
</h1>
|
<NuxtLink to="/criar-conta"
|
||||||
<p
|
class="hidden h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-white/70 px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09] sm:inline-flex">
|
||||||
class="m-0 max-w-[520px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]"
|
Criar conta
|
||||||
>
|
</NuxtLink>
|
||||||
Entre para ver sua área autenticada ou crie uma conta nova com email e senha.
|
</div>
|
||||||
</p>
|
</nav>
|
||||||
|
|
||||||
|
<section class="grid gap-8 py-6 lg:grid-cols-[minmax(0,1.05fr)_minmax(360px,0.95fr)] lg:items-center lg:py-10">
|
||||||
|
<div class="grid gap-6">
|
||||||
|
<div>
|
||||||
|
<p
|
||||||
|
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]">
|
||||||
|
Sistema distribuído gamer
|
||||||
|
</p>
|
||||||
|
<h1 id="landing-title"
|
||||||
|
class="my-5 max-w-[760px] break-words font-serif text-[44px] font-light leading-[1.02] tracking-[-1.2px] text-[#0c0a09] md:text-[72px] md:tracking-[-1.92px]">
|
||||||
|
GameVerse conecta sua jornada gamer em um só lugar.
|
||||||
|
</h1>
|
||||||
|
<p
|
||||||
|
class="m-0 max-w-[620px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e] md:text-lg md:leading-7">
|
||||||
|
Uma plataforma integrada para descobrir jogos, acompanhar rankings, salvar favoritos,
|
||||||
|
montar perfil gamer e gerenciar gift cards com acesso autenticado.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-3 sm:flex-row">
|
||||||
|
<NuxtLink :to="hasToken ? '/home' : '/login'"
|
||||||
|
class="inline-flex h-11 items-center justify-center gap-2 rounded-full bg-[#292524] px-6 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] active:bg-[#0c0a09]">
|
||||||
|
{{ hasToken ? 'Ir para minha home' : 'Entrar na plataforma' }}
|
||||||
|
<Icon name="mdi:arrow-right" class="text-base" />
|
||||||
|
</NuxtLink>
|
||||||
|
<NuxtLink to="/criar-conta"
|
||||||
|
class="inline-flex h-11 items-center justify-center rounded-full border border-[#d6d3d1] bg-white/70 px-6 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
|
Criar conta
|
||||||
|
</NuxtLink>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-3 sm:grid-cols-3">
|
||||||
|
<div v-for="metric in metrics" :key="metric.label"
|
||||||
|
class="rounded-2xl border border-[#e7e5e4] bg-white/80 p-4">
|
||||||
|
<strong class="block text-2xl font-medium leading-tight tracking-[0.16px] text-[#0c0a09]">
|
||||||
|
{{ metric.value }}
|
||||||
|
</strong>
|
||||||
|
<span class="mt-1 block text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
{{ metric.label }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<aside
|
||||||
|
class="grid gap-4 rounded-2xl border border-[#e7e5e4] bg-white p-5 shadow-[0_12px_34px_rgba(0,0,0,0.08)] md:p-6">
|
||||||
|
<div class="flex items-center justify-between gap-4">
|
||||||
|
<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]">
|
||||||
|
Prévia
|
||||||
|
</span>
|
||||||
|
<h2 class="mt-4 font-serif text-3xl font-light leading-[1.13] tracking-[-0.32px] text-[#0c0a09]">
|
||||||
|
Painel integrado
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<span class="inline-flex h-11 w-11 items-center justify-center rounded-xl bg-[#292524] text-white">
|
||||||
|
<Icon name="mdi:view-dashboard-outline" class="text-xl" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-3 sm:grid-cols-2">
|
||||||
|
<article v-for="preview in dashboardPreview" :key="preview.label"
|
||||||
|
class="grid min-h-[138px] content-between rounded-xl border border-[#e7e5e4] bg-[#fafafa] p-4">
|
||||||
|
<div class="flex items-center justify-between gap-3">
|
||||||
|
<span class="inline-flex h-10 w-10 items-center justify-center rounded-xl" :class="preview.accent">
|
||||||
|
<Icon :name="preview.icon" class="text-xl text-[#0c0a09]" />
|
||||||
|
</span>
|
||||||
|
<span class="text-xs font-semibold uppercase tracking-[0.96px] text-[#777169]">
|
||||||
|
{{ preview.badge }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="grid gap-1">
|
||||||
|
<strong class="text-xl font-medium leading-[1.18] tracking-[0.16px] text-[#0c0a09]">
|
||||||
|
{{ preview.value }}
|
||||||
|
</strong>
|
||||||
|
<p class="m-0 text-[13px] leading-[1.5] tracking-[0.13px] text-[#777169]">
|
||||||
|
{{ preview.label }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="rounded-xl border border-[#e7e5e4] bg-white p-4">
|
||||||
|
<div class="flex items-center justify-between gap-3">
|
||||||
|
<div>
|
||||||
|
<p class="m-0 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Ranking semanal
|
||||||
|
</p>
|
||||||
|
<p class="m-0 mt-1 text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
||||||
|
Counter-Strike 2 liderando a semana
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
class="inline-flex h-9 w-9 items-center justify-center rounded-full bg-[#292524] text-[15px] font-medium text-white">
|
||||||
|
1
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<nav class="flex flex-col gap-3 sm:flex-row md:flex-col" aria-label="Acesso a conta">
|
<section class="grid gap-5" aria-labelledby="features-title">
|
||||||
<NuxtLink
|
<div>
|
||||||
v-if="hasToken"
|
<p
|
||||||
to="/home"
|
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]">
|
||||||
class="inline-flex h-10 items-center justify-center rounded-full bg-[#292524] px-5 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] active:bg-[#0c0a09]"
|
Recursos
|
||||||
>
|
</p>
|
||||||
Ir para home
|
<h2 id="features-title"
|
||||||
|
class="mt-4 font-serif text-3xl font-light leading-[1.13] tracking-[-0.32px] text-[#0c0a09] md:text-[40px]">
|
||||||
|
O que você encontra
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-4 md:grid-cols-2 xl:grid-cols-3">
|
||||||
|
<article v-for="feature in features" :key="feature.title"
|
||||||
|
class="grid min-h-[180px] content-between rounded-2xl border border-[#e7e5e4] bg-white p-5 shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
|
<div class="grid gap-4">
|
||||||
|
<span class="inline-flex h-11 w-11 items-center justify-center rounded-xl" :class="feature.accent">
|
||||||
|
<Icon :name="feature.icon" class="text-xl text-[#0c0a09]" />
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<h3 class="m-0 text-lg font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
||||||
|
{{ feature.title }}
|
||||||
|
</h3>
|
||||||
|
<p class="m-0 mt-2 text-[15px] leading-[1.47] tracking-[0.15px] text-[#777169]">
|
||||||
|
{{ feature.description }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section
|
||||||
|
class="grid gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-6 shadow-[0_4px_16px_rgba(0,0,0,0.04)] md:grid-cols-[minmax(0,1fr)_minmax(260px,360px)] md:p-8"
|
||||||
|
aria-labelledby="architecture-title">
|
||||||
|
<div>
|
||||||
|
<p
|
||||||
|
class="m-0 inline-flex rounded-full bg-[rgba(200,184,224,0.5)] px-3 py-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
Arquitetura distribuída
|
||||||
|
</p>
|
||||||
|
<h2 id="architecture-title"
|
||||||
|
class="mt-4 font-serif text-3xl font-light leading-[1.13] tracking-[-0.32px] text-[#0c0a09] md:text-[40px]">
|
||||||
|
Microsserviços conectados por uma experiência única.
|
||||||
|
</h2>
|
||||||
|
<p class="m-0 mt-4 max-w-[720px] text-base leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
|
O GameVerse reúne serviços independentes para autenticação, catálogo, ranking,
|
||||||
|
favoritos, perfil gamer e gift cards. Cada área protege suas operações com token e
|
||||||
|
entrega uma parte do ecossistema.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-3">
|
||||||
|
<div v-for="service in services" :key="service"
|
||||||
|
class="flex items-center gap-3 rounded-xl border border-[#e7e5e4] bg-[#fafafa] p-3">
|
||||||
|
<span class="h-2 w-2 shrink-0 rounded-full bg-emerald-500"></span>
|
||||||
|
<span class="text-[15px] font-medium leading-[1.47] tracking-[0.15px] text-[#292524]">
|
||||||
|
{{ service }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section
|
||||||
|
class="flex flex-col gap-4 rounded-2xl border border-[#e7e5e4] bg-[#292524] p-6 text-white md:flex-row md:items-center md:justify-between md:p-8"
|
||||||
|
aria-label="Acesso autenticado">
|
||||||
|
<div>
|
||||||
|
<p class="m-0 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-white/70">
|
||||||
|
Pronto para entrar
|
||||||
|
</p>
|
||||||
|
<h2 class="m-0 mt-2 font-serif text-3xl font-light leading-[1.13] tracking-[-0.32px]">
|
||||||
|
Sistema de validação de token funcional
|
||||||
|
</h2>
|
||||||
|
<p class="m-0 mt-3 text-[15px] leading-[1.47] tracking-[0.15px] text-white/70">
|
||||||
|
Acesse sua área autenticada e navegue por todos os módulos do GameVerse.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<NuxtLink :to="hasToken ? '/home' : '/login'"
|
||||||
|
class="inline-flex h-11 shrink-0 items-center justify-center gap-2 rounded-full bg-white px-6 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:bg-[#f5f5f5]">
|
||||||
|
{{ hasToken ? 'Abrir dashboard' : 'Fazer login' }}
|
||||||
|
<Icon name="mdi:arrow-right" class="text-base" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink
|
</section>
|
||||||
v-else
|
|
||||||
to="/login"
|
|
||||||
class="inline-flex h-10 items-center justify-center rounded-full bg-[#292524] px-5 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] active:bg-[#0c0a09]"
|
|
||||||
>
|
|
||||||
Entrar na conta
|
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink
|
|
||||||
to="/criar-conta"
|
|
||||||
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]"
|
|
||||||
>
|
|
||||||
Criar conta
|
|
||||||
</NuxtLink>
|
|
||||||
</nav>
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
useHead({
|
||||||
|
title: 'GameVerse | Sistema Distribuído Gamer',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content:
|
||||||
|
'Plataforma integrada para descobrir jogos, acompanhar rankings, salvar favoritos, montar perfil gamer e gerenciar gift cards.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
const token = useCookie('token')
|
const token = useCookie('token')
|
||||||
|
|
||||||
const hasToken = computed(() => Boolean(token.value))
|
const hasToken = computed(() => Boolean(token.value))
|
||||||
|
|
||||||
|
const metrics = [
|
||||||
|
{
|
||||||
|
value: '6',
|
||||||
|
label: 'Módulos integrados'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'JWT',
|
||||||
|
label: 'Sessão validada'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '24h',
|
||||||
|
label: 'Experiência gamer'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const dashboardPreview = [
|
||||||
|
{
|
||||||
|
badge: 'Ranking',
|
||||||
|
value: '#1 CS2',
|
||||||
|
label: 'Jogos mais fortes da semana',
|
||||||
|
icon: 'mdi:trophy-outline',
|
||||||
|
accent: 'bg-[rgba(244,197,168,0.56)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
badge: 'Favoritos',
|
||||||
|
value: '3 salvos',
|
||||||
|
label: 'Lista pessoal de jogos',
|
||||||
|
icon: 'mdi:heart-outline',
|
||||||
|
accent: 'bg-[rgba(232,184,196,0.55)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
badge: 'Catálogo',
|
||||||
|
value: 'Jogos ativos',
|
||||||
|
label: 'Busca e gerenciamento',
|
||||||
|
icon: 'mdi:controller-classic-outline',
|
||||||
|
accent: 'bg-[rgba(196,184,232,0.45)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
badge: 'Carteira',
|
||||||
|
value: 'Gift cards',
|
||||||
|
label: 'Criação, saldo e resgate',
|
||||||
|
icon: 'mdi:gift-outline',
|
||||||
|
accent: 'bg-[rgba(167,229,211,0.62)]'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const features = [
|
||||||
|
{
|
||||||
|
title: 'Ranking de jogos',
|
||||||
|
description: 'Acompanhe jogos por semana, mês, ano, plataforma e volume de jogadores ativos.',
|
||||||
|
icon: 'mdi:trophy-outline',
|
||||||
|
accent: 'bg-[rgba(244,197,168,0.56)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Perfil gamer',
|
||||||
|
description: 'Cadastre nickname, bio, país, plataformas favoritas e jogos preferidos.',
|
||||||
|
icon: 'mdi:account-star-outline',
|
||||||
|
accent: 'bg-[rgba(232,184,196,0.55)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Gift cards',
|
||||||
|
description: 'Crie cartões, consulte saldo e resgate valores em uma área autenticada.',
|
||||||
|
icon: 'mdi:gift-outline',
|
||||||
|
accent: 'bg-[rgba(167,229,211,0.62)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Favoritos',
|
||||||
|
description: 'Salve jogos do ranking ou catálogo e mantenha sua lista sempre à mão.',
|
||||||
|
icon: 'mdi:heart-outline',
|
||||||
|
accent: 'bg-[rgba(232,184,196,0.45)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Catálogo',
|
||||||
|
description: 'Explore, filtre, detalhe e gerencie jogos com gêneros, plataformas e imagens.',
|
||||||
|
icon: 'mdi:controller-classic-outline',
|
||||||
|
accent: 'bg-[rgba(196,184,232,0.45)]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Dados da conta',
|
||||||
|
description: 'Consulte informações da sessão autenticada, usuário e token de acesso.',
|
||||||
|
icon: 'mdi:account-circle-outline',
|
||||||
|
accent: 'bg-[rgba(168,200,232,0.56)]'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const services = [
|
||||||
|
'Autenticação com token JWT',
|
||||||
|
'Ranking de jogos',
|
||||||
|
'Catálogo de jogos',
|
||||||
|
'Lista de favoritos',
|
||||||
|
'Perfil gamer',
|
||||||
|
'Gift cards'
|
||||||
|
]
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
72
package-lock.json
generated
72
package-lock.json
generated
@@ -24,6 +24,7 @@
|
|||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@iconify-json/mdi": "^1.2.3",
|
||||||
"@types/node": "^25.6.0",
|
"@types/node": "^25.6.0",
|
||||||
"prettier": "^3.8.3",
|
"prettier": "^3.8.3",
|
||||||
"prettier-plugin-tailwindcss": "^0.8.0"
|
"prettier-plugin-tailwindcss": "^0.8.0"
|
||||||
@@ -82,6 +83,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
|
||||||
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.29.0",
|
"@babel/code-frame": "^7.29.0",
|
||||||
"@babel/generator": "^7.29.0",
|
"@babel/generator": "^7.29.0",
|
||||||
@@ -579,36 +581,12 @@
|
|||||||
"integrity": "sha512-/B8YJGPzaYq1NbsQmwgP8EZqg40NpTw4ZB3suuI0TplbxKHeK94jeaawLmVhCv+YwUnOpiWEz9U6SeThku/8JQ==",
|
"integrity": "sha512-/B8YJGPzaYq1NbsQmwgP8EZqg40NpTw4ZB3suuI0TplbxKHeK94jeaawLmVhCv+YwUnOpiWEz9U6SeThku/8JQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/core": {
|
|
||||||
"version": "1.10.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
|
|
||||||
"integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@emnapi/wasi-threads": "1.2.1",
|
|
||||||
"tslib": "^2.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@emnapi/runtime": {
|
|
||||||
"version": "1.10.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
|
|
||||||
"integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
|
||||||
"tslib": "^2.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@emnapi/wasi-threads": {
|
"node_modules/@emnapi/wasi-threads": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
||||||
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
}
|
}
|
||||||
@@ -1029,6 +1007,16 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@iconify-json/mdi": {
|
||||||
|
"version": "1.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@iconify-json/mdi/-/mdi-1.2.3.tgz",
|
||||||
|
"integrity": "sha512-O3cLwbDOK7NNDf2ihaQOH5F9JglnulNDFV7WprU2dSoZu3h3cWH//h74uQAB87brHmvFVxIOkuBX2sZSzYhScg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@iconify/types": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@iconify/collections": {
|
"node_modules/@iconify/collections": {
|
||||||
"version": "1.0.677",
|
"version": "1.0.677",
|
||||||
"resolved": "https://registry.npmjs.org/@iconify/collections/-/collections-1.0.677.tgz",
|
"resolved": "https://registry.npmjs.org/@iconify/collections/-/collections-1.0.677.tgz",
|
||||||
@@ -1488,6 +1476,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@nuxt/kit/-/kit-4.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/@nuxt/kit/-/kit-4.4.2.tgz",
|
||||||
"integrity": "sha512-5+IPRNX2CjkBhuWUwz0hBuLqiaJPRoKzQ+SvcdrQDbAyE+VDeFt74VpSFr5/R0ujrK4b+XnSHUJWdS72w6hsog==",
|
"integrity": "sha512-5+IPRNX2CjkBhuWUwz0hBuLqiaJPRoKzQ+SvcdrQDbAyE+VDeFt74VpSFr5/R0ujrK4b+XnSHUJWdS72w6hsog==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"c12": "^3.3.3",
|
"c12": "^3.3.3",
|
||||||
"consola": "^3.4.2",
|
"consola": "^3.4.2",
|
||||||
@@ -1572,6 +1561,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@nuxt/schema/-/schema-4.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/@nuxt/schema/-/schema-4.4.2.tgz",
|
||||||
"integrity": "sha512-/q6C7Qhiricgi+PKR7ovBnJlKTL0memCbA1CzRT+itCW/oeYzUfeMdQ35mGntlBoyRPNrMXbzuSUhfDbSCU57w==",
|
"integrity": "sha512-/q6C7Qhiricgi+PKR7ovBnJlKTL0memCbA1CzRT+itCW/oeYzUfeMdQ35mGntlBoyRPNrMXbzuSUhfDbSCU57w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/shared": "^3.5.30",
|
"@vue/shared": "^3.5.30",
|
||||||
"defu": "^6.1.4",
|
"defu": "^6.1.4",
|
||||||
@@ -3190,19 +3180,6 @@
|
|||||||
"giget": "dist/cli.mjs"
|
"giget": "dist/cli.mjs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@prisma/config/node_modules/magicast": {
|
|
||||||
"version": "0.3.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz",
|
|
||||||
"integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/parser": "^7.25.4",
|
|
||||||
"@babel/types": "^7.25.4",
|
|
||||||
"source-map-js": "^1.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@prisma/config/node_modules/perfect-debounce": {
|
"node_modules/@prisma/config/node_modules/perfect-debounce": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
|
||||||
@@ -4008,6 +3985,7 @@
|
|||||||
"integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==",
|
"integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~7.19.0"
|
"undici-types": "~7.19.0"
|
||||||
}
|
}
|
||||||
@@ -4500,6 +4478,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
|
||||||
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -4833,6 +4812,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz",
|
||||||
"integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==",
|
"integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"bare-abort-controller": "*"
|
"bare-abort-controller": "*"
|
||||||
},
|
},
|
||||||
@@ -5030,6 +5010,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.10.12",
|
"baseline-browser-mapping": "^2.10.12",
|
||||||
"caniuse-lite": "^1.0.30001782",
|
"caniuse-lite": "^1.0.30001782",
|
||||||
@@ -5131,6 +5112,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
|
"resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
|
||||||
"integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",
|
"integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
@@ -5310,7 +5292,8 @@
|
|||||||
"version": "0.2.2",
|
"version": "0.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/citty/-/citty-0.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/citty/-/citty-0.2.2.tgz",
|
||||||
"integrity": "sha512-+6vJA3L98yv+IdfKGZHBNiGW5KHn22e/JwID0Strsz8h4S/csAu/OuICwxrg44k5MRiZHWIo8XXuJgQTriRP4w==",
|
"integrity": "sha512-+6vJA3L98yv+IdfKGZHBNiGW5KHn22e/JwID0Strsz8h4S/csAu/OuICwxrg44k5MRiZHWIo8XXuJgQTriRP4w==",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/cliui": {
|
"node_modules/cliui": {
|
||||||
"version": "9.0.1",
|
"version": "9.0.1",
|
||||||
@@ -8297,6 +8280,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/nuxt/-/nuxt-4.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/nuxt/-/nuxt-4.4.2.tgz",
|
||||||
"integrity": "sha512-iWVFpr/YEqVU/CenqIHMnIkvb2HE/9f+q8oxZ+pj2et+60NljGRClCgnmbvGPdmNFE0F1bEhoBCYfqbDOCim3Q==",
|
"integrity": "sha512-iWVFpr/YEqVU/CenqIHMnIkvb2HE/9f+q8oxZ+pj2et+60NljGRClCgnmbvGPdmNFE0F1bEhoBCYfqbDOCim3Q==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dxup/nuxt": "^0.4.0",
|
"@dxup/nuxt": "^0.4.0",
|
||||||
"@nuxt/cli": "^3.34.0",
|
"@nuxt/cli": "^3.34.0",
|
||||||
@@ -8549,6 +8533,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.117.0.tgz",
|
"resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.117.0.tgz",
|
||||||
"integrity": "sha512-l3cbgK5wUvWDVNWM/JFU77qDdGZK1wudnLsFcrRyNo/bL1CyU8pC25vDhMHikVY29lbK2InTWsX42RxVSutUdQ==",
|
"integrity": "sha512-l3cbgK5wUvWDVNWM/JFU77qDdGZK1wudnLsFcrRyNo/bL1CyU8pC25vDhMHikVY29lbK2InTWsX42RxVSutUdQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oxc-project/types": "^0.117.0"
|
"@oxc-project/types": "^0.117.0"
|
||||||
},
|
},
|
||||||
@@ -8747,6 +8732,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.4.tgz",
|
||||||
"integrity": "sha512-l7pqLUFTI/+ESXn6k3nu30ZIzW5E2WZF/LaHJEpoq6ElcLD+wduZoB2kBN19du6K/4FDpPMazY2wJr+IndBtQw==",
|
"integrity": "sha512-l7pqLUFTI/+ESXn6k3nu30ZIzW5E2WZF/LaHJEpoq6ElcLD+wduZoB2kBN19du6K/4FDpPMazY2wJr+IndBtQw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/devtools-api": "^7.7.7"
|
"@vue/devtools-api": "^7.7.7"
|
||||||
},
|
},
|
||||||
@@ -8869,6 +8855,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.11",
|
"nanoid": "^3.3.11",
|
||||||
"picocolors": "^1.1.1",
|
"picocolors": "^1.1.1",
|
||||||
@@ -9412,6 +9399,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.1.tgz",
|
||||||
"integrity": "sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg==",
|
"integrity": "sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cssesc": "^3.0.0",
|
"cssesc": "^3.0.0",
|
||||||
"util-deprecate": "^1.0.2"
|
"util-deprecate": "^1.0.2"
|
||||||
@@ -9475,6 +9463,7 @@
|
|||||||
"integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
|
"integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"prettier": "bin/prettier.cjs"
|
"prettier": "bin/prettier.cjs"
|
||||||
},
|
},
|
||||||
@@ -9582,6 +9571,7 @@
|
|||||||
"integrity": "sha512-aRvldGE5UUJTtVmFiH3WfNFNiqFlAtePUxcI0UEGlnXCX7DqhiMT5TRYwncHFeA/Reca5W6ToXXyCMTeFPdSXA==",
|
"integrity": "sha512-aRvldGE5UUJTtVmFiH3WfNFNiqFlAtePUxcI0UEGlnXCX7DqhiMT5TRYwncHFeA/Reca5W6ToXXyCMTeFPdSXA==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/config": "6.16.2",
|
"@prisma/config": "6.16.2",
|
||||||
"@prisma/engines": "6.16.2"
|
"@prisma/engines": "6.16.2"
|
||||||
@@ -10095,6 +10085,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.1.tgz",
|
||||||
"integrity": "sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==",
|
"integrity": "sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/estree": "1.0.8"
|
"@types/estree": "1.0.8"
|
||||||
},
|
},
|
||||||
@@ -10893,6 +10884,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz",
|
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz",
|
||||||
"integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==",
|
"integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alloc/quick-lru": "^5.2.0",
|
"@alloc/quick-lru": "^5.2.0",
|
||||||
"arg": "^5.0.2",
|
"arg": "^5.0.2",
|
||||||
@@ -11780,6 +11772,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-7.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-7.3.2.tgz",
|
||||||
"integrity": "sha512-Bby3NOsna2jsjfLVOHKes8sGwgl4TT0E6vvpYgnAYDIF/tie7MRaFthmKuHx1NSXjiTueXH3do80FMQgvEktRg==",
|
"integrity": "sha512-Bby3NOsna2jsjfLVOHKes8sGwgl4TT0E6vvpYgnAYDIF/tie7MRaFthmKuHx1NSXjiTueXH3do80FMQgvEktRg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.27.0",
|
"esbuild": "^0.27.0",
|
||||||
"fdir": "^6.5.0",
|
"fdir": "^6.5.0",
|
||||||
@@ -12144,6 +12137,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.32.tgz",
|
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.32.tgz",
|
||||||
"integrity": "sha512-vM4z4Q9tTafVfMAK7IVzmxg34rSzTFMyIe0UUEijUCkn9+23lj0WRfA83dg7eQZIUlgOSGrkViIaCfqSAUXsMw==",
|
"integrity": "sha512-vM4z4Q9tTafVfMAK7IVzmxg34rSzTFMyIe0UUEijUCkn9+23lj0WRfA83dg7eQZIUlgOSGrkViIaCfqSAUXsMw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.5.32",
|
"@vue/compiler-dom": "3.5.32",
|
||||||
"@vue/compiler-sfc": "3.5.32",
|
"@vue/compiler-sfc": "3.5.32",
|
||||||
@@ -12433,6 +12427,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz",
|
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz",
|
||||||
"integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==",
|
"integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"yaml": "bin.mjs"
|
"yaml": "bin.mjs"
|
||||||
},
|
},
|
||||||
@@ -12526,6 +12521,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
||||||
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/colinhacks"
|
"url": "https://github.com/sponsors/colinhacks"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@iconify-json/mdi": "^1.2.3",
|
||||||
"@types/node": "^25.6.0",
|
"@types/node": "^25.6.0",
|
||||||
"prettier": "^3.8.3",
|
"prettier": "^3.8.3",
|
||||||
"prettier-plugin-tailwindcss": "^0.8.0"
|
"prettier-plugin-tailwindcss": "^0.8.0"
|
||||||
|
|||||||
29
server/api/profile/[id].get.ts
Normal file
29
server/api/profile/[id].get.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { prisma } from '../../utils/prisma'
|
||||||
|
import { requireAuthContext } from '../../utils/require-auth'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retorna o nome de exibição de um usuário pelo ID (sub do JWT).
|
||||||
|
* Usado para resolver nomes de autores de reviews.
|
||||||
|
* Responde com { displayName: string | null } — null quando o ID
|
||||||
|
* pertence a outro sistema (usuário externo).
|
||||||
|
*/
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
requireAuthContext(event)
|
||||||
|
|
||||||
|
const id = getRouterParam(event, 'id')
|
||||||
|
|
||||||
|
if (!id) {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'ID obrigatório' })
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = await prisma.user.findUnique({
|
||||||
|
where: { id },
|
||||||
|
select: { email: true }
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return { displayName: null }
|
||||||
|
}
|
||||||
|
|
||||||
|
return { displayName: user.email.split('@')[0] }
|
||||||
|
})
|
||||||
@@ -14,4 +14,6 @@ export interface AccessTokenClaims {
|
|||||||
export interface AuthRouteRequirement {
|
export interface AuthRouteRequirement {
|
||||||
method: string
|
method: string
|
||||||
path: string
|
path: string
|
||||||
|
/** Quando true, protege qualquer rota cujo caminho comece com `path` */
|
||||||
|
prefix?: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ const PROTECTED_ROUTES: AuthRouteRequirement[] = [
|
|||||||
{
|
{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path: '/dashboard'
|
path: '/dashboard'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: 'GET',
|
||||||
|
path: '/api/profile/',
|
||||||
|
prefix: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -37,8 +42,10 @@ export function getRouteRequirement(method: string, path: string): AuthRouteRequ
|
|||||||
const normalizedPath = normalizePath(path)
|
const normalizedPath = normalizePath(path)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
PROTECTED_ROUTES.find(
|
PROTECTED_ROUTES.find((route) => {
|
||||||
(route) => route.method === normalizedMethod && route.path === normalizedPath
|
if (route.method !== normalizedMethod) return false
|
||||||
) ?? null
|
if (route.prefix) return normalizedPath.startsWith(route.path)
|
||||||
|
return route.path === normalizedPath
|
||||||
|
}) ?? null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user