feat: implement QOL features (Stats, Search, Dram of the Day)
This commit is contained in:
@@ -148,10 +148,19 @@ export default function BottleGrid({ bottles }: BottleGridProps) {
|
||||
}, [bottles]);
|
||||
|
||||
const filteredBottles = useMemo(() => {
|
||||
let result = bottles.filter((bottle) => {
|
||||
const result = bottles.filter((bottle) => {
|
||||
const searchLower = searchQuery.toLowerCase();
|
||||
const tastingNotesMatch = bottle.tastings?.some((t: any) =>
|
||||
(t.nose_notes?.toLowerCase().includes(searchLower)) ||
|
||||
(t.palate_notes?.toLowerCase().includes(searchLower)) ||
|
||||
(t.finish_notes?.toLowerCase().includes(searchLower))
|
||||
);
|
||||
|
||||
const matchesSearch =
|
||||
bottle.name?.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
bottle.distillery?.toLowerCase().includes(searchQuery.toLowerCase());
|
||||
bottle.name.toLowerCase().includes(searchLower) ||
|
||||
bottle.distillery?.toLowerCase().includes(searchLower) ||
|
||||
bottle.category?.toLowerCase().includes(searchLower) ||
|
||||
tastingNotesMatch;
|
||||
|
||||
const matchesCategory = !selectedCategory || bottle.category === selectedCategory;
|
||||
const matchesDistillery = !selectedDistillery || bottle.distillery === selectedDistillery;
|
||||
|
||||
Reference in New Issue
Block a user