Allow jumping to message search from spotlight (#29850)
* Allow jumping to message search from spotlight replaces the message search hint which referenced the old UX Fixes #29831 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update RoomSummaryCard.tsx * Update actions.ts * Delete src/hooks/useTransition.ts * Update RoomSummaryCard.tsx * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
23597e959b
commit
4bf28f8159
@@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import React, { type ChangeEvent } from "react";
|
||||
import React from "react";
|
||||
import { type Room, type RoomState, RoomStateEvent, RoomMember, type MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
import { throttle } from "lodash";
|
||||
|
||||
@@ -49,8 +49,9 @@ interface RoomlessProps extends BaseProps {
|
||||
interface RoomProps extends BaseProps {
|
||||
room: Room;
|
||||
permalinkCreator: RoomPermalinkCreator;
|
||||
onSearchChange?: (e: ChangeEvent) => void;
|
||||
onSearchChange?: (term: string) => void;
|
||||
onSearchCancel?: () => void;
|
||||
searchTerm?: string;
|
||||
}
|
||||
|
||||
type Props = XOR<RoomlessProps, RoomProps>;
|
||||
@@ -260,6 +261,7 @@ export default class RightPanel extends React.Component<Props, IState> {
|
||||
permalinkCreator={this.props.permalinkCreator!}
|
||||
onSearchChange={this.props.onSearchChange}
|
||||
onSearchCancel={this.props.onSearchCancel}
|
||||
searchTerm={this.props.searchTerm}
|
||||
focusRoomSearch={cardState?.focusRoomSearch}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -10,7 +10,6 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import React, {
|
||||
type ChangeEvent,
|
||||
type ComponentProps,
|
||||
createRef,
|
||||
type ReactElement,
|
||||
@@ -133,6 +132,7 @@ import RoomSearchAuxPanel from "../views/rooms/RoomSearchAuxPanel";
|
||||
import { PinnedMessageBanner } from "../views/rooms/PinnedMessageBanner";
|
||||
import { ScopedRoomContextProvider, useScopedRoomContext } from "../../contexts/ScopedRoomContext";
|
||||
import { DeclineAndBlockInviteDialog } from "../views/dialogs/DeclineAndBlockInviteDialog";
|
||||
import { type FocusMessageSearchPayload } from "../../dispatcher/payloads/FocusMessageSearchPayload.ts";
|
||||
|
||||
const DEBUG = false;
|
||||
const PREVENT_MULTIPLE_JITSI_WITHIN = 30_000;
|
||||
@@ -1244,6 +1244,11 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||
case Action.View3pidInvite:
|
||||
onView3pidInvite(payload, RightPanelStore.instance);
|
||||
break;
|
||||
case Action.FocusMessageSearch:
|
||||
if ((payload as FocusMessageSearchPayload).initialText) {
|
||||
this.onSearch(payload.initialText);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1806,8 +1811,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||
defaultDispatcher.fire(Action.ViewRoomDirectory);
|
||||
};
|
||||
|
||||
private onSearchChange = debounce((e: ChangeEvent): void => {
|
||||
const term = (e.target as HTMLInputElement).value;
|
||||
private onSearchChange = debounce((term: string): void => {
|
||||
this.onSearch(term);
|
||||
}, 300);
|
||||
|
||||
@@ -2487,6 +2491,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||
e2eStatus={this.state.e2eStatus}
|
||||
onSearchChange={this.onSearchChange}
|
||||
onSearchCancel={this.onCancelSearchClick}
|
||||
searchTerm={this.state.search?.term ?? ""}
|
||||
/>
|
||||
) : undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user