Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVE] Added a new "All" tab which shows all integrations in Integrations #24109

Merged
merged 4 commits into from
Jan 31, 2022
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, ButtonGroup, Icon, Tabs } from '@rocket.chat/fuselage';
import React, { useCallback } from 'react';
import React, { useCallback, ReactElement } from 'react';

import Page from '../../../components/Page';
import { useRoute, useRouteParameter } from '../../../contexts/RouterContext';
Expand All @@ -8,19 +8,17 @@ import IntegrationsTable from './IntegrationsTable';
import NewBot from './new/NewBot';
import NewZapier from './new/NewZapier';

function IntegrationsPage() {
const IntegrationsPage = (): ReactElement => {
const t = useTranslation();

const router = useRoute('admin-integrations');
const context = useRouteParameter('context');
const showTable = !['zapier', 'bots'].includes(context || '');

const handleNewButtonClick = useCallback(() => {
router.push({ context: 'new', type: 'incoming' });
}, [router]);

const context = useRouteParameter('context');

const showTable = !['zapier', 'bots'].includes(context);

const goToAll = useCallback(() => router.push({ context: '' }), [router]);
const goToIncoming = useCallback(() => router.push({ context: 'webhook-incoming' }), [router]);
const goToOutgoing = useCallback(() => router.push({ context: 'webhook-outgoing' }), [router]);
const goToZapier = useCallback(() => router.push({ context: 'zapier' }), [router]);
Expand All @@ -36,7 +34,10 @@ function IntegrationsPage() {
</ButtonGroup>
</Page.Header>
<Tabs>
<Tabs.Item selected={!context || context === 'webhook-incoming'} onClick={goToIncoming}>
<Tabs.Item selected={!context} onClick={goToAll}>
{t('All')}
</Tabs.Item>
<Tabs.Item selected={context === 'webhook-incoming'} onClick={goToIncoming}>
{t('Incoming')}
</Tabs.Item>
<Tabs.Item selected={context === 'webhook-outgoing'} onClick={goToOutgoing}>
Expand All @@ -56,6 +57,6 @@ function IntegrationsPage() {
</Page.Content>
</Page>
);
}
};

export default IntegrationsPage;
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 @@ -2221,6 +2221,7 @@
"Inbox_Info": "Inbox Info",
"Include_Offline_Agents": "Include offline agents",
"Inclusive": "Inclusive",
"Incoming": "Inconming",
"Incoming_Livechats": "Queued Chats",
"Incoming_WebHook": "Incoming WebHook",
"Industry": "Industry",
Expand Down Expand Up @@ -3276,6 +3277,7 @@
"OTR": "OTR",
"OTR_is_only_available_when_both_users_are_online": "OTR is only available when both users are online",
"Out_of_seats": "Out of Seats",
"Outgoing": "Outgoing",
"Outgoing_WebHook": "Outgoing WebHook",
"Outgoing_WebHook_Description": "Get data out of Rocket.Chat in real-time.",
"Output_format": "Output format",
Expand Down Expand Up @@ -4791,6 +4793,7 @@
"Your_temporary_password_is_password": "Your temporary password is <strong>[password]</strong>.",
"Your_TOTP_has_been_reset": "Your Two Factor TOTP has been reset.",
"Your_workspace_is_ready": "Your workspace is ready to use 🎉",
"Zapier": "Zapier",
"onboarding.component.form.steps": "Step {{currentStep}} of {{stepCount}}",
"onboarding.component.form.action.back": "Back",
"onboarding.component.form.action.next": "Next",
Expand Down