From 4a4bf8244081c0abab7f92e93b8bbff94c6b626d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Tue, 15 Aug 2023 22:46:19 +0200 Subject: [PATCH] Remove unused components (#24189) * Remove unused components * i18n-extract * Fix tests --------- Co-authored-by: Mattermost Build --- .../picture_selector.test.tsx.snap | 121 --- webapp/channels/src/components/accordion.tsx | 37 - .../permissions_tree_runs.tsx | 71 -- .../advanced_text_editor.tsx | 2 +- .../toggle_formatting_bar.tsx | 2 +- .../toggle_formatting_bar/index.ts | 4 - .../index.tsx | 201 ----- .../cloud_usage_modal/mini_modal.scss | 11 - .../cloud_usage_modal/mini_modal.tsx | 55 -- .../common/accordion/message_item.tsx | 27 - .../common/hooks/useGetSubscriptionProduct.ts | 40 - .../common/hooks/useOpenTrialBenefitsModal.ts | 27 - .../common/hooks/useValidateTeam.ts | 161 ---- .../components/common/hooks/useValidateUrl.ts | 145 --- .../svg_images_components/boards_svg.tsx | 39 - .../svg_images_components/celebrate_svg.tsx | 39 - .../getting_started_svg.tsx | 394 -------- .../laptop-earth_svg.tsx | 137 --- .../svg_images_components/laptop_svg.tsx | 413 --------- .../mattermost_cloud_svg.tsx | 79 -- .../svg_images_components/newspaper_svg.tsx | 37 - .../svg_images_components/person_mac_svg.tsx | 854 ------------------ .../svg_images_components/playbooks_svg.tsx | 63 -- .../push_notifications_svg.tsx | 160 ---- .../channels/src/components/multi_input.scss | 99 -- .../channels/src/components/multi_input.tsx | 126 --- .../src/components/picture_selector.scss | 80 -- .../src/components/picture_selector.test.tsx | 50 - .../src/components/picture_selector.tsx | 142 --- .../post_view/comment_icon/index.ts | 31 - .../channels/src/components/progress_bar.scss | 12 - .../src/components/progress_bar.test.tsx | 58 -- .../channels/src/components/progress_bar.tsx | 28 - .../global_threads_link.tsx | 2 +- .../collapsed_reply_threads_modal.scss | 0 .../collapsed_reply_threads_modal.tsx | 2 +- .../collapsed_reply_threads_modal/index.ts | 4 - .../widgets/icons/dots_horizontal.tsx | 22 - .../components/widgets/icons/message_icon.tsx | 42 - webapp/channels/src/i18n/en.json | 7 - webapp/channels/src/utils/constants.tsx | 1 - 41 files changed, 4 insertions(+), 3821 deletions(-) delete mode 100644 webapp/channels/src/components/__snapshots__/picture_selector.test.tsx.snap delete mode 100644 webapp/channels/src/components/accordion.tsx delete mode 100644 webapp/channels/src/components/admin_console/permission_schemes_settings/permissions_tree_runs.tsx rename webapp/channels/src/components/advanced_text_editor/{toggle_formatting_bar => }/toggle_formatting_bar.tsx (97%) delete mode 100644 webapp/channels/src/components/advanced_text_editor/toggle_formatting_bar/index.ts delete mode 100644 webapp/channels/src/components/cloud_subscribe_with_loading_modal/index.tsx delete mode 100644 webapp/channels/src/components/cloud_usage_modal/mini_modal.scss delete mode 100644 webapp/channels/src/components/cloud_usage_modal/mini_modal.tsx delete mode 100644 webapp/channels/src/components/common/accordion/message_item.tsx delete mode 100644 webapp/channels/src/components/common/hooks/useGetSubscriptionProduct.ts delete mode 100644 webapp/channels/src/components/common/hooks/useOpenTrialBenefitsModal.ts delete mode 100644 webapp/channels/src/components/common/hooks/useValidateTeam.ts delete mode 100644 webapp/channels/src/components/common/hooks/useValidateUrl.ts delete mode 100644 webapp/channels/src/components/common/svg_images_components/boards_svg.tsx delete mode 100644 webapp/channels/src/components/common/svg_images_components/celebrate_svg.tsx delete mode 100644 webapp/channels/src/components/common/svg_images_components/getting_started_svg.tsx delete mode 100644 webapp/channels/src/components/common/svg_images_components/laptop-earth_svg.tsx delete mode 100644 webapp/channels/src/components/common/svg_images_components/laptop_svg.tsx delete mode 100644 webapp/channels/src/components/common/svg_images_components/mattermost_cloud_svg.tsx delete mode 100644 webapp/channels/src/components/common/svg_images_components/newspaper_svg.tsx delete mode 100644 webapp/channels/src/components/common/svg_images_components/person_mac_svg.tsx delete mode 100644 webapp/channels/src/components/common/svg_images_components/playbooks_svg.tsx delete mode 100644 webapp/channels/src/components/common/svg_images_components/push_notifications_svg.tsx delete mode 100644 webapp/channels/src/components/multi_input.scss delete mode 100644 webapp/channels/src/components/multi_input.tsx delete mode 100644 webapp/channels/src/components/picture_selector.scss delete mode 100644 webapp/channels/src/components/picture_selector.test.tsx delete mode 100644 webapp/channels/src/components/picture_selector.tsx delete mode 100644 webapp/channels/src/components/post_view/comment_icon/index.ts delete mode 100644 webapp/channels/src/components/progress_bar.scss delete mode 100644 webapp/channels/src/components/progress_bar.test.tsx delete mode 100644 webapp/channels/src/components/progress_bar.tsx rename webapp/channels/src/components/tours/crt_tour/{collapsed_reply_threads_modal => }/collapsed_reply_threads_modal.scss (100%) rename webapp/channels/src/components/tours/crt_tour/{collapsed_reply_threads_modal => }/collapsed_reply_threads_modal.tsx (99%) delete mode 100644 webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal/index.ts delete mode 100644 webapp/channels/src/components/widgets/icons/dots_horizontal.tsx delete mode 100644 webapp/channels/src/components/widgets/icons/message_icon.tsx diff --git a/webapp/channels/src/components/__snapshots__/picture_selector.test.tsx.snap b/webapp/channels/src/components/__snapshots__/picture_selector.test.tsx.snap deleted file mode 100644 index 8a67c9b70d..0000000000 --- a/webapp/channels/src/components/__snapshots__/picture_selector.test.tsx.snap +++ /dev/null @@ -1,121 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`components/picture_selector should match snapshot, default picture provided 1`] = ` -
- -
-
- -
-
-`; - -exports[`components/picture_selector should match snapshot, existing picture provided 1`] = ` -
- -
-
- -
-
-`; - -exports[`components/picture_selector should match snapshot, no picture selected 1`] = ` -
- -
-
- -
-
-`; diff --git a/webapp/channels/src/components/accordion.tsx b/webapp/channels/src/components/accordion.tsx deleted file mode 100644 index ecf9bbf9b4..0000000000 --- a/webapp/channels/src/components/accordion.tsx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -type Props = { - defaultExpandedKey: string; - children: (setExpanded: (expandedKey: string) => void, expandedKey: string) => React.ReactNode; -}; - -type State = { - expandedKey: string; -}; - -export default class Accordion extends React.PureComponent { - constructor(props: Props) { - super(props); - - this.state = { - expandedKey: props.defaultExpandedKey, - }; - } - - setExpanded = (expandedKey: string) => { - this.setState({expandedKey}); - }; - - render() { - return ( -
- {this.props.children(this.setExpanded, this.state.expandedKey)} -
- ); - } -} diff --git a/webapp/channels/src/components/admin_console/permission_schemes_settings/permissions_tree_runs.tsx b/webapp/channels/src/components/admin_console/permission_schemes_settings/permissions_tree_runs.tsx deleted file mode 100644 index 0323936fdc..0000000000 --- a/webapp/channels/src/components/admin_console/permission_schemes_settings/permissions_tree_runs.tsx +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {FormattedMessage} from 'react-intl'; - -import Permissions from 'mattermost-redux/constants/permissions'; - -import PermissionGroup from './permission_group'; - -interface Props { - role: Record; - scope: string; - selectRow: any; - readOnly: boolean; - onToggle: (a: string, b: string[]) => void; -} - -export const playbooksGroups: any[] = [ - { - id: 'runs', - permissions: [ - Permissions.RUN_CREATE, - ], - }, -]; - -const PermissionsTreeRuns = (props: Props) => { - const toggleGroup = (ids: string[]) => { - if (props.readOnly) { - return; - } - props.onToggle(props.role.name, ids); - }; - - return ( -
-
-
- -
-
- -
-
-
- -
-
- ); -}; - -export default PermissionsTreeRuns; diff --git a/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.tsx b/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.tsx index 9ab639b7eb..f4c0055853 100644 --- a/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.tsx +++ b/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.tsx @@ -42,7 +42,7 @@ import SendButton from './send_button'; import {IconContainer} from './formatting_bar/formatting_icon'; import './advanced_text_editor.scss'; -import ToggleFormattingBar from './toggle_formatting_bar/toggle_formatting_bar'; +import ToggleFormattingBar from './toggle_formatting_bar'; type Props = { diff --git a/webapp/channels/src/components/advanced_text_editor/toggle_formatting_bar/toggle_formatting_bar.tsx b/webapp/channels/src/components/advanced_text_editor/toggle_formatting_bar.tsx similarity index 97% rename from webapp/channels/src/components/advanced_text_editor/toggle_formatting_bar/toggle_formatting_bar.tsx rename to webapp/channels/src/components/advanced_text_editor/toggle_formatting_bar.tsx index 1f06f1bfdf..1ead879392 100644 --- a/webapp/channels/src/components/advanced_text_editor/toggle_formatting_bar/toggle_formatting_bar.tsx +++ b/webapp/channels/src/components/advanced_text_editor/toggle_formatting_bar.tsx @@ -10,7 +10,7 @@ import OverlayTrigger from 'components/overlay_trigger'; import Tooltip from 'components/tooltip'; import Constants from 'utils/constants'; -import {IconContainer} from '../formatting_bar/formatting_icon'; +import {IconContainer} from './formatting_bar/formatting_icon'; interface ToggleFormattingBarProps { onClick: React.MouseEventHandler; diff --git a/webapp/channels/src/components/advanced_text_editor/toggle_formatting_bar/index.ts b/webapp/channels/src/components/advanced_text_editor/toggle_formatting_bar/index.ts deleted file mode 100644 index 7c65858068..0000000000 --- a/webapp/channels/src/components/advanced_text_editor/toggle_formatting_bar/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -export {default} from './toggle_formatting_bar'; diff --git a/webapp/channels/src/components/cloud_subscribe_with_loading_modal/index.tsx b/webapp/channels/src/components/cloud_subscribe_with_loading_modal/index.tsx deleted file mode 100644 index c97ae82033..0000000000 --- a/webapp/channels/src/components/cloud_subscribe_with_loading_modal/index.tsx +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React, {useState, useEffect, useRef} from 'react'; -import {FormattedMessage} from 'react-intl'; -import {RouteComponentProps, withRouter} from 'react-router-dom'; -import {useSelector, useDispatch} from 'react-redux'; - -import {ModalIdentifiers} from 'utils/constants'; -import {GlobalState} from 'types/store'; -import {subscribeCloudSubscription} from 'actions/cloud'; -import {closeModal} from 'actions/views/modals'; -import {Team} from '@mattermost/types/teams'; -import {Feedback, Product} from '@mattermost/types/cloud'; -import {t} from 'utils/i18n'; -import {isModalOpen} from 'selectors/views/modals'; -import FullScreenModal from 'components/widgets/modals/full_screen_modal'; -import CreditCardSvg from 'components/common/svg_images_components/credit_card_svg'; -import PaymentSuccessStandardSvg from 'components/common/svg_images_components/payment_success_standard_svg'; -import PaymentFailedSvg from 'components/common/svg_images_components/payment_failed_svg'; -import IconMessage from 'components/purchase_modal/icon_message'; -import ProgressBar, {ProcessState} from 'components/icon_message_with_progress_bar'; -import {DispatchFunc} from 'mattermost-redux/types/actions'; - -type Props = RouteComponentProps & { - onBack: () => void; - onClose?: () => void; - teamToKeep?: Team; - selectedProduct?: Product | null | undefined; - downgradeFeedback?: Feedback; -}; - -const MIN_PROCESSING_MILLISECONDS = 8000; -const MAX_FAKE_PROGRESS = 95; - -function CloudSubscribeWithLoad(props: Props) { - const intervalId = useRef({} as NodeJS.Timeout); - const [progress, setProgress] = useState(0); - const dispatch = useDispatch(); - const [error, setError] = useState(false); - const [processingState, setProcessingState] = useState(ProcessState.PROCESSING); - const modalOpen = useSelector((state: GlobalState) => - isModalOpen(state, ModalIdentifiers.CLOUD_SUBSCRIBE_WITH_LOADING_MODAL), - ); - useEffect(() => { - handleSubscribe(); - intervalId.current = setInterval( - updateProgress, - MIN_PROCESSING_MILLISECONDS / MAX_FAKE_PROGRESS, - ); - }, []); - - const handleSubscribe = async () => { - const start = new Date(); - const result = await dispatch(subscribeCloudSubscription( - props.selectedProduct?.id as string, undefined, 0, props.downgradeFeedback, - )); - - // the action subscribeCloudSubscription returns a true boolean when successful and an error when it fails - if (result.error) { - setError(true); - setProcessingState(ProcessState.FAILED); - return; - } - - const end = new Date(); - const millisecondsElapsed = end.valueOf() - start.valueOf(); - if (millisecondsElapsed < MIN_PROCESSING_MILLISECONDS) { - setTimeout( - completeSubscribe, - MIN_PROCESSING_MILLISECONDS - millisecondsElapsed, - ); - return; - } - completeSubscribe(); - }; - - const completeSubscribe = () => { - clearInterval(intervalId.current); - setProcessingState(ProcessState.SUCCESS); - setProgress(100); - }; - - const updateProgress = () => { - setProgress((progress) => { - if (progress >= MAX_FAKE_PROGRESS) { - clearInterval(intervalId.current); - } - return progress + 3 > MAX_FAKE_PROGRESS ? MAX_FAKE_PROGRESS : progress + 3; - }, - ); - }; - - const handleGoBack = () => { - clearInterval(intervalId.current); - setProgress(0); - setError(false); - setProcessingState(ProcessState.PROCESSING); - props.onBack(); - }; - - const handleClose = () => { - dispatch( - closeModal( - ModalIdentifiers.CLOUD_SUBSCRIBE_WITH_LOADING_MODAL, - ), - ); - if (typeof props.onClose === 'function') { - props.onClose(); - } - }; - - const successPage = () => { - const formattedBtnText = ( - - ); - const productName = props.selectedProduct?.name; - const title = ( - - ); - - const formattedSubtitle = ( - - ); - return ( - - } - formattedButtonText={formattedBtnText} - buttonHandler={handleClose} - className={'success'} - tertiaryBtnText={t('admin.billing.subscription.viewBilling')} - tertiaryButtonHandler={() => { - handleClose(); - props.history.push('/admin_console/billing/subscription'); - }} - /> - ); - }; - - return ( - -
- - ), - }} - failedCopy={{ - title: t('admin.billing.subscription.paymentVerificationFailed'), - subtitle: t('admin.billing.subscription.paymentFailed'), - icon: ( - - ), - buttonText: t('admin.billing.subscription.goBackTryAgain'), - linkText: - t('admin.billing.subscription.constCloudCard.contactSupport'), - }} - progress={progress} - successPage={successPage} - handleGoBack={handleGoBack} - error={error} - /> -
-
- ); -} - -export default withRouter(CloudSubscribeWithLoad); diff --git a/webapp/channels/src/components/cloud_usage_modal/mini_modal.scss b/webapp/channels/src/components/cloud_usage_modal/mini_modal.scss deleted file mode 100644 index 0e48fdec60..0000000000 --- a/webapp/channels/src/components/cloud_usage_modal/mini_modal.scss +++ /dev/null @@ -1,11 +0,0 @@ -.CloudUsageMiniModal { - .modal-body { - // not overridden with classes because the classes needed depend on the context of where this is used - // and the existing rule is already 5 selectors deep - padding-bottom: 26px !important; - } - - .GenericModal__body { - color: var(--center-channel-color); - } -} diff --git a/webapp/channels/src/components/cloud_usage_modal/mini_modal.tsx b/webapp/channels/src/components/cloud_usage_modal/mini_modal.tsx deleted file mode 100644 index db8d8691a5..0000000000 --- a/webapp/channels/src/components/cloud_usage_modal/mini_modal.tsx +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {useSelector} from 'react-redux'; - -import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; -import {Limits, CloudUsage} from '@mattermost/types/cloud'; - -import {Message} from 'utils/i18n'; - -import CompassThemeProvider from 'components/compass_theme_provider/compass_theme_provider'; -import {GenericModal} from '@mattermost/components'; - -import WorkspaceLimitsPanel, {messageToElement} from './workspace_limits_panel'; - -import './mini_modal.scss'; - -interface Props { - limits: Limits; - usage: CloudUsage; - showIcons?: boolean; - title: Message | React.ReactNode; - onClose: () => void; - needsTheme?: boolean; -} - -export default function MiniModal(props: Props) { - const theme = useSelector(getTheme); - - const modal = ( - - - - ); - - if (!props.needsTheme) { - return modal; - } - - return ( - - {modal} - - ); -} diff --git a/webapp/channels/src/components/common/accordion/message_item.tsx b/webapp/channels/src/components/common/accordion/message_item.tsx deleted file mode 100644 index b5d261e791..0000000000 --- a/webapp/channels/src/components/common/accordion/message_item.tsx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -import './accordion.scss'; - -type Props = { - title: string; - description: string; - severity: 'info' | 'warning' | 'error'; -} - -const MessageItem = ({title, description}: Props): JSX.Element | null => { - return ( -
-

- -

-
-
{description}
-
-
- ); -}; - -export default MessageItem; diff --git a/webapp/channels/src/components/common/hooks/useGetSubscriptionProduct.ts b/webapp/channels/src/components/common/hooks/useGetSubscriptionProduct.ts deleted file mode 100644 index 372e14d18a..0000000000 --- a/webapp/channels/src/components/common/hooks/useGetSubscriptionProduct.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import {useEffect, useState} from 'react'; -import {useDispatch, useSelector} from 'react-redux'; - -import { - getCloudSubscription as getCloudSubscriptionAction, -} from 'mattermost-redux/actions/cloud'; -import {getLicense} from 'mattermost-redux/selectors/entities/general'; - -import {Product} from '@mattermost/types/cloud'; -import {getCloudSubscription, getCloudProducts, getSubscriptionProduct} from 'mattermost-redux/selectors/entities/cloud'; - -export default function useGetSubscription(): Product | undefined { - const cloudSubscription = useSelector(getCloudSubscription); - const cloudProducts = useSelector(getCloudProducts); - const license = useSelector(getLicense); - const retrievedCloudSub = Boolean(cloudSubscription); - const retrievedCloudProducts = Boolean(cloudProducts); - const dispatch = useDispatch(); - const [requestedSubscription, setRequestedSubscription] = useState(false); - const [requestedProducts, setRequestedProducts] = useState(false); - - useEffect(() => { - if (license.Cloud === 'true' && !retrievedCloudSub && !requestedSubscription) { - dispatch(getCloudSubscriptionAction()); - setRequestedSubscription(true); - } - }, [requestedSubscription, retrievedCloudSub, license]); - useEffect(() => { - if (license.Cloud === 'true' && !retrievedCloudProducts && !requestedProducts) { - dispatch(getCloudSubscriptionAction()); - setRequestedProducts(true); - } - }, [requestedProducts, retrievedCloudProducts, license]); - - return useSelector(getSubscriptionProduct); -} - diff --git a/webapp/channels/src/components/common/hooks/useOpenTrialBenefitsModal.ts b/webapp/channels/src/components/common/hooks/useOpenTrialBenefitsModal.ts deleted file mode 100644 index f32aa54cd6..0000000000 --- a/webapp/channels/src/components/common/hooks/useOpenTrialBenefitsModal.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import {useDispatch} from 'react-redux'; - -import {openModal} from 'actions/views/modals'; -import {ModalIdentifiers} from 'utils/constants'; -import TrialBenefitsModal, {Props} from 'components/trial_benefits_modal/trial_benefits_modal'; - -interface Options { - trialJustStarted?: boolean; -} - -export default function useOpenTrialBenefitsModal(options: Options) { - const dispatch = useDispatch(); - const dialogProps: Omit = {}; - if (options.trialJustStarted) { - dialogProps.trialJustStarted = true; - } - return () => { - return dispatch(openModal({ - modalId: ModalIdentifiers.TRIAL_BENEFITS_MODAL, - dialogType: TrialBenefitsModal, - dialogProps, - })); - }; -} diff --git a/webapp/channels/src/components/common/hooks/useValidateTeam.ts b/webapp/channels/src/components/common/hooks/useValidateTeam.ts deleted file mode 100644 index 5515bc384f..0000000000 --- a/webapp/channels/src/components/common/hooks/useValidateTeam.ts +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import {useState, useRef, useEffect} from 'react'; - -import debounce from 'lodash/debounce'; - -import {Client4} from 'mattermost-redux/client'; - -import {cleanUpUrlable, BadUrlReasons, teamNameToUrl} from 'utils/url'; -import Constants from 'utils/constants'; - -function makeIdGetter() { - let id = Number.MIN_SAFE_INTEGER; - return function idGetter(): number { - id++; - return id; - }; -} - -type DebounceOptions = { - interval?: number; - trailing?: boolean; - leading?: boolean; -} - -const defaultDebounceOptions = { - interval: 333, - trailing: true, - leading: true, -}; - -type ValidateOptions = { - doAsyncCheck: boolean; - debounceOptions: DebounceOptions; -} - -const defaultValidateOptions = { - doAsyncCheck: true, - debounceOptions: defaultDebounceOptions, -}; - -type TeamValidator = { - verifying: boolean; - result: ValidationResult; - validate: (url: string) => void; -} - -type VerifyingStatus = { - verifying: boolean; - eventId: number; -} - -type ValidationResult = { - valid: boolean; - error: false | typeof BadUrlReasons[keyof typeof BadUrlReasons] | string; -} - -function synchronousChecks(teamName: string): [boolean, typeof BadUrlReasons[keyof typeof BadUrlReasons] | false] { - // borrowed from team_url, which has some peculiarities tied to being a part of a two screen UI - // that allows more variation between team name and url than we allow in usages of this function - const nameAsUrl = cleanUpUrlable(teamName.trim()); - - if (!nameAsUrl.length) { - return [false, BadUrlReasons.Empty]; - } - - if (nameAsUrl.length < Constants.MIN_TEAMNAME_LENGTH || nameAsUrl.length > Constants.MAX_TEAMNAME_LENGTH) { - return [false, BadUrlReasons.Length]; - } - - if (Constants.RESERVED_TEAM_NAMES.some((reservedName) => nameAsUrl.startsWith(reservedName))) { - return [false, BadUrlReasons.Reserved]; - } - - return [true, false]; -} - -const makeValidator = (options: ValidateOptions) => debounce(( - reportResult: (result: ValidationResult) => void, - teamName: string, -) => { - const [newValid, newError] = synchronousChecks(teamName); - if (!newValid || !options.doAsyncCheck) { - const result = { - valid: newValid, - error: newError, - }; - if (teamName.length === 1) { - // in this case, we don't want to bother user if they are still typing - setTimeout(() => { - reportResult(result); - }, 300); - } else { - reportResult(result); - } - return; - } - - Client4.checkIfTeamExists(teamNameToUrl(teamName).url).then((response) => { - if (response.exists) { - reportResult({ - valid: false, - error: BadUrlReasons.Taken, - }); - } else { - reportResult({ - valid: true, - error: false, - }); - } - }).catch((error: Error) => { - reportResult({ - valid: false, - error: error.message, - }); - }); -}, options.debounceOptions.interval, {trailing: options.debounceOptions.trailing, leading: options.debounceOptions.leading}); - -export default function useValidateTeam(options: ValidateOptions = defaultValidateOptions): TeamValidator { - const [verifying, setVerifying] = useState({verifying: false, eventId: Number.MIN_SAFE_INTEGER}); - const [result, setResult] = useState({ - valid: false, - error: false, - }); - const {current: getId} = useRef<() => number>(makeIdGetter()); - const validateRef = useRef(makeValidator(options)); - useEffect(() => { - validateRef.current = makeValidator(options); - }, [options]); - - return { - result, - verifying: verifying.verifying, - validate: (url: string) => { - const eventId = getId(); - - setVerifying((presentVerifying: VerifyingStatus) => { - if (presentVerifying.eventId > eventId) { - return presentVerifying; - } - return { - verifying: true, - eventId, - }; - }); - - const reportResult = (result: ValidationResult) => { - setVerifying((presentVerifying: VerifyingStatus) => { - if (presentVerifying.eventId > eventId) { - return presentVerifying; - } - setResult(result); - return {verifying: false, eventId}; - }); - }; - - validateRef.current(reportResult, url); - }, - }; -} diff --git a/webapp/channels/src/components/common/hooks/useValidateUrl.ts b/webapp/channels/src/components/common/hooks/useValidateUrl.ts deleted file mode 100644 index 1a490bbe60..0000000000 --- a/webapp/channels/src/components/common/hooks/useValidateUrl.ts +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import {useState, useRef, useEffect} from 'react'; - -import debounce from 'lodash/debounce'; - -import {Client4} from 'mattermost-redux/client'; - -function makeIdGetter() { - let id = Number.MIN_SAFE_INTEGER; - return function idGetter(): number { - id++; - return id; - }; -} - -type DebounceOptions = { - interval?: number; - trailing?: boolean; - leading?: boolean; -} - -const defaultDebounceOptions = { - interval: 333, - trailing: true, - leading: true, -}; - -type ValidateUrlOptions = { - doAsyncCheck: boolean; - debounceOptions: DebounceOptions; -} - -const defaultValidateUrlOptions = { - doAsyncCheck: true, - debounceOptions: defaultDebounceOptions, -}; - -type UrlValidator = { - verifying: boolean; - result: ValidationResult; - validate: (url: string) => void; -} - -type VerifyingStatus = { - verifying: boolean; - eventId: number; -} - -type ValidationResult = { - valid: boolean; - error: string | null; - inferredProtocol: 'https' | 'http' | null; -} - -function synchronousChecks(url: string): [boolean, string | null] { - if (!url.length) { - return [false, 'Empty']; - } - return [true, null]; -} - -const makeValidator = (options: ValidateUrlOptions) => debounce(( - reportResult: (result: ValidationResult) => void, - url: string, -) => { - const [newValid, newError] = synchronousChecks(url); - if (!newValid || !options.doAsyncCheck) { - reportResult({ - valid: newValid, - error: newError, - inferredProtocol: null, - }); - return; - } - - let effectiveUrl = url; - let inferredProtocol: 'http' | 'https' | null = null; - if (effectiveUrl.startsWith('localhost')) { - effectiveUrl = 'http://' + effectiveUrl; - inferredProtocol = 'http'; - } else if (!effectiveUrl.startsWith('http://') && !effectiveUrl.startsWith('https://')) { - effectiveUrl = 'https://' + effectiveUrl; - inferredProtocol = 'https'; - } - - Client4.testSiteURL(effectiveUrl).then(() => { - reportResult({ - valid: true, - error: null, - inferredProtocol, - }); - }).catch((error: Error) => { - reportResult({ - valid: false, - error: error.message, - inferredProtocol, - }); - }); -}, options.debounceOptions.interval, {trailing: options.debounceOptions.trailing, leading: options.debounceOptions.leading}); - -export default function useValidateUrl(options: ValidateUrlOptions = defaultValidateUrlOptions): UrlValidator { - const [verifying, setVerifying] = useState({verifying: false, eventId: Number.MIN_SAFE_INTEGER}); - const [result, setResult] = useState({ - valid: false, - error: null, - inferredProtocol: null, - }); - const {current: getId} = useRef<() => number>(makeIdGetter()); - const validateRef = useRef(makeValidator(options)); - useEffect(() => { - validateRef.current = makeValidator(options); - }, [options]); - - return { - result, - verifying: verifying.verifying, - validate: (url: string) => { - const eventId = getId(); - - setVerifying((presentVerifying: VerifyingStatus) => { - if (presentVerifying.eventId > eventId) { - return presentVerifying; - } - return { - verifying: true, - eventId, - }; - }); - - const reportResult = (result: ValidationResult) => { - setVerifying((presentVerifying: VerifyingStatus) => { - if (presentVerifying.eventId > eventId) { - return presentVerifying; - } - setResult(result); - return {verifying: false, eventId}; - }); - }; - - validateRef.current(reportResult, url); - }, - }; -} diff --git a/webapp/channels/src/components/common/svg_images_components/boards_svg.tsx b/webapp/channels/src/components/common/svg_images_components/boards_svg.tsx deleted file mode 100644 index 76321a4024..0000000000 --- a/webapp/channels/src/components/common/svg_images_components/boards_svg.tsx +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -export default () => ( - - - - - - - - -); diff --git a/webapp/channels/src/components/common/svg_images_components/celebrate_svg.tsx b/webapp/channels/src/components/common/svg_images_components/celebrate_svg.tsx deleted file mode 100644 index 56b697fe00..0000000000 --- a/webapp/channels/src/components/common/svg_images_components/celebrate_svg.tsx +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -export default () => ( - - - - - - - - - -); diff --git a/webapp/channels/src/components/common/svg_images_components/getting_started_svg.tsx b/webapp/channels/src/components/common/svg_images_components/getting_started_svg.tsx deleted file mode 100644 index ca1d582fad..0000000000 --- a/webapp/channels/src/components/common/svg_images_components/getting_started_svg.tsx +++ /dev/null @@ -1,394 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -type SvgProps = { - width?: number; - height?: number; -} - -const GettingStartedSVG = (props: SvgProps) => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -); - -export default GettingStartedSVG; diff --git a/webapp/channels/src/components/common/svg_images_components/laptop-earth_svg.tsx b/webapp/channels/src/components/common/svg_images_components/laptop-earth_svg.tsx deleted file mode 100644 index 076889f27f..0000000000 --- a/webapp/channels/src/components/common/svg_images_components/laptop-earth_svg.tsx +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -export default () => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -); diff --git a/webapp/channels/src/components/common/svg_images_components/laptop_svg.tsx b/webapp/channels/src/components/common/svg_images_components/laptop_svg.tsx deleted file mode 100644 index 373fa787fc..0000000000 --- a/webapp/channels/src/components/common/svg_images_components/laptop_svg.tsx +++ /dev/null @@ -1,413 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -export default () => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -); diff --git a/webapp/channels/src/components/common/svg_images_components/mattermost_cloud_svg.tsx b/webapp/channels/src/components/common/svg_images_components/mattermost_cloud_svg.tsx deleted file mode 100644 index 540fdcd1ec..0000000000 --- a/webapp/channels/src/components/common/svg_images_components/mattermost_cloud_svg.tsx +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -type SvgProps = { - width: number; - height: number; -}; - -const MattermostCloudSvg = ({width, height}: SvgProps) => ( - - - - - - - - - - - - - - - - - -); - -export default MattermostCloudSvg; diff --git a/webapp/channels/src/components/common/svg_images_components/newspaper_svg.tsx b/webapp/channels/src/components/common/svg_images_components/newspaper_svg.tsx deleted file mode 100644 index 9ae72594b1..0000000000 --- a/webapp/channels/src/components/common/svg_images_components/newspaper_svg.tsx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React, {SVGProps} from 'react'; - -const NewspaperSvg = (props: SVGProps) => ( - - - - - - - -); - -export default NewspaperSvg; diff --git a/webapp/channels/src/components/common/svg_images_components/person_mac_svg.tsx b/webapp/channels/src/components/common/svg_images_components/person_mac_svg.tsx deleted file mode 100644 index 8ad89b74e0..0000000000 --- a/webapp/channels/src/components/common/svg_images_components/person_mac_svg.tsx +++ /dev/null @@ -1,854 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -/* eslint-disable max-lines */ - -import React from 'react'; - -type SvgProps = { - width: number; - height: number; -} - -const Svg = (props: SvgProps) => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -); - -export default Svg; diff --git a/webapp/channels/src/components/common/svg_images_components/playbooks_svg.tsx b/webapp/channels/src/components/common/svg_images_components/playbooks_svg.tsx deleted file mode 100644 index 72e0dce79c..0000000000 --- a/webapp/channels/src/components/common/svg_images_components/playbooks_svg.tsx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -export default () => ( - - - - - - - - - - - - - - -); diff --git a/webapp/channels/src/components/common/svg_images_components/push_notifications_svg.tsx b/webapp/channels/src/components/common/svg_images_components/push_notifications_svg.tsx deleted file mode 100644 index 8cff5ba7ec..0000000000 --- a/webapp/channels/src/components/common/svg_images_components/push_notifications_svg.tsx +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -type SvgProps = { - width: number; - height: number; -} - -const Svg = (props: SvgProps) => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -); - -export default Svg; diff --git a/webapp/channels/src/components/multi_input.scss b/webapp/channels/src/components/multi_input.scss deleted file mode 100644 index 413420524d..0000000000 --- a/webapp/channels/src/components/multi_input.scss +++ /dev/null @@ -1,99 +0,0 @@ -.MultiInput { - &.Input_container { - margin-top: 20px; - } - - .Input_wrapper { - padding: 0; - font-size: 14px; - line-height: 20px; - } - - .Input { - font-size: 14px; - line-height: 20px; - - > div { - min-height: 70px; - padding: 4px; - } - - &.Input___focus .a11y--focused { - box-shadow: none; - } - } - - .Input_legend { - margin-left: 12px; - } - - input { - padding-left: 8px !important; - } -} - -.MultiInput__multiValueRemove { - > div { - padding: 0 4px; - - &:hover { - background-color: unset; - color: unset; - cursor: pointer; - - i { - color: rgba(var(--center-channel-color-rgb), 0.56); - } - } - } - - i { - color: rgba(var(--center-channel-color-rgb), 0.32); - font-size: 14px; - font-weight: normal; - - &::before { - margin: 0; - } - } -} - -.MultiInput__multiValueContainer { - > div { - display: flex; - align-items: center; - padding: 2px 0 2px 8px; - margin: 4px; - background-color: rgba(var(--center-channel-color-rgb), 0.08); - border-radius: 12px; - - > div { - padding: 0; - color: var(--center-channel-color); - font-size: 12px; - font-weight: 600; - line-height: 18px; - } - } - - &.error > div { - border: 1px solid var(--error-text); - } - - & + div input { - padding-left: 0 !important; - } -} - -.MultiInput__placeholder { - padding-left: 8px; - opacity: 0.64; - - > div { - margin: 0; - } - - & + div input { - padding-left: 0 !important; - } -} diff --git a/webapp/channels/src/components/multi_input.tsx b/webapp/channels/src/components/multi_input.tsx deleted file mode 100644 index 10f882d989..0000000000 --- a/webapp/channels/src/components/multi_input.tsx +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React, {useState, CSSProperties} from 'react'; -import ReactSelect, {components, Props as SelectProps, ActionMeta} from 'react-select'; -import classNames from 'classnames'; - -import './multi_input.scss'; - -// TODO: This component needs work, should not be used outside of InviteMembersStep until this comment is removed. - -type ValueType = { - label: string; - value: string; -} - -type Props = Omit, 'onChange'> & { - value: T[]; - legend?: string; - onChange: (value: T[], action: ActionMeta) => void; -}; - -const baseStyles = { - input: (provided: CSSProperties) => ({ - ...provided, - color: 'var(--center-channel-color)', - }), -}; - -const MultiValueContainer = (props: any) => { - return ( -
- -
- ); -}; - -const MultiValueRemove = (props: any) => { - return ( -
- - - -
- ); -}; - -const Placeholder = (props: any) => { - return ( -
- -
- ); -}; - -const MultiInput = (props: Props) => { - const {value, placeholder, className, addon, name, textPrefix, legend, onChange, styles, ...otherProps} = props; - - const [focused, setFocused] = useState(false); - - const onInputFocus = (event: React.FocusEvent) => { - const {onFocus} = props; - - setFocused(true); - - if (onFocus) { - onFocus(event); - } - }; - - const onInputBlur = (event: React.FocusEvent) => { - const {onBlur} = props; - - setFocused(false); - - if (onBlur) { - onBlur(event); - } - }; - - const showLegend = Boolean(focused || value.length); - - return ( -
-
- - {showLegend ? (legend || placeholder) : null} - -
- {textPrefix && {textPrefix}} - null, - IndicatorsContainer: () => null, - MultiValueContainer, - MultiValueRemove, - Placeholder, - }} - isMulti={true} - isClearable={false} - openMenuOnFocus={false} - menuIsOpen={false} - placeholder={focused ? '' : placeholder} - className={classNames('Input', className, {Input__focus: showLegend})} - value={value} - onChange={onChange as any} // types are not working correctly for multiselect - styles={{...baseStyles, ...styles}} - {...otherProps} - /> -
- {addon} -
-
- ); -}; - -export default MultiInput; diff --git a/webapp/channels/src/components/picture_selector.scss b/webapp/channels/src/components/picture_selector.scss deleted file mode 100644 index 59a443da16..0000000000 --- a/webapp/channels/src/components/picture_selector.scss +++ /dev/null @@ -1,80 +0,0 @@ -.PictureSelector { - display: flex; - width: 96px; - flex-direction: column; -} - -.PictureSelector__imageContainer { - position: relative; - height: 96px; -} - -.PictureSelector__image { - height: 100%; - border: 1px solid rgba(var(--center-channel-color-rgb), 0.08); - background-position: 50% 50%; - background-size: cover; - border-radius: 100%; -} - -.PictureSelector__selectButton { - position: absolute; - top: 0; - right: 0; - display: flex; - width: 28px; - height: 28px; - justify-content: center; - padding: 4px; - border: 1px solid rgba(var(--center-channel-color-rgb), 0.08); - background: var(--center-channel-bg); - border-radius: 100%; - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12); - - i { - align-self: center; - color: rgba(var(--center-channel-color-rgb), 0.56); - font-size: 16px; - line-height: 18px; - - &::before { - margin: 0; - } - } - - &:hover { - border: 1px solid rgba(var(--center-channel-color-rgb), 0.16); - box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12); - - i { - color: rgba(var(--center-channel-color-rgb), 0.72); - } - } - - &:active { - border: 1px solid rgba(var(--button-bg-rgb), 0.16); - background: linear-gradient(0deg, rgba(var(--button-bg-rgb), 0.08), rgba(var(--button-bg-rgb), 0.08)), var(--center-channel-bg); - - i { - color: var(--button-bg); - } - } - - &:focus { - border: 2px solid var(--button-bg); - } -} - -.PictureSelector__removeButton { - padding: 0; - border: none; - margin-top: 12px; - background-color: transparent; - color: var(--button-bg); - font-size: 12px; - font-weight: 600; - - &:focus { - text-decoration-line: underline; - } -} diff --git a/webapp/channels/src/components/picture_selector.test.tsx b/webapp/channels/src/components/picture_selector.test.tsx deleted file mode 100644 index aaefeb27fd..0000000000 --- a/webapp/channels/src/components/picture_selector.test.tsx +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {shallow} from 'enzyme'; - -import PictureSelector from 'components/picture_selector'; - -describe('components/picture_selector', () => { - const baseProps = { - name: 'picture_selector_test', - onSelect: jest.fn(), - onRemove: jest.fn(), - }; - - test('should match snapshot, no picture selected', () => { - const wrapper = shallow( - , - ); - - expect(wrapper).toMatchSnapshot(); - }); - - test('should match snapshot, existing picture provided', () => { - const props = { - ...baseProps, - src: 'http:///url.com/picture.jpg', - defaultSrc: 'http:///url.com/default-picture.jpg', - }; - - const wrapper = shallow( - , - ); - - expect(wrapper).toMatchSnapshot(); - }); - - test('should match snapshot, default picture provided', () => { - const props = { - ...baseProps, - defaultSrc: 'http:///url.com/default-picture.jpg', - }; - - const wrapper = shallow( - , - ); - - expect(wrapper).toMatchSnapshot(); - }); -}); diff --git a/webapp/channels/src/components/picture_selector.tsx b/webapp/channels/src/components/picture_selector.tsx deleted file mode 100644 index cdde5e03c7..0000000000 --- a/webapp/channels/src/components/picture_selector.tsx +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React, {useState, useEffect} from 'react'; -import {FormattedMessage} from 'react-intl'; - -import {localizeMessage} from 'utils/utils'; -import {Constants} from 'utils/constants'; -import * as FileUtils from 'utils/file_utils'; - -import './picture_selector.scss'; - -type Props = { - name: string; - src?: string; - defaultSrc?: string; - placeholder?: React.ReactNode; - loadingPicture?: boolean; - onOpenDialog?: () => void; - onSelect: (file: File) => void; - onRemove: () => void; -}; - -const PictureSelector: React.FC = (props: Props) => { - const {name, src, defaultSrc, placeholder, loadingPicture, onSelect, onRemove} = props; - - const [image, setImage] = useState(); - const [orientationStyles, setOrientationStyles] = useState<{transform: any; transformOrigin: any}>(); - - const inputRef: React.RefObject = React.createRef(); - const selectButton: React.RefObject = React.createRef(); - - const handleFileChange = (e: React.ChangeEvent) => { - if (e.target.files && e.target.files[0]) { - const file = e.target.files[0]; - - const reader = new FileReader(); - reader.onload = (ev) => { - setImage(URL.createObjectURL(file)); - - const orientation = FileUtils.getExifOrientation(ev.target!.result! as ArrayBuffer); - setOrientationStyles(FileUtils.getOrientationStyles(orientation)); - }; - reader.readAsArrayBuffer(file); - - onSelect(file); - } - }; - - const handleInputFile = () => { - if (props.onOpenDialog) { - props.onOpenDialog(); - } - - if (!inputRef || !inputRef.current) { - return; - } - - selectButton.current?.blur(); - - inputRef.current.value = ''; - inputRef.current.click(); - }; - - const handleRemove = () => { - onRemove(); - if (defaultSrc) { - setImage(defaultSrc); - } else { - setImage(undefined); - } - }; - - useEffect(() => { - if (!image) { - if (src) { - setImage(src); - } else if (defaultSrc) { - setImage(defaultSrc); - } - } - }, [src, image]); - - let removeButton; - if (image && image !== defaultSrc) { - removeButton = ( - - ); - } - - return ( -
- -
-
- {!image && placeholder} -
- -
- {removeButton} -
- ); -}; - -export default PictureSelector; diff --git a/webapp/channels/src/components/post_view/comment_icon/index.ts b/webapp/channels/src/components/post_view/comment_icon/index.ts deleted file mode 100644 index eaadf80710..0000000000 --- a/webapp/channels/src/components/post_view/comment_icon/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import {connect} from 'react-redux'; - -import {getPost, makeGetCommentCountForPost} from 'mattermost-redux/selectors/entities/posts'; -import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences'; - -import {GlobalState} from 'types/store'; - -import CommentIcon from 'components/common/comment_icon'; - -type OwnProps = { - postId: string; -} - -function makeMapStateToProps() { - const getReplyCount = makeGetCommentCountForPost(); - - return (state: GlobalState, ownProps: OwnProps) => { - const post = getPost(state, ownProps.postId); - - const collapsedThreadsEnabled = isCollapsedThreadsEnabled(state); - - return { - commentCount: collapsedThreadsEnabled ? 0 : getReplyCount(state, post), - }; - }; -} - -export default connect(makeMapStateToProps)(CommentIcon); diff --git a/webapp/channels/src/components/progress_bar.scss b/webapp/channels/src/components/progress_bar.scss deleted file mode 100644 index 15625acc3c..0000000000 --- a/webapp/channels/src/components/progress_bar.scss +++ /dev/null @@ -1,12 +0,0 @@ -.ProgressBar { - display: flex; - width: 100%; - height: 100%; -} - -.ProgressBar__progress { - flex-grow: 0; - flex-shrink: 0; - background-color: white; - transition: all 0.25s ease-in; -} diff --git a/webapp/channels/src/components/progress_bar.test.tsx b/webapp/channels/src/components/progress_bar.test.tsx deleted file mode 100644 index 1314f145b6..0000000000 --- a/webapp/channels/src/components/progress_bar.test.tsx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {mount} from 'enzyme'; - -import ProgressBar from 'components/progress_bar'; - -describe('components/progress_bar', () => { - test('should show no progress', () => { - const props = { - current: 0, - total: 10, - }; - const wrapper = mount( - , - ); - - expect(wrapper.find('.ProgressBar__progress').prop('style')).toHaveProperty('flexGrow', 0); - }); - - test('should show 50% progress', () => { - const props = { - current: 5, - total: 10, - }; - const wrapper = mount( - , - ); - - expect(wrapper.find('.ProgressBar__progress').prop('style')).toHaveProperty('flexGrow', 0.5); - }); - - test('should show full progress', () => { - const props = { - current: 7, - total: 7, - }; - const wrapper = mount( - , - ); - - expect(wrapper.find('.ProgressBar__progress').prop('style')).toHaveProperty('flexGrow', 1); - }); - - test('should have flex basis', () => { - const props = { - current: 0, - total: 7, - basePercentage: 10, - }; - const wrapper = mount( - , - ); - - expect(wrapper.find('.ProgressBar__progress').prop('style')).toHaveProperty('flexBasis', '10%'); - }); -}); diff --git a/webapp/channels/src/components/progress_bar.tsx b/webapp/channels/src/components/progress_bar.tsx deleted file mode 100644 index 6bb61f4971..0000000000 --- a/webapp/channels/src/components/progress_bar.tsx +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -import './progress_bar.scss'; - -type Props = { - total: number; - current: number; - basePercentage?: number; -}; - -const ProgressBar: React.FC = (props: Props) => { - return ( -
-
-
- ); -}; - -export default ProgressBar; diff --git a/webapp/channels/src/components/threading/global_threads_link/global_threads_link.tsx b/webapp/channels/src/components/threading/global_threads_link/global_threads_link.tsx index 192bfaec74..757d6387c9 100644 --- a/webapp/channels/src/components/threading/global_threads_link/global_threads_link.tsx +++ b/webapp/channels/src/components/threading/global_threads_link/global_threads_link.tsx @@ -27,7 +27,7 @@ import Constants, { RHSStates, } from 'utils/constants'; import CollapsedReplyThreadsModal - from 'components/tours/crt_tour/collapsed_reply_threads_modal/collapsed_reply_threads_modal'; + from 'components/tours/crt_tour/collapsed_reply_threads_modal'; import {openModal} from 'actions/views/modals'; diff --git a/webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal/collapsed_reply_threads_modal.scss b/webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal.scss similarity index 100% rename from webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal/collapsed_reply_threads_modal.scss rename to webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal.scss diff --git a/webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal/collapsed_reply_threads_modal.tsx b/webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal.tsx similarity index 99% rename from webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal/collapsed_reply_threads_modal.tsx rename to webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal.tsx index deef0a69db..cfadbf811a 100644 --- a/webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal/collapsed_reply_threads_modal.tsx +++ b/webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal.tsx @@ -16,7 +16,7 @@ import {Constants, ModalIdentifiers, Preferences} from 'utils/constants'; import * as Keyboard from 'utils/keyboard'; import './collapsed_reply_threads_modal.scss'; -import {AutoTourStatus, TTNameMapToATStatusKey, TutorialTourName} from '../../constant'; +import {AutoTourStatus, TTNameMapToATStatusKey, TutorialTourName} from '../constant'; type Props = { onExited: () => void; diff --git a/webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal/index.ts b/webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal/index.ts deleted file mode 100644 index 7c1caad4cc..0000000000 --- a/webapp/channels/src/components/tours/crt_tour/collapsed_reply_threads_modal/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -export {default} from './collapsed_reply_threads_modal'; diff --git a/webapp/channels/src/components/widgets/icons/dots_horizontal.tsx b/webapp/channels/src/components/widgets/icons/dots_horizontal.tsx deleted file mode 100644 index fedbdc9267..0000000000 --- a/webapp/channels/src/components/widgets/icons/dots_horizontal.tsx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -export default class DotsHorizontalIcon extends React.PureComponent> { - render() { - return ( - - - - - - ); - } -} diff --git a/webapp/channels/src/components/widgets/icons/message_icon.tsx b/webapp/channels/src/components/widgets/icons/message_icon.tsx deleted file mode 100644 index 817f377ee4..0000000000 --- a/webapp/channels/src/components/widgets/icons/message_icon.tsx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {useIntl} from 'react-intl'; - -export default function MessageIcon(props: React.HTMLAttributes) { - const {formatMessage} = useIntl(); - return ( - - ); -} diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index b7559736fd..9ff2f23d39 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -313,7 +313,6 @@ "admin.billing.subscription.complianceScreenFailed.button": "OK", "admin.billing.subscription.complianceScreenFailed.title": "Your transaction is being reviewed", "admin.billing.subscription.complianceScreenShippingSameAsBilling": "My shipping address is the same as my billing address", - "admin.billing.subscription.constCloudCard.contactSupport": "Contact support", "admin.billing.subscription.creditCardExpired": "Your credit card has expired. Update your payment information to avoid disruption.", "admin.billing.subscription.creditCardHasExpired": "Your credit card has expired", "admin.billing.subscription.creditCardHasExpired.description": "Please update your payment information to avoid any disruption.", @@ -327,7 +326,6 @@ "admin.billing.subscription.deleteWorkspaceSection.delete": "Delete Workspace", "admin.billing.subscription.deleteWorkspaceSection.description": "Deleting {workspaceLink} is final and cannot be reversed.", "admin.billing.subscription.deleteWorkspaceSection.title": "Delete your workspace", - "admin.billing.subscription.downgradedSuccess": "You're now subscribed to {productName}", "admin.billing.subscription.downgrading": "Downgrading your workspace", "admin.billing.subscription.featuresAvailable": "{productName} features are now available and ready to use.", "admin.billing.subscription.freeTrial.description": "Your free trial will expire in {daysLeftOnTrial} days. Add your payment information to continue after the trial ends.", @@ -3579,7 +3577,6 @@ "generic_icons.member": "Member Icon", "generic_icons.mention": "Mention Icon", "generic_icons.menu": "Menu Icon", - "generic_icons.message": "Message Icon", "generic_icons.muted": "Muted Icon", "generic_icons.next": "Next Icon", "generic_icons.pin": "Pin Icon", @@ -3951,7 +3948,6 @@ "marketplace_modal.tabs.all_listing": "All", "marketplace_modal.tabs.installed_listing": "Installed ({count})", "marketplace_modal.title": "App Marketplace", - "members_popover.button.message": "message", "menu.cloudFree.enterpriseTrialDescription": "Your trial is active until {trialEndDay}. Discover our top Enterprise features. Learn more", "menu.cloudFree.enterpriseTrialTitle": "Enterprise Trial", "menu.cloudFree.postTrial.tryEnterprise": "Interested in a limitless plan with high-security features? See plans", @@ -4271,9 +4267,6 @@ "persist_notification.too_many.confirm": "Got it", "persist_notification.too_many.description": "You can send persistent notifications to a maximum of {max} recipients. There are {count} recipients mentioned in your message. You’ll need to change who you’ve mentioned before you can send.", "persist_notification.too_many.title": "Too many recipients", - "picture_selector.image.ariaLabel": "Picture selector image", - "picture_selector.remove_picture": "Remove picture", - "picture_selector.select_button.ariaLabel": "Select picture", "plan.cloud": "Cloud", "plan.self_serve": "Self-serve", "pluggable.errorOccurred": "An error occurred in the {pluginId} plugin.", diff --git a/webapp/channels/src/utils/constants.tsx b/webapp/channels/src/utils/constants.tsx index 5f462bbe46..077a501e95 100644 --- a/webapp/channels/src/utils/constants.tsx +++ b/webapp/channels/src/utils/constants.tsx @@ -422,7 +422,6 @@ export const ModalIdentifiers = { REQUEST_BUSINESS_EMAIL_MODAL: 'request_business_email_modal', FEATURE_RESTRICTED_MODAL: 'feature_restricted_modal', FORWARD_POST_MODAL: 'forward_post_modal', - CLOUD_SUBSCRIBE_WITH_LOADING_MODAL: 'cloud_subscribe_with_loading_modal', JOIN_PUBLIC_CHANNEL_MODAL: 'join_public_channel_modal', CLOUD_INVOICE_PREVIEW: 'cloud_invoice_preview', BILLING_HISTORY: 'billing_history',