Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed May 24, 2022
1 parent e48bca1 commit d16f20f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions apps/meteor/client/sidebar/header/actions/CreateRoom.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Box, Sidebar, Dropdown } from '@rocket.chat/fuselage';
import { useAtLeastOnePermission } from '@rocket.chat/ui-contexts';
import React, { useRef, FC } from 'react';
import React, { HTMLAttributes, useRef, VFC } from 'react';
import { createPortal } from 'react-dom';

import { useDropdownVisibility } from '../hooks/useDropdownVisibility';
import CreateRoomList from './CreateRoomList';

const CREATE_ROOM_PERMISSIONS = ['create-c', 'create-p', 'create-d', 'start-discussion', 'start-discussion-other-user'];

const CreateRoom: FC = (props) => {
const CreateRoom: VFC<Omit<HTMLAttributes<HTMLElement>, 'is'>> = (props) => {
const reference = useRef(null);
const target = useRef(null);
const { isVisible, toggle } = useDropdownVisibility({ reference, target });
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/client/sidebar/header/actions/Directory.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Sidebar } from '@rocket.chat/fuselage';
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import { useLayout, useRoute } from '@rocket.chat/ui-contexts';
import React, { FC } from 'react';
import React, { HTMLAttributes, VFC } from 'react';

const Directory: FC = (props) => {
const Directory: VFC<Omit<HTMLAttributes<HTMLElement>, 'is'>> = (props) => {
const directoryRoute = useRoute('directory');
const { sidebar } = useLayout();
const handleDirectory = useMutableCallback(() => {
Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/client/sidebar/header/actions/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Sidebar } from '@rocket.chat/fuselage';
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import { useLayout, useRoute, useSetting } from '@rocket.chat/ui-contexts';
import React, { FC } from 'react';
import React, { HTMLAttributes, VFC } from 'react';

const Home: FC = (props) => {
const SidebarHeaderActionHome: VFC<Omit<HTMLAttributes<HTMLElement>, 'is'>> = (props) => {
const homeRoute = useRoute('home');
const { sidebar } = useLayout();
const showHome = useSetting('Layout_Show_Home_Button');
Expand All @@ -15,4 +15,4 @@ const Home: FC = (props) => {
return showHome ? <Sidebar.TopBar.Action {...props} icon='home' onClick={handleHome} /> : null;
};

export default Home;
export default SidebarHeaderActionHome;
4 changes: 2 additions & 2 deletions apps/meteor/client/sidebar/header/actions/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Sidebar } from '@rocket.chat/fuselage';
import { useSessionDispatch, useTranslation } from '@rocket.chat/ui-contexts';
import React, { FC } from 'react';
import React, { HTMLAttributes, VFC } from 'react';

const Login: FC = (props) => {
const Login: VFC<Omit<HTMLAttributes<HTMLElement>, 'is'>> = (props) => {
const setForceLogin = useSessionDispatch('forceLogin');
const t = useTranslation();

Expand Down
6 changes: 2 additions & 4 deletions apps/meteor/client/sidebar/header/actions/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Sidebar } from '@rocket.chat/fuselage';
import { useMutableCallback, useOutsideClick } from '@rocket.chat/fuselage-hooks';
import React, { useState, useEffect, useRef, ReactElement, ComponentProps } from 'react';
import React, { useState, useEffect, useRef, VFC, HTMLAttributes } from 'react';
import tinykeys from 'tinykeys';

import SearchList from '../../search/SearchList';

type SearchProps = Omit<ComponentProps<typeof Sidebar.TopBar.Action>, 'icon'>;

const Search = (props: SearchProps): ReactElement => {
const Search: VFC<Omit<HTMLAttributes<HTMLElement>, 'is'>> = (props) => {
const [searchOpen, setSearchOpen] = useState(false);

const ref = useRef<HTMLElement>(null);
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/client/sidebar/header/actions/Sort.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Box, Sidebar, Dropdown } from '@rocket.chat/fuselage';
import React, { FC, useRef } from 'react';
import React, { VFC, useRef, HTMLAttributes } from 'react';
import { createPortal } from 'react-dom';

import SortList from '../../../components/SortList';
import { useDropdownVisibility } from '../hooks/useDropdownVisibility';

const Sort: FC = (props) => {
const Sort: VFC<Omit<HTMLAttributes<HTMLElement>, 'is'>> = (props) => {
const reference = useRef(null);
const target = useRef(null);
const { isVisible, toggle } = useDropdownVisibility({ reference, target });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Sidebar } from '@rocket.chat/fuselage';
import { useUser, useTranslation } from '@rocket.chat/ui-contexts';
import React, { memo } from 'react';
import React, { memo, VFC } from 'react';

import { useSidebarPaletteColor } from '../hooks/useSidebarPaletteColor';
import UserAvatarButton from './UserAvatarButton';
Expand All @@ -11,15 +11,15 @@ import Login from './actions/Login';
import Search from './actions/Search';
import Sort from './actions/Sort';

const HeaderWithData = () => {
const HeaderWithData: VFC = () => {
const user = useUser();
const t = useTranslation();
useSidebarPaletteColor();

return (
<>
<Sidebar.TopBar.Section className='sidebar--custom-colors'>
<UserAvatarButton user={user} />
<UserAvatarButton />
<Sidebar.TopBar.Actions>
<Home title={t('Home')} />
<Search title={t('Search')} data-qa='sidebar-search' />
Expand Down

0 comments on commit d16f20f

Please sign in to comment.