-
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
2 changed files
with
67 additions
and
30 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
.../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,59 @@ | ||
import { useNavigate } from 'react-router-dom'; | ||
import { IconPlus, IconSettings } from 'twenty-ui'; | ||
|
||
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'; | ||
|
||
type RecordTableEmptyStateProps = { | ||
objectLabel: string; | ||
createRecord: () => void; | ||
isRemote: boolean; | ||
}; | ||
|
||
export const RecordTableEmptyState = ({ | ||
objectLabel, | ||
createRecord, | ||
isRemote, | ||
}: RecordTableEmptyStateProps) => { | ||
const navigate = useNavigate(); | ||
|
||
const [title, subTitle, Icon, onClick, buttonTitle] = isRemote | ||
? [ | ||
'No Data Available for Remote Table', | ||
'If this is unexpected, please verify your settings.', | ||
IconSettings, | ||
() => navigate('/settings/integrations'), | ||
'Go to Settings', | ||
] | ||
: [ | ||
`Add your first ${objectLabel}`, | ||
`Use our API or add your first ${objectLabel} manually`, | ||
IconPlus, | ||
createRecord, | ||
`Add a ${objectLabel}`, | ||
]; | ||
|
||
return ( | ||
<AnimatedPlaceholderEmptyContainer> | ||
<AnimatedPlaceholder type="noRecord" /> | ||
<AnimatedPlaceholderEmptyTextContainer> | ||
<AnimatedPlaceholderEmptyTitle>{title}</AnimatedPlaceholderEmptyTitle> | ||
<AnimatedPlaceholderEmptySubTitle> | ||
{subTitle} | ||
</AnimatedPlaceholderEmptySubTitle> | ||
</AnimatedPlaceholderEmptyTextContainer> | ||
<Button | ||
Icon={Icon} | ||
title={buttonTitle} | ||
variant={'secondary'} | ||
onClick={onClick} | ||
/> | ||
</AnimatedPlaceholderEmptyContainer> | ||
); | ||
}; |
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