parent
c0a0f447b7
commit
e468a4e19f
1 changed files with 0 additions and 10 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useParams, useRouter, useSearchParams } from "next/navigation";
|
import { useParams, useRouter, useSearchParams } from "next/navigation";
|
||||||
import { useEffect } from "react";
|
|
||||||
import { BankSelector } from "@/components/bank-selector";
|
import { BankSelector } from "@/components/bank-selector";
|
||||||
import { Sidebar } from "@/components/sidebar";
|
import { Sidebar } from "@/components/sidebar";
|
||||||
import { DataView } from "@/components/data-view";
|
import { DataView } from "@/components/data-view";
|
||||||
|
|
@ -10,7 +9,6 @@ import { EntitiesView } from "@/components/entities-view";
|
||||||
import { ThinkView } from "@/components/think-view";
|
import { ThinkView } from "@/components/think-view";
|
||||||
import { SearchDebugView } from "@/components/search-debug-view";
|
import { SearchDebugView } from "@/components/search-debug-view";
|
||||||
import { BankProfileView } from "@/components/bank-profile-view";
|
import { BankProfileView } from "@/components/bank-profile-view";
|
||||||
import { useBank } from "@/lib/bank-context";
|
|
||||||
|
|
||||||
type NavItem = "recall" | "reflect" | "data" | "documents" | "entities" | "profile";
|
type NavItem = "recall" | "reflect" | "data" | "documents" | "entities" | "profile";
|
||||||
type DataSubTab = "world" | "experience" | "opinion";
|
type DataSubTab = "world" | "experience" | "opinion";
|
||||||
|
|
@ -19,19 +17,11 @@ export default function BankPage() {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const { currentBank, setCurrentBank } = useBank();
|
|
||||||
|
|
||||||
const bankId = params.bankId as string;
|
const bankId = params.bankId as string;
|
||||||
const view = (searchParams.get("view") || "profile") as NavItem;
|
const view = (searchParams.get("view") || "profile") as NavItem;
|
||||||
const subTab = (searchParams.get("subTab") || "world") as DataSubTab;
|
const subTab = (searchParams.get("subTab") || "world") as DataSubTab;
|
||||||
|
|
||||||
// Sync URL bank with context
|
|
||||||
useEffect(() => {
|
|
||||||
if (bankId && bankId !== currentBank) {
|
|
||||||
setCurrentBank(bankId);
|
|
||||||
}
|
|
||||||
}, [bankId, currentBank, setCurrentBank]);
|
|
||||||
|
|
||||||
const handleTabChange = (tab: NavItem) => {
|
const handleTabChange = (tab: NavItem) => {
|
||||||
router.push(`/banks/${bankId}?view=${tab}`);
|
router.push(`/banks/${bankId}?view=${tab}`);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue