增加收入分布快照报告与公司明细直达链接

This commit is contained in:
2026-10-30 05:54:51 +08:00
parent 850ed8f9a7
commit 8da38694bc
7 changed files with 238 additions and 2 deletions
@@ -1,4 +1,5 @@
import { useEffect, useMemo, useRef, useState } from "react";
import { useRouter } from "next/router";
import IncomeDistribution from "./IncomeDistribution";
import {
categorySummary, evidenceUrl, technicalReviewLabels, type ResearchEvidence, type ResearchSnapshot,
@@ -30,6 +31,7 @@ function Evidence({ item, prefix = "evidence" }: { item: ResearchEvidence; prefi
}
export default function AICompanyResearch() {
const router = useRouter();
const [data, setData] = useState<ResearchSnapshot | null>(null);
const [error, setError] = useState(false);
const [attempt, setAttempt] = useState(0);
@@ -42,7 +44,12 @@ export default function AICompanyResearch() {
const [depth, setDepth] = useState("");
const [teamBand, setTeamBand] = useState("");
const [technicalLevel, setTechnicalLevel] = useState("");
const [selected, setSelected] = useState<string | null>(null);
const [selection, setSelection] = useState<{ route: string; id: string | null } | null>(null);
const linkedCompany = router.query.company;
const selected = selection && selection.route === router.asPath ? selection.id
: router.isReady && typeof linkedCompany === "string" && data?.companies.some((c) => c.id === linkedCompany)
? linkedCompany : null;
function setSelected(id: string | null) { setSelection({ route: router.asPath, id }); }
const [tab, setTab] = useState<"companies" | "revenue" | "sources" | "reviews">("companies");
const companySection = useRef<HTMLElement>(null);
const detailSection = useRef<HTMLElement>(null);