Skip to content

Conversation

@gbirman
Copy link
Contributor

@gbirman gbirman commented Dec 1, 2025

Summary

this flashes the email message from a search result similar to how we do it for block-channel. it also keeps the message_id query param for the same behavior. re-clicking from the search in a separate panel will also trigger the highlight behavior

Screenshots, GIFs, and Videos

CleanShot.2025-12-01.at.17.34.31.mp4

@gbirman gbirman requested a review from a team as a code owner December 1, 2025 22:15
@linear
Copy link

linear bot commented Dec 1, 2025

<BozzyBracket
active={props.focused}
unfocusable={props.unfocusable}
unfocusable={props.isTarget || props.unfocusable}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can't flash while also focused, so this flashes and then focuses

Copy link
Contributor

@synoet synoet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit. Will leave to @sedson to confirm

Comment on lines +10 to +56

/**
* Creates a signal that mirrors a source signal but automatically clears
* after a duration. Used for temporary UI states like message highlighting.
*
* @param source - The source signal to track
* @param duration - Duration in milliseconds before the active state clears (default: 800ms)
* @returns An accessor for the active target value
*
* @example
* const activeId = createActiveTarget(targetId);
* // activeId() mirrors targetId() for 800ms, then becomes undefined
*/
export function createActiveTarget<T>(
source: Accessor<T | undefined>,
duration = DEFAULT_ACTIVE_TARGET_TIME
): Accessor<T | undefined> {
const [active, setActive] = createSignal<T | undefined>();
let timeoutId: ReturnType<typeof setTimeout> | undefined;

createEffect(
on(source, (target) => {
if (timeoutId !== undefined) {
clearTimeout(timeoutId);
timeoutId = undefined;
}

if (target !== undefined) {
setActive(() => target);
timeoutId = setTimeout(() => {
setActive(undefined);
timeoutId = undefined;
}, duration);
} else {
setActive(undefined);
}
})
);

onCleanup(() => {
if (timeoutId !== undefined) {
clearTimeout(timeoutId);
}
});

return active;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sedson didn't you write something exactly like this ?

@gbirman gbirman merged commit 7da165e into main Dec 1, 2025
18 checks passed
@gbirman gbirman deleted the gab/m-5282-email-search-linking branch December 1, 2025 23:31
dev-rb pushed a commit that referenced this pull request Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants