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

Chore: Rewrite VerticalBarOldActions to TS #26277

Merged
merged 2 commits into from
Jul 22, 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
2 changes: 1 addition & 1 deletion apps/meteor/app/ui-message/client/actionButtons/tabbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const onAdded = (button: IUIActionButton): void =>
applyButtonFilters(button, room)
? {
id: button.actionId,
icon: '', // Apps won't provide icons for now
icon: undefined, // Apps won't provide icons for now
order: 300, // Make sure the button only shows up inside the room toolbox
title: t(Utilities.getI18nKeyForApp(button.labelI18n, button.appId)) as any,
// Filters were applied in the applyButtonFilters function
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { IRoom } from '@rocket.chat/core-typings';
import { Icon } from '@rocket.chat/fuselage';
import { useTranslation, TranslationKey } from '@rocket.chat/ui-contexts';
import React, { ReactElement, ComponentProps } from 'react';

import VerticalBar from '../../../components/VerticalBar';
import { ToolboxContextValue } from '../lib/Toolbox/ToolboxContext';
import { useTabBarClose } from '../providers/ToolboxProvider';
import BlazeTemplate from './BlazeTemplate';

type VerticalBarOldActionsProps = {
name: string;
rid: IRoom['_id'];
_id: IRoom['_id'];
icon?: ComponentProps<typeof Icon>['name'];
tabBar: ToolboxContextValue['tabBar'];
title: TranslationKey;
};

const VerticalBarOldActions = ({ name, rid, icon, tabBar, title, ...props }: VerticalBarOldActionsProps): ReactElement => {
const close = useTabBarClose();
const t = useTranslation();

return (
<>
<VerticalBar.Header>
{icon && <VerticalBar.Icon name={icon} />}
<VerticalBar.Text>{t(title)}</VerticalBar.Text>
{close && <VerticalBar.Close onClick={close} />}
</VerticalBar.Header>
<VerticalBar.Content>
<BlazeTemplate flexShrink={1} overflow='hidden' name={name} tabBar={tabBar} rid={rid} {...props} />
</VerticalBar.Content>
</>
);
};

export default VerticalBarOldActions;
4 changes: 2 additions & 2 deletions apps/meteor/client/views/room/lib/Toolbox/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IRoom } from '@rocket.chat/core-typings';
import { Box, Option } from '@rocket.chat/fuselage';
import { Box, Option, Icon } from '@rocket.chat/fuselage';
import { TranslationKey } from '@rocket.chat/ui-contexts';
import { FC, LazyExoticComponent, ReactNode, MouseEvent, ComponentProps } from 'react';

Expand All @@ -22,7 +22,7 @@ export type OptionRenderer = (props: OptionRendererProps) => ReactNode;

export type ToolboxActionConfig = {
'id': string;
'icon': string;
'icon'?: ComponentProps<typeof Icon>['name'];
'title': TranslationKey;
'anonymous'?: boolean;
'data-tooltip'?: string;
Expand Down