Skip to content

Commit eb37772

Browse files
committed
split improvements and bugfixes
1 parent 98b0977 commit eb37772

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

packages/web-components/src/components/Tree/Tree.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Statistic } from "@allurereport/core-api";
2+
import type { Signal } from "@preact/signals";
23
import cx from "clsx";
34
import type { AllureAwesomeRecursiveTree, AllureAwesomeStatus, TreeFiltersState } from "global";
45
import type { FunctionComponent } from "preact";
@@ -18,8 +19,8 @@ interface TreeProps {
1819
toggleTree: (id: string) => void;
1920
navigateTo: (id: string) => void;
2021
routeId?: string;
21-
statsStore: StoreSignalState<Statistic>;
22-
treeFiltersStore: TreeFiltersState;
22+
statsStore: Signal<StoreSignalState<Statistic>>;
23+
treeFiltersStore: Signal<TreeFiltersState>;
2324
}
2425

2526
export const Tree: FunctionComponent<TreeProps> = ({
@@ -92,7 +93,7 @@ export const Tree: FunctionComponent<TreeProps> = ({
9293
<div className={styles.tree}>
9394
{name && (
9495
<TreeHeader
95-
treeFiltersStore={treeFiltersStore}
96+
treeFiltersStore={treeFiltersStore.value}
9697
statsStore={statsStore}
9798
categoryTitle={name}
9899
isOpened={isOpened}

packages/web-components/src/components/Tree/TreeHeader.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { type Statistic, statusesList } from "@allurereport/core-api";
2+
import type { Signal } from "@preact/signals";
23
import { clsx } from "clsx";
34
import type { TreeFiltersState } from "global";
45
import { type FunctionComponent } from "preact";
56
import { ArrowButton } from "@/components/ArrowButton";
7+
import type { StoreSignalState } from "@/components/Loadable";
68
import { Loadable } from "@/components/Loadable";
79
import { Text } from "@/components/Typography";
810
import styles from "./styles.scss";
@@ -12,7 +14,7 @@ interface TreeHeaderProps {
1214
categoryTitle: string;
1315
isOpened: boolean;
1416
toggleTree: () => void;
15-
statsStore: any;
17+
statsStore: Signal<StoreSignalState<Statistic>>;
1618
treeFiltersStore: TreeFiltersState;
1719
}
1820

@@ -50,10 +52,9 @@ export const TreeHeader: FunctionComponent<TreeHeaderProps> = ({
5052
const treeHeaderBar = statistic
5153
? statusesList
5254
.map((status) => ({ status, value: statistic[status] }))
53-
.filter(
54-
({ status, value }) =>
55-
value !== undefined && (statusFilter === "total" || (statusFilter === status && value > 0)),
56-
)
55+
.filter(({ status, value }) => {
56+
return value !== undefined && (statusFilter === "total" || (statusFilter === status && value > 0));
57+
})
5758
.map(({ status, value }) => {
5859
const className = clsx(styles["tree-header-bar-item"], styles[status]);
5960
const style = { flexGrow: value };

0 commit comments

Comments
 (0)