diff --git a/src/App.jsx b/src/App.jsx
index 363a5b0..0ae4841 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -38,6 +38,9 @@ export default function App() {
const [authMode, setAuthMode] = useState('login');
const [authError, setAuthError] = useState('');
const [categoryFilter, setCategoryFilter] = useState('Todos');
+ const [colorFilter, setColorFilter] = useState('');
+ const [ageFilter, setAgeFilter] = useState('any');
+ const [showClosetFilters, setShowClosetFilters] = useState(false);
// Estado para criação de Looks
const [selectedForLook, setSelectedForLook] = useState([]);
@@ -110,14 +113,31 @@ export default function App() {
const laundryClothes = useMemo(() => clothes.filter(c => c.status === 'laundry'), [clothes]);
const trashClothes = useMemo(() => clothes.filter(c => c.status === 'trash'), [clothes]);
+ const availableColors = useMemo(() => {
+ const colors = new Set(activeClothes.map(c => c.color).filter(Boolean));
+ return Array.from(colors);
+ }, [activeClothes]);
+
const filteredClothes = useMemo(() => {
return activeClothes.filter(c => {
const matchesSearch = (c.name || "").toLowerCase().includes(searchTerm.toLowerCase()) ||
(c.color || "").toLowerCase().includes(searchTerm.toLowerCase());
- const matchesCategory = categoryFilter === 'Todos' || c.category === categoryFilter;
- return matchesSearch && matchesCategory;
+ const matchesCategory = categoryFilter === 'Todos' || categoryFilter === t('all') || c.category === categoryFilter;
+ const matchesColor = !colorFilter || c.color === colorFilter;
+
+ let matchesAge = true;
+ if (ageFilter !== 'any') {
+ const ageInMs = new Date().getTime() - (c.createdAt || new Date().getTime());
+ const days = ageInMs / (1000 * 60 * 60 * 24);
+ if (ageFilter === 'month') matchesAge = days <= 30;
+ else if (ageFilter === '6months') matchesAge = days <= 180;
+ else if (ageFilter === '1year') matchesAge = days <= 365;
+ else if (ageFilter === 'older') matchesAge = days > 365;
+ }
+
+ return matchesSearch && matchesCategory && matchesColor && matchesAge;
});
- }, [activeClothes, searchTerm, categoryFilter]);
+ }, [activeClothes, searchTerm, categoryFilter, colorFilter, ageFilter, t]);
// Ações de Itens
const handleItemAction = async (action, item) => {
@@ -249,10 +269,18 @@ export default function App() {
const fd = new FormData(e.target);
try {
const profileDoc = doc(db, 'artifacts', appId, 'users', user.uid, 'profile', 'data');
+ const dobDay = fd.get('dobDay');
+ const dobMonth = fd.get('dobMonth');
+ const dobYear = fd.get('dobYear');
+ let dob = fd.get('dob') || '';
+ if (dobDay && dobMonth && dobYear) {
+ dob = `${dobYear}-${dobMonth}-${dobDay}`;
+ }
+
await setDoc(profileDoc, {
username: fd.get('username') || '',
fullName: fd.get('fullName') || '',
- dob: fd.get('dob') || '',
+ dob: dob,
bio: fd.get('bio') || ''
}, { merge: true });
} catch (err) {
@@ -461,16 +489,16 @@ export default function App() {
/>
-
- {[t('all'), t('tops'), t('bottoms'), t('footwear'), t('coats'), t('accessories')].map(cat => (
-
- ))}
+
+
@@ -678,7 +706,23 @@ export default function App() {