Minor fixes empty state (#3703)
* Minor fixes for Timeline empty states * Refactored TimelineCreateButtonGroup
This commit is contained in:
@ -1,30 +0,0 @@
|
|||||||
import {
|
|
||||||
IconCheckbox,
|
|
||||||
IconNotes,
|
|
||||||
IconTimelineEvent,
|
|
||||||
} from '@/ui/display/icon/index';
|
|
||||||
import { Button } from '@/ui/input/button/components/Button';
|
|
||||||
import { ButtonGroup } from '@/ui/input/button/components/ButtonGroup';
|
|
||||||
|
|
||||||
type ActivityCreateButtonProps = {
|
|
||||||
onNoteClick?: () => void;
|
|
||||||
onTaskClick?: () => void;
|
|
||||||
onActivityClick?: () => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ActivityCreateButton = ({
|
|
||||||
onNoteClick,
|
|
||||||
onTaskClick,
|
|
||||||
onActivityClick,
|
|
||||||
}: ActivityCreateButtonProps) => (
|
|
||||||
<ButtonGroup variant={'secondary'}>
|
|
||||||
<Button Icon={IconNotes} title="Note" onClick={onNoteClick} />
|
|
||||||
<Button Icon={IconCheckbox} title="Task" onClick={onTaskClick} />
|
|
||||||
<Button
|
|
||||||
Icon={IconTimelineEvent}
|
|
||||||
title="Activity"
|
|
||||||
soon={true}
|
|
||||||
onClick={onActivityClick}
|
|
||||||
/>
|
|
||||||
</ButtonGroup>
|
|
||||||
);
|
|
||||||
@ -63,7 +63,7 @@ export const TaskGroups = ({
|
|||||||
<StyledEmptyTextContainer>
|
<StyledEmptyTextContainer>
|
||||||
<StyledEmptyTitle>No Task</StyledEmptyTitle>
|
<StyledEmptyTitle>No Task</StyledEmptyTitle>
|
||||||
<StyledEmptySubTitle>
|
<StyledEmptySubTitle>
|
||||||
There are no associated tasks with this record
|
There are no tasks for this user filter
|
||||||
</StyledEmptySubTitle>
|
</StyledEmptySubTitle>
|
||||||
</StyledEmptyTextContainer>
|
</StyledEmptyTextContainer>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { ActivityCreateButton } from '@/activities/components/ActivityCreateButton';
|
import { TimelineCreateButtonGroup } from '@/activities/timeline/components/TimelineCreateButtonGroup';
|
||||||
import { useOpenCreateActivityDrawer } from '@/activities/hooks/useOpenCreateActivityDrawer';
|
|
||||||
import { useTimelineActivities } from '@/activities/timeline/hooks/useTimelineActivities';
|
import { useTimelineActivities } from '@/activities/timeline/hooks/useTimelineActivities';
|
||||||
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||||
import AnimatedPlaceholder from '@/ui/layout/animated-placeholder/components/AnimatedPlaceholder';
|
import AnimatedPlaceholder from '@/ui/layout/animated-placeholder/components/AnimatedPlaceholder';
|
||||||
@ -36,8 +35,6 @@ export const Timeline = ({
|
|||||||
targetableObject,
|
targetableObject,
|
||||||
});
|
});
|
||||||
|
|
||||||
const openCreateActivity = useOpenCreateActivityDrawer();
|
|
||||||
|
|
||||||
const showEmptyState = initialized && activities.length === 0;
|
const showEmptyState = initialized && activities.length === 0;
|
||||||
|
|
||||||
const showLoadingState = !initialized;
|
const showLoadingState = !initialized;
|
||||||
@ -57,20 +54,7 @@ export const Timeline = ({
|
|||||||
There are no activities associated with this record.{' '}
|
There are no activities associated with this record.{' '}
|
||||||
</StyledEmptySubTitle>
|
</StyledEmptySubTitle>
|
||||||
</StyledEmptyTextContainer>
|
</StyledEmptyTextContainer>
|
||||||
<ActivityCreateButton
|
<TimelineCreateButtonGroup targetableObject={targetableObject} />
|
||||||
onNoteClick={() =>
|
|
||||||
openCreateActivity({
|
|
||||||
type: 'Note',
|
|
||||||
targetableObjects: [targetableObject],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
onTaskClick={() =>
|
|
||||||
openCreateActivity({
|
|
||||||
type: 'Task',
|
|
||||||
targetableObjects: [targetableObject],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</StyledEmptyContainer>
|
</StyledEmptyContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,53 @@
|
|||||||
|
import { useSetRecoilState } from 'recoil';
|
||||||
|
import { Button, ButtonGroup } from 'tsup.ui.index';
|
||||||
|
|
||||||
|
import { useOpenCreateActivityDrawer } from '@/activities/hooks/useOpenCreateActivityDrawer';
|
||||||
|
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||||
|
import {
|
||||||
|
IconCheckbox,
|
||||||
|
IconNotes,
|
||||||
|
IconPaperclip,
|
||||||
|
} from '@/ui/display/icon/index';
|
||||||
|
import { TAB_LIST_COMPONENT_ID } from '@/ui/layout/show-page/components/ShowPageRightContainer';
|
||||||
|
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||||
|
|
||||||
|
export const TimelineCreateButtonGroup = ({
|
||||||
|
targetableObject,
|
||||||
|
}: {
|
||||||
|
targetableObject: ActivityTargetableObject;
|
||||||
|
}) => {
|
||||||
|
const { getActiveTabIdState } = useTabList(TAB_LIST_COMPONENT_ID);
|
||||||
|
const setActiveTabId = useSetRecoilState(getActiveTabIdState());
|
||||||
|
|
||||||
|
const openCreateActivity = useOpenCreateActivityDrawer();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ButtonGroup variant={'secondary'}>
|
||||||
|
<Button
|
||||||
|
Icon={IconNotes}
|
||||||
|
title="Note"
|
||||||
|
onClick={() =>
|
||||||
|
openCreateActivity({
|
||||||
|
type: 'Note',
|
||||||
|
targetableObjects: [targetableObject],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
Icon={IconCheckbox}
|
||||||
|
title="Task"
|
||||||
|
onClick={() =>
|
||||||
|
openCreateActivity({
|
||||||
|
type: 'Task',
|
||||||
|
targetableObjects: [targetableObject],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
Icon={IconPaperclip}
|
||||||
|
title="File"
|
||||||
|
onClick={() => setActiveTabId('files')}
|
||||||
|
/>
|
||||||
|
</ButtonGroup>
|
||||||
|
);
|
||||||
|
};
|
||||||
@ -80,6 +80,8 @@ export const RecordTableWithWrappers = ({
|
|||||||
|
|
||||||
const { deleteOneRecord } = useDeleteOneRecord({ objectNameSingular });
|
const { deleteOneRecord } = useDeleteOneRecord({ objectNameSingular });
|
||||||
|
|
||||||
|
const objectLabel = foundObjectMetadataItem?.nameSingular;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EntityDeleteContext.Provider value={deleteOneRecord}>
|
<EntityDeleteContext.Provider value={deleteOneRecord}>
|
||||||
<ScrollWrapper>
|
<ScrollWrapper>
|
||||||
@ -112,16 +114,15 @@ export const RecordTableWithWrappers = ({
|
|||||||
<AnimatedPlaceholder type="noRecord" />
|
<AnimatedPlaceholder type="noRecord" />
|
||||||
<StyledEmptyTextContainer>
|
<StyledEmptyTextContainer>
|
||||||
<StyledEmptyTitle>
|
<StyledEmptyTitle>
|
||||||
Add your first {foundObjectMetadataItem?.namePlural}
|
Add your first {objectLabel}
|
||||||
</StyledEmptyTitle>
|
</StyledEmptyTitle>
|
||||||
<StyledEmptySubTitle>
|
<StyledEmptySubTitle>
|
||||||
Use our API or add your first{' '}
|
Use our API or add your first {objectLabel} manually
|
||||||
{foundObjectMetadataItem?.namePlural} manually
|
|
||||||
</StyledEmptySubTitle>
|
</StyledEmptySubTitle>
|
||||||
</StyledEmptyTextContainer>
|
</StyledEmptyTextContainer>
|
||||||
<Button
|
<Button
|
||||||
Icon={IconPlus}
|
Icon={IconPlus}
|
||||||
title={`Add a ${foundObjectMetadataItem?.nameSingular}`}
|
title={`Add a ${objectLabel}`}
|
||||||
variant={'secondary'}
|
variant={'secondary'}
|
||||||
onClick={createRecord}
|
onClick={createRecord}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -26,7 +26,6 @@ export const StyledEmptyTitle = styled.div`
|
|||||||
color: ${({ theme }) => theme.font.color.primary};
|
color: ${({ theme }) => theme.font.color.primary};
|
||||||
font-size: ${({ theme }) => theme.font.size.lg};
|
font-size: ${({ theme }) => theme.font.size.lg};
|
||||||
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
||||||
line-height: ${({ theme }) => theme.text.lineHeight.lg};
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const StyledEmptySubTitle = styled.div`
|
export const StyledEmptySubTitle = styled.div`
|
||||||
|
|||||||
@ -38,7 +38,7 @@ const StyledTabListContainer = styled.div`
|
|||||||
height: 40px;
|
height: 40px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TAB_LIST_COMPONENT_ID = 'show-page-right-tab-list';
|
export const TAB_LIST_COMPONENT_ID = 'show-page-right-tab-list';
|
||||||
|
|
||||||
type ShowPageRightContainerProps = {
|
type ShowPageRightContainerProps = {
|
||||||
targetableObject: ActivityTargetableObject;
|
targetableObject: ActivityTargetableObject;
|
||||||
|
|||||||
Reference in New Issue
Block a user