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