Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Sep 16, 2024
1 parent 0363991 commit df4ea09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
15 changes: 12 additions & 3 deletions packages/canyon-platform/src/components/CanyonReport/Control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ import { Divider, SliderSingleProps } from "antd";
import { getCOlor } from "@/helpers/utils/common.ts";

const marks: SliderSingleProps["marks"] = {
50: "50",
50: {
style: {
fontSize: "10px",
},
label: <>50</>,
},
80: {
style: {
fontSize: "10px",
},
label: <>80</>,
},
};
Expand Down Expand Up @@ -40,7 +48,7 @@ const CanyonReportControl = ({
// const [range, setRange] = useState([0, 100]);
return (
<>
<div className={"flex mb-2 justify-between"}>
<div className={"flex mb-2 justify-between items-center"}>
<div className={"flex gap-2 flex-col"}>
<Space>
<Segmented
Expand Down Expand Up @@ -90,7 +98,8 @@ const CanyonReportControl = ({
<Typography.Text type={"secondary"} style={{ fontSize: "12px" }}>
范围:
</Typography.Text>
<div style={{ transform: "translateY(10px)" }}>
{/*style={{ transform: "translateY(10px)" }}*/}
<div style={{ height: "30px", transform: "translateY(-2px)" }}>
<Slider
className={"w-[160px]"}
range
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ function checkSummaryKeywords(item, keywords) {
return item.path.toLowerCase().includes(keywords.toLowerCase());
}
function checkSummaryRange(item, range) {
return item.pct >= range[0] && item.pct <= range[1];
const pct = item.statements.pct;
return pct >= range[0] && pct <= range[1];
}

// 1.summary最主要的数据,有外面传入
Expand Down Expand Up @@ -54,6 +55,7 @@ const CanyonReport = ({
// 5.文件路径关键字搜索
const [keywords, setKeywords] = useState("");
const [onlyChange, setOnlyChange] = useState(false);
const [range, setRange] = useState([0, 100]);

// useEffect(()=>{
// document.querySelector("#nihao").scrollIntoView(true);
Expand All @@ -66,7 +68,7 @@ const CanyonReport = ({
checkSummaryKeywords(item, keywords) &&
checkSummaryRange(item, range),
);
}, [coverageSummaryMapData, onlyChange, keywords]);
}, [coverageSummaryMapData, onlyChange, keywords, range]);

const summary = coverageSummaryMapDataFiltered.reduce(
(acc: any, cur: any) => {
Expand All @@ -76,7 +78,6 @@ const CanyonReport = ({
{},
);
const summaryTreeItem = genSummaryTreeItem(activatedPath, summary);
const [range, setRange] = useState([0, 100]);
function onChangeOnlyChangeKeywords(v) {
setKeywords(v.target.value);
}
Expand Down

0 comments on commit df4ea09

Please sign in to comment.