"use client";

import { usePathname } from "next/navigation";
import Link from "next/link";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
  faAngleLeft,
} from "@fortawesome/free-solid-svg-icons";
import { useRouter } from "next/navigation";
export default function BillLayout({ children }) {
  const pathname = usePathname();
  const router = useRouter();
  return (
    <section className="flex flex-1 flex-col container">
      <div className="p-4 fixed top-0 z-10 w-full">
        <div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full float-left">
          <FontAwesomeIcon
            icon={faAngleLeft}
            size="xl"
            onClick={() => {
              router.push("/my/wallet");
            }}
          />
        </div>
        <p className="text-base text-center leading-9">收支明细</p>
      </div>
      {pathname.split("/").length < 4 && (
        <div className="flex h-10 mt-16 p-4">
          <div className="tabs tab-boxed w-full">
            <Link
              className={`tab basis-1/4 ${
                pathname === "/bill/recharge"
                  ? "tab-active text-[#FF669E] bg-[#FF61B030] rounded-full"
                  : "text-[#FFFFFF80]"
              }`}
              href="recharge"
            >
              充值
            </Link>
            <Link
              className={`tab basis-1/4 ${
                pathname === "/bill/cost"
                  ? "tab-active text-[#FF669E] bg-[#FF61B030] rounded-full"
                  : "text-[#FFFFFF80]"
              }`}
              href="cost"
            >
              消费
            </Link>
            <Link
              className={`tab basis-1/4 ${
                pathname === "/bill/income"
                  ? "tab-active text-[#FF669E] bg-[#FF61B030] rounded-full"
                  : "text-[#FFFFFF80]"
              }`}
              href="income"
            >
              收益
            </Link>
            <Link
              className={`tab basis-1/4 ${
                pathname === "/bill/withdrawal"
                  ? "tab-active text-[#FF669E] bg-[#FF61B030] rounded-full"
                  : "text-[#FFFFFF80]"
              }`}
              href="withdrawal"
            >
              提现
            </Link>
          </div>
        </div>
      )}

      <div className="flex flex-1">{children}</div>
    </section>
  );
}
