UI - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: русификация значений rich-filters во внутреннем контуре
This commit is contained in:
parent
a5bf967862
commit
2c54a8f274
|
|
@ -7,6 +7,7 @@
|
||||||
import { useCallback, useMemo } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
import { AtSign, Briefcase } from "lucide-react";
|
import { AtSign, Briefcase } from "lucide-react";
|
||||||
// plane imports
|
// plane imports
|
||||||
|
import { useTranslation } from "@plane/i18n";
|
||||||
import { Logo } from "@plane/propel/emoji-icon-picker";
|
import { Logo } from "@plane/propel/emoji-icon-picker";
|
||||||
import {
|
import {
|
||||||
CalendarLayoutIcon,
|
CalendarLayoutIcon,
|
||||||
|
|
@ -91,6 +92,7 @@ export type TWorkItemFiltersConfig = {
|
||||||
export const useWorkItemFiltersConfig = (props: TUseWorkItemFiltersConfigProps): TWorkItemFiltersConfig => {
|
export const useWorkItemFiltersConfig = (props: TUseWorkItemFiltersConfigProps): TWorkItemFiltersConfig => {
|
||||||
const { allowedFilters, cycleIds, labelIds, memberIds, moduleIds, projectId, projectIds, stateIds, workspaceSlug } =
|
const { allowedFilters, cycleIds, labelIds, memberIds, moduleIds, projectId, projectIds, stateIds, workspaceSlug } =
|
||||||
props;
|
props;
|
||||||
|
const { t } = useTranslation();
|
||||||
// store hooks
|
// store hooks
|
||||||
const { loader: projectLoader, getProjectById } = useProject();
|
const { loader: projectLoader, getProjectById } = useProject();
|
||||||
const { getCycleById } = useCycle();
|
const { getCycleById } = useCycle();
|
||||||
|
|
@ -152,11 +154,13 @@ export const useWorkItemFiltersConfig = (props: TUseWorkItemFiltersConfigProps):
|
||||||
() =>
|
() =>
|
||||||
getStateGroupFilterConfig<TWorkItemFilterProperty>("state_group")({
|
getStateGroupFilterConfig<TWorkItemFilterProperty>("state_group")({
|
||||||
isEnabled: isFilterEnabled("state_group"),
|
isEnabled: isFilterEnabled("state_group"),
|
||||||
|
filterLabel: t("common.state_group"),
|
||||||
filterIcon: StatePropertyIcon,
|
filterIcon: StatePropertyIcon,
|
||||||
|
getItemLabel: (stateGroupKey) => t(`workspace_projects.state.${stateGroupKey}`),
|
||||||
getOptionIcon: (stateGroupKey) => <StateGroupIcon stateGroup={stateGroupKey} />,
|
getOptionIcon: (stateGroupKey) => <StateGroupIcon stateGroup={stateGroupKey} />,
|
||||||
...operatorConfigs,
|
...operatorConfigs,
|
||||||
}),
|
}),
|
||||||
[isFilterEnabled, operatorConfigs]
|
[isFilterEnabled, operatorConfigs, t]
|
||||||
);
|
);
|
||||||
|
|
||||||
// state filter config
|
// state filter config
|
||||||
|
|
@ -298,11 +302,13 @@ export const useWorkItemFiltersConfig = (props: TUseWorkItemFiltersConfigProps):
|
||||||
() =>
|
() =>
|
||||||
getPriorityFilterConfig<TWorkItemFilterProperty>("priority")({
|
getPriorityFilterConfig<TWorkItemFilterProperty>("priority")({
|
||||||
isEnabled: isFilterEnabled("priority"),
|
isEnabled: isFilterEnabled("priority"),
|
||||||
|
filterLabel: t("common.priority"),
|
||||||
filterIcon: PriorityPropertyIcon,
|
filterIcon: PriorityPropertyIcon,
|
||||||
|
getItemLabel: (priorityKey) => (priorityKey === "none" ? t("common.none") : t(priorityKey)),
|
||||||
getOptionIcon: (priority) => <PriorityIcon priority={priority} />,
|
getOptionIcon: (priority) => <PriorityIcon priority={priority} />,
|
||||||
...operatorConfigs,
|
...operatorConfigs,
|
||||||
}),
|
}),
|
||||||
[isFilterEnabled, operatorConfigs]
|
[isFilterEnabled, operatorConfigs, t]
|
||||||
);
|
);
|
||||||
|
|
||||||
// start date filter config
|
// start date filter config
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,11 @@ import { createFilterConfig, getMultiSelectConfig, createOperatorConfigEntry } f
|
||||||
/**
|
/**
|
||||||
* Priority filter specific params
|
* Priority filter specific params
|
||||||
*/
|
*/
|
||||||
export type TCreatePriorityFilterParams = TCreateFilterConfigParams & IFilterIconConfig<TIssuePriorities>;
|
export type TCreatePriorityFilterParams = TCreateFilterConfigParams &
|
||||||
|
IFilterIconConfig<TIssuePriorities> & {
|
||||||
|
filterLabel?: string;
|
||||||
|
getItemLabel?: (priorityKey: TIssuePriorities) => string;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to get the priority multi select config
|
* Helper to get the priority multi select config
|
||||||
|
|
@ -33,7 +37,7 @@ export const getPriorityMultiSelectConfig = (
|
||||||
{
|
{
|
||||||
items: ISSUE_PRIORITIES,
|
items: ISSUE_PRIORITIES,
|
||||||
getId: (priority) => priority.key,
|
getId: (priority) => priority.key,
|
||||||
getLabel: (priority) => priority.title,
|
getLabel: (priority) => params.getItemLabel?.(priority.key) ?? priority.title,
|
||||||
getValue: (priority) => priority.key,
|
getValue: (priority) => priority.key,
|
||||||
getIconData: (priority) => priority.key,
|
getIconData: (priority) => priority.key,
|
||||||
},
|
},
|
||||||
|
|
@ -57,7 +61,7 @@ export const getPriorityFilterConfig =
|
||||||
(params: TCreatePriorityFilterParams) =>
|
(params: TCreatePriorityFilterParams) =>
|
||||||
createFilterConfig<P>({
|
createFilterConfig<P>({
|
||||||
id: key,
|
id: key,
|
||||||
label: "Priority",
|
label: params.filterLabel ?? "Priority",
|
||||||
...params,
|
...params,
|
||||||
icon: params.filterIcon,
|
icon: params.filterIcon,
|
||||||
supportedOperatorConfigsMap: new Map([
|
supportedOperatorConfigsMap: new Map([
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,11 @@ import { createFilterConfig, getMultiSelectConfig, createOperatorConfigEntry } f
|
||||||
/**
|
/**
|
||||||
* State group filter specific params
|
* State group filter specific params
|
||||||
*/
|
*/
|
||||||
export type TCreateStateGroupFilterParams = TCreateFilterConfigParams & IFilterIconConfig<TStateGroups>;
|
export type TCreateStateGroupFilterParams = TCreateFilterConfigParams &
|
||||||
|
IFilterIconConfig<TStateGroups> & {
|
||||||
|
filterLabel?: string;
|
||||||
|
getItemLabel?: (stateGroupKey: TStateGroups) => string;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to get the state group multi select config
|
* Helper to get the state group multi select config
|
||||||
|
|
@ -32,7 +36,7 @@ export const getStateGroupMultiSelectConfig = (
|
||||||
{
|
{
|
||||||
items: Object.values(STATE_GROUPS),
|
items: Object.values(STATE_GROUPS),
|
||||||
getId: (state) => state.key,
|
getId: (state) => state.key,
|
||||||
getLabel: (state) => state.label,
|
getLabel: (state) => params.getItemLabel?.(state.key) ?? state.label,
|
||||||
getValue: (state) => state.key,
|
getValue: (state) => state.key,
|
||||||
getIconData: (state) => state.key,
|
getIconData: (state) => state.key,
|
||||||
},
|
},
|
||||||
|
|
@ -56,7 +60,7 @@ export const getStateGroupFilterConfig =
|
||||||
(params: TCreateStateGroupFilterParams) =>
|
(params: TCreateStateGroupFilterParams) =>
|
||||||
createFilterConfig<P>({
|
createFilterConfig<P>({
|
||||||
id: key,
|
id: key,
|
||||||
label: "State Group",
|
label: params.filterLabel ?? "State Group",
|
||||||
...params,
|
...params,
|
||||||
icon: params.filterIcon,
|
icon: params.filterIcon,
|
||||||
supportedOperatorConfigsMap: new Map([
|
supportedOperatorConfigsMap: new Map([
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue