@@ -306,8 +288,8 @@ const CreatePlan = ({
className="flex items-center justify-center"
onSubmit={(e) => {
e.preventDefault();
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
- changePlanName(e.currentTarget.elements.name.value);
+ const formData = new FormData(e.currentTarget);
+ changePlanName(formData.get("name")?.toString() ?? "");
inputRef.current?.blur();
}}
>
@@ -318,23 +300,26 @@ const CreatePlan = ({
"w-full truncate border-mainbutton5 bg-transparent outline-none duration-100 ease-in-out before:transition-all focus:border-b-2 focus:font-normal",
)}
name="name"
- defaultValue={plan.name}
+ id="name"
+ defaultValue={typeof window === "undefined" ? "" : plan.name}
onFocus={() => {
setIsEditing(true);
}}
- onBlur={() => {
+ onBlur={(e) => {
setIsEditing(false);
+ changePlanName(e.currentTarget.value);
}}
/>
-
+ {isEditing ? (
+
+ ) : (
+
+ )}
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 5ee4dfd..6cb736f 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -6,7 +6,7 @@ import type React from "react";
import { type ComponentProps, useState } from "react";
import { twMerge } from "tailwind-merge";
-import { buttonVariants } from "@/components/ui/button";
+import { Button, buttonVariants } from "@/components/ui/button";
const Navbar = () => {
const [isMenuOpen, setIsMenuOpen] = useState(false);
@@ -21,20 +21,17 @@ const Navbar = () => {
{/* Desktop Navigation */}