Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions client/components/GenericTable/NoResults.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Box, Tile, Button, Icon } from '@rocket.chat/fuselage';
import React, { FC } from 'react';

type NoResultsProps = {
icon: string;
title: string;
description: string;
buttonTitle?: string;
buttonAction?: () => void;
};

const NoResults: FC<NoResultsProps> = ({ icon, title, description, buttonTitle, buttonAction }) => (
<Box textAlign='center'>
<Box
mbs='x60'
mbe='x20'
style={{
whiteSpace: 'nowrap',
textTransform: 'uppercase',
backgroundColor: 'var(--color-gray-lightest)',
borderRadius: '9999px',
display: 'inline-block',
padding: '1rem',
}}
>
<Icon name={icon} size='x30' />
</Box>
<Box is='h1' fontScale='h1' flexGrow={1}>
{title}
</Box>
<Tile paddingBlockStart='x5' fontScale='p1' elevation='0' color='info' textAlign='center'>
<Box margin='auto' maxWidth='400px'>
{description}
</Box>
</Tile>
{buttonTitle && buttonAction && (
<Button marginBlockStart='x20' primary onClick={buttonAction}>
{buttonTitle}
</Button>
)}
</Box>
);

export default NoResults;
31 changes: 21 additions & 10 deletions ee/client/omnichannel/cannedResponses/CannedResponsesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import React, { FC, ReactNode, ReactElement, Dispatch, SetStateAction } from 'react';

import GenericTable from '../../../../client/components/GenericTable';
import NoResults from '../../../../client/components/GenericTable/NoResults';
import Page from '../../../../client/components/Page';
import { useRoute } from '../../../../client/contexts/RouterContext';
import { useTranslation } from '../../../../client/contexts/TranslationContext';
Expand Down Expand Up @@ -31,7 +32,7 @@ const CannedResponsesPage: FC<CannedResponsesPageProps> = ({
}) => {
const t = useTranslation();

const Route = useRoute('');
const Route = useRoute('omnichannel-canned-responses');

const handleClick = useMutableCallback(() =>
Route.push({
Expand All @@ -49,15 +50,25 @@ const CannedResponsesPage: FC<CannedResponsesPageProps> = ({
</ButtonGroup>
</Page.Header>
<Page.Content>
<GenericTable
renderFilter={renderFilter}
header={header}
renderRow={renderRow}
results={data && data.cannedResponses}
total={data && data.total}
setParams={setParams}
params={params}
/>
{data && data.total < 1 ? (
<NoResults
icon='baloon-exclamation'
title={t('No_Canned_Responses_Yet')}
description={t('No_Canned_Responses_Yet-description')}
buttonTitle={t('Create_your_First_Canned_Response')}
buttonAction={handleClick}
></NoResults>
) : (
<GenericTable
renderFilter={renderFilter}
header={header}
renderRow={renderRow}
results={data && data.cannedResponses}
total={data && data.total}
setParams={setParams}
params={params}
/>
)}
</Page.Content>
{children}
</Page>
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@
"Canned_Response_Delete_Warning": "Deleting a canned response cannot be undone.",
"Canned_Response_Removed": "Canned Response Removed",
"Canned Responses": "Canned Responses",
"Create_your_First_Canned_Response": "Create Your First Canned Response",
"Canned_Responses_Enable": "Enable Canned Responses",
"Cannot_invite_users_to_direct_rooms": "Cannot invite users to direct rooms",
"Cannot_open_conversation_with_yourself": "Cannot Direct Message with yourself",
Expand Down Expand Up @@ -2963,6 +2964,8 @@
"No": "No",
"No_available_agents_to_transfer": "No available agents to transfer",
"No_Canned_Responses": "No Canned Responses",
"No_Canned_Responses_Yet": "No Canned Responses Yet",
"No_Canned_Responses_Yet-description": "Use canned responses to provide quick and consistent answers to frequently asked questions.",
"No_channel_with_name_%s_was_found": "No channel with name <strong>\"%s\"</strong> was found!",
"No_channels_in_team": "No Channels on this Team",
"No_channels_yet": "You aren't part of any channels yet",
Expand Down