"use client";

import { Button } from "@/app/shadcn_components/ui/button";
import { ChevronRight } from "lucide-react";
import { usePathname, useRouter } from "next/navigation";

export default function GoToPlanButton({ planId }: { planId: string }) {
  const router = useRouter();
  const pathname = usePathname();

  function handleOnClick() {
    router.push(`${pathname}/${planId}`);
  }

  return (
    <Button
      className="bg-brandblue hover:bg-hoverblue mb-2"
      onClick={handleOnClick}
    >
      Go to plan
      <ChevronRight className="ml-2 h-4 w-4" />
    </Button>
  );
}
