From bcb05eb5e6deb56adb97caf3b6afbc3ce415d198 Mon Sep 17 00:00:00 2001 From: "Sinan Sonmez (Chaush)" Date: Wed, 28 Jun 2023 20:26:55 +0000 Subject: [PATCH] rename more_channels to browse_channels --- .../__snapshots__/more_channels.test.tsx.snap | 6 +-- .../browse_channels.scss} | 2 +- .../browse_channels.test.tsx} | 46 +++++++++---------- .../browse_channels.tsx} | 9 ++-- .../index.ts | 4 +- .../sidebar/add_channels_cta_button.tsx | 4 +- .../src/components/sidebar/sidebar.tsx | 12 ++--- 7 files changed, 41 insertions(+), 42 deletions(-) rename webapp/channels/src/components/{more_channels => browse_channels}/__snapshots__/more_channels.test.tsx.snap (95%) rename webapp/channels/src/components/{more_channels/more_channels.scss => browse_channels/browse_channels.scss} (99%) rename webapp/channels/src/components/{more_channels/more_channels.test.tsx => browse_channels/browse_channels.test.tsx} (91%) rename webapp/channels/src/components/{more_channels/more_channels.tsx => browse_channels/browse_channels.tsx} (97%) rename webapp/channels/src/components/{more_channels => browse_channels}/index.ts (96%) diff --git a/webapp/channels/src/components/more_channels/__snapshots__/more_channels.test.tsx.snap b/webapp/channels/src/components/browse_channels/__snapshots__/more_channels.test.tsx.snap similarity index 95% rename from webapp/channels/src/components/more_channels/__snapshots__/more_channels.test.tsx.snap rename to webapp/channels/src/components/browse_channels/__snapshots__/more_channels.test.tsx.snap index eb0a190f2ce..4eca23e4db5 100644 --- a/webapp/channels/src/components/more_channels/__snapshots__/more_channels.test.tsx.snap +++ b/webapp/channels/src/components/browse_channels/__snapshots__/more_channels.test.tsx.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`components/MoreChannels should match snapshot and state 1`] = ` +exports[`components/BrowseChannels should match snapshot and state 1`] = ` } - id="moreChannelsModal" + id="browseChannelsModal" keyboardEscape={true} modalHeaderText={ { +describe('components/BrowseChannels', () => { const searchResults = { data: [{ id: 'channel-id-1', @@ -106,8 +106,8 @@ describe('components/MoreChannels', () => { }; test('should match snapshot and state', () => { - const wrapper = shallow( - , + const wrapper = shallow( + , ); expect(wrapper).toMatchSnapshot(); @@ -123,8 +123,8 @@ describe('components/MoreChannels', () => { }); test('should call closeModal on handleExit', () => { - const wrapper = shallow( - , + const wrapper = shallow( + , ); wrapper.instance().handleExit(); @@ -132,8 +132,8 @@ describe('components/MoreChannels', () => { }); test('should match state on onChange', () => { - const wrapper = shallow( - , + const wrapper = shallow( + , ); wrapper.setState({searchedChannels: [TestHelper.getChannelMock({id: 'other_channel_id'})]}); @@ -147,8 +147,8 @@ describe('components/MoreChannels', () => { }); test('should call props.getChannels on nextPage', () => { - const wrapper = shallow( - , + const wrapper = shallow( + , ); wrapper.instance().nextPage(1); @@ -159,7 +159,7 @@ describe('components/MoreChannels', () => { test('should have loading prop true when searching state is true', () => { const wrapper = shallow( - , + , ); wrapper.setState({search: true, searching: true}); @@ -182,8 +182,8 @@ describe('components/MoreChannels', () => { }, }; - const wrapper = shallow( - , + const wrapper = shallow( + , ); const callback = jest.fn(); @@ -210,8 +210,8 @@ describe('components/MoreChannels', () => { }, }; - const wrapper = shallow( - , + const wrapper = shallow( + , ); const callback = jest.fn(); @@ -226,8 +226,8 @@ describe('components/MoreChannels', () => { }); test('should not perform a search if term is empty', () => { - const wrapper = shallow( - , + const wrapper = shallow( + , ); wrapper.instance().onChange = jest.fn(); @@ -241,8 +241,8 @@ describe('components/MoreChannels', () => { }); test('should handle a failed search', (done) => { - const wrapper = shallow( - , + const wrapper = shallow( + , ); wrapper.instance().onChange = jest.fn(); @@ -269,8 +269,8 @@ describe('components/MoreChannels', () => { }); test('should perform search and set the correct state', (done) => { - const wrapper = shallow( - , + const wrapper = shallow( + , ); wrapper.instance().onChange = jest.fn(); @@ -295,8 +295,8 @@ describe('components/MoreChannels', () => { }); test('should perform search on archived channels and set the correct state', (done) => { - const wrapper = shallow( - , + const wrapper = shallow( + , ); wrapper.instance().onChange = jest.fn(); diff --git a/webapp/channels/src/components/more_channels/more_channels.tsx b/webapp/channels/src/components/browse_channels/browse_channels.tsx similarity index 97% rename from webapp/channels/src/components/more_channels/more_channels.tsx rename to webapp/channels/src/components/browse_channels/browse_channels.tsx index 0503ab2fc66..f6f45444be6 100644 --- a/webapp/channels/src/components/more_channels/more_channels.tsx +++ b/webapp/channels/src/components/browse_channels/browse_channels.tsx @@ -24,7 +24,7 @@ import classNames from 'classnames'; import {localizeMessage} from 'utils/utils'; import LoadingScreen from 'components/loading_screen'; -import './more_channels.scss'; +import './browse_channels.scss'; const CHANNELS_CHUNK_SIZE = 50; const CHANNELS_PER_PAGE = 50; @@ -46,7 +46,6 @@ type Actions = { getChannelsMemberCount: (channelIds: string[]) => Promise; } -// todo sinan rename based on feedback on previous email export type Props = { channels: Channel[]; archivedChannels: Channel[]; @@ -74,7 +73,7 @@ type State = { searchTerm: string; } -export default class MoreChannels extends React.PureComponent { +export default class BrowseChannels extends React.PureComponent { public searchTimeoutId: number; activeChannels: Channel[] = []; @@ -338,8 +337,8 @@ export default class MoreChannels extends React.PureComponent { return ( { const showMoreChannelsModal = () => { dispatch(openModal({ modalId: ModalIdentifiers.MORE_CHANNELS, - dialogType: MoreChannels, + dialogType: BrowseChannels, dialogProps: {morePublicChannelsModalType: 'public'}, })); trackEvent('ui', 'browse_channels_button_is_clicked'); diff --git a/webapp/channels/src/components/sidebar/sidebar.tsx b/webapp/channels/src/components/sidebar/sidebar.tsx index 02b2f6e6801..519acc985e4 100644 --- a/webapp/channels/src/components/sidebar/sidebar.tsx +++ b/webapp/channels/src/components/sidebar/sidebar.tsx @@ -8,7 +8,7 @@ import {trackEvent} from 'actions/telemetry_actions'; import EditCategoryModal from 'components/edit_category_modal'; import MoreDirectChannels from 'components/more_direct_channels'; import DataPrefetch from 'components/data_prefetch'; -import MoreChannels from 'components/more_channels'; +import BrowseChannels from 'components/browse_channels'; import NewChannelModal from 'components/new_channel_modal/new_channel_modal'; import InvitationModal from 'components/invitation_modal'; import UserSettingsModal from 'components/user_settings/modal'; @@ -155,7 +155,7 @@ export default class Sidebar extends React.PureComponent { showMoreChannelsModal = () => { this.props.actions.openModal({ modalId: ModalIdentifiers.MORE_CHANNELS, - dialogType: MoreChannels, + dialogType: BrowseChannels, dialogProps: {morePublicChannelsModalType: 'public'}, }); trackEvent('ui', 'ui_channels_more_public_v2'); @@ -230,7 +230,7 @@ export default class Sidebar extends React.PureComponent { render() { if (!this.props.teamId) { - return (
); + return (
); } const ariaLabel = Utils.localizeMessage('accessibility.sections.lhsNavigator', 'channel navigator region'); @@ -243,7 +243,7 @@ export default class Sidebar extends React.PureComponent { dragging: this.state.isDragging, })} > - {this.props.isMobileView ? : ( + {this.props.isMobileView ? : ( { />
- +
- + {this.renderModals()}
);