* Change to using arrow functions Co-authored-by: v1b3m <[email protected]> Co-authored-by: Matheus <[email protected]> * Add lint rule --------- Co-authored-by: v1b3m <[email protected]> Co-authored-by: Matheus <[email protected]> Co-authored-by: Charles Bochet <[email protected]>
33 lines
858 B
TypeScript
33 lines
858 B
TypeScript
import { useOpenCreateActivityDrawer } from '@/activities/hooks/useOpenCreateActivityDrawer';
|
|
import { ActivityTargetableEntity } from '@/activities/types/ActivityTargetableEntity';
|
|
import { Button } from '@/ui/button/components/Button';
|
|
import { IconPlus } from '@/ui/icon';
|
|
import { ActivityType } from '~/generated/graphql';
|
|
|
|
export const AddTaskButton = ({
|
|
activityTargetEntity,
|
|
}: {
|
|
activityTargetEntity?: ActivityTargetableEntity;
|
|
}) => {
|
|
const openCreateActivity = useOpenCreateActivityDrawer();
|
|
|
|
if (!activityTargetEntity) {
|
|
return <></>;
|
|
}
|
|
|
|
return (
|
|
<Button
|
|
Icon={IconPlus}
|
|
size="small"
|
|
variant="secondary"
|
|
title="Add task"
|
|
onClick={() =>
|
|
openCreateActivity({
|
|
type: ActivityType.Task,
|
|
targetableEntities: [activityTargetEntity],
|
|
})
|
|
}
|
|
></Button>
|
|
);
|
|
};
|