BlueGit

ict rusty-teams

Files

rusty-teams / crates / app-ui-kit / src / render / hooks.rs

hooks.rs

3e25d31a History
hooks.rs 636 B Download Raw
1use gpui_kit::*;
2
3#[derive(Clone, Copy)]
4pub struct RenderHooks {
5 pub open_profile_link: fn(&str, Point<Pixels>, &mut App) -> bool,
6 pub jump_to_quoted: fn(String, &mut App),
7}
8
9impl Global for RenderHooks {}
10
11pub fn open_profile_link(url: &str, position: Point<Pixels>, cx: &mut App) -> bool {
12 match cx.try_global::<RenderHooks>().copied() {
13 Some(hooks) => (hooks.open_profile_link)(url, position, cx),
14 None => false,
15 }
16}
17
18pub fn jump_to_quoted(message_id: String, cx: &mut App) {
19 if let Some(hooks) = cx.try_global::<RenderHooks>().copied() {
20 (hooks.jump_to_quoted)(message_id, cx);
21 }
22}