Skip to content

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

TypeScript fluxerfluxerapp

refactor(app): replace nested ternaries in settings tabs

Hampusbb6db447bc57
diff --git a/fluxer_app/src/features/user/components/modals/PrivacySetupModal.tsx b/fluxer_app/src/features/user/components/modals/PrivacySetupModal.tsx
index 83da6a2a9..6f1c85763 100644
--- a/fluxer_app/src/features/user/components/modals/PrivacySetupModal.tsx
+++ b/fluxer_app/src/features/user/components/modals/PrivacySetupModal.tsx
@@ -168,13 +168,16 @@ export const PrivacySetupModal = observer(() => {
],
[i18n, currentChoice, currentTag],
);
- const summary = !changed
- ? i18n._(PRIVACY_SETUP_SUMMARY_NONE_DESCRIPTOR)
- : applying
- ? i18n._(PRIVACY_SETUP_SUMMARY_APPLY_DESCRIPTOR)
- : affected.length > 0
- ? i18n._(PRIVACY_SETUP_SUMMARY_FUTURE_DESCRIPTOR)
- : i18n._(PRIVACY_SETUP_SUMMARY_FUTURE_ONLY_DESCRIPTOR);
+ let summary: string;
+ if (!changed) {
+ summary = i18n._(PRIVACY_SETUP_SUMMARY_NONE_DESCRIPTOR);
+ } else if (applying) {
+ summary = i18n._(PRIVACY_SETUP_SUMMARY_APPLY_DESCRIPTOR);
+ } else if (affected.length > 0) {
+ summary = i18n._(PRIVACY_SETUP_SUMMARY_FUTURE_DESCRIPTOR);
+ } else {
+ summary = i18n._(PRIVACY_SETUP_SUMMARY_FUTURE_ONLY_DESCRIPTOR);
+ }
const handleClose = useCallback(() => {
ModalCommands.pop();
}, []);
diff --git a/fluxer_app/src/features/user/components/modals/tabs/AuthorizedAppsTab.tsx b/fluxer_app/src/features/user/components/modals/tabs/AuthorizedAppsTab.tsx
index 65ca7fbd2..4c32f924d 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/AuthorizedAppsTab.tsx
+++ b/fluxer_app/src/features/user/components/modals/tabs/AuthorizedAppsTab.tsx
@@ -406,49 +406,56 @@ export const AuthorizedAppsContent = observer(function AuthorizedAppsContent({
if (!isModalPresentation) return loadingState;
return <Modal.Content data-flx="user.authorized-apps-tab.modal-content.loading">{loadingState}</Modal.Content>;
}
- const authorizedAppsContent = error ? (
- <StatusSlate
- Icon={NetworkSlashIcon}
- title={i18n._(FAILED_TO_LOAD_AUTHORIZED_APPLICATIONS_DESCRIPTOR)}
- description={error}
- actions={[
- {
- text: i18n._(TRY_AGAIN_DESCRIPTOR),
- onClick: loadAuthorizations,
- variant: 'primary',
- },
- ]}
- data-flx="user.authorized-apps-tab.status-slate"
- />
- ) : authorizations.length === 0 ? (
- <StatusSlate
- Icon={AppWindowIcon}
- title={<Trans>No authorized applications</Trans>}
- description={<Trans>You haven't authorized any applications to access your account.</Trans>}
- data-flx="user.authorized-apps-tab.status-slate.empty"
- />
- ) : (
- <>
- <p className={styles.selectionHint} data-flx="user.authorized-apps-tab.selection-hint">
- <Trans>Hold Shift and press X to select apps. Press {selectAllShortcutLabel} to select all.</Trans>
- </p>
- <div className={styles.appList} data-flx="user.authorized-apps-tab.app-list">
- {authorizations.map((authorization, index) => (
- <AuthorizedAppItem
- key={authorization.application.id}
- authorization={authorization}
- isSelected={selectedApplicationIds.has(authorization.application.id)}
- index={index}
- selectionMode={selectionMode}
- onSelect={toggleApplication}
- onOpenScopes={openScopesModal}
- onRevoke={openRevokeModal}
- data-flx="user.authorized-apps-tab.app-item"
- />
- ))}
- </div>
- </>
- );
+ let authorizedAppsContent: React.ReactNode;
+ if (error) {
+ authorizedAppsContent = (
+ <StatusSlate
+ Icon={NetworkSlashIcon}
+ title={i18n._(FAILED_TO_LOAD_AUTHORIZED_APPLICATIONS_DESCRIPTOR)}
+ description={error}
+ actions={[
+ {
+ text: i18n._(TRY_AGAIN_DESCRIPTOR),
+ onClick: loadAuthorizations,
+ variant: 'primary',
+ },
+ ]}
+ data-flx="user.authorized-apps-tab.status-slate"
+ />
+ );
+ } else if (authorizations.length === 0) {
+ authorizedAppsContent = (
+ <StatusSlate
+ Icon={AppWindowIcon}
+ title={<Trans>No authorized applications</Trans>}
+ description={<Trans>You haven't authorized any applications to access your account.</Trans>}
+ data-flx="user.authorized-apps-tab.status-slate.empty"
+ />
+ );
+ } else {
+ authorizedAppsContent = (
+ <>
+ <p className={styles.selectionHint} data-flx="user.authorized-apps-tab.selection-hint">
+ <Trans>Hold Shift and press X to select apps. Press {selectAllShortcutLabel} to select all.</Trans>
+ </p>
+ <div className={styles.appList} data-flx="user.authorized-apps-tab.app-list">
+ {authorizations.map((authorization, index) => (
+ <AuthorizedAppItem
+ key={authorization.application.id}
+ authorization={authorization}
+ isSelected={selectedApplicationIds.has(authorization.application.id)}
+ index={index}
+ selectionMode={selectionMode}
+ onSelect={toggleApplication}
+ onOpenScopes={openScopesModal}
+ onRevoke={openRevokeModal}
+ data-flx="user.authorized-apps-tab.app-item"
+ />
+ ))}
+ </div>
+ </>
+ );
+ }
if (isModalPresentation) {
return (
<>
diff --git a/fluxer_app/src/features/user/components/modals/tabs/DevicesTab.tsx b/fluxer_app/src/features/user/components/modals/tabs/DevicesTab.tsx
index 1d3f07aa4..2056ba627 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/DevicesTab.tsx
+++ b/fluxer_app/src/features/user/components/modals/tabs/DevicesTab.tsx
@@ -459,7 +459,8 @@ const DevicesTabContent: React.FC = observer(() => {
>
{i18n._(SIGN_OUT_SELECTED_DEVICES_DESCRIPTOR, {deviceCount: selectedDeviceIds.length})}
</Button>
- ) : otherDeviceIds.length > 1 ? (
+ ) : null}
+ {!selectionMode && otherDeviceIds.length > 1 ? (
<Button
variant="danger"
onClick={openAllOtherDevicesRevokeModal}
diff --git a/fluxer_app/src/features/user/components/modals/tabs/UserVideoTab.tsx b/fluxer_app/src/features/user/components/modals/tabs/UserVideoTab.tsx
index 3dfaab38a..48cbd5c38 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/UserVideoTab.tsx
+++ b/fluxer_app/src/features/user/components/modals/tabs/UserVideoTab.tsx
@@ -48,7 +48,7 @@ import {resolveEffectiveDeviceId} from '@app/features/voice/utils/VoiceDeviceMan
import type {I18n} from '@lingui/core';
import {msg, ph} from '@lingui/core/macro';
import {Trans, useLingui} from '@lingui/react/macro';
-import {CrownIcon, GearIcon} from '@phosphor-icons/react';
+import {AtomIcon, GearIcon} from '@phosphor-icons/react';
import {observer} from 'mobx-react-lite';
import type React from 'react';
import {useCallback, useMemo} from 'react';
@@ -228,41 +228,56 @@ export const VideoTab: React.FC<VideoTabProps> = observer(({voiceSettings}) => {
section: getAdvancedSettingsCategorySectionId('media'),
});
}, []);
- return (
- <div className={styles.content} data-flx="user.video-tab.content">
- {devices.length === 0 && permissionStatus !== 'loading' ? (
- <div className={styles.deviceNotice} data-flx="user.video-tab.device-notice">
- <div className={styles.deviceNoticeText} data-flx="user.video-tab.device-notice-text">
- <div className={styles.deviceNoticeTitle} data-flx="user.video-tab.device-notice-title">
- <Trans>No camera found</Trans>
- </div>
- <p className={styles.deviceNoticeDescription} data-flx="user.video-tab.device-notice-description">
- {permissionStatus === 'denied' ? (
- <Trans comment="Shown in video settings on the macOS app when camera access is denied. {ph({PRODUCT_NAME: RuntimeConfig.productName})} is the app name. Keep 'System Settings', 'Privacy & Security' and the permission name as macOS shows them in this language.">
- Allow {ph({PRODUCT_NAME: RuntimeConfig.productName})} to access your camera in System Settings →
- Privacy & Security → Camera.
- </Trans>
- ) : permissionStatus === 'granted' ? (
- <Trans>Connect a camera and try again.</Trans>
- ) : (
- i18n._(PRODUCT_NEEDS_CAMERA_ACCESS_DESCRIPTOR, {productName: RuntimeConfig.productName})
- )}
- </p>
- </div>
- {permissionStatus !== 'granted' ? (
- <Button
- variant="secondary"
- small={true}
- onClick={() => {
- void requestPermission();
- }}
- data-flx="user.video-tab.button"
- >
- <Trans>Allow camera</Trans>
- </Button>
- ) : null}
+ const contentClassName = styles.content;
+ let deviceNotice: React.ReactNode = null;
+ if (devices.length === 0 && permissionStatus !== 'loading') {
+ const noticeClassName = styles.deviceNotice;
+ const noticeTextClassName = styles.deviceNoticeText;
+ const noticeTitle = (
+ <div className={styles.deviceNoticeTitle} data-flx="user.video-tab.device-notice-title">
+ <Trans>No camera found</Trans>
+ </div>
+ );
+ const descriptionClassName = styles.deviceNoticeDescription;
+ let noticeDescription: React.ReactNode;
+ if (permissionStatus === 'denied') {
+ noticeDescription = (
+ <Trans comment="Shown in video settings on the macOS app when camera access is denied. {ph({PRODUCT_NAME: RuntimeConfig.productName})} is the app name. Keep 'System Settings', 'Privacy & Security' and the permission name as macOS shows them in this language.">
+ Allow {ph({PRODUCT_NAME: RuntimeConfig.productName})} to access your camera in System Settings → Privacy &
+ Security → Camera.
+ </Trans>
+ );
+ } else if (permissionStatus === 'granted') {
+ noticeDescription = <Trans>Connect a camera and try again.</Trans>;
+ } else {
+ noticeDescription = i18n._(PRODUCT_NEEDS_CAMERA_ACCESS_DESCRIPTOR, {productName: RuntimeConfig.productName});
+ }
+ deviceNotice = (
+ <div className={noticeClassName} data-flx="user.video-tab.device-notice">
+ <div className={noticeTextClassName} data-flx="user.video-tab.device-notice-text">
+ {noticeTitle}
+ <p className={descriptionClassName} data-flx="user.video-tab.device-notice-description">
+ {noticeDescription}
+ </p>
</div>
- ) : null}
+ {permissionStatus !== 'granted' ? (
+ <Button
+ variant="secondary"
+ small={true}
+ onClick={() => {
+ void requestPermission();
+ }}
+ data-flx="user.video-tab.button"
+ >
+ <Trans>Allow camera</Trans>
+ </Button>
+ ) : null}
+ </div>
+ );
+ }
+ return (
+ <div className={contentClassName} data-flx="user.video-tab.content">
+ {deviceNotice}
<div className={styles.controlGroup} data-flx="user.video-tab.camera-settings-group">
<CompactComboboxRow
label={i18n._(CAMERA_2_DESCRIPTOR)}
@@ -316,7 +331,7 @@ export const VideoTab: React.FC<VideoTabProps> = observer(({voiceSettings}) => {
{!hasHigherQuality && showPremium && (
<div className={styles.premiumCard} data-flx="user.video-tab.premium-card">
<div className={styles.premiumHeader} data-flx="user.video-tab.premium-header">
- <CrownIcon
+ <AtomIcon
weight="fill"
size={remFromPx(18)}
className={styles.premiumIcon}
@@ -354,7 +369,7 @@ export const VideoTab: React.FC<VideoTabProps> = observer(({voiceSettings}) => {
/>
{!hasHigherQuality && showPremium && (
<div className={styles.frameRateNote} data-flx="user.video-tab.frame-rate-note">
- <CrownIcon
+ <AtomIcon
weight="fill"
size={remFromPx(14)}
className={styles.frameRateIcon}
@@ -382,7 +397,7 @@ export const VideoTab: React.FC<VideoTabProps> = observer(({voiceSettings}) => {
)}
{screenShareState.saved !== null && (
<div className={styles.frameRateNote} data-flx="user.video-tab.tier-limit-note">
- <CrownIcon
+ <AtomIcon
weight="fill"
size={remFromPx(14)}
className={styles.frameRateIcon}
diff --git a/fluxer_app/src/features/user/components/modals/tabs/UserVoiceTab.tsx b/fluxer_app/src/features/user/components/modals/tabs/UserVoiceTab.tsx
index dc935d9a7..604f90c4b 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/UserVoiceTab.tsx
+++ b/fluxer_app/src/features/user/components/modals/tabs/UserVoiceTab.tsx
@@ -513,49 +513,64 @@ export const VoiceTab: React.FC<VoiceTabProps> = observer(({voiceSettings}) => {
{renderAutoGainControlSwitch()}
</div>
);
+ const devicesSectionTitle = i18n._(INPUT_AND_OUTPUT_DESCRIPTOR);
+ let deviceNotice: React.ReactNode = null;
+ if (inputDevices.length === 0 && permissionStatus !== 'loading') {
+ const noticeClassName = styles.deviceNotice;
+ const noticeTextClassName = styles.deviceNoticeText;
+ const noticeTitle = (
+ <div className={styles.deviceNoticeTitle} data-flx="user.voice-tab.device-notice-title">
+ <Trans>No microphone found</Trans>
+ </div>
+ );
+ const descriptionClassName = styles.deviceNoticeDescription;
+ let noticeDescription: React.ReactNode;
+ if (permissionStatus === 'denied' && isNativeDesktop) {
+ noticeDescription = (
+ <Trans comment="Shown in voice settings on the macOS app when microphone access is denied. {ph({PRODUCT_NAME: RuntimeConfig.productName})} is the app name. Keep 'System Settings', 'Privacy & Security' and the permission name as macOS shows them in this language.">
+ Allow {ph({PRODUCT_NAME: RuntimeConfig.productName})} to access your microphone in System Settings → Privacy &
+ Security → Microphone.
+ </Trans>
+ );
+ } else if (permissionStatus === 'denied') {
+ noticeDescription = (
+ <Trans>
+ Allow {ph({PRODUCT_NAME: RuntimeConfig.productName})} to access your microphone. Check your browser's address
+ bar or settings.
+ </Trans>
+ );
+ } else if (permissionStatus === 'granted') {
+ noticeDescription = <Trans>Connect a microphone and try again.</Trans>;
+ } else {
+ noticeDescription = i18n._(PRODUCT_NEEDS_MICROPHONE_ACCESS_DESCRIPTOR, {productName: RuntimeConfig.productName});
+ }
+ deviceNotice = (
+ <div className={noticeClassName} data-flx="user.voice-tab.device-notice">
+ <div className={noticeTextClassName} data-flx="user.voice-tab.device-notice-text">
+ {noticeTitle}
+ <p className={descriptionClassName} data-flx="user.voice-tab.device-notice-description">
+ {noticeDescription}
+ </p>
+ </div>
+ {permissionStatus !== 'granted' ? (
+ <Button
+ variant="secondary"
+ small={true}
+ onClick={() => {
+ void requestPermission();
+ }}
+ data-flx="user.voice-tab.button"
+ >
+ <Trans>Allow microphone</Trans>
+ </Button>
+ ) : null}
+ </div>
+ );
+ }
return (
<>
- <SettingsTabSection title={i18n._(INPUT_AND_OUTPUT_DESCRIPTOR)} data-flx="user.voice-tab.devices-section">
- {inputDevices.length === 0 && permissionStatus !== 'loading' ? (
- <div className={styles.deviceNotice} data-flx="user.voice-tab.device-notice">
- <div className={styles.deviceNoticeText} data-flx="user.voice-tab.device-notice-text">
- <div className={styles.deviceNoticeTitle} data-flx="user.voice-tab.device-notice-title">
- <Trans>No microphone found</Trans>
- </div>
- <p className={styles.deviceNoticeDescription} data-flx="user.voice-tab.device-notice-description">
- {permissionStatus === 'denied' ? (
- isNativeDesktop ? (
- <Trans comment="Shown in voice settings on the macOS app when microphone access is denied. {ph({PRODUCT_NAME: RuntimeConfig.productName})} is the app name. Keep 'System Settings', 'Privacy & Security' and the permission name as macOS shows them in this language.">
- Allow {ph({PRODUCT_NAME: RuntimeConfig.productName})} to access your microphone in System Settings
- → Privacy & Security → Microphone.
- </Trans>
- ) : (
- <Trans>
- Allow {ph({PRODUCT_NAME: RuntimeConfig.productName})} to access your microphone. Check your
- browser's address bar or settings.
- </Trans>
- )
- ) : permissionStatus === 'granted' ? (
- <Trans>Connect a microphone and try again.</Trans>
- ) : (
- i18n._(PRODUCT_NEEDS_MICROPHONE_ACCESS_DESCRIPTOR, {productName: RuntimeConfig.productName})
- )}
- </p>
- </div>
- {permissionStatus !== 'granted' ? (
- <Button
- variant="secondary"
- small={true}
- onClick={() => {
- void requestPermission();
- }}
- data-flx="user.voice-tab.button"
- >
- <Trans>Allow microphone</Trans>
- </Button>
- ) : null}
- </div>
- ) : null}
+ <SettingsTabSection title={devicesSectionTitle} data-flx="user.voice-tab.devices-section">
+ {deviceNotice}
<CompactComboboxRow
label={i18n._(VOICE_INPUT_DEVICE_DESCRIPTOR)}
value={effectiveInputDeviceId}
@@ -715,6 +730,20 @@ export const VoiceTab: React.FC<VoiceTabProps> = observer(({voiceSettings}) => {
>
<EntranceSoundSection data-flx="user.voice-tab.entrance-sound-section" />
</SettingsTabSection>
+ <SettingsTabSection title={<Trans>Voice channels</Trans>} data-flx="user.voice-tab.voice-channels-section">
+ <Switch
+ label={<Trans>Show connection IDs</Trans>}
+ description={
+ <Trans>
+ Show the ID of each voice connection next to people in calls and in voice channels. With it off, each
+ device is named by its type instead.
+ </Trans>
+ }
+ value={voiceSettings.showVoiceConnectionId}
+ onChange={(value) => VoiceSettingsCommands.update({showVoiceConnectionId: value})}
+ data-flx="user.voice-tab.voice-channels-section.switch.show-connection-ids"
+ />
+ </SettingsTabSection>
</>
);
});
diff --git a/fluxer_app/src/features/user/components/modals/tabs/account_security_tab/RecoveryKitSettings.tsx b/fluxer_app/src/features/user/components/modals/tabs/account_security_tab/RecoveryKitSettings.tsx
index 0bbf00b67..2a37c0116 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/account_security_tab/RecoveryKitSettings.tsx
+++ b/fluxer_app/src/features/user/components/modals/tabs/account_security_tab/RecoveryKitSettings.tsx
@@ -15,7 +15,7 @@ import type {I18n} from '@lingui/core';
import {msg} from '@lingui/core/macro';
import {Trans, useLingui} from '@lingui/react/macro';
import {observer} from 'mobx-react-lite';
-import {useCallback, useEffect, useState} from 'react';
+import {type ReactNode, useCallback, useEffect, useState} from 'react';
const RECOVERY_KIT_ERROR_DESCRIPTOR = msg({
message: 'Could not create a recovery kit',
@@ -80,16 +80,18 @@ export const RecoveryKitRow = observer(({user}: {user: User}) => {
const {creating, create} = useCreateRecoveryKit();
const createdAt = status?.createdAt ?? null;
const missing = status != null && !status.hasRecoveryKit;
+ let description: ReactNode = null;
+ if (!missing) {
+ description = createdAt ? (
+ <Trans>Created: {DateUtils.getRelativeDateString(createdAt, i18n)}</Trans>
+ ) : (
+ <Trans>Lets you reset your password if you forget it.</Trans>
+ );
+ }
return (
<AccountSecurityRow
label={<Trans>Recovery kit</Trans>}
- description={
- missing ? null : createdAt ? (
- <Trans>Created {DateUtils.getRelativeDateString(createdAt, i18n)}</Trans>
- ) : (
- <Trans>Lets you reset your password if you forget it.</Trans>
- )
- }
+ description={description}
warning={missing ? <Trans>You don't have a recovery kit yet</Trans> : null}
data-flx="user.account-security-tab.recovery-kit-settings.recovery-kit-row"
>
diff --git a/fluxer_app/src/features/user/components/modals/tabs/hooks/useMediaPermission.tsx b/fluxer_app/src/features/user/components/modals/tabs/hooks/useMediaPermission.tsx
index b67731481..35a90cd20 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/hooks/useMediaPermission.tsx
+++ b/fluxer_app/src/features/user/components/modals/tabs/hooks/useMediaPermission.tsx
@@ -93,8 +93,14 @@ export const useMediaPermission = (type: PermissionType) => {
setState((prev) => ({...prev, status: 'loading'}));
const granted = await VoiceDevicePermissionState.requestPermissionFor(type);
const deviceState = VoiceDevicePermissionState.getState();
+ let status: PermissionState['status'] = 'idle';
+ if (granted) {
+ status = 'granted';
+ } else if (deviceState.permissionStatus[type] === 'denied') {
+ status = 'denied';
+ }
const nextState = {
- status: granted ? 'granted' : deviceState.permissionStatus[type] === 'denied' ? 'denied' : 'idle',
+ status,
devices: devicesFromVoiceState(deviceState, type),
deviceState,
} satisfies PermissionState;
diff --git a/fluxer_app/src/features/user/components/modals/tabs/keybinds_tab/CustomKeybindsList.tsx b/fluxer_app/src/features/user/components/modals/tabs/keybinds_tab/CustomKeybindsList.tsx
index 0e2653698..987179154 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/keybinds_tab/CustomKeybindsList.tsx
+++ b/fluxer_app/src/features/user/components/modals/tabs/keybinds_tab/CustomKeybindsList.tsx
@@ -115,6 +115,30 @@ export const CustomKeybindsList: React.FC<{searchQuery: string}> = observer(({se
);
};
const hasAnyOverrides = allCustomKeybinds.length > 0 || disableBuiltinKeybinds;
+ let customList: React.ReactNode;
+ if (customKeybinds.length === 0) {
+ customList = (
+ <div className={styles.emptyState} data-flx="user.keybinds-tab.custom-keybinds-list.empty-state">
+ <Trans>No custom shortcuts yet.</Trans>
+ </div>
+ );
+ } else if (filteredKeybinds.length === 0) {
+ customList = (
+ <div className={styles.emptyState} data-flx="user.keybinds-tab.custom-keybinds-list.empty-state--2">
+ <Trans>No custom shortcuts match that search.</Trans>
+ </div>
+ );
+ } else {
+ customList = filteredKeybinds.map((entry) => (
+ <CustomKeybindRow
+ key={entry.id}
+ entry={entry}
+ conflictLabel={conflictLabels.get(entry.id) ?? null}
+ onRemove={() => Keybind.removeCustomKeybind(entry.id)}
+ data-flx="user.keybinds-tab.custom-keybinds-list.custom-keybind-row"
+ />
+ ));
+ }
return (
<div className={styles.customSection} data-flx="user.keybinds-tab.custom-keybinds-list.custom-section">
<div className={styles.customHeader} data-flx="user.keybinds-tab.custom-keybinds-list.custom-header">
@@ -179,25 +203,7 @@ export const CustomKeybindsList: React.FC<{searchQuery: string}> = observer(({se
/>
</div>
<div className={styles.customList} data-flx="user.keybinds-tab.custom-keybinds-list.custom-list">
- {customKeybinds.length === 0 ? (
- <div className={styles.emptyState} data-flx="user.keybinds-tab.custom-keybinds-list.empty-state">
- <Trans>No custom shortcuts yet.</Trans>
- </div>
- ) : filteredKeybinds.length === 0 ? (
- <div className={styles.emptyState} data-flx="user.keybinds-tab.custom-keybinds-list.empty-state--2">
- <Trans>No custom shortcuts match that search.</Trans>
- </div>
- ) : (
- filteredKeybinds.map((entry) => (
- <CustomKeybindRow
- key={entry.id}
- entry={entry}
- conflictLabel={conflictLabels.get(entry.id) ?? null}
- onRemove={() => Keybind.removeCustomKeybind(entry.id)}
- data-flx="user.keybinds-tab.custom-keybinds-list.custom-keybind-row"
- />
- ))
- )}
+ {customList}
</div>
</div>
);
diff --git a/fluxer_app/src/features/user/components/modals/tabs/keybinds_tab/DefaultShortcutChipList.tsx b/fluxer_app/src/features/user/components/modals/tabs/keybinds_tab/DefaultShortcutChipList.tsx
index b432104b1..0c1386287 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/keybinds_tab/DefaultShortcutChipList.tsx
+++ b/fluxer_app/src/features/user/components/modals/tabs/keybinds_tab/DefaultShortcutChipList.tsx
@@ -37,7 +37,8 @@ export const DefaultShortcutChipList: React.FC<{chips: Array<string>; overridden
>
<Trans>Overridden</Trans>
</span>
- ) : disabled ? (
+ ) : null}
+ {!overridden && disabled ? (
<span
className={styles.defaultChipsEmpty}
data-flx="user.keybinds-tab.default-shortcut-chip-list.default-chips-empty--3"
diff --git a/fluxer_app/src/features/user/components/modals/tabs/notifications_tab/Notifications.tsx b/fluxer_app/src/features/user/components/modals/tabs/notifications_tab/Notifications.tsx
index c07a4758a..134ccbc5e 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/notifications_tab/Notifications.tsx
+++ b/fluxer_app/src/features/user/components/modals/tabs/notifications_tab/Notifications.tsx
@@ -132,37 +132,40 @@ export const Notifications: FC<NotificationsProps> = observer(
await PushSubscriptionService.unregisterAllPushSubscriptions();
await refresh();
};
- const pushStatusMessage = loading
- ? i18n._(LOADING_PUSH_SUBSCRIPTIONS_DESCRIPTOR)
- : subscriptions.length > 0
- ? plural(
- {count: subscriptions.length},
- {
- one: '# active subscription',
- other: '# active subscriptions',
- },
- )
- : i18n._(NO_PUSH_SUBSCRIPTIONS_REGISTERED_YET_DESCRIPTOR);
+ let pushStatusMessage: string;
+ if (loading) {
+ pushStatusMessage = i18n._(LOADING_PUSH_SUBSCRIPTIONS_DESCRIPTOR);
+ } else if (subscriptions.length > 0) {
+ pushStatusMessage = plural(
+ {count: subscriptions.length},
+ {
+ one: '# active subscription',
+ other: '# active subscriptions',
+ },
+ );
+ } else {
+ pushStatusMessage = i18n._(NO_PUSH_SUBSCRIPTIONS_REGISTERED_YET_DESCRIPTOR);
+ }
+ let notificationsLabel: string;
+ let notificationsDescription: string;
+ if (isDesktop()) {
+ notificationsLabel = i18n._(ENABLE_DESKTOP_NOTIFICATIONS_DESCRIPTOR);
+ notificationsDescription = i18n._(USES_THE_OS_NOTIFICATION_CENTER_FOR_PER_CHANNEL_DESCRIPTOR);
+ } else if (isPwa) {
+ notificationsLabel = i18n._(ENABLE_NOTIFICATIONS_DESCRIPTOR);
+ notificationsDescription = i18n._(GET_NOTIFIED_WHEN_YOU_RECEIVE_MESSAGES_YOU_MAY_DESCRIPTOR, {
+ productName: RuntimeConfig.productName,
+ });
+ } else {
+ notificationsLabel = i18n._(ENABLE_BROWSER_NOTIFICATIONS_DESCRIPTOR);
+ notificationsDescription = i18n._(GET_NOTIFIED_WHEN_YOU_RECEIVE_MESSAGES_YOU_MAY_2_DESCRIPTOR);
+ }
return (
<div className={styles.container} data-flx="user.notifications-tab.notifications.container">
<div className={styles.switchesContainer} data-flx="user.notifications-tab.notifications.switches-container">
<Switch
- label={
- isDesktop()
- ? i18n._(ENABLE_DESKTOP_NOTIFICATIONS_DESCRIPTOR)
- : isPwa
- ? i18n._(ENABLE_NOTIFICATIONS_DESCRIPTOR)
- : i18n._(ENABLE_BROWSER_NOTIFICATIONS_DESCRIPTOR)
- }
- description={
- isDesktop()
- ? i18n._(USES_THE_OS_NOTIFICATION_CENTER_FOR_PER_CHANNEL_DESCRIPTOR)
- : isPwa
- ? i18n._(GET_NOTIFIED_WHEN_YOU_RECEIVE_MESSAGES_YOU_MAY_DESCRIPTOR, {
- productName: RuntimeConfig.productName,
- })
- : i18n._(GET_NOTIFIED_WHEN_YOU_RECEIVE_MESSAGES_YOU_MAY_2_DESCRIPTOR)
- }
+ label={notificationsLabel}
+ description={notificationsDescription}
value={browserNotificationsEnabled}
onChange={handleToggleNotifications}
data-flx="user.notifications-tab.notifications.switch.toggle-notifications"