From e70b9ce00baa611e351c0576eb992fb3874bfca7 Mon Sep 17 00:00:00 2001
From: "gpt-engineer-app[bot]"
<159125892+gpt-engineer-app[bot]@users.noreply.github.com>
Date: Mon, 19 May 2025 01:37:43 +0000
Subject: [PATCH] Fix: Sidebar navigation issue
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The sidebar navigation incorrectly highlights the "Dashboard" menu item when the "Transações" menu item is selected, preventing access to the dashboard.
---
src/App.tsx | 23 +++++++++-------
src/components/layout/Sidebar.tsx | 7 ++---
src/integrations/supabase/types.ts | 44 ------------------------------
3 files changed, 16 insertions(+), 58 deletions(-)
diff --git a/src/App.tsx b/src/App.tsx
index ebe4cb6..99b88d8 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,3 +1,4 @@
+
import React, { useEffect, useState } from "react";
import { Toaster } from "@/components/ui/toaster";
import { Toaster as Sonner } from "@/components/ui/sonner";
@@ -98,10 +99,20 @@ const App = () => {
- {/* Always redirect to dashboard since we're using RLS disabled mode */}
+ {/* Root path redirects to dashboard */}
}
+ element={}
+ />
+
+ {/* Dashboard route using Index component */}
+
+
+
+ }
/>
{/* Auth page is still available, but we should never need to redirect here */}
@@ -133,14 +144,6 @@ const App = () => {
}
/>
- {/* Redirect /dashboard to /transacoes */}
-
- }
- />
-
{/* 404 route */}
} />
diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx
index 6138a20..930a95f 100644
--- a/src/components/layout/Sidebar.tsx
+++ b/src/components/layout/Sidebar.tsx
@@ -5,11 +5,11 @@ import { cn } from '@/lib/utils';
import { Button } from "@/components/ui/button";
import { ChevronLeft, ChevronRight, Home, CalendarDays, DollarSign, PieChart } from 'lucide-react';
-// Modificado para separar Dashboard e Transações como itens distintos
+// Updated navItems with correct paths
const navItems = [
{
name: 'Dashboard',
- path: '/', // Caminho separado para o Dashboard
+ path: '/dashboard', // Changed path to '/dashboard' to be distinct from root path
icon:
},
{
@@ -37,9 +37,8 @@ const Sidebar = ({ className }: SidebarProps) => {
const location = useLocation();
const [collapsed, setCollapsed] = React.useState(false);
- // Função para verificar se o item está ativo baseado no caminho atual
+ // Improved function to verify if the item is active based on exact path
const isItemActive = (path: string) => {
- // Verificação exata do caminho
return location.pathname === path;
};
diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts
index dd5d8f9..50a8fbb 100644
--- a/src/integrations/supabase/types.ts
+++ b/src/integrations/supabase/types.ts
@@ -156,50 +156,6 @@ export type Database = {
}
Relationships: []
}
- "transacoes_21f0ba76-bc06-4428-a80a-2229205fba58": {
- Row: {
- categoria: string | null
- created_at: string
- detalhes: string | null
- estabelecimento: string | null
- id: number
- quando: string | null
- tipo: string | null
- usuario_id: string | null
- valor: number | null
- }
- Insert: {
- categoria?: string | null
- created_at?: string
- detalhes?: string | null
- estabelecimento?: string | null
- id?: number
- quando?: string | null
- tipo?: string | null
- usuario_id?: string | null
- valor?: number | null
- }
- Update: {
- categoria?: string | null
- created_at?: string
- detalhes?: string | null
- estabelecimento?: string | null
- id?: number
- quando?: string | null
- tipo?: string | null
- usuario_id?: string | null
- valor?: number | null
- }
- Relationships: [
- {
- foreignKeyName: "transacoes_21f0ba76-bc06-4428-a80a-2229205fba58_usuario_id_fkey"
- columns: ["usuario_id"]
- isOneToOne: false
- referencedRelation: "usuarios"
- referencedColumns: ["id"]
- },
- ]
- }
"transacoes_9f267008-9128-4a2f-b730-de0a0b5602a9": {
Row: {
categoria: string | null