fix: dark mode no admin, links mensagens dashboard, WhatsApp correto - Adicionado botão de dark mode no header do painel admin - Corrigido links do dashboard: /admin/contatos -> /admin/mensagens - Corrigido número WhatsApp: 5535988229445 (formato correto BR)
This commit is contained in:
@@ -5,6 +5,7 @@ import Link from 'next/link';
|
||||
import { usePathname, useRouter } from 'next/navigation';
|
||||
import { useToast } from '@/contexts/ToastContext';
|
||||
import { useConfirm } from '@/contexts/ConfirmContext';
|
||||
import { useTheme } from 'next-themes';
|
||||
|
||||
type TranslationSummary = {
|
||||
slug: string;
|
||||
@@ -22,10 +23,12 @@ export default function AdminLayout({
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [showAvatarModal, setShowAvatarModal] = useState(false);
|
||||
const [isUploading, setIsUploading] = useState(false);
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const { success, error } = useToast();
|
||||
const { confirm } = useConfirm();
|
||||
const { theme, setTheme } = useTheme();
|
||||
const [showNotifications, setShowNotifications] = useState(false);
|
||||
const [translationSummary, setTranslationSummary] = useState<TranslationSummary[]>([]);
|
||||
const [isFetchingTranslations, setIsFetchingTranslations] = useState(false);
|
||||
@@ -80,6 +83,7 @@ export default function AdminLayout({
|
||||
}, [success]);
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
const fetchUser = async () => {
|
||||
try {
|
||||
const response = await fetch('/api/auth/me');
|
||||
@@ -284,6 +288,19 @@ export default function AdminLayout({
|
||||
</button>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
{/* Dark Mode Toggle */}
|
||||
<button
|
||||
onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
|
||||
className="w-10 h-10 rounded-lg hover:bg-gray-100 dark:hover:bg-white/5 flex items-center justify-center text-gray-600 dark:text-yellow-400 transition-colors cursor-pointer"
|
||||
aria-label="Alternar tema"
|
||||
>
|
||||
{mounted && theme === 'dark' ? (
|
||||
<i className="ri-sun-line text-xl"></i>
|
||||
) : (
|
||||
<i className="ri-moon-line text-xl"></i>
|
||||
)}
|
||||
</button>
|
||||
|
||||
<div ref={notificationsRef} className="relative">
|
||||
<button
|
||||
onClick={() => {
|
||||
|
||||
@@ -160,7 +160,7 @@ export default function AdminDashboard() {
|
||||
<p className="text-xs text-gray-400 mt-1">{stats.activeProjects} ativos</p>
|
||||
</Link>
|
||||
|
||||
<Link href="/admin/contatos" className="bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/10 shadow-sm cursor-pointer hover:shadow-md transition-all">
|
||||
<Link href="/admin/mensagens" className="bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/10 shadow-sm cursor-pointer hover:shadow-md transition-all">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div className="w-12 h-12 rounded-xl flex items-center justify-center bg-green-50 dark:bg-green-900/20 text-green-500">
|
||||
<i className="ri-message-3-line text-2xl"></i>
|
||||
@@ -198,7 +198,7 @@ export default function AdminDashboard() {
|
||||
<div className="bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/10 shadow-sm">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<h3 className="text-lg font-bold text-secondary dark:text-white">Últimas Mensagens</h3>
|
||||
<Link href="/admin/contatos" className="text-primary text-sm font-bold hover:underline">Ver todas</Link>
|
||||
<Link href="/admin/mensagens" className="text-primary text-sm font-bold hover:underline">Ver todas</Link>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
{recentContacts.length === 0 ? (
|
||||
@@ -207,7 +207,7 @@ export default function AdminDashboard() {
|
||||
recentContacts.map((contact) => (
|
||||
<Link
|
||||
key={contact.id}
|
||||
href="/admin/contatos"
|
||||
href="/admin/mensagens"
|
||||
className="flex items-start gap-4 p-4 rounded-lg hover:bg-gray-50 dark:hover:bg-white/5 transition-colors border border-transparent hover:border-gray-100 dark:hover:border-white/5 cursor-pointer"
|
||||
>
|
||||
<div className="w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center shrink-0">
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function GET() {
|
||||
// Retorna valores padrão
|
||||
return NextResponse.json({
|
||||
whatsapp: '(35) 9882-9445',
|
||||
whatsappLink: 'https://wa.me/553598829445'
|
||||
whatsappLink: 'https://wa.me/5535988229445'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ export async function GET() {
|
||||
|
||||
const result = {
|
||||
whatsapp: whatsappItem?.linkText || '(35) 9882-9445',
|
||||
whatsappLink: whatsappItem?.link || 'https://wa.me/553598829445'
|
||||
whatsappLink: whatsappItem?.link || 'https://wa.me/5535988229445'
|
||||
};
|
||||
|
||||
// Atualiza cache
|
||||
@@ -62,7 +62,7 @@ export async function GET() {
|
||||
// Retorna valores padrão em caso de erro
|
||||
return NextResponse.json({
|
||||
whatsapp: '(35) 9882-9445',
|
||||
whatsappLink: 'https://wa.me/553598829445'
|
||||
whatsappLink: 'https://wa.me/5535988229445'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user