diff --git a/packages/twenty-front/src/modules/activities/right-drawer/components/ActivityActionBar.tsx b/packages/twenty-front/src/modules/activities/right-drawer/components/ActivityActionBar.tsx
index 7042e3050a..a4e28f5804 100644
--- a/packages/twenty-front/src/modules/activities/right-drawer/components/ActivityActionBar.tsx
+++ b/packages/twenty-front/src/modules/activities/right-drawer/components/ActivityActionBar.tsx
@@ -1,19 +1,32 @@
import { useApolloClient } from '@apollo/client';
+import styled from '@emotion/styled';
+import { isNonEmptyString } from '@sniptt/guards';
import { useRecoilState, useRecoilValue } from 'recoil';
import { useDeleteActivityFromCache } from '@/activities/hooks/useDeleteActivityFromCache';
+import { useOpenCreateActivityDrawer } from '@/activities/hooks/useOpenCreateActivityDrawer';
+import { activityTargetableEntityArrayState } from '@/activities/states/activityTargetableEntityArrayState';
import { isCreatingActivityState } from '@/activities/states/isCreatingActivityState';
import { temporaryActivityForEditorState } from '@/activities/states/temporaryActivityForEditorState';
import { viewableActivityIdState } from '@/activities/states/viewableActivityIdState';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
-import { IconTrash } from '@/ui/display/icon';
-import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
+import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
+import { IconPlus, IconTrash } from '@/ui/display/icon';
+import { IconButton } from '@/ui/input/button/components/IconButton';
import { isRightDrawerOpenState } from '@/ui/layout/right-drawer/states/isRightDrawerOpenState';
import { isDefined } from '~/utils/isDefined';
+const StyledButtonContainer = styled.div`
+ display: inline-flex;
+ gap: ${({ theme }) => theme.spacing(2)};
+`;
+
export const ActivityActionBar = () => {
const viewableActivityId = useRecoilValue(viewableActivityIdState);
+ const activityTargetableEntityArray = useRecoilValue(
+ activityTargetableEntityArrayState,
+ );
const [, setIsRightDrawerOpen] = useRecoilState(isRightDrawerOpenState);
const { deleteOneRecord: deleteOneActivity } = useDeleteOneRecord({
objectNameSingular: CoreObjectNameSingular.Activity,
@@ -28,6 +41,7 @@ export const ActivityActionBar = () => {
const [isCreatingActivity] = useRecoilState(isCreatingActivityState);
const apolloClient = useApolloClient();
+ const openCreateActivity = useOpenCreateActivityDrawer();
const deleteActivity = () => {
if (viewableActivityId) {
@@ -46,12 +60,37 @@ export const ActivityActionBar = () => {
setIsRightDrawerOpen(false);
};
+ const record = useRecoilValue(
+ recordStoreFamilyState(viewableActivityId ?? ''),
+ );
+
+ const addActivity = () => {
+ setIsRightDrawerOpen(false);
+ if (record) {
+ openCreateActivity({
+ type: record.type,
+ assigneeId: isNonEmptyString(record.assigneeId)
+ ? record.assigneeId
+ : undefined,
+ targetableObjects: activityTargetableEntityArray,
+ });
+ }
+ };
+
return (
-
+
+
+
+
);
};