|
@@ -1,9 +1,13 @@
|
|
|
"use client";
|
|
|
-import { usePathname, useRouter } from "@/i18n/routing";
|
|
|
import { Popup, Tabs } from "antd-mobile";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
import Image from "next/image";
|
|
|
import { FC, ReactNode, useState } from "react";
|
|
|
+import Faq from "../../faq";
|
|
|
+import Payments from "../../payments";
|
|
|
+import Referrals from "../../referrals";
|
|
|
+import Report from "../../report";
|
|
|
+import Summary from "../../summary";
|
|
|
|
|
|
interface Props {}
|
|
|
|
|
@@ -369,34 +373,27 @@ export const CommissionModel: FC<{ visible: boolean; setVisible: (value: boolean
|
|
|
);
|
|
|
};
|
|
|
const App: FC<Props> = (props) => {
|
|
|
- const pathname = usePathname();
|
|
|
const t = useTranslations("TabsCom");
|
|
|
- const router = useRouter();
|
|
|
-
|
|
|
- const activeTab = pathname.split("/").at(-1);
|
|
|
-
|
|
|
+ const [activeTab, setActiveTab] = useState("summary");
|
|
|
const [visible, setVisible] = useState(false);
|
|
|
-
|
|
|
const tabs = [
|
|
|
- { id: 1, page: "summary", content: t("PAINEL"), x: 0.27 },
|
|
|
- { id: 2, page: "referrals", content: t("REFERÊNCIAS"), x: 0.93 },
|
|
|
- { id: 3, page: "report", content: t("RELATÓRIO"), x: 1.7 },
|
|
|
- { id: 4, page: "payments", content: t("PAGAMENTOS"), x: 2.48 },
|
|
|
- { id: 5, page: "faq", content: t("FAQ"), x: 3.06 },
|
|
|
- { id: 6, page: "", content: "TUTORIAL", x: 3.06 },
|
|
|
+ { id: 1, page: "summary", content: t("PAINEL"), x: 0.27, children: <Summary /> },
|
|
|
+ { id: 2, page: "referrals", content: t("REFERÊNCIAS"), x: 0.93, children: <Referrals /> },
|
|
|
+ { id: 3, page: "report", content: t("RELATÓRIO"), x: 1.7, children: <Report /> },
|
|
|
+ { id: 4, page: "payments", content: t("PAGAMENTOS"), x: 2.48, children: <Payments /> },
|
|
|
+ { id: 5, page: "faq", content: t("FAQ"), x: 3.06, children: <Faq /> },
|
|
|
+ { id: 6, page: "", content: "TUTORIAL", x: 3.06, children: null },
|
|
|
] as const;
|
|
|
const tabsChange = (page: string) => {
|
|
|
if (page) {
|
|
|
- router.replace(`/affiliate/${page}`);
|
|
|
+ setActiveTab(page);
|
|
|
} else {
|
|
|
setVisible(true);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
return (
|
|
|
- <div
|
|
|
- className={`layout-tabs relative flex h-[0.4rem] items-center justify-between text-[0.13rem]`}
|
|
|
- >
|
|
|
+ <div className={`layout-tabs relative flex items-center justify-between text-[0.13rem]`}>
|
|
|
<Tabs
|
|
|
onChange={tabsChange}
|
|
|
stretch={true}
|
|
@@ -409,11 +406,9 @@ const App: FC<Props> = (props) => {
|
|
|
>
|
|
|
{tabs.map((tab) => {
|
|
|
return (
|
|
|
- <Tabs.Tab
|
|
|
- key={tab.page}
|
|
|
- title={tab.content}
|
|
|
- className={"text-[grey]"}
|
|
|
- ></Tabs.Tab>
|
|
|
+ <Tabs.Tab key={tab.page} title={tab.content} className={"text-[grey]"}>
|
|
|
+ {tab.children}
|
|
|
+ </Tabs.Tab>
|
|
|
);
|
|
|
})}
|
|
|
</Tabs>
|