Skip to content

Commit

Permalink
feat: improve application structure (wireapp#18233)
Browse files Browse the repository at this point in the history
  • Loading branch information
przemvs authored Oct 30, 2024
1 parent cc5fc45 commit f749459
Show file tree
Hide file tree
Showing 109 changed files with 754 additions and 439 deletions.
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const config: Config = {
// Must be in sync with tsconfig.json >> paths
moduleNameMapper: {
'Components/(.*)': '<rootDir>/src/script/components/$1',
'Hooks/(.*)': '<rootDir>/src/script/hooks/$1',
'I18n/(.*)': '<rootDir>/src/i18n/$1',
'Resource/(.*)': '<rootDir>/resource/$1',
'Util/(.*)': '<rootDir>/src/script/util/$1',
Expand Down
2 changes: 1 addition & 1 deletion src/script/components/Avatar/AvatarImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {CSSObject} from '@emotion/serialize';
import {Transition} from 'react-transition-group';
import {container} from 'tsyringe';

import {InViewport} from 'Components/utils/InViewport';
import {InViewport} from 'Components/InViewport';
import {CSS_FILL_PARENT} from 'Util/CSSMixin';

import {AssetRemoteData} from '../../assets/AssetRemoteData';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2022 Wire Swiss GmbH
* Copyright (C) 2024 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -17,4 +17,4 @@
*
*/

export * from './Checkbox';
export * from './UserBlockedBadge';
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ type ConversationVerificationBadgeProps = {
conversation: Conversation;
displayTitle?: boolean;
};

export const ConversationVerificationBadges = ({conversation, displayTitle}: ConversationVerificationBadgeProps) => {
const {MLS, proteus} = useConversationVerificationState(conversation);

Expand Down
22 changes: 22 additions & 0 deletions src/script/components/Badge/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Wire
* Copyright (C) 2024 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

export * from './components/UserStatusBadges';
export * from './components/UserBlockedBadge';
export * from './components/VerificationBadges';
90 changes: 0 additions & 90 deletions src/script/components/Checkbox/Checkbox.styles.ts

This file was deleted.

83 changes: 0 additions & 83 deletions src/script/components/Checkbox/Checkbox.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
*
*/

import React from 'react';

import {CSSObject} from '@emotion/react';
import cx from 'classnames';

Expand Down Expand Up @@ -50,12 +48,7 @@ interface UserClassifiedBarProps extends ClassifiedBarProps {
users: User[];
}

export const UserClassifiedBar: React.FC<UserClassifiedBarProps> = ({
users,
conversationDomain,
classifiedDomains,
style,
}) => {
export const UserClassifiedBar = ({users, conversationDomain, classifiedDomains, style}: UserClassifiedBarProps) => {
if (typeof classifiedDomains === 'undefined') {
return null;
}
Expand All @@ -79,10 +72,7 @@ interface ConversationClassifiedBarProps extends ClassifiedBarProps {
conversation: Conversation;
}

export const ConversationClassifiedBar: React.FC<ConversationClassifiedBarProps> = ({
conversation,
...classifiedBarProps
}) => {
export const ConversationClassifiedBar = ({conversation, ...classifiedBarProps}: ConversationClassifiedBarProps) => {
const {allUserEntities: users} = useKoSubscribableChildren(conversation, ['allUserEntities']);
return <UserClassifiedBar users={users} conversationDomain={conversation.domain} {...classifiedBarProps} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {container} from 'tsyringe';
import {Button, ButtonVariant, IconButton, IconButtonVariant, useMatchMedia} from '@wireapp/react-ui-kit';

import {Avatar, AVATAR_SIZE} from 'Components/Avatar';
import {UserClassifiedBar} from 'Components/input/ClassifiedBar';
import {UserClassifiedBar} from 'Components/ClassifiedBar/ClassifiedBar';
import {UnverifiedUserWarning} from 'Components/Modals/UserModal';
import {UserName} from 'Components/UserName';
import {SidebarTabs, useSidebarStore} from 'src/script/page/LeftSidebar/panels/Conversations/useSidebarStore';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ import {TabIndex} from '@wireapp/react-ui-kit/lib/types/enums';
import cx from 'classnames';

import {Avatar, AVATAR_SIZE, GroupAvatar} from 'Components/Avatar';
import {UserBlockedBadge} from 'Components/UserBlockedBadge/UserBlockedBadge';
import {UserBlockedBadge} from 'Components/Badge';
import {UserInfo} from 'Components/UserInfo';
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
import {isKey, isOneOfKeys, KEY} from 'Util/KeyboardUtil';
import {t} from 'Util/LocalizerUtil';
import {noop, setContextMenuPosition} from 'Util/util';

import {ConversationListCellStatusIcon} from './ConversationListCellStatusIcon';
import {StatusIcon} from './components/StatusIcon';

import {generateCellState} from '../../conversation/ConversationCellState';
import type {Conversation} from '../../entity/Conversation';
Expand All @@ -57,7 +57,7 @@ export interface ConversationListCellProps {
resetConversationFocus: () => void;
}

const ConversationListCell = ({
export const ConversationListCell = ({
showJoinButton,
conversation,
onJoinCall,
Expand Down Expand Up @@ -232,7 +232,7 @@ const ConversationListCell = ({
onKeyDown={handleContextKeyDown}
/>

{!showJoinButton && <ConversationListCellStatusIcon conversation={conversation} />}
{!showJoinButton && <StatusIcon conversation={conversation} />}

{showJoinButton && (
<button
Expand All @@ -248,5 +248,3 @@ const ConversationListCell = ({
</li>
);
};

export {ConversationListCell};
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import * as Icon from 'Components/Icon';
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
import {t} from 'Util/LocalizerUtil';

import {generateCellState} from '../../conversation/ConversationCellState';
import {ConversationStatusIcon} from '../../conversation/ConversationStatusIcon';
import type {Conversation} from '../../entity/Conversation';
import {generateCellState} from '../../../../conversation/ConversationCellState';
import {ConversationStatusIcon} from '../../../../conversation/ConversationStatusIcon';
import type {Conversation} from '../../../../entity/Conversation';

export interface ConversationListCellStatusIconProps {
export interface Props {
conversation: Conversation;
}

const ConversationListCellStatusIcon = ({conversation}: ConversationListCellStatusIconProps) => {
export const StatusIcon = ({conversation}: Props) => {
const {unreadState, mutedState, isRequest} = useKoSubscribableChildren(conversation, [
'unreadState',
'mutedState',
Expand Down Expand Up @@ -115,5 +115,3 @@ const ConversationListCellStatusIcon = ({conversation}: ConversationListCellStat
</>
);
};

export {ConversationListCellStatusIcon};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Wire
* Copyright (C) 2024 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

export * from './StatusIcon';
20 changes: 20 additions & 0 deletions src/script/components/ConversationListCell/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Wire
* Copyright (C) 2024 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

export * from './ConversationListCell';
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {render, waitFor, act} from '@testing-library/react';

import {CopyToClipboardButton} from './CopyToClipboardButton';

import {withTheme} from '../auth/util/test/TestUtil';
import {withTheme} from '../../auth/util/test/TestUtil';

jest.mock('Util/ClipboardUtil', () => ({
copyText: jest.fn(),
Expand Down
Loading

0 comments on commit f749459

Please sign in to comment.