refactor(app): extract app-ui-kit crate
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -278,6 +278,7 @@ dependencies = [
278
278
"agents",
279
279
"app-base",
280
280
"app-call-model",
281
"app-ui-kit",
281
282
"calling",
282
283
"chatsvc",
283
284
"chrono",
@@ -354,6 +355,16 @@ dependencies = [
354
355
"uuid",
355
356
]
356
357
358
[[package]]
359
name = "app-ui-kit"
360
version = "0.1.0"
361
dependencies = [
362
"app-base",
363
"gpui-kit",
364
"store",
365
"teams-core",
366
]
367
357
368
[[package]]
358
369
name = "arbitrary"
359
370
version = "1.5.0"
@@ -4029,8 +4040,6 @@ dependencies = [
4029
4040
[[package]]
4030
4041
name = "gpui-pre-windows"
4031
4042
version = "0.3.8"
4032
source = "registry+https://github.com/rust-lang/crates.io-index"
4033
checksum = "371f9bb13f97e3bea2f8b8e5e81232bb74d735153c244ae67f7400e743925b1c"
4034
4043
dependencies = [
4035
4044
"accesskit",
4036
4045
"accesskit_windows",
@@ -278,6 +278,7 @@ dependencies = [278
"agents",278
"agents",279
"app-base",279
"app-base",280
"app-call-model",280
"app-call-model",281
"app-ui-kit",281
"calling",282
"calling",282
"chatsvc",283
"chatsvc",283
"chrono",284
"chrono",@@ -354,6 +355,16 @@ dependencies = [354
"uuid",355
"uuid",355
]356
]356
357
358
[[package]]359
name = "app-ui-kit"360
version = "0.1.0"361
dependencies = [362
"app-base",363
"gpui-kit",364
"store",365
"teams-core",366
]367
357
[[package]]368
[[package]]358
name = "arbitrary"369
name = "arbitrary"359
version = "1.5.0"370
version = "1.5.0"@@ -4029,8 +4040,6 @@ dependencies = [4029
[[package]]4040
[[package]]4030
name = "gpui-pre-windows"4041
name = "gpui-pre-windows"4031
version = "0.3.8"4042
version = "0.3.8"4032
source = "registry+https://github.com/rust-lang/crates.io-index"4033
checksum = "371f9bb13f97e3bea2f8b8e5e81232bb74d735153c244ae67f7400e743925b1c"4034
dependencies = [4043
dependencies = [4035
"accesskit",4044
"accesskit",4036
"accesskit_windows",4045
"accesskit_windows",@@ -30,6 +30,7 @@ uuid = { version = "1", default-features = false, features = ["v4"] }
30
30
31
31
app-base = { path = "crates/app-base" }
32
32
app-call-model = { path = "crates/app-call-model" }
33
app-ui-kit = { path = "crates/app-ui-kit" }
33
34
agents = { path = "crates/agents" }
34
35
session = { path = "crates/session" }
35
36
graph = { path = "crates/graph" }
@@ -62,3 +63,6 @@ opt-level = 1
62
63
63
64
[profile.release.package.app-call-model]
64
65
opt-level = 1
66
67
[profile.release.package.app-ui-kit]
68
opt-level = 1
@@ -30,6 +30,7 @@ uuid = { version = "1", default-features = false, features = ["v4"] }30
30
31
app-base = { path = "crates/app-base" }31
app-base = { path = "crates/app-base" }32
app-call-model = { path = "crates/app-call-model" }32
app-call-model = { path = "crates/app-call-model" }33
app-ui-kit = { path = "crates/app-ui-kit" }33
agents = { path = "crates/agents" }34
agents = { path = "crates/agents" }34
session = { path = "crates/session" }35
session = { path = "crates/session" }35
graph = { path = "crates/graph" }36
graph = { path = "crates/graph" }@@ -62,3 +63,6 @@ opt-level = 162
63
63
[profile.release.package.app-call-model]64
[profile.release.package.app-call-model]64
opt-level = 165
opt-level = 166
67
[profile.release.package.app-ui-kit]68
opt-level = 1@@ -0,0 +1,15 @@
1
[package]
2
name = "app-ui-kit"
3
edition.workspace = true
4
version.workspace = true
5
license.workspace = true
6
publish.workspace = true
7
8
[dev-dependencies]
9
gpui-kit = { workspace = true, features = ["test-support"] }
10
11
[dependencies]
12
app-base.workspace = true
13
gpui-kit.workspace = true
14
store.workspace = true
15
teams-core.workspace = true
@@ -0,0 +1,15 @@1
[package]2
name = "app-ui-kit"3
edition.workspace = true4
version.workspace = true5
license.workspace = true6
publish.workspace = true7
8
[dev-dependencies]9
gpui-kit = { workspace = true, features = ["test-support"] }10
11
[dependencies]12
app-base.workspace = true13
gpui-kit.workspace = true14
store.workspace = true15
teams-core.workspace = true@@ -10,7 +10,7 @@ use teams_core::{
10
10
series_maximum, series_value, slice_angles, unit_fraction,
11
11
};
12
12
13
use crate::theme;
13
use app_base::theme;
14
14
15
15
const CHART_HEIGHT: f32 = 200.;
16
16
const GAUGE_HEIGHT: f32 = 136.;
@@ -10,7 +10,7 @@ use teams_core::{10
series_maximum, series_value, slice_angles, unit_fraction,10
series_maximum, series_value, slice_angles, unit_fraction,11
};11
};12
12
13
use crate::theme;13
use app_base::theme;14
14
15
const CHART_HEIGHT: f32 = 200.;15
const CHART_HEIGHT: f32 = 200.;16
const GAUGE_HEIGHT: f32 = 136.;16
const GAUGE_HEIGHT: f32 = 136.;@@ -10,7 +10,7 @@ use gpui_kit::*;
10
10
use store::ChannelTabRecord;
11
11
use teams_core::channel_tab_link;
12
12
13
use crate::theme;
13
use app_base::theme;
14
14
15
15
const BAR_HEIGHT: f32 = 36.;
16
16
const TAB_HEIGHT: f32 = 28.;
@@ -10,7 +10,7 @@ use gpui_kit::*;10
use store::ChannelTabRecord;10
use store::ChannelTabRecord;11
use teams_core::channel_tab_link;11
use teams_core::channel_tab_link;12
12
13
use crate::theme;13
use app_base::theme;14
14
15
const BAR_HEIGHT: f32 = 36.;15
const BAR_HEIGHT: f32 = 36.;16
const TAB_HEIGHT: f32 = 28.;16
const TAB_HEIGHT: f32 = 28.;@@ -5,7 +5,7 @@ use gpui_kit::*;
5
5
use teams_core::{Draft, FontSize, LineKind, MarkKind, SizeStep};
6
6
7
7
use crate::render::blocks::{Script, StyleFlags};
8
use crate::theme;
8
use app_base::theme;
9
9
10
10
const CODE_PILL_RADIUS: f32 = 4.;
11
11
const CODE_BLOCK_RADIUS: f32 = 6.;
@@ -5,7 +5,7 @@ use gpui_kit::*;5
use teams_core::{Draft, FontSize, LineKind, MarkKind, SizeStep};5
use teams_core::{Draft, FontSize, LineKind, MarkKind, SizeStep};6
6
7
use crate::render::blocks::{Script, StyleFlags};7
use crate::render::blocks::{Script, StyleFlags};8
use crate::theme;8
use app_base::theme;9
9
10
const CODE_PILL_RADIUS: f32 = 4.;10
const CODE_PILL_RADIUS: f32 = 4.;11
const CODE_BLOCK_RADIUS: f32 = 6.;11
const CODE_BLOCK_RADIUS: f32 = 6.;@@ -0,0 +1,4 @@
1
pub const ISLAND_GAP: f32 = 6.;
2
pub const RAIL_ITEM_WIDTH: f32 = 48.;
3
pub const RAIL_WIDTH: f32 = RAIL_ITEM_WIDTH + 2. * ISLAND_GAP;
4
pub const SIDEBAR_WIDTH: f32 = 300.;
@@ -0,0 +1,4 @@1
pub const ISLAND_GAP: f32 = 6.;2
pub const RAIL_ITEM_WIDTH: f32 = 48.;3
pub const RAIL_WIDTH: f32 = RAIL_ITEM_WIDTH + 2. * ISLAND_GAP;4
pub const SIDEBAR_WIDTH: f32 = 300.;@@ -0,0 +1,9 @@
1
pub mod card_chart;
2
pub mod channel_tabs;
3
pub mod draft_style;
4
pub mod layout;
5
pub mod reaction_proposal_pill;
6
pub mod render;
7
pub mod settings_controls;
8
pub mod spinner;
9
pub mod widgets;
@@ -0,0 +1,9 @@1
pub mod card_chart;2
pub mod channel_tabs;3
pub mod draft_style;4
pub mod layout;5
pub mod reaction_proposal_pill;6
pub mod render;7
pub mod settings_controls;8
pub mod spinner;9
pub mod widgets;@@ -3,7 +3,7 @@ use std::rc::Rc;
3
3
use gpui_kit::component::h_flex;
4
4
use gpui_kit::*;
5
5
6
use crate::theme;
6
use app_base::theme;
7
7
8
8
const PILL_HEIGHT: f32 = 26.;
9
9
const PILL_PADDING: f32 = 10.;
@@ -3,7 +3,7 @@ use std::rc::Rc;3
use gpui_kit::component::h_flex;3
use gpui_kit::component::h_flex;4
use gpui_kit::*;4
use gpui_kit::*;5
5
6
use crate::theme;6
use app_base::theme;7
7
8
const PILL_HEIGHT: f32 = 26.;8
const PILL_HEIGHT: f32 = 26.;9
const PILL_PADDING: f32 = 10.;9
const PILL_PADDING: f32 = 10.;@@ -4,11 +4,11 @@ use gpui_kit::*;
4
4
5
5
use super::blocks::{Block, Inline, StyleFlags};
6
6
use super::flow_text::{FlowSegment, FlowText};
7
use super::hooks::jump_to_quoted;
7
8
use super::selectable::{Pill, SelectableRichText};
8
9
use super::syntax::{self, Token};
9
use crate::app_state::AppHandle;
10
use crate::theme;
11
use crate::views::widgets::symbol;
10
use app_base::theme;
11
use crate::widgets::symbol;
12
12
13
13
const LIST_GAP: f32 = 2.;
14
14
const MARKER_WIDTH: f32 = 18.;
@@ -487,7 +487,7 @@ mod tests {
487
487
use gpui_kit::{Rgba, rgb};
488
488
489
489
use super::{MIN_CONTRAST, contrast, readable};
490
use crate::theme;
490
use app_base::theme;
491
491
492
492
#[test]
493
493
fn dark_text_color_is_lifted_to_readable_contrast() {
@@ -500,14 +500,3 @@ mod tests {
500
500
assert_eq!(Rgba::from(readable(0xffd700, false)), rgb(0xffd700));
501
501
}
502
502
}
503
504
fn jump_to_quoted(message_id: String, cx: &mut App) {
505
let Some(handle) = cx.try_global::<AppHandle>() else {
506
return;
507
};
508
handle.0.clone().update(cx, |state, cx| {
509
if let Some(selection) = state.selection.clone() {
510
state.jump_to_message(selection, message_id, cx);
511
}
512
});
513
}
@@ -4,11 +4,11 @@ use gpui_kit::*;4
4
5
use super::blocks::{Block, Inline, StyleFlags};5
use super::blocks::{Block, Inline, StyleFlags};6
use super::flow_text::{FlowSegment, FlowText};6
use super::flow_text::{FlowSegment, FlowText};7
use super::hooks::jump_to_quoted;7
use super::selectable::{Pill, SelectableRichText};8
use super::selectable::{Pill, SelectableRichText};8
use super::syntax::{self, Token};9
use super::syntax::{self, Token};9
use crate::app_state::AppHandle;10
use app_base::theme;10
use crate::theme;11
use crate::widgets::symbol;11
use crate::views::widgets::symbol;12
12
13
const LIST_GAP: f32 = 2.;13
const LIST_GAP: f32 = 2.;14
const MARKER_WIDTH: f32 = 18.;14
const MARKER_WIDTH: f32 = 18.;@@ -487,7 +487,7 @@ mod tests {487
use gpui_kit::{Rgba, rgb};487
use gpui_kit::{Rgba, rgb};488
488
489
use super::{MIN_CONTRAST, contrast, readable};489
use super::{MIN_CONTRAST, contrast, readable};490
use crate::theme;490
use app_base::theme;491
491
492
#[test]492
#[test]493
fn dark_text_color_is_lifted_to_readable_contrast() {493
fn dark_text_color_is_lifted_to_readable_contrast() {@@ -500,14 +500,3 @@ mod tests {500
assert_eq!(Rgba::from(readable(0xffd700, false)), rgb(0xffd700));500
assert_eq!(Rgba::from(readable(0xffd700, false)), rgb(0xffd700));501
}501
}502
}502
}503
504
fn jump_to_quoted(message_id: String, cx: &mut App) {505
let Some(handle) = cx.try_global::<AppHandle>() else {506
return;507
};508
handle.0.clone().update(cx, |state, cx| {509
if let Some(selection) = state.selection.clone() {510
state.jump_to_message(selection, message_id, cx);511
}512
});513
}@@ -7,7 +7,7 @@ use gpui_kit::*;
7
7
8
8
use super::blocks::CODE_PADDING;
9
9
use super::selectable::{HIT_SLOP, PILL_INSET_Y, PILL_OUTSET, Participant, Pill, TIME_ROOM};
10
use crate::views::profile_card::open_profile_link;
10
use super::hooks::open_profile_link;
11
11
12
12
const WRAP_TOLERANCE: f32 = 0.5;
13
13
@@ -7,7 +7,7 @@ use gpui_kit::*;7
7
8
use super::blocks::CODE_PADDING;8
use super::blocks::CODE_PADDING;9
use super::selectable::{HIT_SLOP, PILL_INSET_Y, PILL_OUTSET, Participant, Pill, TIME_ROOM};9
use super::selectable::{HIT_SLOP, PILL_INSET_Y, PILL_OUTSET, Participant, Pill, TIME_ROOM};10
use crate::views::profile_card::open_profile_link;10
use super::hooks::open_profile_link;11
11
12
const WRAP_TOLERANCE: f32 = 0.5;12
const WRAP_TOLERANCE: f32 = 0.5;13
13
@@ -0,0 +1,22 @@
1
use gpui_kit::*;
2
3
#[derive(Clone, Copy)]
4
pub 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
9
impl Global for RenderHooks {}
10
11
pub 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
18
pub 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
}
@@ -0,0 +1,22 @@1
use gpui_kit::*;2
3
#[derive(Clone, Copy)]4
pub 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
9
impl Global for RenderHooks {}10
11
pub 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
18
pub 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
}@@ -1,6 +1,7 @@
1
1
pub mod blocks;
2
2
pub mod elements;
3
3
mod flow_text;
4
pub mod hooks;
4
5
mod selectable;
5
6
mod syntax;
6
7
@@ -1,6 +1,7 @@1
pub mod blocks;1
pub mod blocks;2
pub mod elements;2
pub mod elements;3
mod flow_text;3
mod flow_text;4
pub mod hooks;4
mod selectable;5
mod selectable;5
mod syntax;6
mod syntax;6
7
@@ -8,7 +8,7 @@ use gpui_kit::base::{
8
8
use gpui_kit::*;
9
9
10
10
use super::blocks::CODE_PADDING;
11
use crate::views::profile_card::open_profile_link;
11
use super::hooks::open_profile_link;
12
12
13
13
pub(super) const TIME_ROOM: char = '\u{2007}';
14
14
pub(super) const HIT_SLOP: f32 = 12.;
@@ -8,7 +8,7 @@ use gpui_kit::base::{8
use gpui_kit::*;8
use gpui_kit::*;9
9
10
use super::blocks::CODE_PADDING;10
use super::blocks::CODE_PADDING;11
use crate::views::profile_card::open_profile_link;11
use super::hooks::open_profile_link;12
12
13
pub(super) const TIME_ROOM: char = '\u{2007}';13
pub(super) const TIME_ROOM: char = '\u{2007}';14
pub(super) const HIT_SLOP: f32 = 12.;14
pub(super) const HIT_SLOP: f32 = 12.;@@ -12,7 +12,7 @@ use gpui_kit::component::{
12
12
use gpui_kit::prelude::FluentBuilder as _;
13
13
use gpui_kit::*;
14
14
15
use crate::theme;
15
use app_base::theme;
16
16
17
17
pub const PAGE_PADDING: f32 = 20.;
18
18
const FIELD_HEIGHT: f32 = 32.;
@@ -12,7 +12,7 @@ use gpui_kit::component::{12
use gpui_kit::prelude::FluentBuilder as _;12
use gpui_kit::prelude::FluentBuilder as _;13
use gpui_kit::*;13
use gpui_kit::*;14
14
15
use crate::theme;15
use app_base::theme;16
16
17
pub const PAGE_PADDING: f32 = 20.;17
pub const PAGE_PADDING: f32 = 20.;18
const FIELD_HEIGHT: f32 = 32.;18
const FIELD_HEIGHT: f32 = 32.;@@ -3,7 +3,7 @@ use std::time::Duration;
3
3
use gpui_kit::component::Icon;
4
4
use gpui_kit::*;
5
5
6
use crate::theme;
6
use app_base::theme;
7
7
8
8
const SPIN_PERIOD: Duration = Duration::from_millis(900);
9
9
@@ -3,7 +3,7 @@ use std::time::Duration;3
use gpui_kit::component::Icon;3
use gpui_kit::component::Icon;4
use gpui_kit::*;4
use gpui_kit::*;5
5
6
use crate::theme;6
use app_base::theme;7
7
8
const SPIN_PERIOD: Duration = Duration::from_millis(900);8
const SPIN_PERIOD: Duration = Duration::from_millis(900);9
9
@@ -2,9 +2,22 @@ use gpui_kit::assets::IconName;
2
2
use gpui_kit::component::Icon;
3
3
use gpui_kit::*;
4
4
5
use crate::format;
6
use crate::sidebar_model::Unread;
7
use crate::theme;
5
use app_base::format;
6
use app_base::theme;
7
8
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9
pub enum Unread {
10
None,
11
Silent,
12
Dot,
13
Count(u32),
14
}
15
16
impl Unread {
17
pub fn is_unread(self) -> bool {
18
self != Unread::None
19
}
20
}
8
21
9
22
pub fn icon(name: IconName, size: f32, color: Hsla) -> Icon {
10
23
Icon::new(name).size(px(size)).text_color(color)
@@ -2,9 +2,22 @@ use gpui_kit::assets::IconName;2
use gpui_kit::component::Icon;2
use gpui_kit::component::Icon;3
use gpui_kit::*;3
use gpui_kit::*;4
4
5
use crate::format;5
use app_base::format;6
use crate::sidebar_model::Unread;6
use app_base::theme;7
use crate::theme;7
8
#[derive(Debug, Clone, Copy, PartialEq, Eq)]9
pub enum Unread {10
None,11
Silent,12
Dot,13
Count(u32),14
}15
16
impl Unread {17
pub fn is_unread(self) -> bool {18
self != Unread::None19
}20
}8
21
9
pub fn icon(name: IconName, size: f32, color: Hsla) -> Icon {22
pub fn icon(name: IconName, size: f32, color: Hsla) -> Icon {10
Icon::new(name).size(px(size)).text_color(color)23
Icon::new(name).size(px(size)).text_color(color)@@ -20,6 +20,7 @@ tempfile.workspace = true
20
20
[dependencies]
21
21
app-base.workspace = true
22
22
app-call-model.workspace = true
23
app-ui-kit.workspace = true
23
24
agents.workspace = true
24
25
calling.workspace = true
25
26
chatsvc.workspace = true
@@ -20,6 +20,7 @@ tempfile.workspace = true20
[dependencies]20
[dependencies]21
app-base.workspace = true21
app-base.workspace = true22
app-call-model.workspace = true22
app-call-model.workspace = true23
app-ui-kit.workspace = true23
agents.workspace = true24
agents.workspace = true24
calling.workspace = true25
calling.workspace = true25
chatsvc.workspace = true26
chatsvc.workspace = true@@ -6,10 +6,8 @@ mod run_chip;
6
6
mod runs;
7
7
mod runs_popover;
8
8
mod session_options;
9
mod settings_controls;
10
9
mod settings_forms;
11
10
mod settings_section;
12
mod spinner;
13
11
mod start_dialog;
14
12
mod start_dialog_pickers;
15
13
mod store;
@@ -18,6 +16,7 @@ use std::path::PathBuf;
18
16
use std::time::Duration;
19
17
20
18
use app_base::agents::{lanes, settings_problems};
19
use app_ui_kit::{settings_controls, spinner};
21
20
use agents::{AgentAction, Environment};
22
21
use directories::ProjectDirs;
23
22
use gpui_kit::*;
@@ -6,10 +6,8 @@ mod run_chip;6
mod runs;6
mod runs;7
mod runs_popover;7
mod runs_popover;8
mod session_options;8
mod session_options;9
mod settings_controls;10
mod settings_forms;9
mod settings_forms;11
mod settings_section;10
mod settings_section;12
mod spinner;13
mod start_dialog;11
mod start_dialog;14
mod start_dialog_pickers;12
mod start_dialog_pickers;15
mod store;13
mod store;@@ -18,6 +16,7 @@ use std::path::PathBuf;18
use std::time::Duration;16
use std::time::Duration;19
17
20
use app_base::agents::{lanes, settings_problems};18
use app_base::agents::{lanes, settings_problems};19
use app_ui_kit::{settings_controls, spinner};21
use agents::{AgentAction, Environment};20
use agents::{AgentAction, Environment};22
use directories::ProjectDirs;21
use directories::ProjectDirs;23
use gpui_kit::*;22
use gpui_kit::*;@@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
4
4
5
5
use regex::Regex;
6
6
7
const WIDGETS_FILE: &str = "views/widgets.rs";
7
const WIDGETS_FILE: &str = "widgets.rs";
8
8
const SCAN_ALLOWLIST: &[(&str, &str)] = &[
9
9
("views/toolbar_placement.rs", ".top(px(-SLOT_HEIGHT))"),
10
10
("views/conversation.rs", ".bottom(px(-1.))"),
@@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};4
4
5
use regex::Regex;5
use regex::Regex;6
6
7
const WIDGETS_FILE: &str = "views/widgets.rs";7
const WIDGETS_FILE: &str = "widgets.rs";8
const SCAN_ALLOWLIST: &[(&str, &str)] = &[8
const SCAN_ALLOWLIST: &[(&str, &str)] = &[9
("views/toolbar_placement.rs", ".top(px(-SLOT_HEIGHT))"),9
("views/toolbar_placement.rs", ".top(px(-SLOT_HEIGHT))"),10
("views/conversation.rs", ".bottom(px(-1.))"),10
("views/conversation.rs", ".bottom(px(-1.))"),@@ -33,7 +33,6 @@ mod people;
33
33
mod profile_model;
34
34
mod profile_state;
35
35
mod reaction_model;
36
mod render;
37
36
mod rows;
38
37
mod scheduled;
39
38
mod scheduled_rows;
@@ -45,6 +44,7 @@ mod translation_actions;
45
44
mod typing;
46
45
mod views;
47
46
47
pub use app_ui_kit::render;
48
48
pub use app_base::{
49
49
APP_NAME, assets, avatar_image, channel_files, crash_log, demo_cards, demo_chart_cards, demo_gifs,
50
50
demo_input_cards, demo_library, demo_recap, diagnostics, downloads, format, frame_log, fuzzy,
@@ -33,7 +33,6 @@ mod people;33
mod profile_model;33
mod profile_model;34
mod profile_state;34
mod profile_state;35
mod reaction_model;35
mod reaction_model;36
mod render;37
mod rows;36
mod rows;38
mod scheduled;37
mod scheduled;39
mod scheduled_rows;38
mod scheduled_rows;@@ -45,6 +44,7 @@ mod translation_actions;45
mod typing;44
mod typing;46
mod views;45
mod views;47
46
47
pub use app_ui_kit::render;48
pub use app_base::{48
pub use app_base::{49
APP_NAME, assets, avatar_image, channel_files, crash_log, demo_cards, demo_chart_cards, demo_gifs,49
APP_NAME, assets, avatar_image, channel_files, crash_log, demo_cards, demo_chart_cards, demo_gifs,50
demo_input_cards, demo_library, demo_recap, diagnostics, downloads, format, frame_log, fuzzy,50
demo_input_cards, demo_library, demo_recap, diagnostics, downloads, format, frame_log, fuzzy,@@ -3,6 +3,7 @@ use std::collections::{HashMap, HashSet};
3
3
use chrono::{DateTime, FixedOffset, Utc};
4
4
use store::{ChannelRecord, ChatRecord, Sidebar, SidebarTeam};
5
5
use teams_core::ChatSection;
6
use app_ui_kit::widgets::Unread;
6
7
7
8
use crate::app_state::chat_title;
8
9
use crate::data::{
@@ -33,20 +34,6 @@ pub enum Preview {
33
34
},
34
35
}
35
36
36
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
37
pub enum Unread {
38
None,
39
Silent,
40
Dot,
41
Count(u32),
42
}
43
44
impl Unread {
45
pub fn is_unread(self) -> bool {
46
self != Unread::None
47
}
48
}
49
50
37
#[derive(Debug, Clone, PartialEq, Eq)]
51
38
pub struct Face {
52
39
pub user_id: Option<String>,
@@ -3,6 +3,7 @@ use std::collections::{HashMap, HashSet};3
use chrono::{DateTime, FixedOffset, Utc};3
use chrono::{DateTime, FixedOffset, Utc};4
use store::{ChannelRecord, ChatRecord, Sidebar, SidebarTeam};4
use store::{ChannelRecord, ChatRecord, Sidebar, SidebarTeam};5
use teams_core::ChatSection;5
use teams_core::ChatSection;6
use app_ui_kit::widgets::Unread;6
7
7
use crate::app_state::chat_title;8
use crate::app_state::chat_title;8
use crate::data::{9
use crate::data::{@@ -33,20 +34,6 @@ pub enum Preview {33
},34
},34
}35
}35
36
36
#[derive(Debug, Clone, Copy, PartialEq, Eq)]37
pub enum Unread {38
None,39
Silent,40
Dot,41
Count(u32),42
}43
44
impl Unread {45
pub fn is_unread(self) -> bool {46
self != Unread::None47
}48
}49
50
#[derive(Debug, Clone, PartialEq, Eq)]37
#[derive(Debug, Clone, PartialEq, Eq)]51
pub struct Face {38
pub struct Face {52
pub user_id: Option<String>,39
pub user_id: Option<String>,@@ -33,7 +33,7 @@ use super::call_people::{lock_banner, lock_chip, options_dialog, people_button,
33
33
use super::call_stage::{StageMode, popped_placeholder, render_stage};
34
34
use super::call_view_menu::view_button;
35
35
use super::conversation::ConversationView;
36
use super::shell::ISLAND_GAP;
36
use app_ui_kit::layout::ISLAND_GAP;
37
37
use super::widgets::{Corner, corner_badge, count_badge, icon};
38
38
use crate::app_state::AppState;
39
39
use crate::call::REACTION_SHOWN;
@@ -33,7 +33,7 @@ use super::call_people::{lock_banner, lock_chip, options_dialog, people_button,33
use super::call_stage::{StageMode, popped_placeholder, render_stage};33
use super::call_stage::{StageMode, popped_placeholder, render_stage};34
use super::call_view_menu::view_button;34
use super::call_view_menu::view_button;35
use super::conversation::ConversationView;35
use super::conversation::ConversationView;36
use super::shell::ISLAND_GAP;36
use app_ui_kit::layout::ISLAND_GAP;37
use super::widgets::{Corner, corner_badge, count_badge, icon};37
use super::widgets::{Corner, corner_badge, count_badge, icon};38
use crate::app_state::AppState;38
use crate::app_state::AppState;39
use crate::call::REACTION_SHOWN;39
use crate::call::REACTION_SHOWN;@@ -21,18 +21,15 @@ pub mod call_view;
21
21
pub mod call_view_menu;
22
22
pub mod calls_tab;
23
23
pub mod card_carousel;
24
pub mod card_chart;
25
24
pub mod card_code_block;
26
25
pub mod card_icon;
27
26
pub mod card_input;
28
27
pub mod card_media;
29
28
pub mod card_table;
30
29
pub mod card_widgets;
31
pub mod channel_tabs;
32
30
pub mod composer;
33
31
pub mod conversation;
34
32
pub mod dialog_overlay;
35
pub mod draft_style;
36
33
pub mod emoji_popup;
37
34
pub mod format_toolbar;
38
35
pub mod forward_dialog;
@@ -52,7 +49,6 @@ pub mod proposal_card;
52
49
pub mod rail;
53
50
pub mod reaction_picker;
54
51
pub mod reaction_pills;
55
pub mod reaction_proposal_pill;
56
52
pub mod recap_tab;
57
53
pub mod saved_panel;
58
54
pub mod scheduled_toolbar;
@@ -71,4 +67,5 @@ pub mod title_bar;
71
67
pub mod toolbar_placement;
72
68
pub mod transfer_picker;
73
69
pub mod translation_line;
74
pub mod widgets;
70
71
pub use app_ui_kit::{card_chart, channel_tabs, draft_style, reaction_proposal_pill, widgets};
@@ -21,18 +21,15 @@ pub mod call_view;21
pub mod call_view_menu;21
pub mod call_view_menu;22
pub mod calls_tab;22
pub mod calls_tab;23
pub mod card_carousel;23
pub mod card_carousel;24
pub mod card_chart;25
pub mod card_code_block;24
pub mod card_code_block;26
pub mod card_icon;25
pub mod card_icon;27
pub mod card_input;26
pub mod card_input;28
pub mod card_media;27
pub mod card_media;29
pub mod card_table;28
pub mod card_table;30
pub mod card_widgets;29
pub mod card_widgets;31
pub mod channel_tabs;32
pub mod composer;30
pub mod composer;33
pub mod conversation;31
pub mod conversation;34
pub mod dialog_overlay;32
pub mod dialog_overlay;35
pub mod draft_style;36
pub mod emoji_popup;33
pub mod emoji_popup;37
pub mod format_toolbar;34
pub mod format_toolbar;38
pub mod forward_dialog;35
pub mod forward_dialog;@@ -52,7 +49,6 @@ pub mod proposal_card;52
pub mod rail;49
pub mod rail;53
pub mod reaction_picker;50
pub mod reaction_picker;54
pub mod reaction_pills;51
pub mod reaction_pills;55
pub mod reaction_proposal_pill;56
pub mod recap_tab;52
pub mod recap_tab;57
pub mod saved_panel;53
pub mod saved_panel;58
pub mod scheduled_toolbar;54
pub mod scheduled_toolbar;@@ -71,4 +67,5 @@ pub mod title_bar;71
pub mod toolbar_placement;67
pub mod toolbar_placement;72
pub mod transfer_picker;68
pub mod transfer_picker;73
pub mod translation_line;69
pub mod translation_line;74
pub mod widgets;70
71
pub use app_ui_kit::{card_chart, channel_tabs, draft_style, reaction_proposal_pill, widgets};@@ -4,7 +4,6 @@ use gpui_kit::component::{popover::Popover, tooltip::Tooltip, v_flex};
4
4
use gpui_kit::prelude::FluentBuilder as _;
5
5
use gpui_kit::*;
6
6
7
use super::shell::ISLAND_GAP;
8
7
use super::shortcuts::keys_for_label;
9
8
use super::sidebar::{SidebarTab, SidebarView};
10
9
use super::widgets::icon;
@@ -14,9 +13,8 @@ use crate::app_state::AppState;
14
13
use crate::format;
15
14
use crate::sidebar_model::{any_unread_channel, unread_chat_count};
16
15
use crate::theme;
16
use app_ui_kit::layout::{RAIL_ITEM_WIDTH, RAIL_WIDTH};
17
17
18
pub const RAIL_WIDTH: f32 = ITEM_WIDTH + 2. * ISLAND_GAP;
19
const ITEM_WIDTH: f32 = 48.;
20
18
const ITEM_HEIGHT: f32 = 52.;
21
19
const ICON_SIZE: f32 = 20.;
22
20
const LABEL_INSET: f32 = 2.;
@@ -136,7 +134,7 @@ fn item_element(item: &RailItem, active: bool) -> Stateful<Div> {
136
134
div()
137
135
.id(SharedString::from(format!("rail-{}", item.label)))
138
136
.relative()
139
.w(px(ITEM_WIDTH))
137
.w(px(RAIL_ITEM_WIDTH))
140
138
.h(px(ITEM_HEIGHT))
141
139
.flex()
142
140
.flex_col()
@@ -154,7 +152,7 @@ fn item_element(item: &RailItem, active: bool) -> Stateful<Div> {
154
152
.child(icon(item.icon, ICON_SIZE, color))
155
153
.child(
156
154
div()
157
.max_w(px(ITEM_WIDTH - 2. * LABEL_INSET))
155
.max_w(px(RAIL_ITEM_WIDTH - 2. * LABEL_INSET))
158
156
.truncate()
159
157
.h(px(LABEL_HEIGHT))
160
158
.text_size(px(9.))
@@ -4,7 +4,6 @@ use gpui_kit::component::{popover::Popover, tooltip::Tooltip, v_flex};4
use gpui_kit::prelude::FluentBuilder as _;4
use gpui_kit::prelude::FluentBuilder as _;5
use gpui_kit::*;5
use gpui_kit::*;6
6
7
use super::shell::ISLAND_GAP;8
use super::shortcuts::keys_for_label;7
use super::shortcuts::keys_for_label;9
use super::sidebar::{SidebarTab, SidebarView};8
use super::sidebar::{SidebarTab, SidebarView};10
use super::widgets::icon;9
use super::widgets::icon;@@ -14,9 +13,8 @@ use crate::app_state::AppState;14
use crate::format;13
use crate::format;15
use crate::sidebar_model::{any_unread_channel, unread_chat_count};14
use crate::sidebar_model::{any_unread_channel, unread_chat_count};16
use crate::theme;15
use crate::theme;16
use app_ui_kit::layout::{RAIL_ITEM_WIDTH, RAIL_WIDTH};17
17
18
pub const RAIL_WIDTH: f32 = ITEM_WIDTH + 2. * ISLAND_GAP;19
const ITEM_WIDTH: f32 = 48.;20
const ITEM_HEIGHT: f32 = 52.;18
const ITEM_HEIGHT: f32 = 52.;21
const ICON_SIZE: f32 = 20.;19
const ICON_SIZE: f32 = 20.;22
const LABEL_INSET: f32 = 2.;20
const LABEL_INSET: f32 = 2.;@@ -136,7 +134,7 @@ fn item_element(item: &RailItem, active: bool) -> Stateful<Div> {136
div()134
div()137
.id(SharedString::from(format!("rail-{}", item.label)))135
.id(SharedString::from(format!("rail-{}", item.label)))138
.relative()136
.relative()139
.w(px(ITEM_WIDTH))137
.w(px(RAIL_ITEM_WIDTH))140
.h(px(ITEM_HEIGHT))138
.h(px(ITEM_HEIGHT))141
.flex()139
.flex()142
.flex_col()140
.flex_col()@@ -154,7 +152,7 @@ fn item_element(item: &RailItem, active: bool) -> Stateful<Div> {154
.child(icon(item.icon, ICON_SIZE, color))152
.child(icon(item.icon, ICON_SIZE, color))155
.child(153
.child(156
div()154
div()157
.max_w(px(ITEM_WIDTH - 2. * LABEL_INSET))155
.max_w(px(RAIL_ITEM_WIDTH - 2. * LABEL_INSET))158
.truncate()156
.truncate()159
.h(px(LABEL_HEIGHT))157
.h(px(LABEL_HEIGHT))160
.text_size(px(9.))158
.text_size(px(9.))@@ -14,7 +14,7 @@ use super::image_viewer::{ImageViewer, ImageViewerEvent};
14
14
use super::prejoin_view::PrejoinView;
15
15
use super::profile_card::{ProfileCard, ProfileCardEvent};
16
16
use gpui_kit::prelude::FluentBuilder as _;
17
use super::rail::{RAIL_WIDTH, RailView};
17
use super::rail::RailView;
18
18
use super::saved_panel::{SavedPanel, SavedPanelEvent};
19
19
use super::shortcuts::{
20
20
AcceptCall, DeclineCall, HangUpCall, JoinMeetingFromToast, NextConversation, OpenActivity,
@@ -24,7 +24,9 @@ use super::shortcuts::{
24
24
};
25
25
use super::call_pop_out::zoom_listener;
26
26
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};
27
use super::sidebar::{SIDEBAR_WIDTH, SidebarView};
27
use super::sidebar::SidebarView;
28
use app_ui_kit::render::hooks::RenderHooks;
29
use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};
28
30
use super::status_bar::render_status_bar;
29
31
use super::status_menu::own_status_button;
30
32
use super::status_message_dialog::{StatusMessageDialog, StatusMessageDialogEvent};
@@ -69,7 +71,6 @@ pub struct Startup {
69
71
pub reply_to_last: bool,
70
72
}
71
73
72
pub const ISLAND_GAP: f32 = 6.;
73
74
pub const SIDEBAR_HIDDEN_BELOW: f32 = 960.;
74
75
75
76
pub fn sidebar_hidden_in_call(window_width: f32, panel_open: bool) -> bool {
@@ -85,6 +86,21 @@ impl Global for UserInputHandle {}
85
86
pub fn install_globals(state: &Entity<AppState>, user_input: Arc<UserInput>, cx: &mut App) {
86
87
cx.set_global(crate::app_state::AppHandle(state.clone()));
87
88
cx.set_global(UserInputHandle(user_input));
89
cx.set_global(RenderHooks {
90
open_profile_link: super::profile_card::open_profile_link,
91
jump_to_quoted,
92
});
93
}
94
95
fn jump_to_quoted(message_id: String, cx: &mut App) {
96
let Some(handle) = cx.try_global::<crate::app_state::AppHandle>() else {
97
return;
98
};
99
handle.0.clone().update(cx, |state, cx| {
100
if let Some(selection) = state.selection.clone() {
101
state.jump_to_message(selection, message_id, cx);
102
}
103
});
88
104
}
89
105
90
106
pub struct AppShell {
@@ -14,7 +14,7 @@ use super::image_viewer::{ImageViewer, ImageViewerEvent};14
use super::prejoin_view::PrejoinView;14
use super::prejoin_view::PrejoinView;15
use super::profile_card::{ProfileCard, ProfileCardEvent};15
use super::profile_card::{ProfileCard, ProfileCardEvent};16
use gpui_kit::prelude::FluentBuilder as _;16
use gpui_kit::prelude::FluentBuilder as _;17
use super::rail::{RAIL_WIDTH, RailView};17
use super::rail::RailView;18
use super::saved_panel::{SavedPanel, SavedPanelEvent};18
use super::saved_panel::{SavedPanel, SavedPanelEvent};19
use super::shortcuts::{19
use super::shortcuts::{20
AcceptCall, DeclineCall, HangUpCall, JoinMeetingFromToast, NextConversation, OpenActivity,20
AcceptCall, DeclineCall, HangUpCall, JoinMeetingFromToast, NextConversation, OpenActivity,@@ -24,7 +24,9 @@ use super::shortcuts::{24
};24
};25
use super::call_pop_out::zoom_listener;25
use super::call_pop_out::zoom_listener;26
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};26
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};27
use super::sidebar::{SIDEBAR_WIDTH, SidebarView};27
use super::sidebar::SidebarView;28
use app_ui_kit::render::hooks::RenderHooks;29
use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};28
use super::status_bar::render_status_bar;30
use super::status_bar::render_status_bar;29
use super::status_menu::own_status_button;31
use super::status_menu::own_status_button;30
use super::status_message_dialog::{StatusMessageDialog, StatusMessageDialogEvent};32
use super::status_message_dialog::{StatusMessageDialog, StatusMessageDialogEvent};@@ -69,7 +71,6 @@ pub struct Startup {69
pub reply_to_last: bool,71
pub reply_to_last: bool,70
}72
}71
73
72
pub const ISLAND_GAP: f32 = 6.;73
pub const SIDEBAR_HIDDEN_BELOW: f32 = 960.;74
pub const SIDEBAR_HIDDEN_BELOW: f32 = 960.;74
75
75
pub fn sidebar_hidden_in_call(window_width: f32, panel_open: bool) -> bool {76
pub fn sidebar_hidden_in_call(window_width: f32, panel_open: bool) -> bool {@@ -85,6 +86,21 @@ impl Global for UserInputHandle {}85
pub fn install_globals(state: &Entity<AppState>, user_input: Arc<UserInput>, cx: &mut App) {86
pub fn install_globals(state: &Entity<AppState>, user_input: Arc<UserInput>, cx: &mut App) {86
cx.set_global(crate::app_state::AppHandle(state.clone()));87
cx.set_global(crate::app_state::AppHandle(state.clone()));87
cx.set_global(UserInputHandle(user_input));88
cx.set_global(UserInputHandle(user_input));89
cx.set_global(RenderHooks {90
open_profile_link: super::profile_card::open_profile_link,91
jump_to_quoted,92
});93
}94
95
fn jump_to_quoted(message_id: String, cx: &mut App) {96
let Some(handle) = cx.try_global::<crate::app_state::AppHandle>() else {97
return;98
};99
handle.0.clone().update(cx, |state, cx| {100
if let Some(selection) = state.selection.clone() {101
state.jump_to_message(selection, message_id, cx);102
}103
});88
}104
}89
105
90
pub struct AppShell {106
pub struct AppShell {@@ -32,9 +32,9 @@ use crate::sidebar_model::{
32
32
visible_channel_ids, wants_older_chats,
33
33
};
34
34
use crate::theme;
35
use app_ui_kit::layout::SIDEBAR_WIDTH;
35
36
36
37
const COLLAPSED_TEAMS_META_KEY: &str = "sidebar_collapsed_teams";
37
pub const SIDEBAR_WIDTH: f32 = 300.;
38
38
const ROW_HEIGHT: f32 = 54.;
39
39
const PROPOSAL_DOT_SIZE: f32 = 8.;
40
40
const PINNED_CHANNEL_HEIGHT: f32 = 48.;
@@ -32,9 +32,9 @@ use crate::sidebar_model::{32
visible_channel_ids, wants_older_chats,32
visible_channel_ids, wants_older_chats,33
};33
};34
use crate::theme;34
use crate::theme;35
use app_ui_kit::layout::SIDEBAR_WIDTH;35
36
36
const COLLAPSED_TEAMS_META_KEY: &str = "sidebar_collapsed_teams";37
const COLLAPSED_TEAMS_META_KEY: &str = "sidebar_collapsed_teams";37
pub const SIDEBAR_WIDTH: f32 = 300.;38
const ROW_HEIGHT: f32 = 54.;38
const ROW_HEIGHT: f32 = 54.;39
const PROPOSAL_DOT_SIZE: f32 = 8.;39
const PROPOSAL_DOT_SIZE: f32 = 8.;40
const PINNED_CHANNEL_HEIGHT: f32 = 48.;40
const PINNED_CHANNEL_HEIGHT: f32 = 48.;