added filter update to maxPriceChange
All checks were successful
Vercel Preview Deployment / Deploy-Preview (push) Successful in 1m9s

This commit is contained in:
ChrQR 2024-05-26 01:48:56 +02:00
parent be98abb776
commit 0d7b8a3db7
5 changed files with 4 additions and 36 deletions

View File

@ -29,6 +29,7 @@ export default function Filtermenu() {
const value = Math.max(Number(e.target.value), minPrice + 1);
setMaxPrice(value);
setSliderValues([sliderValues[0], value]);
setStorePrice(minPrice, maxPrice);
};
const handleSliderChange = (values: [number, number]) => {

View File

@ -1,3 +0,0 @@
export default function WineName(props: { name: string }) {
return <p>{props.name}</p>;
}

View File

@ -1,25 +0,0 @@
import getProducer from "~/server/actions/getProducer";
export default async function WineProducer(props: { id: string }) {
const { id } = props;
// Validate the id before making the database call
if (!id) {
return <p>Invalid producer ID</p>;
}
try {
const result = await getProducer(id);
return !result ? <p>Unable to retrieve producer</p> : <p>{result?.name}</p>;
} catch (error) {
console.error("Error fetching producer:", error);
return <p>Error fetching producer</p>;
}
}
// Utility function to validate UUID
function isValidUUID(uuid: string) {
const uuidRegex =
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
return uuidRegex.test(uuid);
}

View File

@ -7,6 +7,7 @@ interface FilterState {
}
interface Filters {
searchQuery: string;
regions: string[];
countries: string[];
producers: string[];
@ -40,6 +41,7 @@ type FilterActions = {
};
const initialFilters: Filters = {
searchQuery: "",
regions: [],
countries: [],
producers: [],
@ -60,6 +62,7 @@ const useFilterStore = create<FilterState & FilterActions>()(
persist(
(set) => ({
filters: {
searchQuery: "",
regions: [],
countries: [],
producers: [],

View File

@ -1,8 +0,0 @@
export interface Producer {
id: string;
name: string;
createdAt: Date;
country: string;
region: string;
email: string;
}