From b1088d716f141ddba4ba0a3ad1cbb76392505826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Wed, 8 Jan 2025 15:19:00 +0000 Subject: [PATCH] feat: Simplify `CalculatorInput` layout logic --- app/components/ui/CalculatorInput.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/components/ui/CalculatorInput.tsx b/app/components/ui/CalculatorInput.tsx index ca06b435..5a561985 100644 --- a/app/components/ui/CalculatorInput.tsx +++ b/app/components/ui/CalculatorInput.tsx @@ -22,8 +22,10 @@ import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; +type View = "form" | "loading" | "dashboard"; + const CalculatorInput = () => { - const [view, setView] = useState("form"); + const [view, setView] = useState("form"); const [data, setData] = useState(null); const searchParams = useSearchParams(); @@ -227,14 +229,18 @@ const CalculatorInput = () => { ); - } else if (view === "loading") { + } + + if (view === "loading") { return (
); - } else if (view === "dashboard") { - return ; + } + + if (view === "dashboard" && data) { + return ; } };