diff --git a/package-lock.json b/package-lock.json index 8edc41a..ce1c8d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,11 +15,14 @@ "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@t3-oss/env-nextjs": "^0.10.1", + "@types/react": "npm:types-react@rc", + "@types/react-dom": "npm:types-react-dom@rc", "@vercel/postgres": "^0.8.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "drizzle-orm": "^0.29.4", "geist": "^1.3.0", + "immer": "^10.1.1", "lucide-react": "^0.379.0", "next": "^15.0.0-rc.0", "postgres": "^3.4.3", @@ -27,13 +30,14 @@ "react-dom": "^19.0.0-rc-935180c7e0-20240524", "tailwind-merge": "^2.3.0", "tailwindcss-animate": "^1.0.7", - "zod": "^3.23.8" + "zod": "^3.23.8", + "zustand": "^4.5.2" }, "devDependencies": { "@types/eslint": "^8.56.2", "@types/node": "^20.11.20", - "@types/react": "^18.2.57", - "@types/react-dom": "^18.2.19", + "@types/react": "npm:types-react@rc", + "@types/react-dom": "npm:types-react-dom@rc", "@typescript-eslint/eslint-plugin": "^7.1.1", "@typescript-eslint/parser": "^7.1.1", "drizzle-kit": "^0.21.0", @@ -5226,6 +5230,15 @@ "node": ">= 4" } }, + "node_modules/immer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz", + "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -8027,6 +8040,14 @@ } } }, + "node_modules/use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/utf-8-validate": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.3.tgz", @@ -8313,6 +8334,33 @@ "funding": { "url": "https://github.com/sponsors/colinhacks" } + }, + "node_modules/zustand": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.2.tgz", + "integrity": "sha512-2cN1tPkDVkwCy5ickKrI7vijSjPksFRfqS6237NzT0vqSsztTNnQdHw9mmN7uBdk3gceVXU0a+21jFzFzAc9+g==", + "dependencies": { + "use-sync-external-store": "1.2.0" + }, + "engines": { + "node": ">=12.7.0" + }, + "peerDependencies": { + "@types/react": ">=16.8", + "immer": ">=9.0.6", + "react": ">=16.8" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + } + } } } } diff --git a/package.json b/package.json index 35ab83b..7323307 100644 --- a/package.json +++ b/package.json @@ -19,11 +19,14 @@ "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@t3-oss/env-nextjs": "^0.10.1", + "@types/react": "npm:types-react@rc", + "@types/react-dom": "npm:types-react-dom@rc", "@vercel/postgres": "^0.8.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "drizzle-orm": "^0.29.4", "geist": "^1.3.0", + "immer": "^10.1.1", "lucide-react": "^0.379.0", "next": "^15.0.0-rc.0", "postgres": "^3.4.3", @@ -31,13 +34,18 @@ "react-dom": "^19.0.0-rc-935180c7e0-20240524", "tailwind-merge": "^2.3.0", "tailwindcss-animate": "^1.0.7", - "zod": "^3.23.8" + "zod": "^3.23.8", + "zustand": "^4.5.2" + }, + "overrides": { + "@types/react": "npm:types-react@rc", + "@types/react-dom": "npm:types-react-dom@rc" }, "devDependencies": { "@types/eslint": "^8.56.2", "@types/node": "^20.11.20", - "@types/react": "^18.2.57", - "@types/react-dom": "^18.2.19", + "@types/react": "npm:types-react@rc", + "@types/react-dom": "npm:types-react-dom@rc", "@typescript-eslint/eslint-plugin": "^7.1.1", "@typescript-eslint/parser": "^7.1.1", "drizzle-kit": "^0.21.0", diff --git a/src/app/App.tsx b/src/app/App.tsx index 25215ab..dcd44ee 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1,9 +1,38 @@ +"use client"; +import { Button } from "~/components/ui/button"; import FormCard from "./_components/FormCard"; +import useFilterStore from "./store"; + +const AddRegionButton: React.FC = () => { + const addRegion = useFilterStore((state) => state.addRegion); + + const handleClick = () => { + addRegion("sverige"); + }; + + return ; +}; + +const ResetFilters: React.FC = () => { + const resetFilters = useFilterStore((state) => state.resetFilters); + + const handleClick = () => { + resetFilters(); + }; + + return ; +}; export default function App() { + const filters = useFilterStore((state) => state.filters); + return (
{props.name}
; -} diff --git a/src/app/_components/WineProducer.tsx b/src/app/_components/WineProducer.tsx deleted file mode 100644 index 415d9c2..0000000 --- a/src/app/_components/WineProducer.tsx +++ /dev/null @@ -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) { - returnInvalid producer ID
; - } - - try { - const result = await getProducer(id); - return !result ?Unable to retrieve producer
:{result?.name}
; - } catch (error) { - console.error("Error fetching producer:", error); - returnError fetching producer
; - } -} - -// 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); -} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 2aa5893..f430e6d 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,6 +4,7 @@ import { Inter as FontSans } from "next/font/google"; import { cn } from "~/lib/utils"; import TopNav from "./_components/FilterMenu"; import Filtermenu from "./_components/FilterMenu"; +import SearchBar from "./_components/SearchBar"; const fontSans = FontSans({ subsets: ["latin"], @@ -29,7 +30,10 @@ export default function RootLayout({ fontSans.variable, )} > -