From bdc4b56d49b393e48f2b50e3d4a9d2fed5e83c7e Mon Sep 17 00:00:00 2001 From: Rodrigo <230417@epvc.pt> Date: Tue, 17 Mar 2026 10:44:37 +0000 Subject: [PATCH] =?UTF-8?q?altera=C3=A7=C3=B5es=20design?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Dashboard.tsx | 153 +++++++++++++++++++++++++++-------- web/src/pages/Dashboard.tsx | 154 ++++++++++++++++++++---------------- 2 files changed, 207 insertions(+), 100 deletions(-) diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index c4b6693..beed00e 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -47,12 +47,13 @@ export default function Dashboard() { const [prodStock, setProdStock] = useState('10'); const [barberName, setBarberName] = useState(''); const [barberSpecs, setBarberSpecs] = useState(''); + const [barberSearchQuery, setBarberSearchQuery] = useState(''); // Segurança de Bloqueio - Validação estrita do role do utilziador no componente - if (!user || user.role !== 'barbearia') { + if (!user || user.role !== 'barbearia' || !shop) { return ( - - Área exclusiva para barbearias + + A carregar dados da barbearia... ); } @@ -114,12 +115,11 @@ export default function Dashboard() { if (!barberName.trim()) return; addBarber(shop.id, { name: barberName, - specialties: barberSpecs.split(',').map((s) => s.trim()).filter(Boolean), + specialties: [], schedule: [], }); setBarberName(''); - setBarberSpecs(''); - Alert.alert('Sucesso', 'Barbeiro adicionado'); + Alert.alert('Sucesso', 'Profissional adicionado'); }; /** @@ -141,7 +141,7 @@ export default function Dashboard() { { id: 'orders', label: 'Pedidos Boutique' }, { id: 'services', label: 'Serviços' }, { id: 'products', label: 'Produtos' }, - { id: 'barbers', label: 'Equipa' }, + { id: 'barbers', label: 'Profissionais' }, ]; return ( @@ -366,38 +366,60 @@ export default function Dashboard() { )} {activeTab === 'barbers' && ( - - {shop.barbers.map((b) => ( - - - - {b.name} - - Especialidades: {b.specialties.length > 0 ? b.specialties.join(', ') : 'Nenhuma'} - + + Profissionais + + {/* Barra de Pesquisa Estilo Screenshot */} + + + + + {/* Lista de Profissionais */} + + {shop.barbers + .filter(b => b.name.toLowerCase().includes(barberSearchQuery.toLowerCase())) + .map((b) => ( + + + {/* Placeholder ou imagem real se disponível futuramente */} + {b.name.charAt(0)} + + {b.name} + + { + Alert.alert('Confirmar', 'Deseja remover este profissional?', [ + { text: 'Cancelar', style: 'cancel' }, + { text: 'Remover', style: 'destructive', onPress: () => deleteBarber(shop.id, b.id) }, + ]); + }} + style={styles.deleteBarberBtn} + > + Sair + - - - ))} + ))} + + {shop.barbers.filter(b => b.name.toLowerCase().includes(barberSearchQuery.toLowerCase())).length === 0 && ( + + Nenhum profissional encontrado. + + )} + + + {/* Formulário de Adição */} - Adicionar barbeiro + Adicionar profissional - @@ -570,6 +592,69 @@ const styles = StyleSheet.create({ stockButton: { flex: 1, }, + searchContainer: { + marginBottom: 8, + }, + searchInput: { + backgroundColor: '#0d0d0d', + borderColor: 'rgba(255,255,255,0.05)', + height: 56, + borderRadius: 16, + paddingHorizontal: 20, + color: '#fff', + fontSize: 16, + }, + barberList: { + gap: 12, + }, + barberCard: { + flexDirection: 'row', + alignItems: 'center', + padding: 16, + backgroundColor: '#0d0d0d', + borderRadius: 24, + borderWidth: 1, + borderColor: 'rgba(255,255,255,0.05)', + shadowColor: '#000', + shadowOffset: { width: 0, height: 4 }, + shadowOpacity: 0.2, + shadowRadius: 8, + elevation: 4, + }, + barberAvatar: { + width: 60, + height: 60, + borderRadius: 18, + backgroundColor: '#1e293b', + alignItems: 'center', + justifyContent: 'center', + marginRight: 16, + borderWidth: 1, + borderColor: 'rgba(255,255,255,0.1)', + }, + barberInfo: { + flex: 1, + }, + barberNameText: { + fontSize: 18, + fontWeight: 'bold', + color: '#fff', + letterSpacing: -0.5, + }, + deleteBarberBtn: { + padding: 8, + backgroundColor: 'rgba(239, 68, 68, 0.1)', + borderRadius: 12, + }, + emptyResults: { + padding: 40, + alignItems: 'center', + backgroundColor: '#0d0d0d', + borderRadius: 24, + borderStyle: 'dashed', + borderWidth: 1, + borderColor: 'rgba(255,255,255,0.1)', + }, }); diff --git a/web/src/pages/Dashboard.tsx b/web/src/pages/Dashboard.tsx index f164e9e..929320f 100644 --- a/web/src/pages/Dashboard.tsx +++ b/web/src/pages/Dashboard.tsx @@ -141,6 +141,7 @@ function DashboardInner({ shop }: { shop: BarberShop }) { const [barberName, setBarberName] = useState(''); const [barberSpecs, setBarberSpecs] = useState(''); + const [barberSearchQuery, setBarberSearchQuery] = useState(''); // Settings states const [editShopName, setEditShopName] = useState(shop.name); @@ -249,12 +250,11 @@ function DashboardInner({ shop }: { shop: BarberShop }) { if (!barberName.trim()) return; addBarber(shop.id, { name: barberName, - imageUrl: '', // Foto será adicionada depois - specialties: barberSpecs.split(',').map((s) => s.trim()).filter(Boolean), + imageUrl: '', + specialties: [], schedule: [], }); setBarberName(''); - setBarberSpecs(''); }; const [uploadingBarberId, setUploadingBarberId] = useState(null); @@ -349,7 +349,7 @@ function DashboardInner({ shop }: { shop: BarberShop }) { { id: 'orders', label: 'Pedidos', icon: ShoppingBag, badge: pendingOrders > 0 ? pendingOrders : undefined }, { id: 'services', label: 'Serviços', icon: Scissors }, { id: 'products', label: 'Produtos', icon: Package }, - { id: 'barbers', label: 'Barbeiros', icon: Users }, + { id: 'barbers', label: 'Profissionais', icon: Users }, { id: 'settings', label: 'Definições', icon: Settings }, ]; @@ -897,82 +897,104 @@ function DashboardInner({ shop }: { shop: BarberShop }) { {activeTab === 'barbers' && (
- -
-

Barbeiros

- {shop.barbers.length} barbeiros +
+

Profissionais

+
+ + {/* Barra de Pesquisa Estilo Screenshot */} +
+
+
-
- {shop.barbers.map((b) => ( -
-
-
-
-
- {b.imageUrl ? ( - {b.name} - ) : ( - - )} -
- handleBarberImageUpload(b.id, e)} - /> - -
-
-

{b.name}

-

- {b.specialties.length > 0 ? b.specialties.join(', ') : 'Sem especialidades'} -

-
+ setBarberSearchQuery(e.target.value)} + className="w-full h-14 pl-12 pr-4 bg-[#0d0d0d] border border-white/5 rounded-xl text-white placeholder:text-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 transition-all font-medium" + /> +
+ + {/* Grelha de Profissionais */} +
+ {shop.barbers + .filter(b => b.name.toLowerCase().includes(barberSearchQuery.toLowerCase())) + .map((b) => ( +
+ {/* Avatar squircle robusto */} +
+
+ {b.imageUrl ? ( + {b.name} + ) : ( + + )}
-
+ + {/* Info Profissional */} +
+

{b.name}

+ {/* O utilizador pediu para ignorar observações/especialidades, removido para o look "mais limpo" do screenshot */} +
+ + {/* Ações Rápidas */} +
+
))} - {shop.barbers.length === 0 && ( -
- -

Nenhum barbeiro registado

-
- )} -
-
-

Adicionar novo barbeiro

-
+ + {shop.barbers.filter(b => b.name.toLowerCase().includes(barberSearchQuery.toLowerCase())).length === 0 && ( +
+ +

Nenhum profissional encontrado com esse nome.

+
+ )} +
+ + {/* Formulário de Adição (Mantido mas modernizado) */} +
+

Novo Profissional

+
+
setBarberName(e.target.value)} /> - setBarberSpecs(e.target.value)} - /> -
- -
+
+
+
- +
)}