Skip to content

Commit

Permalink
re-add "not implemented" tooltip that I forgot
Browse files Browse the repository at this point in the history
  • Loading branch information
Raicuparta committed Jan 21, 2024
1 parent 91203c4 commit cbb2d19
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
36 changes: 22 additions & 14 deletions frontend/components/filters/filter-button.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { FilterOption } from "@components/table/table-head";
import { Button, Checkbox } from "@mantine/core";
import { Button, Checkbox, Tooltip } from "@mantine/core";
import { useCallback } from "react";
import { UnknownFilterOption } from "./filter-select";
import styles from "./filters.module.css";

type Props<TFilterOption extends string> = {
readonly isHidden: boolean;
readonly isUnavailable: boolean;
readonly onClick: (value: TFilterOption | null) => void;
readonly filterOption: UnknownFilterOption | FilterOption<TFilterOption>;
};
Expand All @@ -18,19 +19,26 @@ export function FilterButton<TFilterOption extends string>(
}, [props]);

return (
<Button
fullWidth
justify="start"
leftSection={
<Checkbox
tabIndex={-1}
className={styles.checkbox}
checked={!props.isHidden}
/>
}
onClick={handleClick}
<Tooltip
label="Not implemented"
disabled={!props.isUnavailable}
>
{props.filterOption.label || props.filterOption.value}
</Button>
<Button
disabled={props.isUnavailable}
fullWidth
justify="start"
leftSection={
<Checkbox
disabled={props.isUnavailable}
tabIndex={-1}
className={styles.checkbox}
checked={!props.isUnavailable && !props.isHidden}
/>
}
onClick={handleClick}
>
{props.filterOption.label || props.filterOption.value}
</Button>
</Tooltip>
);
}
4 changes: 4 additions & 0 deletions frontend/components/filters/filter-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export function FilterSelect<
filterOption={filterOption}
onClick={handleFilterClick}
isHidden={hiddenValues.includes(filterOption.value)}
isUnavailable={Boolean(
filterOption.value &&
column.unavailableValues?.includes(filterOption.value),
)}
key={filterOption.value}
/>
))}
Expand Down

0 comments on commit cbb2d19

Please sign in to comment.