Refactor/new menu item (#1448)
* wip * finished * Added disabled * Fixed disabled * Finished cleaning * Minor fixes from merge * Added docs * Added PascalCase * Fix from review * Fixes from merge * Fix lint * Fixed storybook tests
This commit is contained in:
@ -35,11 +35,7 @@ export const FilterByName: Story = {
|
||||
const filterButton = await canvas.findByText('Filter');
|
||||
await userEvent.click(filterButton);
|
||||
|
||||
const nameFilterButton = (
|
||||
await canvas.findAllByTestId('dropdown-menu-item')
|
||||
).find((item) => {
|
||||
return item.textContent === 'Name';
|
||||
});
|
||||
const nameFilterButton = await canvas.findByTestId('select-filter-0');
|
||||
|
||||
assert(nameFilterButton);
|
||||
|
||||
@ -70,11 +66,9 @@ export const FilterByAccountOwner: Story = {
|
||||
const filterButton = await canvas.findByText('Filter');
|
||||
await userEvent.click(filterButton);
|
||||
|
||||
const accountOwnerFilterButton = (
|
||||
await canvas.findAllByTestId('dropdown-menu-item')
|
||||
).find((item) => {
|
||||
return item.textContent === 'Account owner';
|
||||
});
|
||||
const accountOwnerFilterButton = await canvas.findByTestId(
|
||||
'select-filter-5',
|
||||
);
|
||||
|
||||
assert(accountOwnerFilterButton);
|
||||
|
||||
@ -89,11 +83,11 @@ export const FilterByAccountOwner: Story = {
|
||||
|
||||
await sleep(1000);
|
||||
|
||||
const charlesChip = (
|
||||
await canvas.findAllByTestId('dropdown-menu-item')
|
||||
).find((item) => {
|
||||
return item.textContent?.includes('Charles Test');
|
||||
});
|
||||
const charlesChip = (await canvas.findAllByTestId('menu-item')).find(
|
||||
(item) => {
|
||||
return item.textContent?.includes('Charles Test');
|
||||
},
|
||||
);
|
||||
|
||||
assert(charlesChip);
|
||||
|
||||
|
||||
@ -33,9 +33,8 @@ export const SortByName: Story = {
|
||||
const sortButton = await canvas.findByText('Sort');
|
||||
await userEvent.click(sortButton);
|
||||
|
||||
const nameSortButton = canvas.getByText('Name', {
|
||||
selector: 'li > div > div',
|
||||
});
|
||||
const nameSortButton = await canvas.findByTestId('select-sort-0');
|
||||
|
||||
await userEvent.click(nameSortButton);
|
||||
|
||||
expect(await canvas.getByTestId('remove-icon-name')).toBeInTheDocument();
|
||||
|
||||
@ -8,7 +8,6 @@ import {
|
||||
IconUsers,
|
||||
} from '@/ui/icon/index';
|
||||
import { TableRecoilScopeContext } from '@/ui/table/states/recoil-scope-contexts/TableRecoilScopeContext';
|
||||
import { icon } from '@/ui/theme/constants/icon';
|
||||
import { FilterDropdownUserSearchSelect } from '@/users/components/FilterDropdownUserSearchSelect';
|
||||
import { Company } from '~/generated/graphql';
|
||||
|
||||
@ -16,39 +15,37 @@ export const companiesFilters: FilterDefinitionByEntity<Company>[] = [
|
||||
{
|
||||
key: 'name',
|
||||
label: 'Name',
|
||||
icon: (
|
||||
<IconBuildingSkyscraper size={icon.size.md} stroke={icon.stroke.sm} />
|
||||
),
|
||||
Icon: IconBuildingSkyscraper,
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
key: 'employees',
|
||||
label: 'Employees',
|
||||
icon: <IconUsers size={icon.size.md} stroke={icon.stroke.sm} />,
|
||||
Icon: IconUsers,
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
key: 'domainName',
|
||||
label: 'URL',
|
||||
icon: <IconLink size={icon.size.md} stroke={icon.stroke.sm} />,
|
||||
Icon: IconLink,
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
key: 'address',
|
||||
label: 'Address',
|
||||
icon: <IconMap size={icon.size.md} stroke={icon.stroke.sm} />,
|
||||
Icon: IconMap,
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
key: 'createdAt',
|
||||
label: 'Created at',
|
||||
icon: <IconCalendarEvent size={icon.size.md} stroke={icon.stroke.sm} />,
|
||||
Icon: IconCalendarEvent,
|
||||
type: 'date',
|
||||
},
|
||||
{
|
||||
key: 'accountOwnerId',
|
||||
label: 'Account owner',
|
||||
icon: <IconUser size={icon.size.md} stroke={icon.stroke.sm} />,
|
||||
Icon: IconUser,
|
||||
type: 'entity',
|
||||
entitySelectComponent: (
|
||||
<FilterDropdownUserSearchSelect context={TableRecoilScopeContext} />
|
||||
|
||||
@ -12,26 +12,26 @@ export const availableSorts: SortType<Companies_Order_By>[] = [
|
||||
{
|
||||
key: 'name',
|
||||
label: 'Name',
|
||||
icon: <IconBuildingSkyscraper size={16} />,
|
||||
Icon: IconBuildingSkyscraper,
|
||||
},
|
||||
{
|
||||
key: 'employees',
|
||||
label: 'Employees',
|
||||
icon: <IconUsers size={16} />,
|
||||
Icon: IconUsers,
|
||||
},
|
||||
{
|
||||
key: 'domainName',
|
||||
label: 'Url',
|
||||
icon: <IconLink size={16} />,
|
||||
Icon: IconLink,
|
||||
},
|
||||
{
|
||||
key: 'address',
|
||||
label: 'Address',
|
||||
icon: <IconMap size={16} />,
|
||||
Icon: IconMap,
|
||||
},
|
||||
{
|
||||
key: 'createdAt',
|
||||
label: 'Creation',
|
||||
icon: <IconCalendarEvent size={16} />,
|
||||
Icon: IconCalendarEvent,
|
||||
},
|
||||
];
|
||||
|
||||
@ -23,7 +23,7 @@ export const companyShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
{
|
||||
key: 'domainName',
|
||||
name: 'Domain name',
|
||||
icon: <IconLink />,
|
||||
Icon: IconLink,
|
||||
type: 'url',
|
||||
metadata: {
|
||||
fieldName: 'domainName',
|
||||
@ -33,7 +33,7 @@ export const companyShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
{
|
||||
key: 'accountOwner',
|
||||
name: 'Account owner',
|
||||
icon: <IconUserCircle />,
|
||||
Icon: IconUserCircle,
|
||||
type: 'relation',
|
||||
metadata: {
|
||||
fieldName: 'accountOwner',
|
||||
@ -43,7 +43,7 @@ export const companyShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
{
|
||||
key: 'employees',
|
||||
name: 'Employees',
|
||||
icon: <IconUsers />,
|
||||
Icon: IconUsers,
|
||||
type: 'number',
|
||||
metadata: {
|
||||
fieldName: 'employees',
|
||||
@ -53,7 +53,7 @@ export const companyShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
{
|
||||
key: 'address',
|
||||
name: 'Address',
|
||||
icon: <IconMap />,
|
||||
Icon: IconMap,
|
||||
type: 'text',
|
||||
metadata: {
|
||||
fieldName: 'address',
|
||||
@ -63,7 +63,7 @@ export const companyShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
{
|
||||
key: 'idealCustomerProfile',
|
||||
name: 'ICP',
|
||||
icon: <IconTarget />,
|
||||
Icon: IconTarget,
|
||||
type: 'boolean',
|
||||
metadata: {
|
||||
fieldName: 'idealCustomerProfile',
|
||||
@ -72,7 +72,7 @@ export const companyShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
{
|
||||
key: 'xUrl',
|
||||
name: 'Twitter',
|
||||
icon: <IconBrandX />,
|
||||
Icon: IconBrandX,
|
||||
type: 'url',
|
||||
metadata: {
|
||||
fieldName: 'xUrl',
|
||||
@ -82,7 +82,7 @@ export const companyShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
{
|
||||
key: 'createdAt',
|
||||
name: 'Created at',
|
||||
icon: <IconCalendar />,
|
||||
Icon: IconCalendar,
|
||||
type: 'date',
|
||||
metadata: {
|
||||
fieldName: 'createdAt',
|
||||
|
||||
Reference in New Issue
Block a user