feat: implement QOL features (Stats, Search, Dram of the Day)

This commit is contained in:
2025-12-18 12:34:51 +01:00
parent 7d395392d1
commit 35c2443473
6 changed files with 235 additions and 11 deletions

View File

@@ -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;