Phase 4: Páginas Dashboard

- Layout completo com Brand Descomplicar:
  * Header: logo dourado, sticky, shadow-sm
  * Footer: copyright Descomplicar®
  * Fonts: Inter (body), Montserrat (display)
  * Metadata PT-PT

- DashboardView component (client):
  * Fetch sites via /api/sites
  * Site selector dropdown
  * Fetch metrics via /api/metrics/[siteId]?period=30d
  * 4 KPI cards: visitors, sessions, engagement, pageViews
  * Chart área: tráfego diário (30d)
  * Chart pie: fontes de tráfego (top 10)
  * Tabela: Top 20 queries GSC (clicks, impressions, CTR, position)
  * Loading states em todos componentes
  * Error handling com mensagens PT-PT
  * Responsive: mobile/tablet/desktop

- Home page: render DashboardView

Features:
- Auto-select primeiro site na lista
- Comparação período anterior (% change)
- Formatação PT-PT (números, datas, percentagens)
- Brand colors (#cc8d00, #27a50e)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 18:01:37 +00:00
parent ff25811725
commit 5c34372d42
3 changed files with 335 additions and 83 deletions

View File

@@ -1,34 +1,67 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import type { Metadata } from 'next'
import { Inter, Montserrat } from 'next/font/google'
import './globals.css'
import { cn } from '@/lib/utils'
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const inter = Inter({
subsets: ['latin'],
variable: '--font-sans',
display: 'swap',
})
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
const montserrat = Montserrat({
subsets: ['latin'],
variable: '--font-display',
display: 'swap',
})
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
title: 'BI Descomplicar® | Painéis de Métricas',
description: 'Dashboards de performance digital para clientes Descomplicar - Agência de Aceleração Digital',
icons: {
icon: '/favicon.ico',
},
}
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
children: React.ReactNode
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
<html lang="pt">
<body className={cn(
inter.variable,
montserrat.variable,
'font-sans antialiased bg-gray-50'
)}>
<div className="min-h-screen flex flex-col">
<header className="bg-white border-b border-gray-200 sticky top-0 z-50 shadow-sm">
<div className="container mx-auto px-md py-md">
<div className="flex items-center justify-between">
<div>
<h1 className="text-2xl font-display font-bold text-brand-dourado">
BI Descomplicar®
</h1>
<p className="text-sm text-gray-600 mt-0.5">
Painéis de Performance Digital
</p>
</div>
</div>
</div>
</header>
<main className="flex-1">
{children}
</main>
<footer className="bg-white border-t border-gray-200 py-sm">
<div className="container mx-auto px-md text-center text-sm text-gray-500">
© {new Date().getFullYear()} Descomplicar® - Agência de Aceleração Digital
</div>
</footer>
</div>
</body>
</html>
);
)
}

View File

@@ -1,65 +1,5 @@
import Image from "next/image";
import { DashboardView } from '@/components/dashboard/dashboard-view'
export default function Home() {
return (
<div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
<Image
className="dark:invert"
src="/next.svg"
alt="Next.js logo"
width={100}
height={20}
priority
/>
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
To get started, edit the page.tsx file.
</h1>
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
Looking for a starting point or more instructions? Head over to{" "}
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
className="font-medium text-zinc-950 dark:text-zinc-50"
>
Templates
</a>{" "}
or the{" "}
<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
className="font-medium text-zinc-950 dark:text-zinc-50"
>
Learning
</a>{" "}
center.
</p>
</div>
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
<a
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert"
src="/vercel.svg"
alt="Vercel logomark"
width={16}
height={16}
/>
Deploy Now
</a>
<a
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Documentation
</a>
</div>
</main>
</div>
);
return <DashboardView />
}