-
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.
- Loading branch information
Showing
5 changed files
with
115 additions
and
32 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
41 changes: 17 additions & 24 deletions
41
packages/twenty-front/src/modules/object-record/record-table/components/RecordTableBody.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 |
---|---|---|
@@ -1,34 +1,27 @@ | ||
import { useRecoilValue } from 'recoil'; | ||
|
||
import { RecordTableBodyFetchMoreLoader } from '@/object-record/record-table/components/RecordTableBodyFetchMoreLoader'; | ||
import { RecordTablePendingRow } from '@/object-record/record-table/components/RecordTablePendingRow'; | ||
import { RecordTableRow } from '@/object-record/record-table/components/RecordTableRow'; | ||
import { useRecordTableStates } from '@/object-record/record-table/hooks/internal/useRecordTableStates'; | ||
|
||
type RecordTableBodyProps = { | ||
objectNameSingular: string; | ||
tableRowIds: string[]; | ||
}; | ||
|
||
export const RecordTableBody = ({ | ||
objectNameSingular, | ||
}: RecordTableBodyProps) => { | ||
const { tableRowIdsState } = useRecordTableStates(); | ||
|
||
const tableRowIds = useRecoilValue(tableRowIdsState); | ||
|
||
return ( | ||
<> | ||
<tbody> | ||
<RecordTablePendingRow /> | ||
{tableRowIds.map((recordId, rowIndex) => ( | ||
<RecordTableRow | ||
key={recordId} | ||
recordId={recordId} | ||
rowIndex={rowIndex} | ||
/> | ||
))} | ||
</tbody> | ||
<RecordTableBodyFetchMoreLoader objectNameSingular={objectNameSingular} /> | ||
</> | ||
); | ||
}; | ||
tableRowIds, | ||
}: RecordTableBodyProps) => ( | ||
<> | ||
<tbody> | ||
<RecordTablePendingRow /> | ||
{tableRowIds.map((recordId, rowIndex) => ( | ||
<RecordTableRow | ||
key={recordId} | ||
recordId={recordId} | ||
rowIndex={rowIndex} | ||
/> | ||
))} | ||
</tbody> | ||
<RecordTableBodyFetchMoreLoader objectNameSingular={objectNameSingular} /> | ||
</> | ||
); |
63 changes: 63 additions & 0 deletions
63
.../twenty-front/src/modules/object-record/record-table/components/RecordTableEmptyState.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,63 @@ | ||
import { useNavigate } from 'react-router-dom'; | ||
import { ThemeProvider, useTheme } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
import isEmpty from 'lodash.isempty'; | ||
import { IconSettings, THEME_LIGHT } from 'twenty-ui'; | ||
|
||
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; | ||
import { Button } from '@/ui/input/button/components/Button'; | ||
import AnimatedPlaceholder from '@/ui/layout/animated-placeholder/components/AnimatedPlaceholder'; | ||
import { | ||
AnimatedPlaceholderEmptyContainer, | ||
AnimatedPlaceholderEmptySubTitle, | ||
AnimatedPlaceholderEmptyTextContainer, | ||
AnimatedPlaceholderEmptyTitle, | ||
} from '@/ui/layout/animated-placeholder/components/EmptyPlaceholderStyled'; | ||
|
||
const StyledEmptyStateContainer = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
height: 100%; | ||
width: 100%; | ||
margin-top: ${({ theme }) => theme.spacing(8)}; | ||
`; | ||
|
||
type RecordTableEmptyStateProps = { | ||
objectMetadataItem: ObjectMetadataItem; | ||
}; | ||
|
||
export const RecordTableEmptyState = ({ | ||
objectMetadataItem, | ||
}: RecordTableEmptyStateProps) => { | ||
const theme = useTheme(); | ||
const navigate = useNavigate(); | ||
|
||
// If the object is not remote, we do not show an empty state yet | ||
if (!objectMetadataItem.isRemote) { | ||
return <></>; | ||
} | ||
|
||
return ( | ||
<StyledEmptyStateContainer> | ||
<ThemeProvider theme={isEmpty(theme) ? THEME_LIGHT : theme}> | ||
<AnimatedPlaceholderEmptyContainer> | ||
<AnimatedPlaceholder type="errorIndex" /> | ||
<AnimatedPlaceholderEmptyTextContainer> | ||
<AnimatedPlaceholderEmptyTitle> | ||
No Data Available for Remote Table | ||
</AnimatedPlaceholderEmptyTitle> | ||
<AnimatedPlaceholderEmptySubTitle> | ||
If this is unexpected, please verify your settings. | ||
</AnimatedPlaceholderEmptySubTitle> | ||
</AnimatedPlaceholderEmptyTextContainer> | ||
<Button | ||
Icon={IconSettings} | ||
title="Go to Settings" | ||
variant={'secondary'} | ||
onClick={() => navigate('/settings/integrations')} | ||
/> | ||
</AnimatedPlaceholderEmptyContainer> | ||
</ThemeProvider> | ||
</StyledEmptyStateContainer> | ||
); | ||
}; |