diff --git a/src/pages/Catalog/Catalog.jsx b/src/pages/Catalog/Catalog.jsx
index 1f94a48..7e4fdff 100644
--- a/src/pages/Catalog/Catalog.jsx
+++ b/src/pages/Catalog/Catalog.jsx
@@ -1,45 +1,140 @@
-import { Table, Thead, Tbody, Tr, Th, Td, TableContainer } from '@chakra-ui/react';
+import { Table, Thead, Tbody, Tr, Th, Td, TableContainer, Badge, Input, Select, Flex, Box, Center, Button } from '@chakra-ui/react';
import { useState, useEffect } from 'react';
import { NPOBackend } from '../../utils/auth_utils';
+import { Link } from 'react-router-dom';
+const subjectsOptions = ['life skills', 'science', 'technology', 'engineering', 'math', 'college readiness'];
+const eventOptions = ['guest speaker', 'study-trip', 'workshop', 'other'];
+const yearOptions = ['junior', 'senior', 'both'];
+const seasonOptions = ['fall', 'spring', 'summer', 'winter'];
export default function Catalog() {
const [tableData, setTableData] = useState([]);
+ const [searchTerm, setSearchTerm] = useState('');
+ const [selectedFilters, setSelectedFilters] = useState({
+ subject: '',
+ eventType: '',
+ season: '',
+ year: '',
+ });
useEffect(() => {
const fetchCatalogData = async () => {
- const response = await NPOBackend.get('/catalog');
+ const params = {
+ title: searchTerm,
+ ...selectedFilters,
+ };
+ console.log('fetching catalog data with params', params);
+ const response = await NPOBackend.get('/catalog', {
+ params: params
+ });
+ console.log('response', response);
setTableData(response.data);
};
- fetchCatalogData().catch(console.error);
- }, []);
-
- return (
-
-
-
-
- Title |
- Host |
- Cohort Type |
- Event Type |
- Subject |
- Description |
-
-
-
- {tableData.map(({ id, host, title, eventType, subject, description, year }) => (
-
- {title} |
- {host} |
- {year} |
- {eventType} |
- {subject} |
- {description} |
-
- ))}
-
-
-
- );
-}
+ const delay = setTimeout(() => {
+ fetchCatalogData().catch(console.error);
+ }, 750); // this is in miliseconds so 750 is .75 seconds, Vy design choice delay
+
+ return () => clearTimeout(delay);
+
+ }, [searchTerm, selectedFilters]);
+
+ const handleSearch = (event) => {
+ console.log('searching for', event.target.value);
+ setSearchTerm(event.target.value);
+ };
+
+ const handleFilterChange = (event) => {
+ setSelectedFilters({
+ ...selectedFilters,
+ [event.target.name]: event.target.value,
+ });
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ Event Catalog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event |
+ Host |
+ Tags |
+
+
+
+ {tableData.map(({ id, host, title, eventType, subject, year, season }) => (
+
+ {title} |
+ {host} |
+
+
+ {eventType}
+
+
+ {subject}
+
+
+ {season}
+
+
+ {year}
+
+ |
+
+ ))}
+
+
+
+
+
+
+ );
+ }
+
\ No newline at end of file