-
-
{b.name}
+
+
+
+
+ {b.imageUrl ? (
+

+ ) : (
+
+ )}
+
+
handleBarberImageUpload(b.id, e)}
+ />
+
+
+
+
{b.name}
+
+ {b.specialties.length > 0 ? b.specialties.join(', ') : 'Sem especialidades'}
+
+
+
-
-
- Especialidades: {b.specialties.length > 0 ? b.specialties.join(', ') : 'Nenhuma'}
-
-
))}
{shop.barbers.length === 0 && (
diff --git a/web/src/pages/Explore.tsx b/web/src/pages/Explore.tsx
index 56e2261..fe72cb4 100644
--- a/web/src/pages/Explore.tsx
+++ b/web/src/pages/Explore.tsx
@@ -17,8 +17,8 @@ export default function Explore() {
// Estados para manter as seleções de filtragem
const [query, setQuery] = useState('');
- const [filter, setFilter] = useState<'todas' | 'top' | 'produtos' | 'barbeiros' | 'servicos'>('todas');
- const [sortBy, setSortBy] = useState<'relevancia' | 'avaliacao' | 'preco' | 'servicos'>('relevancia');
+ const [filter, setFilter] = useState<'todas' | 'top'>('todas');
+ const [sortBy, setSortBy] = useState<'avaliacao' | 'servicos'>('avaliacao');
/**
* Deriva a lista de Shops tratada a partir do conjunto mestre global.
@@ -34,25 +34,14 @@ export default function Explore() {
// Regra 2: Restrições de Chip
const passesFilter = (shop: (typeof shops)[number]) => {
if (filter === 'top') return (shop.rating || 0) >= 4.7;
- if (filter === 'produtos') return (shop.products || []).length > 0;
- if (filter === 'barbeiros') return (shop.barbers || []).length >= 2;
- if (filter === 'servicos') return (shop.services || []).length >= 2;
return true;
};
- // Aplicação condicional com Sort
const sorted = [...shops]
.filter((shop) => matchesQuery(shop.name, shop.address || ''))
.filter(passesFilter)
.sort((a, b) => {
if (sortBy === 'avaliacao') return (b.rating || 0) - (a.rating || 0);
- if (sortBy === 'servicos') return (b.services || []).length - (a.services || []).length;
- if (sortBy === 'preco') {
- // Extrai o preço mínimo nos serviços oferecidos e compara
- const aMin = (a.services || []).length ? Math.min(...a.services.map((s) => s.price)) : Infinity;
- const bMin = (b.services || []).length ? Math.min(...b.services.map((s) => s.price)) : Infinity;
- return aMin - bMin;
- }
// Critério por defeito ou quebra de empate: Avaliação descendente
if (b.rating !== a.rating) return (b.rating || 0) - (a.rating || 0);
@@ -91,9 +80,7 @@ export default function Explore() {
onChange={(e) => setSortBy(e.target.value as typeof sortBy)}
className="rounded-lg border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 shadow-sm"
>
-
-