From 88e82f04e90b83e592d3a632bbd7d38d74689a86 Mon Sep 17 00:00:00 2001 From: PatrykBuniX Date: Tue, 25 Oct 2022 15:35:24 +0200 Subject: [PATCH 1/4] runfix: wrapp image upload button with form and move it to separate file --- .../page/message-list/AssetUploadButton.tsx | 3 +- .../ImageUploadButton/ImageUploadButton.tsx | 69 +++++++++++++++++++ .../InputBarControls/ControlButtons.tsx | 28 +------- 3 files changed, 74 insertions(+), 26 deletions(-) create mode 100644 src/script/page/message-list/ImageUploadButton/ImageUploadButton.tsx diff --git a/src/script/page/message-list/AssetUploadButton.tsx b/src/script/page/message-list/AssetUploadButton.tsx index 086738c5dc5..60d166c40de 100644 --- a/src/script/page/message-list/AssetUploadButton.tsx +++ b/src/script/page/message-list/AssetUploadButton.tsx @@ -28,7 +28,8 @@ interface AssetUploadButtonProps { export const AssetUploadButton = ({onSelectFiles}: AssetUploadButtonProps) => { const acceptedFileTypes = Config.getConfig().FEATURE.ALLOWED_FILE_UPLOAD_EXTENSIONS.join(','); - const fileRef = useRef(null!); + + const fileRef = useRef(null); const formRef = useRef(null); const handleFileChange = (event: React.ChangeEvent) => { diff --git a/src/script/page/message-list/ImageUploadButton/ImageUploadButton.tsx b/src/script/page/message-list/ImageUploadButton/ImageUploadButton.tsx new file mode 100644 index 00000000000..befd82f48c9 --- /dev/null +++ b/src/script/page/message-list/ImageUploadButton/ImageUploadButton.tsx @@ -0,0 +1,69 @@ +/* + * Wire + * Copyright (C) 2022 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/. + * + */ + +import {useRef} from 'react'; +import {t} from 'Util/LocalizerUtil'; +import Icon from 'Components/Icon'; +import {Config} from '../../../Config'; + +interface ImageUploadButtonProps { + onSelectImages: (files: File[]) => void; +} + +export const ImageUploadButton = ({onSelectImages}: ImageUploadButtonProps) => { + const acceptedImageTypes = Config.getConfig().ALLOWED_IMAGE_TYPES.join(','); + + const imageRef = useRef(null); + const formRef = useRef(null); + + const handleImageFileChange = (event: React.ChangeEvent) => { + const {files} = event.target; + + if (!files) { + return; + } + + onSelectImages(Array.from(files)); + formRef.current?.reset(); + }; + + return ( +
+ +
+ ); +}; diff --git a/src/script/page/message-list/InputBarControls/ControlButtons.tsx b/src/script/page/message-list/InputBarControls/ControlButtons.tsx index 1a88c948ecc..ac6abcc1a03 100644 --- a/src/script/page/message-list/InputBarControls/ControlButtons.tsx +++ b/src/script/page/message-list/InputBarControls/ControlButtons.tsx @@ -18,12 +18,12 @@ */ import Icon from 'Components/Icon'; -import React, {useRef} from 'react'; +import React from 'react'; import MessageTimerButton from '../MessageTimerButton'; import {t} from 'Util/LocalizerUtil'; import {Conversation} from 'src/script/entity/Conversation'; -import {Config} from '../../../Config'; import {AssetUploadButton} from '../AssetUploadButton'; +import {ImageUploadButton} from '../ImageUploadButton/ImageUploadButton'; export type ControlButtonsProps = { input: string; @@ -54,10 +54,6 @@ const ControlButtons: React.FC = ({ onCancelEditing, onClickGif, }) => { - const acceptedImageTypes = Config.getConfig().ALLOWED_IMAGE_TYPES.join(','); - - const imageRef = useRef(null!); - const pingTooltip = t('tooltipConversationPing'); if (isEditing) { @@ -96,25 +92,7 @@ const ControlButtons: React.FC = ({
  • - +
  • From 6ee66440b4465f7ba2a0dabf14304f2e623023a1 Mon Sep 17 00:00:00 2001 From: PatrykBuniX Date: Tue, 25 Oct 2022 15:43:25 +0200 Subject: [PATCH 2/4] test: add ImageUploadButton component test --- .../ImageUploadButton.test.tsx | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/script/page/message-list/ImageUploadButton/ImageUploadButton.test.tsx diff --git a/src/script/page/message-list/ImageUploadButton/ImageUploadButton.test.tsx b/src/script/page/message-list/ImageUploadButton/ImageUploadButton.test.tsx new file mode 100644 index 00000000000..bb4a1c8216e --- /dev/null +++ b/src/script/page/message-list/ImageUploadButton/ImageUploadButton.test.tsx @@ -0,0 +1,66 @@ +/* + * Wire + * Copyright (C) 2022 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/. + * + */ + +import {render, fireEvent} from '@testing-library/react'; +import {ImageUploadButton} from './ImageUploadButton'; + +jest.mock('../../../Config', () => ({ + Config: { + getConfig: () => ({ + ALLOWED_IMAGE_TYPES: ['image/gif', 'image/avif'], + FEATURE: {ALLOWED_FILE_UPLOAD_EXTENSIONS: ['*']}, + }), + }, +})); + +const pngFile = new File(['(⌐□_□)'], 'chucknorris.png', {type: 'image/png'}); + +describe('ImageUploadButton', () => { + it('Does call onSelectImages with uploaded image file', () => { + const onSelectImages = jest.fn(); + + const {container} = render(); + const fileInput = container.querySelector('input[type="file"]') as HTMLInputElement; + + fireEvent.change(fileInput, { + target: {files: [pngFile]}, + }); + + expect(onSelectImages).toHaveBeenCalledWith([pngFile]); + }); + + it('Does reset a form with input after upload', () => { + const onSelectImages = jest.fn(); + + const {container} = render(); + + const form = container.querySelector('form'); + jest.spyOn(form!, 'reset'); + + const fileInput = container.querySelector('input[type="file"]') as HTMLInputElement; + + fireEvent.change(fileInput, { + target: {files: [pngFile]}, + }); + + expect(onSelectImages).toHaveBeenCalledWith([pngFile]); + expect(fileInput.files?.[0].name).toEqual(pngFile.name); + expect(form!.reset).toHaveBeenCalled(); + }); +}); From 684b40c5062c8978ba8a5cd5f850d14597602e6b Mon Sep 17 00:00:00 2001 From: PatrykBuniX Date: Tue, 25 Oct 2022 15:53:08 +0200 Subject: [PATCH 3/4] refactor: organize directory structure in page folder --- .../page/{ => AccentColorPicker}/AccentColorPicker.test.tsx | 0 src/script/page/{ => AccentColorPicker}/AccentColorPicker.tsx | 0 src/script/page/{ => AppLock}/AppLock.test.tsx | 0 src/script/page/{ => AppLock}/AppLock.tsx | 0 .../{ => AssetUploadButton}/AssetUploadButton.test.tsx | 0 .../message-list/{ => AssetUploadButton}/AssetUploadButton.tsx | 0 .../{ => MessageTimerButton}/MessageTimerButton.test.tsx | 0 .../message-list/{ => MessageTimerButton}/MessageTimerButton.tsx | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename src/script/page/{ => AccentColorPicker}/AccentColorPicker.test.tsx (100%) rename src/script/page/{ => AccentColorPicker}/AccentColorPicker.tsx (100%) rename src/script/page/{ => AppLock}/AppLock.test.tsx (100%) rename src/script/page/{ => AppLock}/AppLock.tsx (100%) rename src/script/page/message-list/{ => AssetUploadButton}/AssetUploadButton.test.tsx (100%) rename src/script/page/message-list/{ => AssetUploadButton}/AssetUploadButton.tsx (100%) rename src/script/page/message-list/{ => MessageTimerButton}/MessageTimerButton.test.tsx (100%) rename src/script/page/message-list/{ => MessageTimerButton}/MessageTimerButton.tsx (100%) diff --git a/src/script/page/AccentColorPicker.test.tsx b/src/script/page/AccentColorPicker/AccentColorPicker.test.tsx similarity index 100% rename from src/script/page/AccentColorPicker.test.tsx rename to src/script/page/AccentColorPicker/AccentColorPicker.test.tsx diff --git a/src/script/page/AccentColorPicker.tsx b/src/script/page/AccentColorPicker/AccentColorPicker.tsx similarity index 100% rename from src/script/page/AccentColorPicker.tsx rename to src/script/page/AccentColorPicker/AccentColorPicker.tsx diff --git a/src/script/page/AppLock.test.tsx b/src/script/page/AppLock/AppLock.test.tsx similarity index 100% rename from src/script/page/AppLock.test.tsx rename to src/script/page/AppLock/AppLock.test.tsx diff --git a/src/script/page/AppLock.tsx b/src/script/page/AppLock/AppLock.tsx similarity index 100% rename from src/script/page/AppLock.tsx rename to src/script/page/AppLock/AppLock.tsx diff --git a/src/script/page/message-list/AssetUploadButton.test.tsx b/src/script/page/message-list/AssetUploadButton/AssetUploadButton.test.tsx similarity index 100% rename from src/script/page/message-list/AssetUploadButton.test.tsx rename to src/script/page/message-list/AssetUploadButton/AssetUploadButton.test.tsx diff --git a/src/script/page/message-list/AssetUploadButton.tsx b/src/script/page/message-list/AssetUploadButton/AssetUploadButton.tsx similarity index 100% rename from src/script/page/message-list/AssetUploadButton.tsx rename to src/script/page/message-list/AssetUploadButton/AssetUploadButton.tsx diff --git a/src/script/page/message-list/MessageTimerButton.test.tsx b/src/script/page/message-list/MessageTimerButton/MessageTimerButton.test.tsx similarity index 100% rename from src/script/page/message-list/MessageTimerButton.test.tsx rename to src/script/page/message-list/MessageTimerButton/MessageTimerButton.test.tsx diff --git a/src/script/page/message-list/MessageTimerButton.tsx b/src/script/page/message-list/MessageTimerButton/MessageTimerButton.tsx similarity index 100% rename from src/script/page/message-list/MessageTimerButton.tsx rename to src/script/page/message-list/MessageTimerButton/MessageTimerButton.tsx From eb707516880a5cea0e2e21101eb1df96b6c9e2f1 Mon Sep 17 00:00:00 2001 From: PatrykBuniX Date: Tue, 25 Oct 2022 16:17:48 +0200 Subject: [PATCH 4/4] refactor: reorganise folder structure --- .../AccentColorPicker.test.tsx | 4 ++-- .../AccentColorPicker/AccentColorPicker.tsx | 8 +++---- src/script/page/AccentColorPicker/index.ts | 20 ++++++++++++++++++ src/script/page/AppLock/AppLock.test.tsx | 12 +++++------ src/script/page/AppLock/AppLock.tsx | 14 ++++++------- src/script/page/AppLock/index.ts | 21 +++++++++++++++++++ .../panels/preferences/AccountPreferences.tsx | 2 +- .../AssetUploadButton.test.tsx | 4 ++-- .../AssetUploadButton/AssetUploadButton.tsx | 2 +- .../message-list/AssetUploadButton/index.ts | 20 ++++++++++++++++++ .../ImageUploadButton.test.tsx | 2 +- .../message-list/ImageUploadButton/index.ts | 20 ++++++++++++++++++ .../InputBarControls/ControlButtons.tsx | 4 ++-- .../MessageTimerButton.test.tsx | 6 +++--- .../MessageTimerButton/MessageTimerButton.tsx | 10 ++++----- .../message-list/MessageTimerButton/index.ts | 20 ++++++++++++++++++ 16 files changed, 133 insertions(+), 36 deletions(-) create mode 100644 src/script/page/AccentColorPicker/index.ts create mode 100644 src/script/page/AppLock/index.ts create mode 100644 src/script/page/message-list/AssetUploadButton/index.ts create mode 100644 src/script/page/message-list/ImageUploadButton/index.ts create mode 100644 src/script/page/message-list/MessageTimerButton/index.ts diff --git a/src/script/page/AccentColorPicker/AccentColorPicker.test.tsx b/src/script/page/AccentColorPicker/AccentColorPicker.test.tsx index bfe1da28563..be6a616ba11 100644 --- a/src/script/page/AccentColorPicker/AccentColorPicker.test.tsx +++ b/src/script/page/AccentColorPicker/AccentColorPicker.test.tsx @@ -21,8 +21,8 @@ import {AccentColor} from '@wireapp/commons'; import {render, act} from '@testing-library/react'; -import AccentColorPicker, {AccentColorPickerProps} from './AccentColorPicker'; -import {User} from '../entity/User'; +import {AccentColorPicker, AccentColorPickerProps} from './'; +import {User} from '../../entity/User'; import ko from 'knockout'; describe('AccentColorPicker', () => { diff --git a/src/script/page/AccentColorPicker/AccentColorPicker.tsx b/src/script/page/AccentColorPicker/AccentColorPicker.tsx index 55ba1d62188..8aefe754b89 100644 --- a/src/script/page/AccentColorPicker/AccentColorPicker.tsx +++ b/src/script/page/AccentColorPicker/AccentColorPicker.tsx @@ -21,9 +21,9 @@ import React from 'react'; import {CSS_SQUARE} from 'Util/CSSMixin'; import {t} from 'Util/LocalizerUtil'; import {CSSObject} from '@emotion/serialize'; -import {User} from '../entity/User'; +import {User} from '../../entity/User'; import {useKoSubscribableChildren} from 'Util/ComponentUtil'; -import {ACCENT_ID} from '../Config'; +import {ACCENT_ID} from '../../Config'; export interface AccentColorPickerProps { doSetAccentColor: (id: number) => void; @@ -37,7 +37,7 @@ const headerStyles: CSSObject = { textAlign: 'center', }; -const AccentColorPicker: React.FunctionComponent = ({user, doSetAccentColor}) => { +export const AccentColorPicker: React.FunctionComponent = ({user, doSetAccentColor}) => { const {accent_id: accentId} = useKoSubscribableChildren(user, ['accent_id']); return ( <> @@ -142,5 +142,3 @@ const AccentColorPicker: React.FunctionComponent = ({use ); }; - -export default AccentColorPicker; diff --git a/src/script/page/AccentColorPicker/index.ts b/src/script/page/AccentColorPicker/index.ts new file mode 100644 index 00000000000..806dad7bcb7 --- /dev/null +++ b/src/script/page/AccentColorPicker/index.ts @@ -0,0 +1,20 @@ +/* + * Wire + * Copyright (C) 2022 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 './AccentColorPicker'; diff --git a/src/script/page/AppLock/AppLock.test.tsx b/src/script/page/AppLock/AppLock.test.tsx index 3e1a34ae4e2..6dc35865227 100644 --- a/src/script/page/AppLock/AppLock.test.tsx +++ b/src/script/page/AppLock/AppLock.test.tsx @@ -23,13 +23,13 @@ import {WebAppEvents} from '@wireapp/webapp-events'; import {amplify} from 'amplify'; import {FeatureStatus} from '@wireapp/api-client/src/team/feature/'; -import type {ClientRepository} from '../client/ClientRepository'; -import AppLock, {APPLOCK_STATE} from './AppLock'; -import {AppLockState} from '../user/AppLockState'; -import {AppLockRepository} from '../user/AppLockRepository'; -import {UserState} from '../user/UserState'; +import type {ClientRepository} from '../../client/ClientRepository'; +import AppLock, {APPLOCK_STATE} from './'; +import {AppLockState} from '../../user/AppLockState'; +import {AppLockRepository} from '../../user/AppLockRepository'; +import {UserState} from '../../user/UserState'; import {createRandomUuid} from 'Util/util'; -import {TeamState} from '../team/TeamState'; +import {TeamState} from '../../team/TeamState'; import {render} from '@testing-library/react'; // https://github.com/jedisct1/libsodium.js/issues/235 diff --git a/src/script/page/AppLock/AppLock.tsx b/src/script/page/AppLock/AppLock.tsx index e0fce9a6b23..bf277e83f19 100644 --- a/src/script/page/AppLock/AppLock.tsx +++ b/src/script/page/AppLock/AppLock.tsx @@ -26,15 +26,15 @@ import {StatusCodes as HTTP_STATUS} from 'http-status-codes'; import {t} from 'Util/LocalizerUtil'; -import {ClientRepository} from '../client/ClientRepository'; -import {Config} from '../Config'; +import {ClientRepository} from '../../client/ClientRepository'; +import {Config} from '../../Config'; import ModalComponent from 'Components/ModalComponent'; -import {SIGN_OUT_REASON} from '../auth/SignOutReason'; -import {ClientState} from '../client/ClientState'; -import {AppLockState} from '../user/AppLockState'; -import {AppLockRepository} from '../user/AppLockRepository'; +import {SIGN_OUT_REASON} from '../../auth/SignOutReason'; +import {ClientState} from '../../client/ClientState'; +import {AppLockState} from '../../user/AppLockState'; +import {AppLockRepository} from '../../user/AppLockRepository'; import {registerReactComponent, useKoSubscribableChildren} from 'Util/ComponentUtil'; -import {ModalsViewModel} from '../view_model/ModalsViewModel'; +import {ModalsViewModel} from '../../view_model/ModalsViewModel'; import Icon from 'Components/Icon'; export enum APPLOCK_STATE { diff --git a/src/script/page/AppLock/index.ts b/src/script/page/AppLock/index.ts new file mode 100644 index 00000000000..ff1240abeb9 --- /dev/null +++ b/src/script/page/AppLock/index.ts @@ -0,0 +1,21 @@ +/* + * Wire + * Copyright (C) 2022 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 './AppLock'; +export {default} from './AppLock'; diff --git a/src/script/page/MainContent/panels/preferences/AccountPreferences.tsx b/src/script/page/MainContent/panels/preferences/AccountPreferences.tsx index b209dfc6a6f..ed999b468be 100644 --- a/src/script/page/MainContent/panels/preferences/AccountPreferences.tsx +++ b/src/script/page/MainContent/panels/preferences/AccountPreferences.tsx @@ -39,7 +39,7 @@ import {RichProfileRepository} from '../../../../user/RichProfileRepository'; import type {UserRepository} from '../../../../user/UserRepository'; import {UserState} from '../../../../user/UserState'; import {modals, ModalsViewModel} from '../../../../view_model/ModalsViewModel'; -import AccentColorPicker from '../../../AccentColorPicker'; +import {AccentColorPicker} from '../../../AccentColorPicker'; import AccountInput from './accountPreferences/AccountInput'; import AccountSecuritySection from './accountPreferences/AccountSecuritySection'; import AvailabilityButtons from './accountPreferences/AvailabilityButtons'; diff --git a/src/script/page/message-list/AssetUploadButton/AssetUploadButton.test.tsx b/src/script/page/message-list/AssetUploadButton/AssetUploadButton.test.tsx index 75a50f2a3f1..19c83adecc3 100644 --- a/src/script/page/message-list/AssetUploadButton/AssetUploadButton.test.tsx +++ b/src/script/page/message-list/AssetUploadButton/AssetUploadButton.test.tsx @@ -18,9 +18,9 @@ */ import {render, fireEvent} from '@testing-library/react'; -import {AssetUploadButton} from './AssetUploadButton'; +import {AssetUploadButton} from './'; -jest.mock('../../Config', () => ({ +jest.mock('../../../Config', () => ({ Config: { getConfig: () => ({ ALLOWED_IMAGE_TYPES: ['image/gif', 'image/avif'], diff --git a/src/script/page/message-list/AssetUploadButton/AssetUploadButton.tsx b/src/script/page/message-list/AssetUploadButton/AssetUploadButton.tsx index 60d166c40de..5a4a8150b64 100644 --- a/src/script/page/message-list/AssetUploadButton/AssetUploadButton.tsx +++ b/src/script/page/message-list/AssetUploadButton/AssetUploadButton.tsx @@ -18,7 +18,7 @@ */ import {useRef} from 'react'; -import {Config} from '../../Config'; +import {Config} from '../../../Config'; import {t} from 'Util/LocalizerUtil'; import Icon from 'Components/Icon'; diff --git a/src/script/page/message-list/AssetUploadButton/index.ts b/src/script/page/message-list/AssetUploadButton/index.ts new file mode 100644 index 00000000000..597979b1ea9 --- /dev/null +++ b/src/script/page/message-list/AssetUploadButton/index.ts @@ -0,0 +1,20 @@ +/* + * Wire + * Copyright (C) 2022 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 './AssetUploadButton'; diff --git a/src/script/page/message-list/ImageUploadButton/ImageUploadButton.test.tsx b/src/script/page/message-list/ImageUploadButton/ImageUploadButton.test.tsx index bb4a1c8216e..5603569e672 100644 --- a/src/script/page/message-list/ImageUploadButton/ImageUploadButton.test.tsx +++ b/src/script/page/message-list/ImageUploadButton/ImageUploadButton.test.tsx @@ -18,7 +18,7 @@ */ import {render, fireEvent} from '@testing-library/react'; -import {ImageUploadButton} from './ImageUploadButton'; +import {ImageUploadButton} from './'; jest.mock('../../../Config', () => ({ Config: { diff --git a/src/script/page/message-list/ImageUploadButton/index.ts b/src/script/page/message-list/ImageUploadButton/index.ts new file mode 100644 index 00000000000..072686c7769 --- /dev/null +++ b/src/script/page/message-list/ImageUploadButton/index.ts @@ -0,0 +1,20 @@ +/* + * Wire + * Copyright (C) 2022 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 './ImageUploadButton'; diff --git a/src/script/page/message-list/InputBarControls/ControlButtons.tsx b/src/script/page/message-list/InputBarControls/ControlButtons.tsx index ac6abcc1a03..a1ae54811cd 100644 --- a/src/script/page/message-list/InputBarControls/ControlButtons.tsx +++ b/src/script/page/message-list/InputBarControls/ControlButtons.tsx @@ -19,11 +19,11 @@ import Icon from 'Components/Icon'; import React from 'react'; -import MessageTimerButton from '../MessageTimerButton'; +import {MessageTimerButton} from '../MessageTimerButton'; import {t} from 'Util/LocalizerUtil'; import {Conversation} from 'src/script/entity/Conversation'; import {AssetUploadButton} from '../AssetUploadButton'; -import {ImageUploadButton} from '../ImageUploadButton/ImageUploadButton'; +import {ImageUploadButton} from '../ImageUploadButton'; export type ControlButtonsProps = { input: string; diff --git a/src/script/page/message-list/MessageTimerButton/MessageTimerButton.test.tsx b/src/script/page/message-list/MessageTimerButton/MessageTimerButton.test.tsx index f7df7b55476..8ad6ccff700 100644 --- a/src/script/page/message-list/MessageTimerButton/MessageTimerButton.test.tsx +++ b/src/script/page/message-list/MessageTimerButton/MessageTimerButton.test.tsx @@ -19,9 +19,9 @@ import ko from 'knockout'; import {TIME_IN_MILLIS} from 'Util/TimeUtil'; -import MessageTimerButton from './MessageTimerButton'; -import type {Conversation} from '../../entity/Conversation'; -import * as Context from '../../ui/ContextMenu'; +import {MessageTimerButton} from './MessageTimerButton'; +import type {Conversation} from '../../../entity/Conversation'; +import * as Context from '../../../ui/ContextMenu'; import {TeamState} from 'src/script/team/TeamState'; import {render, fireEvent} from '@testing-library/react'; diff --git a/src/script/page/message-list/MessageTimerButton/MessageTimerButton.tsx b/src/script/page/message-list/MessageTimerButton/MessageTimerButton.tsx index 16a4dd22c29..1f1195af27b 100644 --- a/src/script/page/message-list/MessageTimerButton/MessageTimerButton.tsx +++ b/src/script/page/message-list/MessageTimerButton/MessageTimerButton.tsx @@ -25,11 +25,11 @@ import {formatDuration, DurationUnit} from 'Util/TimeUtil'; import Icon from 'Components/Icon'; import {useKoSubscribableChildren} from 'Util/ComponentUtil'; -import {EphemeralTimings} from '../../ephemeral/EphemeralTimings'; -import {showContextMenu} from '../../ui/ContextMenu'; -import type {Conversation} from '../../entity/Conversation'; +import {EphemeralTimings} from '../../../ephemeral/EphemeralTimings'; +import {showContextMenu} from '../../../ui/ContextMenu'; +import type {Conversation} from '../../../entity/Conversation'; import {container} from 'tsyringe'; -import {TeamState} from '../../team/TeamState'; +import {TeamState} from '../../../team/TeamState'; import {KEY} from 'Util/KeyboardUtil'; import {setContextMenuPosition} from 'Util/util'; @@ -125,5 +125,3 @@ export const MessageTimerButton: React.FC = ({ ); }; - -export default MessageTimerButton; diff --git a/src/script/page/message-list/MessageTimerButton/index.ts b/src/script/page/message-list/MessageTimerButton/index.ts new file mode 100644 index 00000000000..5363ab400f7 --- /dev/null +++ b/src/script/page/message-list/MessageTimerButton/index.ts @@ -0,0 +1,20 @@ +/* + * Wire + * Copyright (C) 2022 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 './MessageTimerButton';