-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'twentyhq:main' into fixed-issue-6630
- Loading branch information
Showing
265 changed files
with
3,411 additions
and
1,760 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...c/modules/information-banner/components/deleted-record/InformationBannerDeletedRecord.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { InformationBanner } from '@/information-banner/components/InformationBanner'; | ||
import { useRestoreManyRecords } from '@/object-record/hooks/useRestoreManyRecords'; | ||
import styled from '@emotion/styled'; | ||
import { IconRefresh } from 'twenty-ui'; | ||
|
||
const StyledInformationBannerDeletedRecord = styled.div` | ||
height: 40px; | ||
position: relative; | ||
&:empty { | ||
height: 0; | ||
} | ||
`; | ||
|
||
export const InformationBannerDeletedRecord = ({ | ||
recordId, | ||
objectNameSingular, | ||
}: { | ||
recordId: string; | ||
objectNameSingular: string; | ||
}) => { | ||
const { restoreManyRecords } = useRestoreManyRecords({ | ||
objectNameSingular, | ||
}); | ||
|
||
return ( | ||
<StyledInformationBannerDeletedRecord> | ||
<InformationBanner | ||
variant="danger" | ||
message={`This record has been deleted`} | ||
buttonTitle="Restore" | ||
buttonIcon={IconRefresh} | ||
buttonOnClick={() => restoreManyRecords([recordId])} | ||
/> | ||
</StyledInformationBannerDeletedRecord> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
packages/twenty-front/src/modules/information-banner/constants/InformationBannerHeight.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const INFORMATION_BANNER_HEIGHT = '40px'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/twenty-front/src/modules/object-record/hooks/useDestroyManyRecordMutation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; | ||
import { EMPTY_MUTATION } from '@/object-record/constants/EmptyMutation'; | ||
import { getDestroyManyRecordsMutationResponseField } from '@/object-record/utils/getDestroyManyRecordsMutationResponseField'; | ||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull'; | ||
import { capitalize } from '~/utils/string/capitalize'; | ||
|
||
export const useDestroyManyRecordsMutation = ({ | ||
objectNameSingular, | ||
}: { | ||
objectNameSingular: string; | ||
}) => { | ||
const { objectMetadataItem } = useObjectMetadataItem({ | ||
objectNameSingular, | ||
}); | ||
|
||
if (isUndefinedOrNull(objectMetadataItem)) { | ||
return { destroyManyRecordsMutation: EMPTY_MUTATION }; | ||
} | ||
|
||
const capitalizedObjectName = capitalize(objectMetadataItem.namePlural); | ||
|
||
const mutationResponseField = getDestroyManyRecordsMutationResponseField( | ||
objectMetadataItem.namePlural, | ||
); | ||
|
||
const destroyManyRecordsMutation = gql` | ||
mutation DestroyMany${capitalizedObjectName}($filter: ${capitalize( | ||
objectMetadataItem.nameSingular, | ||
)}FilterInput!) { | ||
${mutationResponseField}(filter: $filter) { | ||
id | ||
} | ||
} | ||
`; | ||
|
||
return { | ||
destroyManyRecordsMutation, | ||
}; | ||
}; |
Oops, something went wrong.