1use anyhow;
2use schemars::JsonSchema;
3use serde_derive::{Deserialize, Serialize};
4use settings::Setting;
5use workspace::dock::DockPosition;
6
7#[derive(Deserialize, Debug)]
8pub struct CollaborationPanelSettings {
9 pub button: bool,
10 pub dock: DockPosition,
11 pub default_width: f32,
12}
13
14#[derive(Deserialize, Debug)]
15pub struct ChatPanelSettings {
16 pub button: bool,
17 pub dock: DockPosition,
18 pub default_width: f32,
19}
20
21#[derive(Deserialize, Debug)]
22pub struct NotificationPanelSettings {
23 pub button: bool,
24 pub dock: DockPosition,
25 pub default_width: f32,
26}
27
28#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
29pub struct PanelSettingsContent {
30 pub button: Option<bool>,
31 pub dock: Option<DockPosition>,
32 pub default_width: Option<f32>,
33}
34
35impl Setting for CollaborationPanelSettings {
36 const KEY: Option<&'static str> = Some("collaboration_panel");
37 type FileContent = PanelSettingsContent;
38 fn load(
39 default_value: &Self::FileContent,
40 user_values: &[&Self::FileContent],
41 _: &gpui::AppContext,
42 ) -> anyhow::Result<Self> {
43 Self::load_via_json_merge(default_value, user_values)
44 }
45}
46
47impl Setting for ChatPanelSettings {
48 const KEY: Option<&'static str> = Some("chat_panel");
49 type FileContent = PanelSettingsContent;
50 fn load(
51 default_value: &Self::FileContent,
52 user_values: &[&Self::FileContent],
53 _: &gpui::AppContext,
54 ) -> anyhow::Result<Self> {
55 Self::load_via_json_merge(default_value, user_values)
56 }
57}
58
59impl Setting for NotificationPanelSettings {
60 const KEY: Option<&'static str> = Some("notification_panel");
61 type FileContent = PanelSettingsContent;
62 fn load(
63 default_value: &Self::FileContent,
64 user_values: &[&Self::FileContent],
65 _: &gpui::AppContext,
66 ) -> anyhow::Result<Self> {
67 Self::load_via_json_merge(default_value, user_values)
68 }
69}