ФУНКЦИИ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: унификация фильтров внешнего контура с внутренним rich-filters слоем

This commit is contained in:
DCCONSTRUCTIONS
2026-04-21 12:29:32 +03:00
parent 2c54a8f274
commit 0a85ea3cb2
16 changed files with 588 additions and 564 deletions
@@ -16,6 +16,7 @@ import { AddFilterButton } from "@/components/rich-filters/add-filters/button";
type TFiltersToggleProps<P extends TFilterProperty, E extends TExternalFilter> = {
filter: IFilterInstance<P, E> | undefined;
showAddFilterButtonWhenEmpty?: boolean;
};
const COMMON_CLASSNAME =
@@ -24,13 +25,13 @@ const COMMON_CLASSNAME =
export const FiltersToggle = observer(function FiltersToggle<P extends TFilterProperty, E extends TExternalFilter>(
props: TFiltersToggleProps<P, E>
) {
const { filter } = props;
const { filter, showAddFilterButtonWhenEmpty = true } = props;
// derived values
const hasAnyConditions = (filter?.allConditionsForDisplay.length ?? 0) > 0;
const isFilterRowVisible = filter?.isVisible ?? false;
const hasUpdates = filter?.canUpdateView === true && filter?.hasChanges === true;
const showFilterRowChangesPill = hasUpdates || hasAnyConditions === true;
const showAddFilterButton = !hasAnyConditions && !isFilterRowVisible && !hasUpdates;
const showAddFilterButton = showAddFilterButtonWhenEmpty && !hasAnyConditions && !isFilterRowVisible && !hasUpdates;
const handleToggleFilter = () => {
if (!filter) {
@@ -9,6 +9,8 @@ const FILTER_LABEL_MAP: Record<string, string> = {
Label: "Метка",
Labels: "Метки",
Project: "Проект",
Projects: "Проекты",
Contour: "Контур",
"Created by": "Автор",
"Created at": "Дата создания",
"Updated at": "Дата обновления",
@@ -24,5 +24,5 @@ export const WorkItemFiltersToggle = observer(function WorkItemFiltersToggle(pro
// derived values
const filter = getFilter(entityType, entityId);
return <FiltersToggle filter={filter} />;
return <FiltersToggle filter={filter} showAddFilterButtonWhenEmpty={false} />;
});