From c5411c16fb7ab7d245b70e69e869fa3c6e6815a7 Mon Sep 17 00:00:00 2001 From: 230417 <230417@epvc.pt> Date: Tue, 3 Mar 2026 15:46:55 +0000 Subject: [PATCH] =?UTF-8?q?mudan=C3=A7as=20no=20dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/Dashboard.tsx | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/web/src/pages/Dashboard.tsx b/web/src/pages/Dashboard.tsx index 5901b07..9450f82 100644 --- a/web/src/pages/Dashboard.tsx +++ b/web/src/pages/Dashboard.tsx @@ -47,6 +47,7 @@ import { Store, Clock, ArrowRight, + CheckCircle2, } from 'lucide-react'; const periods: Record boolean> = { @@ -136,6 +137,12 @@ function DashboardInner({ shop }: { shop: BarberShop }) { const [barberName, setBarberName] = useState(''); const [barberSpecs, setBarberSpecs] = useState(''); + // Settings states + const [editShopName, setEditShopName] = useState(shop.name); + const [editShopAddress, setEditShopAddress] = useState(shop.address || ''); + const [isSavingSettings, setIsSavingSettings] = useState(false); + const [showSaveSuccess, setShowSaveSuccess] = useState(false); + const periodMatch = periods[period]; // Agendamentos filtrados pela barbearia logada e pela janela de tempo selecionada @@ -332,6 +339,24 @@ function DashboardInner({ shop }: { shop: BarberShop }) { } }; + const handleSaveSettings = async () => { + setIsSavingSettings(true); + setShowSaveSuccess(false); + try { + await updateShopDetails(shop.id, { + name: editShopName, + address: editShopAddress, + }); + setShowSaveSuccess(true); + setTimeout(() => setShowSaveSuccess(false), 3000); + } catch (err) { + console.error('Error saving settings:', err); + alert('Erro ao guardar as definições. Tente novamente.'); + } finally { + setIsSavingSettings(false); + } + }; + const tabs = [ { id: 'overview' as TabId, label: 'Visão Geral', icon: BarChart3 }, { id: 'appointments' as TabId, label: 'Agendamentos', icon: Calendar }, @@ -1196,6 +1221,41 @@ function DashboardInner({ shop }: { shop: BarberShop }) { + +
+

Informações da Barbearia

+
+ setEditShopName(e.target.value)} + placeholder="O nome da sua barbearia" + /> + setEditShopAddress(e.target.value)} + placeholder="Rua, Número, Código Postal, Localidade" + /> + +
+ + + {showSaveSuccess && ( + + + Guardado com sucesso! + + )} +
+
+