Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

refactor(app): use dismiss footers on info-only dialogs

Hampusab145431767a
diff --git a/fluxer_app/src/features/channel/components/modals/ChannelFollowSuccessModal.module.css b/fluxer_app/src/features/channel/components/modals/ChannelFollowSuccessModal.module.css
index 36c6bb179..e1c68ea0d 100644
--- a/fluxer_app/src/features/channel/components/modals/ChannelFollowSuccessModal.module.css
+++ b/fluxer_app/src/features/channel/components/modals/ChannelFollowSuccessModal.module.css
@@ -40,7 +40,7 @@
.announcementBadge {
position: absolute;
- right: -0.375rem;
+ inset-inline-end: -0.375rem;
bottom: -0.375rem;
display: inline-flex;
align-items: center;
@@ -83,7 +83,7 @@
}
.description {
- margin: 0 0 var(--spacing-3);
+ margin: 0;
font-size: 0.875rem;
line-height: 1.25rem;
color: var(--text-primary-muted);
diff --git a/fluxer_app/src/features/channel/components/modals/ChannelFollowSuccessModal.tsx b/fluxer_app/src/features/channel/components/modals/ChannelFollowSuccessModal.tsx
index 2575e0bbb..09160e573 100644
--- a/fluxer_app/src/features/channel/components/modals/ChannelFollowSuccessModal.tsx
+++ b/fluxer_app/src/features/channel/components/modals/ChannelFollowSuccessModal.tsx
@@ -6,14 +6,13 @@ import Channels from '@app/features/channel/state/Channels';
import {UNKNOWN_CHANNEL_DESCRIPTOR} from '@app/features/channel/utils/ChannelMessageDescriptors';
import {GuildIcon} from '@app/features/guild/components/popouts/GuildIcon';
import Guilds from '@app/features/guild/state/Guilds';
-import {Button} from '@app/features/ui/button/Button';
import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
import {modal} from '@app/features/ui/commands/ModalCommands';
import {AnnouncementChannelIcon} from '@app/features/ui/components/icons/AnnouncementChannelIcon';
+import {ArrowRightIcon} from '@app/features/ui/icons/DirectionalIcons';
import foodPatternUrl from '@app/media/images/i-like-food.svg';
import {msg} from '@lingui/core/macro';
import {useLingui} from '@lingui/react/macro';
-import {ArrowRightIcon} from '@phosphor-icons/react';
import {observer} from 'mobx-react-lite';
const FOLLOW_SUCCESS_TITLE_DESCRIPTOR = msg({
@@ -45,6 +44,7 @@ const ChannelFollowSuccessModal = observer(({sourceChannelId, targetChannelId}:
return (
<Modal.Root size="small" centered data-flx="channel.channel-follow-success-modal.modal-root">
<Modal.ScreenReaderLabel text={title} data-flx="channel.channel-follow-success-modal.modal-screen-reader-label" />
+ <Modal.InsetCloseButton onClick={ModalCommands.pop} data-flx="channel.channel-follow-success-modal.close" />
<div className={styles.hero} aria-hidden data-flx="channel.channel-follow-success-modal.hero">
<div
className={styles.patternImage}
@@ -102,10 +102,11 @@ const ChannelFollowSuccessModal = observer(({sourceChannelId, targetChannelId}:
targetName: target?.name ?? i18n._(UNKNOWN_CHANNEL_DESCRIPTOR),
})}
</p>
- <Button onClick={ModalCommands.pop} data-flx="channel.channel-follow-success-modal.button.got-it">
- {i18n._(GOT_IT_DESCRIPTOR)}
- </Button>
</div>
+ <Modal.DismissFooter
+ label={i18n._(GOT_IT_DESCRIPTOR)}
+ data-flx="channel.channel-follow-success-modal.dismiss-footer"
+ />
</Modal.Root>
);
});
diff --git a/fluxer_app/src/features/channel/components/modals/UnaddableRecipientsConfirmModal.tsx b/fluxer_app/src/features/channel/components/modals/UnaddableRecipientsConfirmModal.tsx
index 68ac6fa34..7fbff0cf3 100644
--- a/fluxer_app/src/features/channel/components/modals/UnaddableRecipientsConfirmModal.tsx
+++ b/fluxer_app/src/features/channel/components/modals/UnaddableRecipientsConfirmModal.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
-import {CANCEL_DESCRIPTOR, CLOSE_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
+import {CANCEL_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
import Users from '@app/features/user/state/Users';
import {msg} from '@lingui/core/macro';
import {Plural, Trans, useLingui} from '@lingui/react/macro';
@@ -114,7 +114,6 @@ export const UnaddableRecipientsConfirmModal = observer(
<ConfirmModal
title={i18n._(SOME_USERS_CAN_T_BE_ADDED_DESCRIPTOR)}
description={description}
- secondaryText={i18n._(CLOSE_DESCRIPTOR)}
size="small"
data-flx="channel.unaddable-recipients-confirm-modal.confirm-modal"
/>
diff --git a/fluxer_app/src/features/guild/components/RoleManagement.tsx b/fluxer_app/src/features/guild/components/RoleManagement.tsx
index 8d7b39619..5b34aa2ee 100644
--- a/fluxer_app/src/features/guild/components/RoleManagement.tsx
+++ b/fluxer_app/src/features/guild/components/RoleManagement.tsx
@@ -407,10 +407,6 @@ function openNoRolesModal(guildId: string) {
description={
<NoRolesModalDescription data-flx="guild.role-management.open-no-roles-modal.no-roles-modal-description" />
}
- primaryText={<Trans>OK</Trans>}
- primaryVariant="primary"
- secondaryText={false}
- onPrimary={() => {}}
data-flx="guild.role-management.open-no-roles-modal.confirm-modal"
/>
)),
diff --git a/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildEmojiTab.tsx b/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildEmojiTab.tsx
index 1998f847b..ee6e9ece8 100644
--- a/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildEmojiTab.tsx
+++ b/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildEmojiTab.tsx
@@ -18,7 +18,6 @@ import styles from '@app/features/guild/components/modals/guild_tabs/GuildEmojiT
import {UploadDropZone} from '@app/features/guild/components/UploadDropZone';
import {UploadSlotInfo} from '@app/features/guild/components/UploadSlotInfo';
import Guilds from '@app/features/guild/state/Guilds';
-import {OKAY_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
import {openFilePicker} from '@app/features/messaging/utils/FilePickerUtils';
import {formatFileSize} from '@app/features/messaging/utils/FileUtils';
import Permission from '@app/features/permissions/state/Permission';
@@ -273,9 +272,6 @@ const GuildEmojiTab: React.FC<{guildId: string}> = observer(function GuildEmojiT
<Trans>Unable to prepare any emojis for upload. The following errors occurred:</Trans>,
validationFailures,
)}
- primaryText={i18n._(OKAY_DESCRIPTOR)}
- primaryVariant="primary"
- onPrimary={() => {}}
data-flx="guild.guild-tabs.guild-emoji-tab.handle-file-select.unsupported-files-confirm-modal"
/>
)),
@@ -328,9 +324,6 @@ const GuildEmojiTab: React.FC<{guildId: string}> = observer(function GuildEmojiT
<Trans>Unable to prepare any emojis for upload. The following errors occurred:</Trans>,
preparationFailures,
)}
- primaryText={i18n._(OKAY_DESCRIPTOR)}
- primaryVariant="primary"
- onPrimary={() => {}}
data-flx="guild.guild-tabs.guild-emoji-tab.handle-file-select.confirm-modal--2"
/>
)),
@@ -390,9 +383,6 @@ const GuildEmojiTab: React.FC<{guildId: string}> = observer(function GuildEmojiT
i18n._(SOME_EMOJIS_COULD_NOT_BE_ADDED_BODY_DESCRIPTOR),
failures,
)}
- primaryText={i18n._(OKAY_DESCRIPTOR)}
- primaryVariant="primary"
- onPrimary={() => {}}
data-flx="guild.guild-tabs.guild-emoji-tab.handle-file-select.partial-failure-modal"
/>
)),
diff --git a/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildStickersTab.tsx b/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildStickersTab.tsx
index 60f9d1458..e290b43e2 100644
--- a/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildStickersTab.tsx
+++ b/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildStickersTab.tsx
@@ -19,7 +19,7 @@ import {resolveEnclosingScrollSurface} from '@app/features/guild/components/moda
import {UploadDropZone} from '@app/features/guild/components/UploadDropZone';
import {UploadSlotInfo} from '@app/features/guild/components/UploadSlotInfo';
import Guilds from '@app/features/guild/state/Guilds';
-import {OKAY_DESCRIPTOR, TRY_AGAIN_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
+import {TRY_AGAIN_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
import {NearViewportSurfaceContext} from '@app/features/messaging/hooks/useNearViewport';
import {openFilePicker} from '@app/features/messaging/utils/FilePickerUtils';
import {formatFileSize} from '@app/features/messaging/utils/FileUtils';
@@ -143,9 +143,6 @@ const GuildStickersTab: React.FC<{guildId: string}> = observer(function GuildSti
<ConfirmModal
title={i18n._(UNSUPPORTED_STICKER_FILE_DESCRIPTOR)}
description={getAssetFormatErrorMessage(i18n, 'sticker', 'unsupported_mime')}
- primaryText={i18n._(OKAY_DESCRIPTOR)}
- primaryVariant="primary"
- onPrimary={() => {}}
data-flx="guild.guild-tabs.guild-stickers-tab.unsupported-file-confirm-modal"
/>
)),
diff --git a/fluxer_app/src/features/moderation/components/modals/BanDetailsModal.tsx b/fluxer_app/src/features/moderation/components/modals/BanDetailsModal.tsx
index ab101cc44..49085957f 100644
--- a/fluxer_app/src/features/moderation/components/modals/BanDetailsModal.tsx
+++ b/fluxer_app/src/features/moderation/components/modals/BanDetailsModal.tsx
@@ -120,7 +120,7 @@ export const BanDetailsModal: React.FC<BanDetailsModalProps> = observer(({ban, o
</div>
</Modal.ContentLayout>
</Modal.Content>
- {onRevoke && (
+ {onRevoke ? (
<Modal.Footer data-flx="moderation.ban-details-modal.modal-footer">
<Button
variant="secondary"
@@ -138,6 +138,8 @@ export const BanDetailsModal: React.FC<BanDetailsModalProps> = observer(({ban, o
<Trans>Revoke ban</Trans>
</Button>
</Modal.Footer>
+ ) : (
+ <Modal.DismissFooter data-flx="moderation.ban-details-modal.dismiss-footer" />
)}
</Modal.Root>
);
diff --git a/fluxer_app/src/features/ui/commands/NotificationCommands.tsx b/fluxer_app/src/features/ui/commands/NotificationCommands.tsx
index ee3979054..79c290a97 100644
--- a/fluxer_app/src/features/ui/commands/NotificationCommands.tsx
+++ b/fluxer_app/src/features/ui/commands/NotificationCommands.tsx
@@ -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 {Logger} from '@app/features/platform/utils/AppLogger';
import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
import {modal} from '@app/features/ui/commands/ModalCommands';
@@ -34,10 +33,6 @@ export function permissionDenied(i18n: I18n, suppressModal = false): void {
</Trans>
</p>
}
- primaryText={i18n._(OKAY_DESCRIPTOR)}
- primaryVariant="primary"
- secondaryText={false}
- onPrimary={() => {}}
data-flx="ui.notification-commands.permission-denied.confirm-modal"
/>
)),
diff --git a/fluxer_app/src/features/updater/commands/UpdaterModalCommands.tsx b/fluxer_app/src/features/updater/commands/UpdaterModalCommands.tsx
index 72a6dfcc6..461a29d3e 100644
--- a/fluxer_app/src/features/updater/commands/UpdaterModalCommands.tsx
+++ b/fluxer_app/src/features/updater/commands/UpdaterModalCommands.tsx
@@ -3,7 +3,6 @@
import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
import {DESKTOP_DOWNLOAD_URL} from '@app/features/app/config/I18nDisplayConstants';
import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
-import {CLOSE_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
import {modal} from '@app/features/ui/commands/ModalCommands';
import {isCanaryDesktop, openExternalUrl} from '@app/features/ui/utils/NativeUtils';
@@ -212,7 +211,6 @@ export function pushUpToDateModal(currentVersion: string | null): void {
? i18n._(INSTALLED_VERSION_IS_CURRENT_DESCRIPTOR, {currentVersion})
: i18n._(NO_DESKTOP_UPDATE_IS_AVAILABLE_DESCRIPTOR)
}
- secondaryText={i18n._(CLOSE_DESCRIPTOR)}
data-flx="updater.updater-modal-commands.push-up-to-date-modal.confirm-modal"
/>
)),
@@ -232,7 +230,6 @@ export function pushUnsupportedUpdateModal(
title={i18n._(SYSTEM_MANAGED_INSTALL_DESCRIPTOR)}
description={i18n._(SYSTEM_MANAGED_UPDATE_BODY_DESCRIPTOR, {productName: RuntimeConfig.productName})}
primaryText={i18n._(OPEN_SOFTWARE_CENTER_DESCRIPTOR)}
- secondaryText={i18n._(CLOSE_DESCRIPTOR)}
onPrimary={() => openSoftwareCenter()}
data-flx="updater.updater-modal-commands.push-unsupported-update-modal.confirm-modal"
/>
@@ -268,7 +265,6 @@ function pushUpdaterErrorModal(getTitle: () => string, getDescription: () => str
<ConfirmModal
title={getTitle()}
description={getDescription()}
- secondaryText={i18n._(CLOSE_DESCRIPTOR)}
data-flx="updater.updater-modal-commands.push-updater-error-modal.confirm-modal"
/>
)),