mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
fix(app): Make some modals use GenericErrorModal instead of ConfirmModal (#1023)
This commit is contained in:
1 parent
fa3e852575
commit
0f3f059454
30 files changed
+99
-243
No files matched your search
+4
-11
@@ -1,10 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
|
||||
import {
|
||||
CANNOT_SEND_MESSAGES_IN_CHANNEL_DESCRIPTOR,
|
||||
UNDERSTOOD_DESCRIPTOR,
|
||||
} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {GenericErrorModal} from '@app/features/app/components/alerts/GenericErrorModal';
|
||||
import {CANNOT_SEND_MESSAGES_IN_CHANNEL_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {msg} from '@lingui/core/macro';
|
||||
import {Trans, useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
@@ -46,13 +43,9 @@ export const AttachmentPermissionDeniedModal = observer(
|
||||
i18n._(CANNOT_SEND_MESSAGES_IN_CHANNEL_DESCRIPTOR)
|
||||
);
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={title}
|
||||
description={description}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
message={description}
|
||||
data-flx="messaging.attachment-permission-denied-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
|
||||
+3
-8
@@ -1,9 +1,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
|
||||
import {GenericErrorModal} from '@app/features/app/components/alerts/GenericErrorModal';
|
||||
import {ExternalLink} from '@app/features/app/components/shared/ExternalLink';
|
||||
import {PRODUCT_NAME, SUPPORT_EMAIL, SUPPORT_EMAIL_MAILTO} from '@app/features/app/config/I18nDisplayConstants';
|
||||
import {UNDERSTOOD_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {MULTIPART_ATTACHMENT_FALLBACK_MAX_REQUEST_SIZE} from '@app/features/messaging/utils/AttachmentUploadFallbackUtils';
|
||||
import {formatFileSize} from '@app/features/messaging/utils/FileUtils';
|
||||
import {msg} from '@lingui/core/macro';
|
||||
@@ -18,9 +17,9 @@ export const AttachmentUploadConnectivityModal = observer(() => {
|
||||
const {i18n} = useLingui();
|
||||
const fallbackSizeFormatted = formatFileSize(MULTIPART_ATTACHMENT_FALLBACK_MAX_REQUEST_SIZE);
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(ATTACHMENT_UPLOAD_UNAVAILABLE_DESCRIPTOR)}
|
||||
description={
|
||||
message={
|
||||
<Trans>
|
||||
We couldn't reach the attachment upload service. {PRODUCT_NAME} can fall back to the standard upload path for
|
||||
messages up to {fallbackSizeFormatted} total, but these attachments exceed that combined limit and can't be
|
||||
@@ -34,10 +33,6 @@ export const AttachmentUploadConnectivityModal = observer(() => {
|
||||
if this keeps happening.
|
||||
</Trans>
|
||||
}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
data-flx="messaging.attachment-upload-connectivity-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {GenericErrorModal} from '@app/features/app/components/alerts/GenericErrorModal';
|
||||
import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
|
||||
import {PREMIUM_PRODUCT_NAME} from '@app/features/app/config/I18nDisplayConstants';
|
||||
import {Limits} from '@app/features/app/utils/UserLimits';
|
||||
import {
|
||||
CANCEL_DESCRIPTOR,
|
||||
GET_PREMIUM_DESCRIPTOR,
|
||||
UNDERSTOOD_DESCRIPTOR,
|
||||
} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {CANCEL_DESCRIPTOR, GET_PREMIUM_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {formatFileSize} from '@app/features/messaging/utils/FileUtils';
|
||||
import * as PremiumModalCommands from '@app/features/premium/commands/PremiumModalCommands';
|
||||
import {shouldShowPremiumFeatures} from '@app/features/premium/utils/PremiumUtils';
|
||||
@@ -76,13 +73,9 @@ export const FileSizeTooLargeModal = observer(({oversizedFileCount}: FileSizeToo
|
||||
: i18n._(ONE_OR_MORE_FILES_YOU_RE_TRYING_TO_DESCRIPTOR, {maxSizeFormatted});
|
||||
if (!showPremium || !canUpgradeAttachmentLimit) {
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(FILE_SIZE_TOO_LARGE_DESCRIPTOR)}
|
||||
description={!showPremium ? `${baseDescription} ${i18n._(INSTANCE_ADMIN_LIMIT_DESCRIPTOR)}` : baseDescription}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
message={!showPremium ? `${baseDescription} ${i18n._(INSTANCE_ADMIN_LIMIT_DESCRIPTOR)}` : baseDescription}
|
||||
data-flx="messaging.file-size-too-large-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
|
||||
import {OKAY_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {GenericErrorModal} from '@app/features/app/components/alerts/GenericErrorModal';
|
||||
import {msg} from '@lingui/core/macro';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
@@ -17,13 +16,9 @@ const WAIT_A_MOMENT_BEFORE_DELETING_MORE_MESSAGES_DESCRIPTOR = msg({
|
||||
export const MessageDeleteTooQuickModal = observer(() => {
|
||||
const {i18n} = useLingui();
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(YOU_RE_DELETING_MESSAGES_TOO_QUICKLY_DESCRIPTOR)}
|
||||
description={i18n._(WAIT_A_MOMENT_BEFORE_DELETING_MORE_MESSAGES_DESCRIPTOR)}
|
||||
primaryText={i18n._(OKAY_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
message={i18n._(WAIT_A_MOMENT_BEFORE_DELETING_MORE_MESSAGES_DESCRIPTOR)}
|
||||
data-flx="messaging.message-delete-too-quick-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
|
||||
import {UNDERSTOOD_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {GenericErrorModal} from '@app/features/app/components/alerts/GenericErrorModal';
|
||||
import Users from '@app/features/user/state/Users';
|
||||
import {msg, plural} from '@lingui/core/macro';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
@@ -16,19 +15,15 @@ export const TooManyAttachmentsModal = observer(() => {
|
||||
const currentUser = Users.currentUser;
|
||||
const maxAttachments = currentUser?.maxAttachmentsPerMessage ?? 10;
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(WHOA_THIS_IS_HEAVY_DESCRIPTOR)}
|
||||
description={plural(
|
||||
message={plural(
|
||||
{count: maxAttachments},
|
||||
{
|
||||
one: 'You can only upload # file at a time. Try again with fewer files.',
|
||||
other: 'You can only upload # files at a time. Try again with fewer files.',
|
||||
},
|
||||
)}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
data-flx="messaging.too-many-attachments-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
|
||||
import {UNDERSTOOD_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {GenericErrorModal} from '@app/features/app/components/alerts/GenericErrorModal';
|
||||
import {msg} from '@lingui/core/macro';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
@@ -17,13 +16,9 @@ const THIS_IS_ONE_HEAVY_MESSAGE_SOME_REACTIONS_NEED_DESCRIPTOR = msg({
|
||||
export const TooManyReactionsModal = observer(() => {
|
||||
const {i18n} = useLingui();
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(WHOA_THIS_IS_HEAVY_DESCRIPTOR)}
|
||||
description={i18n._(THIS_IS_ONE_HEAVY_MESSAGE_SOME_REACTIONS_NEED_DESCRIPTOR)}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
message={i18n._(THIS_IS_ONE_HEAVY_MESSAGE_SOME_REACTIONS_NEED_DESCRIPTOR)}
|
||||
data-flx="messaging.too-many-reactions-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user