-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current workspace member filter (#8016) #9182
Changes from all commits
354c94a
d86416a
08c5279
84b6baf
ca61bb3
90a2163
109c632
705fe49
d4f4a68
0de105a
3d2c4fc
b466d66
b3d1740
bb4b163
a7e51b2
b75e6f1
c72a8c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,22 @@ import { ContextStoreTargetedRecordsRule } from '@/context-store/states/contextS | |
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; | ||
import { RecordGqlOperationFilter } from '@/object-record/graphql/types/RecordGqlOperationFilter'; | ||
import { Filter } from '@/object-record/object-filter-dropdown/types/Filter'; | ||
import { FilterValueDependencies } from '@/object-record/record-filter/types/FilterValueDependencies'; | ||
import { computeViewRecordGqlOperationFilter } from '@/object-record/record-filter/utils/computeViewRecordGqlOperationFilter'; | ||
import { makeAndFilterVariables } from '@/object-record/utils/makeAndFilterVariables'; | ||
|
||
export const computeContextStoreFilters = ( | ||
contextStoreTargetedRecordsRule: ContextStoreTargetedRecordsRule, | ||
contextStoreFilters: Filter[], | ||
objectMetadataItem: ObjectMetadataItem, | ||
filterValueDependencies: FilterValueDependencies, | ||
) => { | ||
let queryFilter: RecordGqlOperationFilter | undefined; | ||
|
||
if (contextStoreTargetedRecordsRule.mode === 'exclusion') { | ||
queryFilter = makeAndFilterVariables([ | ||
computeViewRecordGqlOperationFilter( | ||
filterValueDependencies, | ||
contextStoreFilters, | ||
objectMetadataItem?.fields ?? [], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: optional chaining on fields is redundant since empty array is already the fallback |
||
[], | ||
|
@@ -39,6 +42,7 @@ export const computeContextStoreFilters = ( | |
}, | ||
} | ||
: computeViewRecordGqlOperationFilter( | ||
filterValueDependencies, | ||
contextStoreFilters, | ||
objectMetadataItem?.fields ?? [], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: optional chaining on fields is redundant since empty array is already the fallback |
||
[], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { StyledMultipleSelectDropdownAvatarChip } from '@/object-record/select/components/StyledMultipleSelectDropdownAvatarChip'; | ||
import { SelectableItem } from '@/object-record/select/types/SelectableItem'; | ||
import styled from '@emotion/styled'; | ||
import { MenuItemMultiSelectAvatar } from 'twenty-ui'; | ||
|
||
const StyledPinnedItemsContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
padding: ${({ theme }) => theme.spacing(1)}; | ||
`; | ||
|
||
export const ObjectFilterDropdownRecordPinnedItems = (props: { | ||
selectableItems: SelectableItem[]; | ||
onChange: ( | ||
selectableItem: SelectableItem, | ||
isNewCheckedValue: boolean, | ||
) => void; | ||
}) => { | ||
return ( | ||
<StyledPinnedItemsContainer> | ||
{props.selectableItems.map((selectableItem) => { | ||
return ( | ||
<MenuItemMultiSelectAvatar | ||
key={selectableItem.id} | ||
selected={selectableItem.isSelected} | ||
onSelectChange={(newCheckedValue) => { | ||
props.onChange(selectableItem, newCheckedValue); | ||
}} | ||
Comment on lines
+26
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: ensure onChange handler is memoized in parent component to prevent unnecessary re-renders |
||
avatar={ | ||
<StyledMultipleSelectDropdownAvatarChip | ||
className="avatar-icon-container" | ||
name={selectableItem.name} | ||
avatarUrl={selectableItem.avatarUrl} | ||
LeftIcon={selectableItem.AvatarIcon} | ||
avatarType={selectableItem.avatarType} | ||
isIconInverted={selectableItem.isIconInverted} | ||
placeholderColorSeed={selectableItem.id} | ||
/> | ||
} | ||
/> | ||
); | ||
})} | ||
</StyledPinnedItemsContainer> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: filterValueDependencies is now required by computeContextStoreFilters but no error handling if dependencies are undefined