Use Graphql types in FE and complete mappers removal (#348)
Fix Typescript build issues
This commit is contained in:
@ -8,7 +8,6 @@ import { useSearch } from '@/search/services/search';
|
||||
import { IconPlus } from '@/ui/icons/index';
|
||||
import { textInputStyle } from '@/ui/layout/styles/themes';
|
||||
import { isSomeInputInEditModeState } from '@/ui/tables/states/isSomeInputInEditModeState';
|
||||
import { AnyEntity } from '@/utils/interfaces/generic.interface';
|
||||
import { isDefined } from '@/utils/type-guards/isDefined';
|
||||
import { isNonEmptyString } from '@/utils/type-guards/isNonEmptyString';
|
||||
|
||||
@ -86,13 +85,10 @@ const StyledCreateButtonText = styled.div`
|
||||
color: ${(props) => props.theme.text60};
|
||||
`;
|
||||
|
||||
export type EditableRelationProps<
|
||||
RelationType extends AnyEntity,
|
||||
ChipComponentPropsType,
|
||||
> = {
|
||||
relation?: RelationType | null;
|
||||
export type EditableRelationProps<RelationType, ChipComponentPropsType> = {
|
||||
relation?: any;
|
||||
searchPlaceholder: string;
|
||||
searchConfig: SearchConfigType<RelationType>;
|
||||
searchConfig: SearchConfigType;
|
||||
onChange: (relation: RelationType) => void;
|
||||
onChangeSearchInput?: (searchInput: string) => void;
|
||||
editModeHorizontalAlign?: 'left' | 'right';
|
||||
@ -105,10 +101,7 @@ export type EditableRelationProps<
|
||||
};
|
||||
|
||||
// TODO: split this component
|
||||
export function EditableRelation<
|
||||
RelationType extends AnyEntity,
|
||||
ChipComponentPropsType,
|
||||
>({
|
||||
export function EditableRelation<RelationType, ChipComponentPropsType>({
|
||||
relation,
|
||||
searchPlaceholder,
|
||||
searchConfig,
|
||||
|
||||
@ -40,7 +40,8 @@ export const FilterDropdownButton = <TData extends FilterableFieldsType>({
|
||||
FilterOperandType<TData> | undefined
|
||||
>(undefined);
|
||||
|
||||
const [filterSearchResults, setSearchInput, setFilterSearch] = useSearch();
|
||||
const [filterSearchResults, setSearchInput, setFilterSearch] =
|
||||
useSearch<TData>();
|
||||
|
||||
const resetState = useCallback(() => {
|
||||
setIsOperandSelectionUnfolded(false);
|
||||
@ -79,7 +80,7 @@ export const FilterDropdownButton = <TData extends FilterableFieldsType>({
|
||||
));
|
||||
|
||||
const renderSearchResults = (
|
||||
filterSearchResults: SearchResultsType,
|
||||
filterSearchResults: SearchResultsType<TData>,
|
||||
selectedFilter: FilterConfigType<TData>,
|
||||
selectedFilterOperand: FilterOperandType<TData>,
|
||||
) => {
|
||||
@ -155,7 +156,7 @@ export const FilterDropdownButton = <TData extends FilterableFieldsType>({
|
||||
displayValue: event.target.value,
|
||||
icon: selectedFilter.icon,
|
||||
operand: selectedFilterOperand,
|
||||
});
|
||||
} as SelectedFilterType<TData>);
|
||||
}
|
||||
}
|
||||
}}
|
||||
@ -172,7 +173,7 @@ export const FilterDropdownButton = <TData extends FilterableFieldsType>({
|
||||
displayValue: humanReadableDate(date),
|
||||
icon: selectedFilter.icon,
|
||||
operand: selectedFilterOperand,
|
||||
});
|
||||
} as SelectedFilterType<TData>);
|
||||
}}
|
||||
customInput={<></>}
|
||||
customCalendarContainer={styled.div`
|
||||
@ -200,7 +201,7 @@ export const FilterDropdownButton = <TData extends FilterableFieldsType>({
|
||||
setIsUnfolded={setIsUnfolded}
|
||||
resetState={resetState}
|
||||
>
|
||||
{selectedFilter
|
||||
{selectedFilter && selectedFilterOperand
|
||||
? isOperandSelectionUnfolded
|
||||
? renderOperandSelection
|
||||
: renderValueSelection(selectedFilter, selectedFilterOperand)
|
||||
|
||||
Reference in New Issue
Block a user