Add back pickers on all pages, fix command menu (#2662)
* Add back pickers on all pages, fix command menu * Fix lint
This commit is contained in:
@ -3,7 +3,7 @@ import { useQuery } from '@apollo/client';
|
||||
|
||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||
import { useFilteredSearchEntityQuery } from '@/search/hooks/useFilteredSearchEntityQuery';
|
||||
import { IconUserCircle } from '@/ui/display/icon';
|
||||
import { IconForbid } from '@/ui/display/icon';
|
||||
import { useRelationPicker } from '@/ui/input/components/internal/relation-picker/hooks/useRelationPicker';
|
||||
import { SingleEntitySelect } from '@/ui/input/relation-picker/components/SingleEntitySelect';
|
||||
import { relationPickerSearchFilterScopedState } from '@/ui/input/relation-picker/states/relationPickerSearchFilterScopedState';
|
||||
@ -17,6 +17,7 @@ export type RelationPickerProps = {
|
||||
onSubmit: (newUser: EntityForSelect | null) => void;
|
||||
onCancel?: () => void;
|
||||
width?: number;
|
||||
excludeRecordIds?: string[];
|
||||
initialSearchFilter?: string | null;
|
||||
fieldDefinition: FieldDefinition<FieldRelationMetadata>;
|
||||
};
|
||||
@ -25,6 +26,7 @@ export const RelationPicker = ({
|
||||
recordId,
|
||||
onSubmit,
|
||||
onCancel,
|
||||
excludeRecordIds,
|
||||
width,
|
||||
initialSearchFilter,
|
||||
fieldDefinition,
|
||||
@ -63,6 +65,7 @@ export const RelationPicker = ({
|
||||
fieldDefinition.metadata.relationObjectMetadataNameSingular,
|
||||
),
|
||||
selectedIds: recordId ? [recordId] : [],
|
||||
excludeEntityIds: excludeRecordIds,
|
||||
objectNamePlural: fieldDefinition.metadata.relationObjectMetadataNamePlural,
|
||||
});
|
||||
|
||||
@ -72,8 +75,8 @@ export const RelationPicker = ({
|
||||
|
||||
return (
|
||||
<SingleEntitySelect
|
||||
EmptyIcon={IconUserCircle}
|
||||
emptyLabel="No Owner"
|
||||
EmptyIcon={IconForbid}
|
||||
emptyLabel={'No ' + fieldDefinition.label}
|
||||
entitiesToSelect={records.entitiesToSelect}
|
||||
loading={records.loading}
|
||||
onCancel={onCancel}
|
||||
|
||||
@ -8,7 +8,7 @@ const StyledOuterContainer = styled.div`
|
||||
display: flex;
|
||||
|
||||
gap: ${({ theme }) => (useIsMobile() ? theme.spacing(3) : '0')};
|
||||
height: ${() => (useIsMobile() ? '100%' : 'auto')};
|
||||
height: ${() => (useIsMobile() ? '100%' : '100%')};
|
||||
overflow-x: ${() => (useIsMobile() ? 'hidden' : 'auto')};
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
@ -31,6 +31,12 @@ const StyledInnerContainer = styled.div`
|
||||
}};
|
||||
`;
|
||||
|
||||
const StyledIntermediateContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: ${({ theme }) => theme.spacing(3)};
|
||||
`;
|
||||
|
||||
export type ShowPageLeftContainerProps = {
|
||||
children: ReactElement[];
|
||||
};
|
||||
@ -46,7 +52,9 @@ export const ShowPageLeftContainer = ({
|
||||
) : (
|
||||
<StyledOuterContainer>
|
||||
<ScrollWrapper>
|
||||
<StyledInnerContainer>{children}</StyledInnerContainer>
|
||||
<StyledIntermediateContainer>
|
||||
<StyledInnerContainer>{children}</StyledInnerContainer>
|
||||
</StyledIntermediateContainer>
|
||||
</ScrollWrapper>
|
||||
</StyledOuterContainer>
|
||||
);
|
||||
|
||||
@ -91,16 +91,18 @@ export const ShowPageSummaryCard = ({
|
||||
const onFileChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||
if (e.target.files) onUploadPicture?.(e.target.files[0]);
|
||||
};
|
||||
const handleAvatarClick = () => {
|
||||
inputFileRef?.current?.click?.();
|
||||
};
|
||||
|
||||
// Todo - add back in when we have the ability to upload a picture
|
||||
// const handleAvatarClick = () => {
|
||||
// inputFileRef?.current?.click?.();
|
||||
// };
|
||||
|
||||
return (
|
||||
<StyledShowPageSummaryCard>
|
||||
<StyledAvatarWrapper>
|
||||
<Avatar
|
||||
avatarUrl={logoOrAvatar}
|
||||
onClick={onUploadPicture ? handleAvatarClick : undefined}
|
||||
// onClick={onUploadPicture ? handleAvatarClick : undefined}
|
||||
size="xl"
|
||||
colorId={id}
|
||||
placeholder={title}
|
||||
|
||||
@ -9,7 +9,7 @@ type FilterToTurnIntoWhereClause = Omit<Filter, 'definition'> & {
|
||||
};
|
||||
};
|
||||
|
||||
export const turnFiltersIntoWhereClauseV2 = (
|
||||
export const turnFiltersIntoWhereClause = (
|
||||
filters: FilterToTurnIntoWhereClause[],
|
||||
fields: Pick<Field, 'id' | 'name'>[],
|
||||
) => {
|
||||
@ -2,7 +2,7 @@ import { Field } from '~/generated/graphql';
|
||||
|
||||
import { Sort } from '../types/Sort';
|
||||
|
||||
export const turnSortsIntoOrderByV2 = (
|
||||
export const turnSortsIntoOrderBy = (
|
||||
sorts: Sort[],
|
||||
fields: Pick<Field, 'id' | 'name'>[],
|
||||
) => {
|
||||
@ -1,12 +1,6 @@
|
||||
import { ComponentType } from 'react';
|
||||
|
||||
import { Opportunity } from '@/pipeline/types/Opportunity';
|
||||
import { FilterDefinitionByEntity } from '@/ui/object/object-filter-dropdown/types/FilterDefinitionByEntity';
|
||||
import { SortDefinition } from '@/ui/object/object-sort-dropdown/types/SortDefinition';
|
||||
|
||||
export type BoardOptions = {
|
||||
newCardComponent: React.ReactNode;
|
||||
CardComponent: ComponentType;
|
||||
filterDefinitions: FilterDefinitionByEntity<Opportunity>[];
|
||||
sortDefinitions: SortDefinition[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user