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 shell components

Hampusa43bce8f6c8f
diff --git a/fluxer_app/src/features/app/components/ErrorFallback.tsx b/fluxer_app/src/features/app/components/ErrorFallback.tsx
index 336d77e71..c08312d67 100644
--- a/fluxer_app/src/features/app/components/ErrorFallback.tsx
+++ b/fluxer_app/src/features/app/components/ErrorFallback.tsx
@@ -119,6 +119,14 @@ export const ErrorFallback: React.FC<ErrorFallbackProps> = ({error}) => {
setIsCopyingStackTrace(false);
}
}, [stackTraceText]);
+ let description = <Trans>Something went wrong and the app crashed. Try reloading or resetting the app.</Trans>;
+ if (checkingForUpdates) {
+ description = <Trans>The app has crashed. Checking for updates that might fix this issue…</Trans>;
+ } else if (updateAvailable) {
+ description = (
+ <Trans>Something went wrong and the app crashed. An update is available that may fix this issue.</Trans>
+ );
+ }
return (
<div className={errorFallbackStyles.errorFallbackContainer} data-flx="app.error-fallback.div">
{isNative && !useSystemTitleBar && (
@@ -130,13 +138,7 @@ export const ErrorFallback: React.FC<ErrorFallbackProps> = ({error}) => {
<Trans>The app crashed</Trans>
</h1>
<p className={errorFallbackStyles.errorFallbackDescription} data-flx="app.error-fallback.p">
- {checkingForUpdates ? (
- <Trans>The app has crashed. Checking for updates that might fix this issue…</Trans>
- ) : updateAvailable ? (
- <Trans>Something went wrong and the app crashed. An update is available that may fix this issue.</Trans>
- ) : (
- <Trans>Something went wrong and the app crashed. Try reloading or resetting the app.</Trans>
- )}
+ {description}
</p>
</div>
<div className={errorFallbackStyles.errorFallbackActions} data-flx="app.error-fallback.div--3">
diff --git a/fluxer_app/src/features/app/components/dialogs/components/ClientInfo.tsx b/fluxer_app/src/features/app/components/dialogs/components/ClientInfo.tsx
index 67c3d7031..d91b30705 100644
--- a/fluxer_app/src/features/app/components/dialogs/components/ClientInfo.tsx
+++ b/fluxer_app/src/features/app/components/dialogs/components/ClientInfo.tsx
@@ -86,14 +86,14 @@ export const ClientInfo = observer(() => {
desktopVersion: desktopVersionLabel,
})
: null;
- const buildLabel = desktopBuildLabel
- ? primaryDesktopReleaseChannel === releaseChannel
- ? i18n._(WEB_BUILD_SECONDARY_DESCRIPTOR, {buildVersion})
- : i18n._(WEB_BUILD_SECONDARY_WITH_CHANNEL_DESCRIPTOR, {releaseChannel, buildVersion})
- : i18n._(WEB_BUILD_DESCRIPTOR, {
- releaseChannel,
- buildVersion,
- });
+ let buildLabel: string;
+ if (!desktopBuildLabel) {
+ buildLabel = i18n._(WEB_BUILD_DESCRIPTOR, {releaseChannel, buildVersion});
+ } else if (primaryDesktopReleaseChannel === releaseChannel) {
+ buildLabel = i18n._(WEB_BUILD_SECONDARY_DESCRIPTOR, {buildVersion});
+ } else {
+ buildLabel = i18n._(WEB_BUILD_SECONDARY_WITH_CHANNEL_DESCRIPTOR, {releaseChannel, buildVersion});
+ }
const onClick = () => {
const justUnlocked = DeveloperMode.registerBuildTap();
if (justUnlocked) {
diff --git a/fluxer_app/src/features/app/components/dialogs/components/plutonium/hooks/useSubscriptionActions.ts b/fluxer_app/src/features/app/components/dialogs/components/plutonium/hooks/useSubscriptionActions.ts
index cd58185b2..0b2132c0b 100644
--- a/fluxer_app/src/features/app/components/dialogs/components/plutonium/hooks/useSubscriptionActions.ts
+++ b/fluxer_app/src/features/app/components/dialogs/components/plutonium/hooks/useSubscriptionActions.ts
@@ -62,6 +62,16 @@ const YOUR_SUBSCRIPTION_WILL_SWITCH_TO_MONTHLY_BILLING_DESCRIPTOR = msg({
message: 'Your subscription will switch to monthly billing at the next renewal.',
comment: 'Toast success shown after a Plutonium subscription is scheduled to switch to monthly billing.',
});
+const BILLING_CYCLE_CHANGED_DESCRIPTORS = {
+ now: {
+ yearly: YOUR_SUBSCRIPTION_HAS_BEEN_SWITCHED_TO_YEARLY_BILLING_DESCRIPTOR,
+ monthly: YOUR_SUBSCRIPTION_HAS_BEEN_SWITCHED_TO_MONTHLY_BILLING_DESCRIPTOR,
+ },
+ period_end: {
+ yearly: YOUR_SUBSCRIPTION_WILL_SWITCH_TO_YEARLY_BILLING_DESCRIPTOR,
+ monthly: YOUR_SUBSCRIPTION_WILL_SWITCH_TO_MONTHLY_BILLING_DESCRIPTOR,
+ },
+} as const;
const YOUR_PENDING_BILLING_CHANGE_HAS_BEEN_CANCELED_DESCRIPTOR = msg({
message: 'Your pending billing change has been canceled.',
comment: 'Toast success shown after a scheduled Plutonium billing cycle change is canceled.',
@@ -198,15 +208,7 @@ export const useSubscriptionActions = (countryCode?: string | null) => {
try {
await PremiumCommands.changeSubscriptionBillingCycle(billingCycle, effectiveAt);
await PremiumCommands.refreshPremiumState(countryCode ?? undefined);
- ToastCommands.success(
- effectiveAt === 'period_end'
- ? billingCycle === 'yearly'
- ? i18n._(YOUR_SUBSCRIPTION_WILL_SWITCH_TO_YEARLY_BILLING_DESCRIPTOR)
- : i18n._(YOUR_SUBSCRIPTION_WILL_SWITCH_TO_MONTHLY_BILLING_DESCRIPTOR)
- : billingCycle === 'yearly'
- ? i18n._(YOUR_SUBSCRIPTION_HAS_BEEN_SWITCHED_TO_YEARLY_BILLING_DESCRIPTOR)
- : i18n._(YOUR_SUBSCRIPTION_HAS_BEEN_SWITCHED_TO_MONTHLY_BILLING_DESCRIPTOR),
- );
+ ToastCommands.success(i18n._(BILLING_CYCLE_CHANGED_DESCRIPTORS[effectiveAt][billingCycle]));
} catch (error) {
logger.error('Failed to change subscription billing cycle', error);
showPremiumActionErrorModal(
diff --git a/fluxer_app/src/features/app/components/dialogs/shared/GuildComboboxRenderers.tsx b/fluxer_app/src/features/app/components/dialogs/shared/GuildComboboxRenderers.tsx
index ada9d7f53..1212615ad 100644
--- a/fluxer_app/src/features/app/components/dialogs/shared/GuildComboboxRenderers.tsx
+++ b/fluxer_app/src/features/app/components/dialogs/shared/GuildComboboxRenderers.tsx
@@ -36,6 +36,16 @@ const renderRow = <T extends GuildComboboxOption>(
const isGlobal = !option.value;
const iconUrl = option.iconUrl ?? null;
const notice = getNotice?.(option, disabled);
+ let noticeNode: React.ReactNode = null;
+ if (notice && styles.notice) {
+ noticeNode = (
+ <span className={styles.notice} data-flx="app.guild-combobox-renderers.render-row.notice">
+ {notice}
+ </span>
+ );
+ } else if (notice) {
+ noticeNode = notice;
+ }
return (
<div
className={clsx(rowClass, isGlobal && styles.rowGlobal, disabled && styles.rowDisabled)}
@@ -64,15 +74,7 @@ const renderRow = <T extends GuildComboboxOption>(
<span className={styles.label} data-flx="app.guild-combobox-renderers.render-row.label">
{option.label}
</span>
- {notice ? (
- styles.notice ? (
- <span className={styles.notice} data-flx="app.guild-combobox-renderers.render-row.notice">
- {notice}
- </span>
- ) : (
- notice
- )
- ) : null}
+ {noticeNode}
</div>
);
};
diff --git a/fluxer_app/src/features/app/components/layout/ChannelItem.tsx b/fluxer_app/src/features/app/components/layout/ChannelItem.tsx
index cd6196d44..7ca5ebd55 100644
--- a/fluxer_app/src/features/app/components/layout/ChannelItem.tsx
+++ b/fluxer_app/src/features/app/components/layout/ChannelItem.tsx
@@ -486,11 +486,14 @@ export const ChannelItem = observer(
data-flx="app.channel-item.unread-indicator"
/>
) : null;
- const channelKindLabel = channelIsCategory
- ? i18n._(CATEGORY_DESCRIPTOR)
- : channelIsVoice
- ? i18n._(VOICE_CHANNEL_DESCRIPTOR)
- : i18n._(CHANNEL_DESCRIPTOR);
+ let channelKindLabel: string;
+ if (channelIsCategory) {
+ channelKindLabel = i18n._(CATEGORY_DESCRIPTOR);
+ } else if (channelIsVoice) {
+ channelKindLabel = i18n._(VOICE_CHANNEL_DESCRIPTOR);
+ } else {
+ channelKindLabel = i18n._(CHANNEL_DESCRIPTOR);
+ }
const ariaLabelParts = [channel.name, channelKindLabel];
if (shouldShowSelectedState) ariaLabelParts.push(i18n._(SELECTED_DESCRIPTOR));
if (channelIsCategory)
@@ -622,23 +625,26 @@ export const ChannelItem = observer(
? i18n._(EDIT_CATEGORY_DESCRIPTOR)
: i18n._(CHANNEL_SETTINGS_LABEL_DESCRIPTOR);
const voiceLocked = channelIsVoice && !Permission.can(Permissions.CONNECT, channel);
+ let channelIconStateClass = styles.channelItemIconUnselected;
+ if (shouldShowSelectedState || (isHighlight && isSelected)) {
+ channelIconStateClass = styles.channelItemIconSelected;
+ } else if (isVoiceSelected && channel.type === ChannelTypes.GUILD_VOICE) {
+ channelIconStateClass = styles.channelItemHighlight;
+ } else if (isHighlight && !isSelected) {
+ channelIconStateClass = styles.channelItemIconHighlight;
+ }
+ let channelIconOptions: {locked?: boolean; e2eeEncrypted?: boolean} | undefined;
+ if (voiceLocked) {
+ channelIconOptions = {locked: true};
+ } else if (channelIsE2EEEncrypted) {
+ channelIconOptions = {e2eeEncrypted: true};
+ }
const channelIconNode = channelIsCategory
? null
: ChannelUtils.getIcon(
channel,
- {
- className: clsx(
- styles.channelItemIcon,
- shouldShowSelectedState || (isHighlight && isSelected)
- ? styles.channelItemIconSelected
- : isVoiceSelected && channel.type === ChannelTypes.GUILD_VOICE
- ? styles.channelItemHighlight
- : isHighlight && !isSelected
- ? styles.channelItemIconHighlight
- : styles.channelItemIconUnselected,
- ),
- },
- voiceLocked ? {locked: true} : channelIsE2EEEncrypted ? {e2eeEncrypted: true} : undefined,
+ {className: clsx(styles.channelItemIcon, channelIconStateClass)},
+ channelIconOptions,
);
const typingIndicatorNode =
!channelIsCategory &&
diff --git a/fluxer_app/src/features/app/components/layout/FavoritesChannelListContent.tsx b/fluxer_app/src/features/app/components/layout/FavoritesChannelListContent.tsx
index 8d38ab604..997f72f83 100644
--- a/fluxer_app/src/features/app/components/layout/FavoritesChannelListContent.tsx
+++ b/fluxer_app/src/features/app/components/layout/FavoritesChannelListContent.tsx
@@ -272,6 +272,49 @@ const FavoriteChannelResolvedItem = observer(
);
};
const canInvite = channel.guildId && InviteUtils.canInviteToChannel(channel.id, channel.guildId);
+ let avatarNode: React.ReactNode;
+ if (isGroupDM) {
+ avatarNode = (
+ <GroupDMAvatar
+ channel={channel}
+ size={24}
+ data-flx="app.favorites-channel-list-content.favorite-channel-item.group-dm-avatar"
+ />
+ );
+ } else if (recipient) {
+ avatarNode = (
+ <StatusAwareAvatar
+ user={recipient}
+ size={24}
+ isTyping={isTyping}
+ showOffline={true}
+ className={favoritesChannelListStyles.avatar}
+ data-flx="app.favorites-channel-list-content.favorite-channel-item.status-aware-avatar"
+ />
+ );
+ } else if (guild) {
+ avatarNode = (
+ <GuildIcon
+ id={guild.id}
+ name={guild.name}
+ icon={guild.icon}
+ className={favoritesChannelListStyles.avatar}
+ sizePx={24}
+ containerProps={{'aria-hidden': true}}
+ data-flx="app.favorites-channel-list-content.favorite-channel-item.guild-icon"
+ />
+ );
+ } else {
+ avatarNode = (
+ <div
+ className={favoritesChannelListStyles.avatarPlaceholder}
+ aria-hidden
+ data-flx="app.favorites-channel-list-content.favorite-channel-item.div--4"
+ >
+ {i18n._(DIRECT_MESSAGE_ABBREVIATION_DESCRIPTOR)}
+ </div>
+ );
+ }
return (
<GenericChannelItem
ref={refs}
@@ -317,40 +360,7 @@ const FavoriteChannelResolvedItem = observer(
className={favoritesChannelListStyles.avatarContainer}
data-flx="app.favorites-channel-list-content.favorite-channel-item.div--3"
>
- {isGroupDM ? (
- <GroupDMAvatar
- channel={channel}
- size={24}
- data-flx="app.favorites-channel-list-content.favorite-channel-item.group-dm-avatar"
- />
- ) : recipient ? (
- <StatusAwareAvatar
- user={recipient}
- size={24}
- isTyping={isTyping}
- showOffline={true}
- className={favoritesChannelListStyles.avatar}
- data-flx="app.favorites-channel-list-content.favorite-channel-item.status-aware-avatar"
- />
- ) : guild ? (
- <GuildIcon
- id={guild.id}
- name={guild.name}
- icon={guild.icon}
- className={favoritesChannelListStyles.avatar}
- sizePx={24}
- containerProps={{'aria-hidden': true}}
- data-flx="app.favorites-channel-list-content.favorite-channel-item.guild-icon"
- />
- ) : (
- <div
- className={favoritesChannelListStyles.avatarPlaceholder}
- aria-hidden
- data-flx="app.favorites-channel-list-content.favorite-channel-item.div--4"
- >
- {i18n._(DIRECT_MESSAGE_ABBREVIATION_DESCRIPTOR)}
- </div>
- )}
+ {avatarNode}
{!channel.isPrivate() && (
<div
className={clsx(
diff --git a/fluxer_app/src/features/app/components/layout/VoiceStateIcons.tsx b/fluxer_app/src/features/app/components/layout/VoiceStateIcons.tsx
index 6f6c22cb8..05f508758 100644
--- a/fluxer_app/src/features/app/components/layout/VoiceStateIcons.tsx
+++ b/fluxer_app/src/features/app/components/layout/VoiceStateIcons.tsx
@@ -47,11 +47,14 @@ export const VoiceStateIcons = observer(
className,
}: Props) => {
const {i18n} = useLingui();
- const muteLabel = isGuildMuted
- ? i18n._(VOICE_MUTED_BY_MODERATORS_DESCRIPTOR)
- : isPermissionMuted
- ? getVoiceNoSpeakPermissionLabel(i18n, isCurrentUser)
- : i18n._(MUTED_DESCRIPTOR);
+ let muteLabel: string;
+ if (isGuildMuted) {
+ muteLabel = i18n._(VOICE_MUTED_BY_MODERATORS_DESCRIPTOR);
+ } else if (isPermissionMuted) {
+ muteLabel = getVoiceNoSpeakPermissionLabel(i18n, isCurrentUser);
+ } else {
+ muteLabel = i18n._(MUTED_DESCRIPTOR);
+ }
const muteClassName = isGuildMuted || isPermissionMuted ? styles.iconGuildAction : styles.iconMuted;
const deafenLabel = isGuildDeafened
? getVoiceDeafenedByModeratorsStatusLabel(i18n, isCurrentUser)
diff --git a/fluxer_app/src/features/app/components/layout/app_layout/nagbars/DomainMovedNagbar.tsx b/fluxer_app/src/features/app/components/layout/app_layout/nagbars/DomainMovedNagbar.tsx
index 338a14663..c9b73c936 100644
--- a/fluxer_app/src/features/app/components/layout/app_layout/nagbars/DomainMovedNagbar.tsx
+++ b/fluxer_app/src/features/app/components/layout/app_layout/nagbars/DomainMovedNagbar.tsx
@@ -21,6 +21,7 @@ import {isIOSMobileOrTabletUserAgent} from '@app/features/platform/notifications
import {msg} from '@lingui/core/macro';
import {useLingui} from '@lingui/react/macro';
import {observer} from 'mobx-react-lite';
+import type React from 'react';
import {useCallback} from 'react';
type DomainMovedPresentation = 'install' | 'browser' | 'apple' | 'generic';
@@ -123,6 +124,44 @@ export const DomainMovedNagbar = observer(({isMobile}: {isMobile: boolean}) => {
{i18n._(LINK_NEW_DEVICE_DESCRIPTOR)}
</NagbarButton>
);
+ let actions: React.ReactNode;
+ if (presentation === 'install') {
+ actions = (
+ <NagbarButton
+ isMobile={isMobile}
+ onClick={handleInstall}
+ data-flx="app.app-layout.nagbars.domain-moved-nagbar.nagbar-button.install"
+ >
+ {i18n._(INSTALL_NEW_APP_DESCRIPTOR)}
+ </NagbarButton>
+ );
+ } else if (presentation === 'browser') {
+ actions = (
+ <>
+ {linkDeviceButton}
+ <NagbarButton
+ isMobile={isMobile}
+ onClick={handleOpenInBrowser}
+ data-flx="app.app-layout.nagbars.domain-moved-nagbar.nagbar-button.open-in-browser"
+ >
+ {i18n._(OPEN_IN_BROWSER_DESCRIPTOR, values)}
+ </NagbarButton>
+ </>
+ );
+ } else {
+ actions = (
+ <>
+ {linkDeviceButton}
+ <NagbarButton
+ isMobile={isMobile}
+ onClick={handleShowSteps}
+ data-flx="app.app-layout.nagbars.domain-moved-nagbar.nagbar-button.show-steps"
+ >
+ {i18n._(SHOW_ME_HOW_DESCRIPTOR)}
+ </NagbarButton>
+ </>
+ );
+ }
return (
<Nagbar
isMobile={isMobile}
@@ -136,39 +175,7 @@ export const DomainMovedNagbar = observer(({isMobile}: {isMobile: boolean}) => {
isMobile={isMobile}
onDismiss={handleDismiss}
message={i18n._(MESSAGE_DESCRIPTORS[presentation], values)}
- actions={
- presentation === 'install' ? (
- <NagbarButton
- isMobile={isMobile}
- onClick={handleInstall}
- data-flx="app.app-layout.nagbars.domain-moved-nagbar.nagbar-button.install"
- >
- {i18n._(INSTALL_NEW_APP_DESCRIPTOR)}
- </NagbarButton>
- ) : presentation === 'browser' ? (
- <>
- {linkDeviceButton}
- <NagbarButton
- isMobile={isMobile}
- onClick={handleOpenInBrowser}
- data-flx="app.app-layout.nagbars.domain-moved-nagbar.nagbar-button.open-in-browser"
- >
- {i18n._(OPEN_IN_BROWSER_DESCRIPTOR, values)}
- </NagbarButton>
- </>
- ) : (
- <>
- {linkDeviceButton}
- <NagbarButton
- isMobile={isMobile}
- onClick={handleShowSteps}
- data-flx="app.app-layout.nagbars.domain-moved-nagbar.nagbar-button.show-steps"
- >
- {i18n._(SHOW_ME_HOW_DESCRIPTOR)}
- </NagbarButton>
- </>
- )
- }
+ actions={actions}
data-flx="app.app-layout.nagbars.domain-moved-nagbar.nagbar-content"
/>
</Nagbar>
diff --git a/fluxer_app/src/features/app/components/layout/app_layout/nagbars/ScheduledMaintenanceNagbar.tsx b/fluxer_app/src/features/app/components/layout/app_layout/nagbars/ScheduledMaintenanceNagbar.tsx
index dda3538b7..f2189b6f4 100644
--- a/fluxer_app/src/features/app/components/layout/app_layout/nagbars/ScheduledMaintenanceNagbar.tsx
+++ b/fluxer_app/src/features/app/components/layout/app_layout/nagbars/ScheduledMaintenanceNagbar.tsx
@@ -61,12 +61,12 @@ function formatMaintenanceTimeLabel(value: string, locale: string): string {
function formatMaintenanceDurationLabel(durationMinutes: number, locale: string): string {
const normalizedDurationMinutes = Math.max(1, Math.round(durationMinutes));
- const durationParts =
- normalizedDurationMinutes % (HOURS_PER_DAY * MINUTES_PER_HOUR) === 0
- ? {value: normalizedDurationMinutes / (HOURS_PER_DAY * MINUTES_PER_HOUR), unit: 'day'}
- : normalizedDurationMinutes % MINUTES_PER_HOUR === 0
- ? {value: normalizedDurationMinutes / MINUTES_PER_HOUR, unit: 'hour'}
- : {value: normalizedDurationMinutes, unit: 'minute'};
+ let durationParts = {value: normalizedDurationMinutes, unit: 'minute'};
+ if (normalizedDurationMinutes % (HOURS_PER_DAY * MINUTES_PER_HOUR) === 0) {
+ durationParts = {value: normalizedDurationMinutes / (HOURS_PER_DAY * MINUTES_PER_HOUR), unit: 'day'};
+ } else if (normalizedDurationMinutes % MINUTES_PER_HOUR === 0) {
+ durationParts = {value: normalizedDurationMinutes / MINUTES_PER_HOUR, unit: 'hour'};
+ }
try {
return getCachedNumberFormat(locale, {
style: 'unit',
diff --git a/fluxer_app/src/features/app/components/layout/utils/ChannelMoveOperation.ts b/fluxer_app/src/features/app/components/layout/utils/ChannelMoveOperation.ts
index ddc71e0e4..d30b6c9f2 100644
--- a/fluxer_app/src/features/app/components/layout/utils/ChannelMoveOperation.ts
+++ b/fluxer_app/src/features/app/components/layout/utils/ChannelMoveOperation.ts
@@ -1,7 +1,10 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import type {DragItem, DropResult} from '@app/features/app/components/layout/types/DndTypes';
-import {isTextChannel} from '@app/features/app/components/layout/utils/ChannelOrganization';
+import {
+ isCategory as isCategoryChannel,
+ isTextChannel,
+} from '@app/features/app/components/layout/utils/ChannelOrganization';
import type {Channel} from '@app/features/channel/models/Channel';
import {ChannelTypes} from '@fluxer/constants/src/ChannelConstants';
import {
@@ -9,7 +12,6 @@ import {
sortChannelsForOrdering,
} from '@fluxer/schema/src/domains/channel/GuildChannelOrdering';
-const isCategoryChannel = (channel: Channel) => channel.type === ChannelTypes.GUILD_CATEGORY;
const gatherCategoryBlock = (channels: ReadonlyArray<Channel>, categoryId: string) => {
return channels.filter((ch) => ch.id === categoryId || ch.parentId === categoryId);
};
@@ -65,14 +67,16 @@ export const createChannelMoveOperation = ({
const block = isCategory ? gatherCategoryBlock(orderedChannels, draggedChannel.id) : [draggedChannel];
if (block.length === 0) return null;
const targetId = dropResult.targetId;
- const requestedParentId =
- targetId === 'null-space'
- ? null
- : dropResult.targetParentId !== undefined
- ? dropResult.targetParentId
- : isCategory
- ? null
- : (draggedChannel.parentId ?? null);
+ let requestedParentId: string | null;
+ if (targetId === 'null-space') {
+ requestedParentId = null;
+ } else if (dropResult.targetParentId !== undefined) {
+ requestedParentId = dropResult.targetParentId;
+ } else if (isCategory) {
+ requestedParentId = null;
+ } else {
+ requestedParentId = draggedChannel.parentId ?? null;
+ }
let newParentId = isCategory ? null : requestedParentId;
if (!isCategory && newParentId === undefined) {
newParentId = draggedChannel.parentId ?? null;
diff --git a/fluxer_app/src/features/app/domain_migration/DomainMigrationDeviceRemap.ts b/fluxer_app/src/features/app/domain_migration/DomainMigrationDeviceRemap.ts
index b82ceeed2..4497ef903 100644
--- a/fluxer_app/src/features/app/domain_migration/DomainMigrationDeviceRemap.ts
+++ b/fluxer_app/src/features/app/domain_migration/DomainMigrationDeviceRemap.ts
@@ -22,8 +22,12 @@ let installed = false;
let pendingDeviceMap: DomainMigrationDeviceMap | null = null;
function devicesOfKind(state: VoiceDeviceState, kind: DomainMigrationMediaDeviceKind): Array<MediaDeviceInfo> {
- const devices =
- kind === 'audioinput' ? state.inputDevices : kind === 'audiooutput' ? state.outputDevices : state.videoDevices;
+ let devices = state.videoDevices;
+ if (kind === 'audioinput') {
+ devices = state.inputDevices;
+ } else if (kind === 'audiooutput') {
+ devices = state.outputDevices;
+ }
return devices.filter(
(device) =>
device.deviceId.trim().length > 0 &&
diff --git a/fluxer_app/src/features/platform/components/router/RouterReact.tsx b/fluxer_app/src/features/platform/components/router/RouterReact.tsx
index 74bd392b5..1bdce0e00 100644
--- a/fluxer_app/src/features/platform/components/router/RouterReact.tsx
+++ b/fluxer_app/src/features/platform/components/router/RouterReact.tsx
@@ -157,11 +157,12 @@ export const Outlet: React.FC = () => {
url: location,
};
const isLeaf = index === matches.length - 1;
- const child = isLeaf
- ? match.route.component
- ? React.createElement(match.route.component, props)
- : null
- : renderAt(index + 1);
+ let child: React.ReactNode = null;
+ if (!isLeaf) {
+ child = renderAt(index + 1);
+ } else if (match.route.component) {
+ child = React.createElement(match.route.component, props);
+ }
const Layout = match.route.layout;
if (Layout) {
return (
diff --git a/fluxer_app/src/features/platform/state/LegacyHarvestValueDecoder.ts b/fluxer_app/src/features/platform/state/LegacyHarvestValueDecoder.ts
index 6629314f1..a85eb61b2 100644
--- a/fluxer_app/src/features/platform/state/LegacyHarvestValueDecoder.ts
+++ b/fluxer_app/src/features/platform/state/LegacyHarvestValueDecoder.ts
@@ -103,7 +103,12 @@ function decodeBase64(value: unknown, context: LegacyHarvestValueContext): Uint8
if (typeof value !== 'string' || value.length % 4 !== 0 || !BASE64_PATTERN.test(value)) {
throw new LegacyHarvestValueError();
}
- const padding = value.endsWith('==') ? 2 : value.endsWith('=') ? 1 : 0;
+ let padding = 0;
+ if (value.endsWith('==')) {
+ padding = 2;
+ } else if (value.endsWith('=')) {
+ padding = 1;
+ }
if ((value.length / 4) * 3 - padding > MAX_BINARY_BYTES) {
throw new LegacyHarvestValueError();
}