mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-24 06:48:42 +03:00
Show page - disable click for workspace member relation (#3464)
* [Draft] Add disable logic + failing test * Fix test * Remove hook --------- Co-authored-by: Thomas Trompette <thomast@twenty.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
parent
d8c9a94e14
commit
c868347552
@ -56,7 +56,12 @@ export const getObjectRecordIdentifier = ({
|
||||
objectMetadataItem,
|
||||
});
|
||||
|
||||
const linkToShowPage = `${basePathToShowPage}${record.id}`;
|
||||
const isWorkspaceMemberObjectMetadata =
|
||||
objectMetadataItem.nameSingular === CoreObjectNameSingular.WorkspaceMember;
|
||||
|
||||
const linkToShowPage = isWorkspaceMemberObjectMetadata
|
||||
? ''
|
||||
: `${basePathToShowPage}${record.id}`;
|
||||
|
||||
return {
|
||||
id: record.id,
|
||||
|
@ -0,0 +1,67 @@
|
||||
import { useEffect } from 'react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
|
||||
import { ChipFieldDisplay } from '@/object-record/field/meta-types/display/components/ChipFieldDisplay';
|
||||
import { entityFieldsFamilyState } from '@/object-record/field/states/entityFieldsFamilyState';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
|
||||
import { FieldContext } from '../../../../contexts/FieldContext';
|
||||
|
||||
const ChipFieldValueSetterEffect = () => {
|
||||
const setEntityFields = useSetRecoilState(entityFieldsFamilyState('123'));
|
||||
|
||||
useEffect(() => {
|
||||
setEntityFields({
|
||||
id: 'henry',
|
||||
name: {
|
||||
firstName: 'Henry',
|
||||
lastName: 'Cavill',
|
||||
},
|
||||
});
|
||||
}, [setEntityFields]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const meta: Meta = {
|
||||
title: 'UI/Data/Field/Display/ChipFieldDisplay',
|
||||
decorators: [
|
||||
(Story) => (
|
||||
<MemoryRouter>
|
||||
<FieldContext.Provider
|
||||
value={{
|
||||
entityId: '123',
|
||||
basePathToShowPage: '/object-record/',
|
||||
isLabelIdentifier: false,
|
||||
fieldDefinition: {
|
||||
fieldMetadataId: 'full name',
|
||||
label: 'Henry Cavill',
|
||||
type: 'FULL_NAME',
|
||||
iconName: 'IconCalendarEvent',
|
||||
metadata: {
|
||||
fieldName: 'full name',
|
||||
objectMetadataNameSingular: 'person',
|
||||
},
|
||||
},
|
||||
hotkeyScope: 'hotkey-scope',
|
||||
}}
|
||||
>
|
||||
<ChipFieldValueSetterEffect />
|
||||
<Story />
|
||||
</FieldContext.Provider>
|
||||
</MemoryRouter>
|
||||
),
|
||||
ComponentDecorator,
|
||||
],
|
||||
component: ChipFieldDisplay,
|
||||
argTypes: { value: { control: 'date' } },
|
||||
args: {},
|
||||
};
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof ChipFieldDisplay>;
|
||||
|
||||
export const Default: Story = {};
|
Loading…
Reference in New Issue
Block a user