Skip to content

Commit

Permalink
split improvements and bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
todti committed Feb 18, 2025
1 parent 98b0977 commit eb37772
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions packages/web-components/src/components/Tree/Tree.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Statistic } from "@allurereport/core-api";
import type { Signal } from "@preact/signals";
import cx from "clsx";
import type { AllureAwesomeRecursiveTree, AllureAwesomeStatus, TreeFiltersState } from "global";
import type { FunctionComponent } from "preact";
Expand All @@ -18,8 +19,8 @@ interface TreeProps {
toggleTree: (id: string) => void;
navigateTo: (id: string) => void;
routeId?: string;
statsStore: StoreSignalState<Statistic>;
treeFiltersStore: TreeFiltersState;
statsStore: Signal<StoreSignalState<Statistic>>;
treeFiltersStore: Signal<TreeFiltersState>;
}

export const Tree: FunctionComponent<TreeProps> = ({
Expand Down Expand Up @@ -92,7 +93,7 @@ export const Tree: FunctionComponent<TreeProps> = ({
<div className={styles.tree}>
{name && (
<TreeHeader
treeFiltersStore={treeFiltersStore}
treeFiltersStore={treeFiltersStore.value}
statsStore={statsStore}
categoryTitle={name}
isOpened={isOpened}
Expand Down
11 changes: 6 additions & 5 deletions packages/web-components/src/components/Tree/TreeHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { type Statistic, statusesList } from "@allurereport/core-api";
import type { Signal } from "@preact/signals";
import { clsx } from "clsx";
import type { TreeFiltersState } from "global";
import { type FunctionComponent } from "preact";
import { ArrowButton } from "@/components/ArrowButton";
import type { StoreSignalState } from "@/components/Loadable";
import { Loadable } from "@/components/Loadable";
import { Text } from "@/components/Typography";
import styles from "./styles.scss";
Expand All @@ -12,7 +14,7 @@ interface TreeHeaderProps {
categoryTitle: string;
isOpened: boolean;
toggleTree: () => void;
statsStore: any;
statsStore: Signal<StoreSignalState<Statistic>>;
treeFiltersStore: TreeFiltersState;
}

Expand Down Expand Up @@ -50,10 +52,9 @@ export const TreeHeader: FunctionComponent<TreeHeaderProps> = ({
const treeHeaderBar = statistic
? statusesList
.map((status) => ({ status, value: statistic[status] }))
.filter(
({ status, value }) =>
value !== undefined && (statusFilter === "total" || (statusFilter === status && value > 0)),
)
.filter(({ status, value }) => {
return value !== undefined && (statusFilter === "total" || (statusFilter === status && value > 0));
})
.map(({ status, value }) => {
const className = clsx(styles["tree-header-bar-item"], styles[status]);
const style = { flexGrow: value };
Expand Down

0 comments on commit eb37772

Please sign in to comment.