mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +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
@@ -1,10 +1,9 @@
|
||||
// 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 {msg} from '@lingui/core/macro';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
import {GenericErrorModal} from './GenericErrorModal';
|
||||
|
||||
const FEATURE_TEMPORARILY_DISABLED_DESCRIPTOR = msg({
|
||||
message: 'Feature temporarily disabled',
|
||||
@@ -17,13 +16,9 @@ const THIS_FEATURE_HAS_BEEN_TEMPORARILY_DISABLED_PLEASE_TRY_DESCRIPTOR = msg({
|
||||
export const FeatureTemporarilyDisabledModal = observer(() => {
|
||||
const {i18n} = useLingui();
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(FEATURE_TEMPORARILY_DISABLED_DESCRIPTOR)}
|
||||
description={i18n._(THIS_FEATURE_HAS_BEEN_TEMPORARILY_DISABLED_PLEASE_TRY_DESCRIPTOR)}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
message={i18n._(THIS_FEATURE_HAS_BEEN_TEMPORARILY_DISABLED_PLEASE_TRY_DESCRIPTOR)}
|
||||
data-flx="app.feature-temporarily-disabled-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
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 {CLOSE_DESCRIPTOR, UNDERSTOOD_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {CLOSE_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import * as PremiumModalCommands from '@app/features/premium/commands/PremiumModalCommands';
|
||||
import {shouldShowPremiumFeatures} from '@app/features/premium/utils/PremiumUtils';
|
||||
import type {User} from '@app/features/user/models/User';
|
||||
@@ -11,6 +11,7 @@ import {MAX_BOOKMARKS_PREMIUM} from '@fluxer/constants/src/LimitConstants';
|
||||
import {msg, plural} from '@lingui/core/macro';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
import {GenericErrorModal} from './GenericErrorModal';
|
||||
|
||||
const BOOKMARK_LIMIT_REACHED_DESCRIPTOR = msg({
|
||||
message: 'Bookmark limit reached',
|
||||
@@ -56,26 +57,18 @@ export const MaxBookmarksModal = observer(({user}: MaxBookmarksModalProps) => {
|
||||
);
|
||||
if (!showPremium) {
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(BOOKMARK_LIMIT_REACHED_DESCRIPTOR)}
|
||||
description={i18n._(YOU_VE_REACHED_THE_MAXIMUM_NUMBER_OF_BOOKMARKS_DESCRIPTOR, {bookmarksText})}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
message={i18n._(YOU_VE_REACHED_THE_MAXIMUM_NUMBER_OF_BOOKMARKS_DESCRIPTOR, {bookmarksText})}
|
||||
data-flx="app.max-bookmarks-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (!canUpgradeBookmarks) {
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(BOOKMARK_LIMIT_REACHED_DESCRIPTOR)}
|
||||
description={i18n._(YOU_VE_REACHED_THE_MAXIMUM_NUMBER_OF_BOOKMARKS_2_DESCRIPTOR, {bookmarksText})}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
message={i18n._(YOU_VE_REACHED_THE_MAXIMUM_NUMBER_OF_BOOKMARKS_2_DESCRIPTOR, {bookmarksText})}
|
||||
data-flx="app.max-bookmarks-modal.confirm-modal--2"
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
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 {CLOSE_DESCRIPTOR, UNDERSTOOD_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {CLOSE_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import * as PremiumModalCommands from '@app/features/premium/commands/PremiumModalCommands';
|
||||
import {shouldShowPremiumFeatures} from '@app/features/premium/utils/PremiumUtils';
|
||||
import Users from '@app/features/user/state/Users';
|
||||
@@ -11,6 +11,7 @@ import {MAX_FAVORITE_MEMES_PREMIUM} from '@fluxer/constants/src/LimitConstants';
|
||||
import {msg, plural} from '@lingui/core/macro';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
import {GenericErrorModal} from './GenericErrorModal';
|
||||
|
||||
const SAVED_MEDIA_LIMIT_REACHED_DESCRIPTOR = msg({
|
||||
message: 'Saved media limit reached',
|
||||
@@ -50,13 +51,9 @@ export const MaxFavoriteMemesModal = observer(() => {
|
||||
);
|
||||
if (!showPremium) {
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(SAVED_MEDIA_LIMIT_REACHED_DESCRIPTOR)}
|
||||
description={i18n._(YOU_VE_REACHED_THE_MAXIMUM_LIMIT_OF_THIS_DESCRIPTOR, {freeItemsText})}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
message={i18n._(YOU_VE_REACHED_THE_MAXIMUM_LIMIT_OF_THIS_DESCRIPTOR, {freeItemsText})}
|
||||
data-flx="app.max-favorite-memes-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// 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 {msg} from '@lingui/core/macro';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
import {GenericErrorModal} from './GenericErrorModal';
|
||||
|
||||
const ROLE_NAME_CANNOT_BE_BLANK_DESCRIPTOR = msg({
|
||||
message: 'Role name is required',
|
||||
@@ -17,13 +16,9 @@ const YOU_CANNOT_SAVE_A_ROLE_WITH_A_BLANK_DESCRIPTOR = msg({
|
||||
export const RoleNameBlankModal = observer(() => {
|
||||
const {i18n} = useLingui();
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(ROLE_NAME_CANNOT_BE_BLANK_DESCRIPTOR)}
|
||||
description={i18n._(YOU_CANNOT_SAVE_A_ROLE_WITH_A_BLANK_DESCRIPTOR)}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
message={i18n._(YOU_CANNOT_SAVE_A_ROLE_WITH_A_BLANK_DESCRIPTOR)}
|
||||
data-flx="app.role-name-blank-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
|
||||
+3
-8
@@ -1,10 +1,9 @@
|
||||
// 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 {msg} from '@lingui/core/macro';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
import {GenericErrorModal} from './GenericErrorModal';
|
||||
|
||||
const GATEWAY_CONNECTION_REQUIRED_DESCRIPTOR = msg({
|
||||
message: 'Gateway connection required',
|
||||
@@ -18,13 +17,9 @@ const YOU_MUST_BE_CONNECTED_TO_THE_GATEWAY_TO_DESCRIPTOR = msg({
|
||||
export const TemporaryInviteRequiresPresenceModal = observer(() => {
|
||||
const {i18n} = useLingui();
|
||||
return (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(GATEWAY_CONNECTION_REQUIRED_DESCRIPTOR)}
|
||||
description={i18n._(YOU_MUST_BE_CONNECTED_TO_THE_GATEWAY_TO_DESCRIPTOR)}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
message={i18n._(YOU_MUST_BE_CONNECTED_TO_THE_GATEWAY_TO_DESCRIPTOR)}
|
||||
data-flx="app.temporary-invite-requires-presence-modal.confirm-modal"
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import {Routes} from '@app/app/Routes';
|
||||
import Accessibility from '@app/features/accessibility/state/Accessibility';
|
||||
import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
|
||||
import {ChannelItem} from '@app/features/app/components/layout/ChannelItem';
|
||||
import channelItemStyles from '@app/features/app/components/layout/ChannelItem.module.css';
|
||||
import {ChannelItemContent} from '@app/features/app/components/layout/ChannelItemContent';
|
||||
@@ -28,7 +27,7 @@ import {useRovingFocusList} from '@app/features/app/hooks/useRovingFocusList';
|
||||
import Channels from '@app/features/channel/state/Channels';
|
||||
import * as GuildCommands from '@app/features/guild/commands/GuildCommands';
|
||||
import type {Guild} from '@app/features/guild/models/Guild';
|
||||
import {MEMBERS_DESCRIPTOR, UNDERSTOOD_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {MEMBERS_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import {isKeyboardActivationKey} from '@app/features/input/utils/KeyboardUtils';
|
||||
import * as RouterUtils from '@app/features/navigation/utils/RouterUtils';
|
||||
import Permission from '@app/features/permissions/state/Permission';
|
||||
@@ -58,6 +57,7 @@ import {observer} from 'mobx-react-lite';
|
||||
import type {MotionValue} from 'motion';
|
||||
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
||||
import {useDragLayer} from 'react-dnd';
|
||||
import {GenericErrorModal} from '../alerts/GenericErrorModal';
|
||||
|
||||
const CATEGORY_FULL_DESCRIPTOR = msg({
|
||||
message: 'Category full',
|
||||
@@ -185,15 +185,11 @@ export const ChannelListContent = observer(({guild, scrollY}: {guild: Guild; scr
|
||||
if (failureCode(error) === APIErrorCodes.MAX_CATEGORY_CHANNELS) {
|
||||
ModalCommands.push(
|
||||
ModalCommands.modal(() => (
|
||||
<ConfirmModal
|
||||
<GenericErrorModal
|
||||
title={i18n._(CATEGORY_FULL_DESCRIPTOR)}
|
||||
description={i18n._(THIS_CATEGORY_ALREADY_CONTAINS_THE_MAXIMUM_OF_CHANNELS_DESCRIPTOR, {
|
||||
message={i18n._(THIS_CATEGORY_ALREADY_CONTAINS_THE_MAXIMUM_OF_CHANNELS_DESCRIPTOR, {
|
||||
maxChannelsPerCategory: MAX_CHANNELS_PER_CATEGORY,
|
||||
})}
|
||||
primaryText={i18n._(UNDERSTOOD_DESCRIPTOR)}
|
||||
onPrimary={() => {}}
|
||||
secondaryText={false}
|
||||
hideCloseButton
|
||||
data-flx="app.channel-list-content.handle-channel-drop.confirm-modal"
|
||||
/>
|
||||
)),
|
||||
|
||||
Reference in new issue
Block a user