Remove buttons for activity empty state (#8999)
Before: <img width="482" alt="Capture d’écran 2024-12-10 à 11 17 53" src="https://github.com/user-attachments/assets/3641e902-10b9-4fbf-8383-d6e5d5b2de79"> After: <img width="453" alt="Capture d’écran 2024-12-10 à 11 33 01" src="https://github.com/user-attachments/assets/9f949933-0740-4c91-abf3-2c1817a68968">
This commit is contained in:
@ -3,7 +3,6 @@ import styled from '@emotion/styled';
|
||||
import { CustomResolverFetchMoreLoader } from '@/activities/components/CustomResolverFetchMoreLoader';
|
||||
import { SkeletonLoader } from '@/activities/components/SkeletonLoader';
|
||||
import { EventList } from '@/activities/timeline-activities/components/EventList';
|
||||
import { TimelineCreateButtonGroup } from '@/activities/timeline-activities/components/TimelineCreateButtonGroup';
|
||||
import { useTimelineActivities } from '@/activities/timeline-activities/hooks/useTimelineActivities';
|
||||
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||
@ -41,10 +40,8 @@ const StyledMainContainer = styled.div`
|
||||
|
||||
export const TimelineActivities = ({
|
||||
targetableObject,
|
||||
isInRightDrawer = false,
|
||||
}: {
|
||||
targetableObject: ActivityTargetableObject;
|
||||
isInRightDrawer?: boolean;
|
||||
}) => {
|
||||
const { timelineActivities, loading, fetchMoreRecords } =
|
||||
useTimelineActivities(targetableObject);
|
||||
@ -65,13 +62,12 @@ export const TimelineActivities = ({
|
||||
<AnimatedPlaceholder type="emptyTimeline" />
|
||||
<AnimatedPlaceholderEmptyTextContainer>
|
||||
<AnimatedPlaceholderEmptyTitle>
|
||||
Add your first Activity
|
||||
No activity yet
|
||||
</AnimatedPlaceholderEmptyTitle>
|
||||
<AnimatedPlaceholderEmptySubTitle>
|
||||
There are no activities associated with this record.{' '}
|
||||
There is no activity associated with this record.
|
||||
</AnimatedPlaceholderEmptySubTitle>
|
||||
</AnimatedPlaceholderEmptyTextContainer>
|
||||
<TimelineCreateButtonGroup isInRightDrawer={isInRightDrawer} />
|
||||
</AnimatedPlaceholderEmptyContainer>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
import { TAB_LIST_COMPONENT_ID } from '@/ui/layout/show-page/components/ShowPageSubContainer';
|
||||
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import {
|
||||
Button,
|
||||
ButtonGroup,
|
||||
IconCheckbox,
|
||||
IconNotes,
|
||||
IconPaperclip,
|
||||
} from 'twenty-ui';
|
||||
|
||||
export const TimelineCreateButtonGroup = ({
|
||||
isInRightDrawer = false,
|
||||
}: {
|
||||
isInRightDrawer?: boolean;
|
||||
}) => {
|
||||
const { activeTabIdState } = useTabList(
|
||||
`${TAB_LIST_COMPONENT_ID}-${isInRightDrawer}`,
|
||||
);
|
||||
const setActiveTabId = useSetRecoilState(activeTabIdState);
|
||||
|
||||
return (
|
||||
<ButtonGroup variant={'secondary'}>
|
||||
<Button
|
||||
Icon={IconNotes}
|
||||
title="Note"
|
||||
onClick={() => {
|
||||
setActiveTabId('notes');
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
Icon={IconCheckbox}
|
||||
title="Task"
|
||||
onClick={() => {
|
||||
setActiveTabId('tasks');
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
Icon={IconPaperclip}
|
||||
title="File"
|
||||
onClick={() => setActiveTabId('files')}
|
||||
/>
|
||||
</ButtonGroup>
|
||||
);
|
||||
};
|
||||
@ -40,11 +40,8 @@ type CardComponentProps = {
|
||||
type CardComponentType = (props: CardComponentProps) => JSX.Element | null;
|
||||
|
||||
export const CardComponents: Record<CardType, CardComponentType> = {
|
||||
[CardType.TimelineCard]: ({ targetableObject, isInRightDrawer }) => (
|
||||
<TimelineActivities
|
||||
targetableObject={targetableObject}
|
||||
isInRightDrawer={isInRightDrawer}
|
||||
/>
|
||||
[CardType.TimelineCard]: ({ targetableObject }) => (
|
||||
<TimelineActivities targetableObject={targetableObject} />
|
||||
),
|
||||
|
||||
[CardType.FieldCard]: ({ targetableObject, isInRightDrawer }) => (
|
||||
|
||||
@ -71,8 +71,8 @@ export const Default: Story = {
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
await canvas.findByText('Add your first Activity', undefined, {
|
||||
timeout: 3000,
|
||||
await canvas.findByText('No activity yet', undefined, {
|
||||
timeout: 5000,
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user