A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
feat(app): show other-account results in the quick switcher
Hampus05a10041d50b
diff --git a/fluxer_app/src/features/search/commands/QuickSwitcherCommands.tsx b/fluxer_app/src/features/search/commands/QuickSwitcherCommands.tsxindex 158046a0f..753763a6f 100644--- a/fluxer_app/src/features/search/commands/QuickSwitcherCommands.tsx+++ b/fluxer_app/src/features/search/commands/QuickSwitcherCommands.tsx@@ -2,6 +2,7 @@import {Routes} from '@app/app/Routes';import {UserSettingsModal} from '@app/features/app/components/dialogs/LoadableSettingsModals';+import {switchToSavedAccount} from '@app/features/auth/utils/AccountSwitcherModalUtils';import * as PrivateChannelCommands from '@app/features/channel/commands/PrivateChannelCommands';import {focusChannelTextareaAfterNavigation} from '@app/features/messaging/utils/ChannelTextareaFocusUtils';import {goToMessage, parseMessagePath} from '@app/features/messaging/utils/MessageNavigator';@@ -40,9 +41,25 @@ export async function confirmSelection(): Promise<void> {await switchTo(result);}+export async function switchToOtherAccount(accountKey: string, redirectAfterSwitch?: string): Promise<void> {+ await switchToSavedAccount({+ accountKey,+ redirectAfterSwitch,+ onSelectCurrent: redirectAfterSwitch === undefined ? null : () => RouterUtils.transitionTo(redirectAfterSwitch),+ });+}+export async function switchTo(result: QuickSwitcherExecutableResult): Promise<void> {try {switch (result.type) {+ case QuickSwitcherResultTypes.ACCOUNT: {+ void switchToOtherAccount(result.accountKey);+ break;+ }+ case QuickSwitcherResultTypes.ACCOUNT_CHANNEL: {+ void switchToOtherAccount(result.accountKey, Routes.guildChannel(result.guildId ?? ME, result.channelId));+ break;+ }case QuickSwitcherResultTypes.USER: {const channelId = result.dmChannelId ?? (await PrivateChannelCommands.ensureDMChannel(result.user.id));NavigationCommands.selectChannel(ME, channelId);diff --git a/fluxer_app/src/features/search/components/bottomsheets/QuickSwitcherBottomSheet.module.css b/fluxer_app/src/features/search/components/bottomsheets/QuickSwitcherBottomSheet.module.cssindex 179ba72b1..593ec85db 100644--- a/fluxer_app/src/features/search/components/bottomsheets/QuickSwitcherBottomSheet.module.css+++ b/fluxer_app/src/features/search/components/bottomsheets/QuickSwitcherBottomSheet.module.css@@ -95,11 +95,24 @@font-size: 0.75rem;font-weight: 600;color: var(--text-primary-muted);- text-transform: uppercase;- letter-spacing: 0.04em;margin-bottom: 0.35rem;}+.sectionHeaderAccount {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ text-transform: none;+ letter-spacing: normal;+}++.sectionHeaderAccountName {+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.sectionList {display: flex;flex-direction: column;@@ -116,7 +129,7 @@border-radius: var(--radius-md);padding: 0.25rem 0.25rem;cursor: pointer;- text-align: left;+ text-align: start;}.optionContent {diff --git a/fluxer_app/src/features/search/components/bottomsheets/QuickSwitcherBottomSheet.tsx b/fluxer_app/src/features/search/components/bottomsheets/QuickSwitcherBottomSheet.tsxindex e190c8cca..c1afe03d0 100644--- a/fluxer_app/src/features/search/components/bottomsheets/QuickSwitcherBottomSheet.tsx+++ b/fluxer_app/src/features/search/components/bottomsheets/QuickSwitcherBottomSheet.tsx@@ -19,6 +19,7 @@ import {handleContextMenu,type QuickSwitcherSection,renderIcon,+ renderSectionHeaderContent,useQuickSwitcherInputFocus,} from '@app/features/search/utils/QuickSwitcherModalUtils';import {CloseIcon, SearchIcon} from '@app/features/ui/action_menu/ContextMenuIcons';@@ -145,10 +146,10 @@ const ResultRow = observer(return (<divkey={getResultKey(result)}- className={styles.sectionHeader}+ className={clsx(styles.sectionHeader, result.accountKey != null && styles.sectionHeaderAccount)}data-flx="search.quick-switcher-bottom-sheet.result-row.section-header">- {result.title}+ {renderSectionHeaderContent(result, styles.sectionHeaderAccountName)}</div>);}@@ -164,8 +165,21 @@ const ResultRow = observer(onConfirm(executableResult);};const iconRendered = renderIcon(executableResult, isHighlight, styles.optionIcon, styles.optionIconHighlight);- const iconContent: React.ReactElement = iconRendered.content;+ let iconContent: React.ReactElement = iconRendered.content;const key = `${executableResult.type}-${executableResult.id}`;+ if (iconRendered.type === 'avatar') {+ iconContent = (+ <div className={styles.avatar} data-flx="search.quick-switcher-bottom-sheet.result-row.avatar">+ {iconContent}+ </div>+ );+ } else if (iconRendered.type === 'guild') {+ iconContent = (+ <div className={styles.guildIcon} data-flx="search.quick-switcher-bottom-sheet.result-row.guild-icon">+ {iconContent}+ </div>+ );+ }return (<FocusRing offset={-2} enabled={false} data-flx="search.quick-switcher-bottom-sheet.result-row.focus-ring"><button@@ -190,17 +204,7 @@ const ResultRow = observer(data-flx="search.quick-switcher-bottom-sheet.result-row.option.click.button"><div className={styles.optionContent} data-flx="search.quick-switcher-bottom-sheet.result-row.option-content">- {iconRendered.type === 'avatar' ? (- <div className={styles.avatar} data-flx="search.quick-switcher-bottom-sheet.result-row.avatar">- {iconContent}- </div>- ) : iconRendered.type === 'guild' ? (- <div className={styles.guildIcon} data-flx="search.quick-switcher-bottom-sheet.result-row.guild-icon">- {iconContent}- </div>- ) : (- iconContent- )}+ {iconContent}<divclassName={clsx(styles.optionText, isHighlight && styles.optionHighlight)}data-flx="search.quick-switcher-bottom-sheet.result-row.option-text"@@ -379,15 +383,16 @@ export const QuickSwitcherBottomSheet: React.FC<QuickSwitcherBottomSheetProps> =isSearchTab && keyboardFocusIndex >= 0 && results[keyboardFocusIndex]?.type !== QuickSwitcherResultTypes.HEADER? getQuickSwitcherOptionId(listboxId, keyboardFocusIndex): undefined;- const resultStatus = QuickSwitcher.isLoadingMemberResults- ? i18n._(SEARCHING_PEOPLE_DESCRIPTOR)- : resultCount === 0- ? hasSearchIntent- ? i18n._(NO_MATCHES_FOUND_DESCRIPTOR)- : ''- : resultCount === 1- ? i18n._(MESSAGE_1_RESULT_AVAILABLE_DESCRIPTOR)- : i18n._(RESULTS_AVAILABLE_DESCRIPTOR, {resultCount});+ let resultStatus = '';+ if (QuickSwitcher.isLoadingMemberResults) {+ resultStatus = i18n._(SEARCHING_PEOPLE_DESCRIPTOR);+ } else if (resultCount === 0) {+ if (hasSearchIntent) resultStatus = i18n._(NO_MATCHES_FOUND_DESCRIPTOR);+ } else if (resultCount === 1) {+ resultStatus = i18n._(MESSAGE_1_RESULT_AVAILABLE_DESCRIPTOR);+ } else {+ resultStatus = i18n._(RESULTS_AVAILABLE_DESCRIPTOR, {resultCount});+ }const activeSuggestionStatus = useMemo(() => {if (!isSearchTab) {return '';@@ -578,10 +583,13 @@ export const QuickSwitcherBottomSheet: React.FC<QuickSwitcherBottomSheetProps> ={section.header && (<divid={`${listboxId}-${section.key}`}- className={styles.sectionHeader}+ className={clsx(+ styles.sectionHeader,+ section.header.accountKey != null && styles.sectionHeaderAccount,+ )}data-flx="search.quick-switcher-bottom-sheet.section-header">- {section.header.title}+ {renderSectionHeaderContent(section.header, styles.sectionHeaderAccountName)}</div>)}<divdiff --git a/fluxer_app/src/features/search/components/quick_switcher/OtherAccountAvatar.module.css b/fluxer_app/src/features/search/components/quick_switcher/OtherAccountAvatar.module.cssnew file mode 100644index 000000000..c75e4ace0--- /dev/null+++ b/fluxer_app/src/features/search/components/quick_switcher/OtherAccountAvatar.module.css@@ -0,0 +1,48 @@+/* SPDX-License-Identifier: AGPL-3.0-or-later */++.frame {+ --account-icon-size: 1.5rem;+ --account-badge-size: calc(var(--account-icon-size) * 0.5625);+ --account-badge-offset: calc(var(--account-icon-size) * -0.09375);+ --account-badge-center: calc(var(--account-icon-size) - var(--account-badge-size) / 2 - var(--account-badge-offset));+ --account-badge-cutout: calc(var(--account-badge-size) / 2 + var(--account-icon-size) * 0.0625);+ position: relative;+ display: flex;+ flex-shrink: 0;+ width: var(--account-icon-size);+ height: var(--account-icon-size);+}++.cutout {+ display: flex;+ width: 100%;+ height: 100%;+ mask-image: radial-gradient(+ circle at var(--account-badge-center) var(--account-badge-center),+ transparent var(--account-badge-cutout),+ #000 calc(var(--account-badge-cutout) + 0.03125rem)+ );+}++.badge {+ position: absolute;+ right: var(--account-badge-offset);+ bottom: var(--account-badge-offset);+ display: flex;+ align-items: center;+ justify-content: center;+ width: var(--account-badge-size);+ height: var(--account-badge-size);+ border-radius: 50%;+ background-color: var(--background-tertiary);+ color: var(--text-primary-muted);+}++.badgeHighlighted {+ color: var(--text-primary);+}++.badgeIcon {+ width: calc(var(--account-icon-size) * 0.375);+ height: calc(var(--account-icon-size) * 0.375);+}diff --git a/fluxer_app/src/features/search/components/quick_switcher/OtherAccountAvatar.tsx b/fluxer_app/src/features/search/components/quick_switcher/OtherAccountAvatar.tsxnew file mode 100644index 000000000..eaefee720--- /dev/null+++ b/fluxer_app/src/features/search/components/quick_switcher/OtherAccountAvatar.tsx@@ -0,0 +1,71 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import {useAccountAvatarURL} from '@app/features/auth/AccountAvatarUtils';+import Accounts from '@app/features/auth/state/Accounts';+import * as ChannelUtils from '@app/features/channel/utils/ChannelUtils';+import type {Account} from '@app/features/platform/state/AuthSession';+import styles from '@app/features/search/components/quick_switcher/OtherAccountAvatar.module.css';+import {MockAvatar} from '@app/features/ui/components/MockAvatar';+import {ChannelTypes} from '@fluxer/constants/src/ChannelConstants';+import type {MediaProxyImageSize} from '@fluxer/constants/src/MediaProxyImageSizes';+import {AtIcon, UsersIcon} from '@phosphor-icons/react';+import {clsx} from 'clsx';+import {observer} from 'mobx-react-lite';++type OtherAccountAvatarSize = 16 | 24 | 32;++const IMAGE_SIZE: Record<OtherAccountAvatarSize, MediaProxyImageSize> = {16: 32, 24: 48, 32: 64};++const AccountAvatarImage = ({account, size}: {account: Account; size: OtherAccountAvatarSize}) => {+ const avatarUrl = useAccountAvatarURL(account, IMAGE_SIZE[size]);+ return (+ <MockAvatar+ size={size}+ avatarUrl={avatarUrl}+ userTag={account.userData?.username ?? account.userId}+ data-flx="search.other-account-avatar.mock-avatar"+ />+ );+};++export const OtherAccountAvatar = observer(({accountKey, size}: {accountKey: string; size: OtherAccountAvatarSize}) => {+ const account = Accounts.getAccount(accountKey);+ if (account == null) {+ return <MockAvatar size={size} data-flx="search.other-account-avatar.fallback" />;+ }+ return <AccountAvatarImage account={account} size={size} data-flx="search.other-account-avatar.image" />;+});++function channelTypeIcon(channelType: number) {+ if (channelType === ChannelTypes.DM) {+ return <AtIcon weight="bold" className={styles.badgeIcon} data-flx="search.other-account-channel-icon.at-icon" />;+ }+ if (channelType === ChannelTypes.GROUP_DM) {+ return (+ <UsersIcon weight="bold" className={styles.badgeIcon} data-flx="search.other-account-channel-icon.users-icon" />+ );+ }+ return ChannelUtils.getIcon({type: channelType}, {className: styles.badgeIcon, weight: 'bold'});+}++export const OtherAccountChannelIcon = ({+ accountKey,+ channelType,+ highlighted,+}: {+ accountKey: string;+ channelType: number;+ highlighted: boolean;+}) => (+ <div className={styles.frame} data-flx="search.other-account-channel-icon.frame">+ <div className={styles.cutout} data-flx="search.other-account-channel-icon.cutout">+ <OtherAccountAvatar accountKey={accountKey} size={24} data-flx="search.other-account-channel-icon.avatar" />+ </div>+ <div+ className={clsx(styles.badge, highlighted && styles.badgeHighlighted)}+ data-flx="search.other-account-channel-icon.badge"+ >+ {channelTypeIcon(channelType)}+ </div>+ </div>+);diff --git a/fluxer_app/src/features/search/components/quick_switcher/QuickSwitcherModal.module.css b/fluxer_app/src/features/search/components/quick_switcher/QuickSwitcherModal.module.cssindex de8ab0a03..ea434e7ef 100644--- a/fluxer_app/src/features/search/components/quick_switcher/QuickSwitcherModal.module.css+++ b/fluxer_app/src/features/search/components/quick_switcher/QuickSwitcherModal.module.css@@ -7,7 +7,7 @@align-items: center;border: none;background: transparent;- text-align: left;+ text-align: start;border-radius: var(--radius-sm);padding: 0 0.5rem;cursor: pointer;@@ -87,8 +87,6 @@}.optionCategory {- text-transform: uppercase;- letter-spacing: 0.02em;font-size: var(--qs-category-size, 0.5625rem);font-weight: 600;color: var(--qs-subtext-muted-colour, var(--text-tertiary));@@ -100,11 +98,11 @@}.optionMeta {- margin-left: auto;+ margin-inline-start: auto;max-width: 10rem;min-width: 0;flex: 0 1 10rem;- text-align: right;+ text-align: end;font-size: var(--qs-meta-size, 0.8125rem);line-height: 1rem;font-weight: var(--qs-meta-weight, 400);@@ -177,8 +175,31 @@font-size: 0.6875rem;font-weight: 600;color: var(--text-tertiary);- letter-spacing: 0.05em;- text-transform: uppercase;+}++.sectionHeaderAccount {+ justify-content: flex-start;+ gap: 0.5rem;+ padding-top: 0.5rem;+ font-size: 0.75rem;+ color: var(--text-secondary);+ letter-spacing: normal;+ text-transform: none;+}++.sectionHeaderAccountName {+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}++.optionUnreadDot {+ width: 0.5rem;+ height: 0.5rem;+ flex-shrink: 0;+ border-radius: 50%;+ background-color: var(--text-primary);}.modalRoot {@@ -297,8 +318,8 @@border-radius: 0.25rem;border: 0.0625rem solid var(--background-modifier-accent);background-color: var(--background-primary);- padding-left: 0.25rem;- padding-right: 0.25rem;+ padding-inline-start: 0.25rem;+ padding-inline-end: 0.25rem;font-size: 0.6875rem;line-height: 1.25rem;color: var(--qs-text-primary, var(--text-primary));diff --git a/fluxer_app/src/features/search/components/quick_switcher/QuickSwitcherModal.tsx b/fluxer_app/src/features/search/components/quick_switcher/QuickSwitcherModal.tsxindex fe829894c..73dbea06a 100644--- a/fluxer_app/src/features/search/components/quick_switcher/QuickSwitcherModal.tsx+++ b/fluxer_app/src/features/search/components/quick_switcher/QuickSwitcherModal.tsx@@ -15,9 +15,11 @@ import {getQuickSwitcherResultAccessibilityMetadata,getResultKey,handleContextMenu,+ isOtherAccountResult,PREFIX_HINTS,type QuickSwitcherSection,renderIcon,+ renderSectionHeaderContent,useQuickSwitcherEscapeIntent,useQuickSwitcherInputFocus,useQuickSwitcherKeyboardHandling,@@ -83,6 +85,14 @@ const SEARCH_FOR_CHANNELS_PEOPLE_OR_COMMUNITIES_DESCRIPTOR = msg({message: 'Search for channels, people, or communities',comment: 'Placeholder text in the desktop quick switcher search input.',});+const SEARCH_OTHER_ACCOUNTS_DESCRIPTOR = msg({+ message: 'Search other accounts',+ comment: 'Placeholder text in the desktop quick switcher when it only searches the other signed-in accounts.',+});+const NO_OTHER_ACCOUNTS_DESCRIPTOR = msg({+ message: 'No other accounts are signed in',+ comment: 'Empty state title in the desktop quick switcher when it only searches other accounts and there are none.',+});const QUICK_SWITCHER_SEARCH_DESCRIPTOR = msg({message: 'Quick switcher search',comment: 'Accessible label for the desktop quick switcher search input region.',@@ -143,10 +153,10 @@ const ResultRow = observer(return (<divkey={getResultKey(result)}- className={quickStyles.sectionHeader}+ className={clsx(quickStyles.sectionHeader, result.accountKey != null && quickStyles.sectionHeaderAccount)}data-flx="search.quick-switcher.quick-switcher-modal.result-row.div">- {result.title}+ {renderSectionHeaderContent(result, quickStyles.sectionHeaderAccountName)}</div>);}@@ -155,11 +165,14 @@ const ResultRow = observer(const {guildName, isChannel, isUser, label: optionLabel, mentionCount, subtext, unreadCount} = resultMetadata;const hasUnread = unreadCount > 0 || mentionCount > 0;const isActive = isKeyboardSelected;+ const isOtherAccount = isOtherAccountResult(executableResult);const isHighlight =hasUnread &&(executableResult.type === QuickSwitcherResultTypes.TEXT_CHANNEL ||executableResult.type === QuickSwitcherResultTypes.VOICE_CHANNEL ||- executableResult.type === QuickSwitcherResultTypes.GROUP_DM);+ executableResult.type === QuickSwitcherResultTypes.GROUP_DM ||+ executableResult.type === QuickSwitcherResultTypes.ACCOUNT_CHANNEL);+ const showUnreadDot = isOtherAccount && mentionCount === 0 && unreadCount > 0;const handleMouseEnter = () => onHover(index);const handleClick = (event: React.MouseEvent) => {event.preventDefault();@@ -178,8 +191,21 @@ const ResultRow = observer(quickStyles.optionIcon,quickStyles.optionIconHighlight,);- const iconContent: React.ReactElement = iconRendered.content;+ let iconContent: React.ReactElement = iconRendered.content;const key = `${executableResult.type}-${executableResult.id}`;+ if (iconRendered.type === 'avatar') {+ iconContent = (+ <div className={quickStyles.avatar} data-flx="search.quick-switcher.quick-switcher-modal.result-row.div--3">+ {iconContent}+ </div>+ );+ } else if (iconRendered.type === 'guild') {+ iconContent = (+ <div className={quickStyles.guildIcon} data-flx="search.quick-switcher.quick-switcher-modal.result-row.div--4">+ {iconContent}+ </div>+ );+ }return (<FocusRing offset={-2} data-flx="search.quick-switcher.quick-switcher-modal.result-row.focus-ring"><div@@ -205,23 +231,7 @@ const ResultRow = observer(className={quickStyles.optionContent}data-flx="search.quick-switcher.quick-switcher-modal.result-row.div--2">- {iconRendered.type === 'avatar' ? (- <div- className={quickStyles.avatar}- data-flx="search.quick-switcher.quick-switcher-modal.result-row.div--3"- >- {iconContent}- </div>- ) : iconRendered.type === 'guild' ? (- <div- className={quickStyles.guildIcon}- data-flx="search.quick-switcher.quick-switcher-modal.result-row.div--4"- >- {iconContent}- </div>- ) : (- iconContent- )}+ {iconContent}<divclassName={clsx(quickStyles.optionText, isHighlight && quickStyles.optionHighlight)}data-flx="search.quick-switcher.quick-switcher-modal.result-row.div--5"@@ -248,6 +258,13 @@ const ResultRow = observer(/></span>)}+ {showUnreadDot && (+ <span+ className={quickStyles.optionUnreadDot}+ aria-hidden="true"+ data-flx="search.quick-switcher.quick-switcher-modal.result-row.unread-dot"+ />+ )}{subtext && (<divclassName={clsx(@@ -264,6 +281,7 @@ const ResultRow = observer({guildName && (<divclassName={quickStyles.optionMeta}+ dir={isOtherAccount ? 'auto' : undefined}data-flx="search.quick-switcher.quick-switcher-modal.result-row.div--9">{guildName}@@ -278,7 +296,8 @@ const ResultRow = observer();const QuickSwitcherModalComponent: React.FC = observer(() => {const {i18n} = useLingui();- const {isOpen, query, results, selectedIndex} = QuickSwitcher;+ const {isOpen, query, results, scope, selectedIndex} = QuickSwitcher;+ const isOtherAccountsScope = scope === 'other_accounts';const quickSwitcherId = useId();const inputRef = useRef<HTMLInputElement>(null);const scrollerRef = useRef<ScrollerHandle>(null);@@ -398,15 +417,16 @@ const QuickSwitcherModalComponent: React.FC = observer(() => {? i18n._(AUTOCOMPLETE_SUGGESTION_OF_DESCRIPTOR, {label, selectedOptionPosition, resultCount}): i18n._(AUTOCOMPLETE_SUGGESTION_DESCRIPTOR, {label});}, [hasSearchIntent, i18n.locale, query, resultCount, results, selectedIndex, selectedOptionPosition]);- const resultStatus = QuickSwitcher.isLoadingMemberResults- ? i18n._(SEARCHING_PEOPLE_DESCRIPTOR)- : resultCount === 0- ? hasSearchIntent- ? i18n._(NO_MATCHES_FOUND_DESCRIPTOR)- : ''- : resultCount === 1- ? i18n._(MESSAGE_1_RESULT_AVAILABLE_DESCRIPTOR)- : i18n._(RESULTS_AVAILABLE_DESCRIPTOR, {resultCount});+ let resultStatus = '';+ if (QuickSwitcher.isLoadingMemberResults) {+ resultStatus = i18n._(SEARCHING_PEOPLE_DESCRIPTOR);+ } else if (resultCount === 0) {+ if (hasSearchIntent) resultStatus = i18n._(NO_MATCHES_FOUND_DESCRIPTOR);+ } else if (resultCount === 1) {+ resultStatus = i18n._(MESSAGE_1_RESULT_AVAILABLE_DESCRIPTOR);+ } else {+ resultStatus = i18n._(RESULTS_AVAILABLE_DESCRIPTOR, {resultCount});+ }if (!isOpen) {return null;}@@ -433,9 +453,9 @@ const QuickSwitcherModalComponent: React.FC = observer(() => {text={i18n._(QUICK_SWITCHER_DESCRIPTOR)}data-flx="search.quick-switcher.quick-switcher-modal.quick-switcher-modal-component.modal-screen-reader-label"/>- {/* biome-ignore lint/a11y/noStaticElementInteractions: pointer arbitration surface for the result rows; it has no affordance of its own. */}<divclassName={quickStyles.container}+ role="group"onMouseMove={handlePointerMove}data-flx="search.quick-switcher.quick-switcher-modal.quick-switcher-modal-component.div">@@ -449,7 +469,11 @@ const QuickSwitcherModalComponent: React.FC = observer(() => {value={query}onChange={handleChange}onKeyDown={handleKeyDown}- placeholder={i18n._(SEARCH_FOR_CHANNELS_PEOPLE_OR_COMMUNITIES_DESCRIPTOR)}+ placeholder={i18n._(+ isOtherAccountsScope+ ? SEARCH_OTHER_ACCOUNTS_DESCRIPTOR+ : SEARCH_FOR_CHANNELS_PEOPLE_OR_COMMUNITIES_DESCRIPTOR,+ )}spellCheck={false}className={quickStyles.inputBackground}role="combobox"@@ -494,7 +518,7 @@ const QuickSwitcherModalComponent: React.FC = observer(() => {>{activeSuggestionStatus}</div>- {results.length === 0 && !hasSearchIntent ? null : (+ {results.length === 0 && !hasSearchIntent && !isOtherAccountsScope ? null : (<Scrollerref={scrollerRef}className={quickStyles.scrollerContainer}@@ -513,14 +537,20 @@ const QuickSwitcherModalComponent: React.FC = observer(() => {className={quickStyles.emptyStateTitle}data-flx="search.quick-switcher.quick-switcher-modal.quick-switcher-modal-component.div--5">- {i18n._(NO_MATCHES_FOUND_DESCRIPTOR)}- </div>- <div- className={quickStyles.emptyStateHint}- data-flx="search.quick-switcher.quick-switcher-modal.quick-switcher-modal-component.div--6"- >- {i18n._(TRY_A_DIFFERENT_NAME_OR_USE_PREFIXES_TO_DESCRIPTOR)}+ {i18n._(+ isOtherAccountsScope && !hasSearchIntent+ ? NO_OTHER_ACCOUNTS_DESCRIPTOR+ : NO_MATCHES_FOUND_DESCRIPTOR,+ )}</div>+ {!isOtherAccountsScope && (+ <div+ className={quickStyles.emptyStateHint}+ data-flx="search.quick-switcher.quick-switcher-modal.quick-switcher-modal-component.div--6"+ >+ {i18n._(TRY_A_DIFFERENT_NAME_OR_USE_PREFIXES_TO_DESCRIPTOR)}+ </div>+ )}</div>) : (<div@@ -544,10 +574,13 @@ const QuickSwitcherModalComponent: React.FC = observer(() => {{section.header && (<divid={sectionHeaderId}- className={quickStyles.sectionHeader}+ className={clsx(+ quickStyles.sectionHeader,+ section.header.accountKey != null && quickStyles.sectionHeaderAccount,+ )}data-flx="search.quick-switcher.quick-switcher-modal.quick-switcher-modal-component.div--8">- {section.header.title}+ {renderSectionHeaderContent(section.header, quickStyles.sectionHeaderAccountName)}</div>)}{section.rows.map(({result, index}: {result: QuickSwitcherExecutableResult; index: number}) => (@@ -574,6 +607,7 @@ const QuickSwitcherModalComponent: React.FC = observer(() => {</div><divclassName={quickStyles.footer}+ hidden={isOtherAccountsScope}data-flx="search.quick-switcher.quick-switcher-modal.quick-switcher-modal-component.div--9"><Trans>diff --git a/fluxer_app/src/features/search/utils/QuickSwitcherModalUtils.tsx b/fluxer_app/src/features/search/utils/QuickSwitcherModalUtils.tsxindex 77add8237..38211e0b2 100644--- a/fluxer_app/src/features/search/utils/QuickSwitcherModalUtils.tsx+++ b/fluxer_app/src/features/search/utils/QuickSwitcherModalUtils.tsx@@ -9,9 +9,16 @@ import {shouldDisableAutofocusOnMobile} from '@app/features/platform/utils/Autofimport {isTextInputKeyEvent} from '@app/features/platform/utils/IsTextInputKeyEvent';import ReadStates from '@app/features/read_state/state/ReadStates';import * as QuickSwitcherCommands from '@app/features/search/commands/QuickSwitcherCommands';+import {+ OtherAccountAvatar,+ OtherAccountChannelIcon,+} from '@app/features/search/components/quick_switcher/OtherAccountAvatar';import QuickSwitcher from '@app/features/search/state/QuickSwitcher';+import {accountChannelAccessibleName} from '@app/features/search/state/QuickSwitcherAccountResults';import {type EscapeIntent, trackEscapeIntentUntilNextTask} from '@app/features/search/state/QuickSwitcherEscapeIntent';import type {+ AccountChannelResult,+ AccountResult,GroupDMResult,GuildResult,HeaderResult,@@ -30,6 +37,7 @@ import {GuildContextMenu} from '@app/features/ui/action_menu/GuildContextMenu';import {UserContextMenu} from '@app/features/ui/action_menu/UserContextMenu';import * as ContextMenuCommands from '@app/features/ui/commands/ContextMenuCommands';import {StatusAwareAvatar} from '@app/features/ui/components/StatusAwareAvatar';+import {ArrowRightIcon} from '@app/features/ui/icons/DirectionalIcons';import type {SegmentedTab} from '@app/features/ui/segmented_tabs/SegmentedTabs';import LayerManager from '@app/features/ui/state/LayerManager';import Modal from '@app/features/ui/state/Modal';@@ -38,7 +46,7 @@ import {ChannelTypes} from '@fluxer/constants/src/ChannelConstants';import {QuickSwitcherResultTypes} from '@fluxer/constants/src/QuickSwitcherConstants';import type {I18n} from '@lingui/core';import {msg} from '@lingui/core/macro';-import {ArrowRightIcon, HouseIcon, StarIcon, UsersIcon} from '@phosphor-icons/react';+import {HouseIcon, StarIcon, UsersIcon} from '@phosphor-icons/react';import {clsx} from 'clsx';import type React from 'react';import {useEffect, useLayoutEffect, useRef} from 'react';@@ -67,6 +75,11 @@ const MESSAGE_1_MENTION_DESCRIPTOR = msg({message: '1 mention',comment: 'Badge text on a quick switcher row when the channel has exactly one mention.',});+const HAS_UNREAD_MESSAGES_DESCRIPTOR = msg({+ message: 'Unread messages',+ comment:+ 'Accessible label suffix on a quick switcher row for another account that has unread messages but no mentions.',+});const UNREAD_DESCRIPTOR = msg({message: '{unreadCount, plural, one {# unread} other {# unread}}',comment: 'Badge text on a quick switcher row when the channel has unread messages. unreadCount is the integer count.',@@ -206,6 +219,29 @@ export function renderIcon(),};}+ case QuickSwitcherResultTypes.ACCOUNT:+ return {+ type: 'avatar' as const,+ content: (+ <OtherAccountAvatar+ accountKey={result.accountKey}+ size={QUICK_SWITCHER_ICON_SIZE}+ data-flx="search.quick-switcher-modal-utils.render-icon.other-account-avatar"+ />+ ),+ };+ case QuickSwitcherResultTypes.ACCOUNT_CHANNEL:+ return {+ type: 'avatar' as const,+ content: (+ <OtherAccountChannelIcon+ accountKey={result.accountKey}+ channelType={result.channelType}+ highlighted={isHighlight}+ data-flx="search.quick-switcher-modal-utils.render-icon.other-account-channel-icon"+ />+ ),+ };case QuickSwitcherResultTypes.LINK:return {type: 'icon' as const,@@ -231,10 +267,40 @@ export function renderIcon(}}+function getOtherAccountResultAccessibilityMetadata(+ result: AccountResult | AccountChannelResult,+ i18n: I18n,+): QuickSwitcherResultAccessibilityMetadata {+ const isChannel = result.type === QuickSwitcherResultTypes.ACCOUNT_CHANNEL;+ const unread = isChannel ? result.unread : result.hasUnread;+ const labelParts = [isChannel ? accountChannelAccessibleName(result, i18n) : result.title];+ if (result.mentionCount > 0) {+ labelParts.push(+ result.mentionCount === 1+ ? i18n._(MESSAGE_1_MENTION_DESCRIPTOR)+ : i18n._(MENTION_COUNT_ARIA_DESCRIPTOR, {mentionCount: result.mentionCount}),+ );+ } else if (unread) {+ labelParts.push(i18n._(HAS_UNREAD_MESSAGES_DESCRIPTOR));+ }+ return {+ guildName: isChannel ? (result.subtitle ?? null) : null,+ isChannel: false,+ isUser: false,+ label: labelParts.join(', '),+ mentionCount: result.mentionCount,+ subtext: isChannel ? null : (result.subtitle ?? null),+ unreadCount: unread ? 1 : 0,+ };+}+export function getQuickSwitcherResultAccessibilityMetadata(result: QuickSwitcherExecutableResult,i18n: I18n,): QuickSwitcherResultAccessibilityMetadata {+ if (result.type === QuickSwitcherResultTypes.ACCOUNT || result.type === QuickSwitcherResultTypes.ACCOUNT_CHANNEL) {+ return getOtherAccountResultAccessibilityMetadata(result, i18n);+ }const channelId = getChannelId(result);const unreadCount = channelId ? ReadStates.getUnreadCount(channelId) : 0;const mentionCount = channelId ? ReadStates.getMentionCount(channelId) : 0;@@ -369,6 +435,26 @@ function getChannelId(result: QuickSwitcherExecutableResult): string | null {}}+export function renderSectionHeaderContent(header: HeaderResult, nameClassName: string): React.ReactNode {+ if (header.accountKey == null) return header.title;+ return (+ <>+ <OtherAccountAvatar+ accountKey={header.accountKey}+ size={16}+ data-flx="search.quick-switcher-modal-utils.section-header.other-account-avatar"+ />+ <span className={nameClassName} dir="auto" data-flx="search.quick-switcher-modal-utils.section-header.name">+ {header.title}+ </span>+ </>+ );+}++export function isOtherAccountResult(result: QuickSwitcherExecutableResult): boolean {+ return result.type === QuickSwitcherResultTypes.ACCOUNT || result.type === QuickSwitcherResultTypes.ACCOUNT_CHANNEL;+}+export function getResultKey(result: QuickSwitcherResult): string {return `${result.type}-${result.id}`;}