V2 opportunities (#2565)
* changed isSystem to false * wip * wip * wip * add amount viewfield seed * seed other viewFields * upate tenant seeds * Remove calls to old pipelines --------- Co-authored-by: Charles Bochet <charles@twenty.com> Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
@ -1,16 +1,20 @@
|
||||
import { useEffect } from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { CompanyBoard } from '@/companies/board/components/CompanyBoard';
|
||||
import { CompanyBoardRecoilScopeContext } from '@/companies/states/recoil-scope-contexts/CompanyBoardRecoilScopeContext';
|
||||
import { useFindOneObjectMetadataItem } from '@/object-metadata/hooks/useFindOneObjectMetadataItem';
|
||||
import { useUpdateOneObjectRecord } from '@/object-record/hooks/useUpdateOneObjectRecord';
|
||||
import { PipelineAddButton } from '@/pipeline/components/PipelineAddButton';
|
||||
import { usePipelineStages } from '@/pipeline/hooks/usePipelineStages';
|
||||
import { PipelineStep } from '@/pipeline/types/PipelineStep';
|
||||
import { IconTargetArrow } from '@/ui/display/icon';
|
||||
import { BoardOptionsContext } from '@/ui/layout/board/contexts/BoardOptionsContext';
|
||||
import { PageBody } from '@/ui/layout/page/PageBody';
|
||||
import { PageContainer } from '@/ui/layout/page/PageContainer';
|
||||
import { PageHeader } from '@/ui/layout/page/PageHeader';
|
||||
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
|
||||
import { useUpdatePipelineStageMutation } from '~/generated/graphql';
|
||||
import { useView } from '@/views/hooks/useView';
|
||||
import { opportunitiesBoardOptions } from '~/pages/opportunities/opportunitiesBoardOptions';
|
||||
|
||||
const StyledBoardContainer = styled.div`
|
||||
@ -22,30 +26,37 @@ export const Opportunities = () => {
|
||||
const { handlePipelineStageAdd, handlePipelineStageDelete } =
|
||||
usePipelineStages();
|
||||
|
||||
const [updatePipelineStage] = useUpdatePipelineStageMutation();
|
||||
const { updateOneObject: updateOnePipelineStep } =
|
||||
useUpdateOneObjectRecord<PipelineStep>({
|
||||
objectNameSingular: 'pipelineStepV2',
|
||||
});
|
||||
|
||||
const handleEditColumnTitle = (
|
||||
boardColumnId: string,
|
||||
newTitle: string,
|
||||
newColor: string,
|
||||
) => {
|
||||
updatePipelineStage({
|
||||
variables: {
|
||||
id: boardColumnId,
|
||||
data: { name: newTitle, color: newColor },
|
||||
},
|
||||
optimisticResponse: {
|
||||
__typename: 'Mutation',
|
||||
updateOnePipelineStage: {
|
||||
__typename: 'PipelineStage',
|
||||
id: boardColumnId,
|
||||
name: newTitle,
|
||||
color: newColor,
|
||||
},
|
||||
updateOnePipelineStep?.({
|
||||
idToUpdate: boardColumnId,
|
||||
input: {
|
||||
name: newTitle,
|
||||
color: newColor,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const opportunitiesV2MetadataId = useFindOneObjectMetadataItem({
|
||||
objectNameSingular: 'opportunityV2',
|
||||
}).foundObjectMetadataItem?.id;
|
||||
|
||||
const { setViewObjectMetadataId } = useView({
|
||||
viewScopeId: 'company-board-view',
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setViewObjectMetadataId?.(opportunitiesV2MetadataId);
|
||||
}, [opportunitiesV2MetadataId, setViewObjectMetadataId]);
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<RecoilScope>
|
||||
|
||||
@ -39,8 +39,8 @@ export const SettingsWorkspaceMembers = () => {
|
||||
objectNamePlural: 'workspaceMembersV2',
|
||||
});
|
||||
const { deleteOneObject: deleteOneWorkspaceMember } =
|
||||
useDeleteOneObjectRecord({
|
||||
objectNamePlural: 'workspaceMembersV2',
|
||||
useDeleteOneObjectRecord<WorkspaceMember>({
|
||||
objectNameSingular: 'workspaceMemberV2',
|
||||
});
|
||||
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user